Repository navigation
Split the sqlite_store and node_service god-objects into concern modules (#1503) - #1588
Merged
mstomar125 merged 1 commit intoJul 9, 2026
Merged
Conversation
`db/sqlite_store.rs` (4931 lines) and `services/node_service/mod.rs` (4095
lines) mixed node CRUD, relationships, embeddings/vector, and search in single
files. Decompose each behind an unchanged public surface by relocating method
groups into concern-focused child modules — each an additional `impl` block over
the same struct, so privacy and the public API are preserved (child modules read
the parent's private fields, consts, and helpers via `use super::*`).
sqlite_store.rs becomes db/sqlite_store/:
- mod.rs — struct, constructor, schema init/migration, event/notifier plumbing,
row mappers, and the embedded tests (unchanged).
- nodes.rs — node CRUD, hierarchy/tree/query, move/reorder, schema, bulk, task.
- relationships.rs — mentions, collections/membership, generic relationships,
relationship orders/counts.
- embeddings.rs — embedding storage, stale markers, vector/BM25 search.
- search.rs — text content search.
node_service/mod.rs keeps the constructor, seeding, and accessors; its hierarchy,
tree-navigation, and move/reorder methods move to a new hierarchy.rs, and
mention_autocomplete joins query.rs. The existing crud/relationship/embedding/
bulk/schema submodules are untouched.
Pure relocation — method bodies are byte-identical; the set of public and
pub(crate) method signatures is unchanged for both types. cargo fmt/clippy
(-D warnings) clean, nodespace-core lib tests 985/985 green, and the daemon,
agent, and desktop app all compile against the unchanged API.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
3 tasks
Contributor
Author
|
APPROVE (code); one merge gate below. I treated this as a refactor and verified behavior-preservation directly rather than trusting "pure relocation":
Merge gate: at review time |
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
db/sqlite_store.rs(4931 lines / 93 methods) andservices/node_service/mod.rs(4095 lines) were god-objects mixing node CRUD, relationships, embeddings/vector, and search. This decomposes each into concern-focused modules behind an unchanged public surface, with zero behavior change — a pure relocation of method bodies.Groundwork for the ADR-053 daemon multi-database work (#1532): the service-assembly refactor there builds on clean seams here, so this lands first to avoid a double refactor.
Approach
Each child module is an additional
implblock over the same struct (use super::*gives child modules access to the parent's private fields, consts, and helpers), so nothing about privacy or the public API changes.sqlite_store.rs→db/sqlite_store/:mod.rsnodes.rsrelationships.rsembeddings.rssearch.rsnode_service/mod.rs: keeps the constructor, seeding, and accessors; its hierarchy / tree-navigation / move-reorder methods move to a newhierarchy.rs, andmention_autocompletejoins the existingquery.rs. The existingcrud/relationship/embedding/bulk/schemasubmodules are untouched.Verification
pub/pub(crate)method signatures is byte-for-byte unchanged for both types (diffed old monolith vs. new modules).use super::*,implwrappers, and module doc-comments).cargo fmt --checkclean;cargo clippy -p nodespace-core --all-targets -- -D warningsclean.cargo test -p nodespace-core --lib— 985/985 pass.nodespace-daemon,nodespace-agent, and the Taurinodespace-appall compile against the unchanged API.Acceptance criteria
sqlite_storeandnode_servicesplit into focused modulesquality:fix/ clippy clean; tests passCloses #1503