Route Store through agent-store substrate (dogfood the causal store)#59
Merged
Conversation
WHAT: modulex's Store now holds an agent_store::SqliteBackend (via from_connection) instead of a bare rusqlite Connection, and the engine generation counter is agent_store::Generation. All domain SQL is unchanged, running on backend.connection(). A one-time migration carries the pre-substrate `meta.last_generation` string into the substrate counter and drops the legacy row (single source of truth). Depends on agent-store 0.1.1 (crates.io). WHY: dogfood the shared causal-store substrate (PG-readiness + shared causal primitives) in a second consumer alongside newt-agent. No behavior change. Regression test: legacy_generation_is_migrated_into_substrate — fails on the old path (old code never dropped the legacy row). 143 modulex-core lib tests green; `just check` clean (fmt + clippy -D warnings + tests). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
WHAT: `[store] backend = "sqlite" | "postgres"` — a flat knob defaulting to sqlite. StoreConfig flattens agent_store::StorePolicy; Store::open_with_policy routes construction by the policy: sqlite opens as before, postgres is reserved (Phase 2) and rejected with a clear error (the engine treats that as a soft "store unavailable" skip — never a silent fallback). Bumps the dep to agent-store 0.1.2. WHY: the backend a consumer opens should be a reviewed configuration choice, not a hardcoded commitment — lowering risk (safe SQLite default, reversible) and letting the fleet change direction (to Postgres, later) by editing config instead of code. Tests: store_backend_is_a_flat_policy_knob (flatten parses via the real Config path), policy_rejects_reserved_postgres_backend (fail-loud, no silent fallback). 145 modulex-core lib tests green; `just check` clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
modulex becomes the second consumer of
agent-store(alongside newt-agent), dogfooding the shared causal-store substrate and making its storage backend a policy-driven config choice.Substrate adoption:
Storeholds anagent_store::SqliteBackend(viafrom_connection) instead of a barerusqlite::Connection. All domain SQL is unchanged — it runs onbackend.connection().agent_store::Generation. A one-time migration carries any pre-substratemeta.last_generationvalue into the substrate counter and drops the legacy row.Policy-driven backend (flat knob):
[store] backend = "sqlite" | "postgres", defaulting to sqlite.StoreConfigflattensagent_store::StorePolicy;Store::open_with_policyroutes construction by the policy.postgresis reserved (Phase 2) and rejected with a clear error (the engine treats it as a soft "store unavailable" skip — never a silent fallback).Depends on
agent-store = "0.1"(crates.io, v0.1.2). No behavior change at the default.Test plan
just checkgreen: fmt + clippy-D warnings+ tests (145 modulex-core lib + workspace).legacy_generation_is_migrated_into_substrate(fails on old path),policy_rejects_reserved_postgres_backend(fail-loud),store_backend_is_a_flat_policy_knob(flatten parses via the real Config path).risk:low — scoped to the store seam + a defaulted config knob, regression-tested, no CI/hook/pipeline changes. Left for human review/merge per repo policy.