Skip to content

Add StorePolicy: declarative, config-selected backend (0.1.2) - #2

Merged
hartsock merged 1 commit into
mainfrom
feat/store-policy
Jun 14, 2026
Merged

Add StorePolicy: declarative, config-selected backend (0.1.2)#2
hartsock merged 1 commit into
mainfrom
feat/store-policy

Conversation

@hartsock

Copy link
Copy Markdown
Member

Summary

Adds the policy seam that keeps backend selection in reviewed configuration, not code:

  • BackendKind (sqlite | postgres) — the shared backend vocabulary.
  • StorePolicy — a flat, serde-deserializable policy ([store] backend = "sqlite"). Default = SQLite, so adopting a policy is a no-op until a value is deliberately set (the low-risk guarantee). Grows new knobs (Postgres URL ref, doorbell mode) as features land.

The crate owns only the vocabulary; resolution stays in each consumer (open semantics — pragmas, connection ownership, domain SQL — are consumer-specific). Consumed first by modulex (folded into #59); newt reuses it.

Test plan

  • just check green (fmt + clippy -D warnings + tests).
  • New tests: default_is_safe_sqlite (regression — default stays SQLite), flat lowercase deserialize, empty-config-is-default, unknown-backend-errors.
  • 20 tests + doctest pass.

risk:low — additive (new module + serde dep), regression-tested, no CI/hook changes.

WHAT: StorePolicy + BackendKind — a flat, serde-deserializable policy that
selects the storage backend from configuration. Default = Sqlite (today's
behavior, no daemon). Adds a serde dep; toml dev-dep for the deserialization
tests. Bump 0.1.1 -> 0.1.2.

WHY: the backend a consumer opens should be a reviewed config choice, not a
hardcoded commitment — lowering risk (safe default, reversible) and letting the
fleet change direction (to Postgres, later) by editing config rather than code.
The crate owns only the vocabulary; resolution stays in each consumer, because
open semantics (pragmas, connection ownership) are consumer-specific.

Regression test: default_is_safe_sqlite — adopting a policy is a no-op until a
value is deliberately set. 20 tests green; fmt + clippy -D warnings clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@hartsock hartsock added the risk:low Scoped, tested, no CI/build changes label Jun 14, 2026
@hartsock
hartsock merged commit 3562dca into main Jun 14, 2026
1 check passed
@hartsock
hartsock deleted the feat/store-policy branch June 14, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:low Scoped, tested, no CI/build changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant