Split db crate into per-domain modules (SRP) #6

Merged
schaefera merged 1 commit from worktree-srp-refactor-db into main 2026-09-03 11:40:46 +00:00
Collaborator

Summary

  • feedsignal-db's Db impl had grown into one 250-line block mixing feed subscriptions, article storage/scoring, reading-event logging, and topic-affinity persistence.
  • Splits it into feeds.rs, articles.rs, reading_events.rs, affinities.rs, each an impl Db block for its own domain — mirroring the earlier web crate split into api/services/jobs/view (#4).
  • lib.rs now only holds the Db struct, connection/pool setup, and module wiring. schema becomes pub(crate) so the new modules can reach the table definitions.
  • Pure move: no behavior or public API changes, method signatures untouched.

Note: this branches off main, independent of the not-yet-merged feed-polling PR (#5) — expect a small conflict in feeds.rs/lib.rs when merging both, easy to resolve by relocating list_feeds/mark_feed_fetched into the new feeds.rs.

Test plan

  • cargo build --workspace
  • cargo clippy --workspace --all-targets (clean)
  • cargo fmt --check
  • cargo test --workspace

🤖 Generated with Claude Code

https://claude.ai/code/session_01QmwX8eafbMstJvt8XPSqft

## Summary - `feedsignal-db`'s `Db` impl had grown into one 250-line block mixing feed subscriptions, article storage/scoring, reading-event logging, and topic-affinity persistence. - Splits it into `feeds.rs`, `articles.rs`, `reading_events.rs`, `affinities.rs`, each an `impl Db` block for its own domain — mirroring the earlier web crate split into `api`/`services`/`jobs`/`view` (#4). - `lib.rs` now only holds the `Db` struct, connection/pool setup, and module wiring. `schema` becomes `pub(crate)` so the new modules can reach the table definitions. - Pure move: no behavior or public API changes, method signatures untouched. Note: this branches off `main`, independent of the not-yet-merged feed-polling PR (#5) — expect a small conflict in `feeds.rs`/`lib.rs` when merging both, easy to resolve by relocating `list_feeds`/`mark_feed_fetched` into the new `feeds.rs`. ## Test plan - [x] `cargo build --workspace` - [x] `cargo clippy --workspace --all-targets` (clean) - [x] `cargo fmt --check` - [x] `cargo test --workspace` 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01QmwX8eafbMstJvt8XPSqft
claude-bot added 1 commit 2026-09-03 11:32:31 +00:00
Split db crate into per-domain modules (feeds/articles/reading_events/affinities)
All checks were successful
CI / check (pull_request) Successful in 2m16s
CI / test (pull_request) Successful in 4m13s
CI / audit (pull_request) Successful in 15s
0612d642c9
feedsignal-db's Db impl had grown into one 250-line block mixing feed
subscriptions, article storage/scoring, reading-event logging, and
topic-affinity persistence in a single file. Split each domain's
methods into its own module (mirroring the earlier web crate SRP
split), keeping lib.rs to just the Db struct and connection setup.
Pure move — no behavior or public API changes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QmwX8eafbMstJvt8XPSqft
schaefera merged commit 75148e5119 into main 2026-09-03 11:40:46 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: schaefera/feedsignal#6
No description provided.