Skip to content

Split the sqlite_store and node_service god-objects by concern #1503

Closed

Description

@malibio

Overview

sqlite_store.rs (~4900 lines / 93 methods) and node_service/mod.rs (~3900 lines) are god-objects that mix node CRUD, relationships, embeddings/vector, and search.

Problem Statement

The size and mixed responsibilities make the files hard to navigate and change safely; several other findings live inside them for that reason.

Proposed Solution

Split each along its natural concerns (node CRUD, relationships, embeddings/vector, search) into focused modules behind the same public surface.

Acceptance Criteria

  • sqlite_store and node_service are split into focused modules
  • Public API unchanged; behavior unchanged
  • Code passes bun run quality:fix; tests pass

Technical Specifications

Reference Files

  • packages/core/src/db/sqlite_store.rs, packages/core/src/services/node_service/mod.rs

Related Issues

  • (none)

Activity

  1. mstomar125 commented on Jul 9, 2026

    @mstomar125
    Contributor

    Done in #1588.

    Both god-objects are split into concern-focused modules behind an unchanged public surface (each child module is an additional impl block over the same struct; use super::* gives access to private fields/consts/helpers):

    • db/sqlite_store.rs → db/sqlite_store/{mod,nodes,relationships,embeddings,search}.rs
    • services/node_service/mod.rs → constructor/seeding/accessors stay; hierarchy/tree/move methods → new hierarchy.rs; mention_autocomplete → existing query.rs (the pre-existing crud/relationship/embedding/bulk/schema submodules untouched).

    Verified pure relocation: the sorted set of pub/pub(crate) method signatures is byte-for-byte identical old-vs-new for both types; method bodies are unchanged. cargo fmt/clippy -D warnings clean; cargo test -p nodespace-core --lib 985/985; daemon, agent, and desktop app all compile against the unchanged API.

    Lands ahead of the ADR-053 daemon multi-database work (#1532) so its service-assembly refactor builds on clean seams.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions