-
Notifications
You must be signed in to change notification settings - Fork 0
refactor(ledger): split sqlite_store.rs into sub-modules #376
Copy link
Copy link
Closed
Labels
refactorCode refactoringCode refactoring
Description
Problem
edda-ledger/src/sqlite_store.rs is 7,003 lines with 11 distinct concerns in a single impl SqliteStore block. It is the second largest file and a frequent churn hotspot.
Mixed concerns: connection/schema management, 13 migration functions, device tokens, suggestions, event persistence, references, decision queries, village/pattern detection, bundles, dependencies, causal chain/outcomes, task briefs.
Evidence of Feasibility
device_token.rs was already extracted from this file — the pattern works. The split should continue.
Proposed Structure
src/
├── sqlite_store.rs (~500 lines: SqliteStore struct, open/create, pragmas)
├── schema/
│ ├── mod.rs (schema constants)
│ └── migrations.rs (~600 lines: v1_to_v2 through v11_to_v12)
├── persistence/
│ ├── events.rs (~460 lines: append, iter, queries)
│ └── snapshots.rs (~125 lines)
├── entities/
│ ├── suggestions.rs (~100 lines)
│ ├── bundles.rs (~115 lines)
│ └── briefs.rs (~125 lines)
├── decisions/
│ ├── queries.rs (~220 lines)
│ ├── dependencies.rs (~125 lines)
│ └── outcomes.rs (~320 lines)
└── analytics/
└── village.rs (~315 lines: stats, pattern detection)
Notes
- Pure refactor — no behavior change
- Tests (~3,400 lines) should be split to match
device_token.rsextraction is the template to follow
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
refactorCode refactoringCode refactoring