refactor(edda-ledger): split sqlite_store.rs into sub-modules (GH-376)#382
refactor(edda-ledger): split sqlite_store.rs into sub-modules (GH-376)#382
Conversation
Convert the 7K-line sqlite_store.rs into a directory module with 9 files: - mod.rs: struct definition, open/create, Drop, tests - types.rs: all public row structs and enums - mappers.rs: row mapping functions and materialization helpers - schema.rs: schema constants (V1-V12), migrations, version management - events.rs: append, iterate, get, find, refs, chain verification - decisions.rs: active decisions, timelines, domains, cross-project sync - village.rs: village stats and recurring pattern detection - dependencies.rs: dep graph, causal chain, outcome metrics - entities.rs: CRUD for device tokens, suggestions, bundles, briefs, snapshots Pure code move — no behavior, SQL, or public API changes. All 159 tests pass identically. The conn field visibility changes to pub(crate) so sub-modules can access it via self.conn. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code Review: PR #382 (Round 1)SummaryClean refactor splitting the 7K-line Key FindingsCritical Issues (P0)None. High Priority (P1)
Testing ReviewCoverageAll existing tests were preserved in Convention Compliance
Testing Verdict: AdequateVerdict: Changes RequestedFixing P1 issues and will re-review. Round 1 of automated review-fix loop |
…irection - Revert conn field from pub(crate) to private (child modules can access parent's private fields) - Change detect_trend_direction from pub to pub(super) to match original private visibility - Remove unnecessary re-export of detect_trend_direction from mod.rs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code Review: PR #382 (Round 2) — LGTM 🎉All P0 and P1 issues have been resolved. SummaryClean refactor splitting
Verdict: LGTM ✅No critical or high-priority issues remaining. This PR is ready for merge. Completed after 2 round(s) of automated review-fix loop |
Summary
sqlite_store.rsinto asqlite_store/directory module with 9 files using Rust's split-impl-block patternimpl SqliteStoreblock for a cohesive concern (events, decisions, schema, etc.)New module layout
mod.rstypes.rsmappers.rsschema.rsevents.rsdecisions.rsvillage.rsdependencies.rsentities.rsKey design choices
connfield visibility changed from private topub(crate)so sub-modules can access itpub(super)for cross-module use withinsqlite_storemod.rssince they exercise multiple concernslib.rsre-exports unchanged — external callers see no differenceCloses #376
Test plan
cargo fmt --check -p edda-ledgerpassescargo clippy -p edda-ledger -- -D warningspassescargo test -p edda-ledger— 159 tests pass (identical to baseline)cargo test --workspace— all workspace tests passcargo clippy --workspace -- -D warningspasseslib.rs)sqlite_store.rsno longer exists (replaced by directory)🤖 Generated with Claude Code