-
Notifications
You must be signed in to change notification settings - Fork 0
refactor(ledger): wrap sqlite_store types in domain abstractions #378
Copy link
Copy link
Closed
Labels
refactorCode refactoringCode refactoring
Description
Problem
`edda-ledger/src/lib.rs` re-exports 12 types directly from `sqlite_store`:
```rust
pub use sqlite_store::{
BundleRow, ChainEntry, DecideSnapshotRow, DecisionRow,
DepRow, DetectedPattern, DeviceTokenRow, ImportParams,
PatternDetectionResult, PatternType, SuggestionRow, TaskBriefRow,
};
```
These are SQL row structs, not domain concepts. Downstream crates like `edda-ask` import `DecisionRow` directly:
```rust
// edda-ask/src/lib.rs:2
use edda_ledger::sqlite_store::DecisionRow;
```
This couples the query engine to the SQLite storage implementation. If the storage backend changes, the blast radius is large.
Proposed Fix
- Create domain-level types (or use existing `DecisionView`) as the public API
- Mark `sqlite_store` types as `pub(crate)` where possible
- Update `edda-ask` and `edda-serve` to use domain types instead of row types
- Keep `sqlite_store` module public only for types that are genuinely domain concepts (`PatternType`)
Impact
- `edda-ask` — uses `DecisionRow` (1 import)
- `edda-serve` — uses several re-exported types
- Other crates — use `Ledger` methods that return these types
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
refactorCode refactoringCode refactoring