Repository navigation
Closed
Labels
pro-boundaryPro/core boundary: Pro code moves to nodespace-sync (ADR-081..085)
Description
Summary
This issue removes the embedding cloud push/pull code that nothing calls any more, while keeping existing databases openable. It implements ADR-083 §3 (proposed; decision 3-A).
- Delete the embedding push/pull API.
- Fold the store's origin-tagged upsert into a single local upsert.
- Drop the push-sweep index from the DDL.
- Keep the
embedding.originandnode.sync_seqcolumns. They stay unused and are commented as such, so databases created by earlier builds still pass the schema shape check.
Context
- Nothing outside core calls it, so there is no gate.
- nodespace-sync stopped syncing embeddings under ADR-045.
- Its test
sync_tables_exclude_embeddings(nodespaced-pro/src/cloud_sync/grpc.rs) pins the synced tables to nodes and relationships. - A grep of sync at
17f9557finds no call to any API below.
- Inside core, only tests call them. That covers the
NodeServicewrappers,apply_remote_embeddingsandembeddings_modified_since. - Columns are shape-checked; indexes are not.
create_schemacompares the column names of existing tables with the DDL (find_shape_mismatchesinpackages/core/src/db/schema.rs).- Dropping
embedding.originornode.sync_seqwould send every existing database to the incompatible-database screen. - Removing
idx_emb_modifiedfrom the DDL is safe. Old databases keep the index, harmlessly.
- Dropping
- Never put
;in aSCHEMA_SQLcomment.execute_schema_sql(schema.rs, ~217) splitsSCHEMA_SQLon;, and a debug assertion fails when a comment splits a statement. - Not recommended: keeping a neutral imported-embeddings writer. If ADR-083 nevertheless keeps one, keep
SqliteStore::apply_remote_embeddingsunder a neutral name and doc, and skip its deletion in step 3. It would have no consumer, and coreCLAUDE.mdbans dead code.
Scope (symbols; lines at af8ddb61 are hints)
packages/core/src/services/node_service/embedding.rs:- delete
NodeService::get_embeddings,embeddings_modified_since,upsert_embeddings,apply_remote_embeddingsanddelete_embeddings, with their docs (~6-80); - keep everything from
set_embedding_wakeronward; - update the test helpers
embed_fresh(~386) andis_stale(~398), and the asserts at ~525 and ~548.
- delete
packages/core/src/services/node_service/mod.rs:- update
svc.get_embeddings(id)in the rootness-refresh test (~4088); - delete
test_embedding_write_wrappers_upsert_read_delete(~4969-4993).
- update
packages/core/src/db/sqlite_store/embeddings.rs:upsert_embeddings(~5-15) and its doc;apply_remote_embeddings(~17-28);upsert_embeddings_with_origin(~30-164);- the
get_embeddingsdoc (~218-220); embeddings_modified_since(~242-281).
packages/core/src/db/sqlite_store/mod.rs:test_get_embeddings_roundtrip_and_modified_since(~2052).packages/core/src/db/schema.rs:- the
node.sync_seqcolumn (~49), comment only; - the
embedding.origincomment (~124-127); idx_emb_modifiedand its comment (~136-140).
- the
packages/core/tests/it/schema_test.rs:- the
origincolumn assertion (~70-73); - the expected index list (~101);
embedding_modified_index_leads_on_origin(~123-146).
- the
Out of scope
- Dropping or renaming
embedding.originornode.sync_seq. That waits for the next change that alters a table's column set (ADR-083 §3). - The store-level
upsert_embeddings,delete_embeddingsandget_embeddingssignatures. They must compile unchanged, because these callers use them:embedding_service.rsandnode_service/crud.rs;tests/it/embedding_service_test.rsandtests/it/search_result_scaling_test.rs;benches/query_crud.rsandexamples/seed_search_corpus.rs.
- Pro wording elsewhere (Remove Pro, Supabase and nodespace-sync wording from core comments, docs and the skill #3372).
Steps
- Start up. Follow core
CLAUDE.md's startup sequence:- pull
main; EnterWorktree({name: "issue-<N>-embedding-seam"});bun install, then thebun run testbaseline;bun run gh:assign <N> "@me", thenbun run gh:status <N> "In Progress".
- pull
- Wrappers. Delete the five
NodeServicewrappers innode_service/embedding.rs. - Point the tests at the store.
- Replace
svc.upsert_embeddings(..)withsvc.store().upsert_embeddings(..). - Replace
svc.get_embeddings(id)withsvc.store().get_embeddings(id). NodeService::store()ispub. Keep.unwrap(), since the store returnsanyhow::Result.- Delete
test_embedding_write_wrappers_upsert_read_delete.
- Replace
- Store upsert (
sqlite_store/embeddings.rs):-
Delete
apply_remote_embeddingsandembeddings_modified_since. -
Merge
upsert_embeddings_with_originintoupsert_embeddings. Drop:- the
originparameter; - its
libsql::Value::Text(origin..)param (~88); originfrom theINSERT INTO embedding (...)column list (~124).
New rows then take the column's
DEFAULT 'local'. - the
-
Change the placeholder builder from 14 params per row to 13:
base = i * 13;- template
(?1..?11, 0, 0, NULL, ?12, ?13); - fix the
// 14 params/rowcomment.
EMBEDDING_CHUNK = 60stays well under SQLite's variable limit. -
Reword the
upsert_embeddingsandget_embeddingsdocs so they describe local behaviour only.
-
- DDL (
db/schema.rs; comments only, and no;in them):- Keep
origin TEXT NOT NULL DEFAULT 'local', and replace its comment. The new comment says it is a legacy provenance column: every write stores the default, and nothing reads it. It is kept becausecreate_schema's shape check compares column names, so dropping it would refuse every database an earlier build created. - Add a one-line comment of the same kind above
sync_seq. - Delete
idx_emb_modifiedand its comment.
- Keep
- Store test. Rename
test_get_embeddings_roundtrip_and_modified_sincetotest_get_embeddings_roundtrip.- Delete the modified-since cursor, remote-provenance and
EXPLAIN QUERY PLANsections. - Keep the chunk round-trip and empty-read assertions.
- Add a raw
SELECT origin FROM embeddingassertion that an upserted row storeslocal.
- Delete the modified-since cursor, remote-provenance and
tests/it/schema_test.rs:- Keep the assertion that
embeddinghas anorigincolumn. Its message becomes: kept so databases created by earlier builds pass the shape check. - Remove
idx_emb_modifiedfrom the expected index list. - Delete
embedding_modified_index_leads_on_origin. - Add
a_database_that_still_has_idx_emb_modified_opens:- run
create_schema; - create
idx_emb_modified ON embedding (origin, modified_at, node_id, chunk_index)by hand; - assert that a second
create_schemaon the same connection returnsOk.
- run
- Keep the assertion that
- Ratchet.
- Run
bun run scripts/check-pro-boundary.ts. - Set
BASELINESto the printed counts, using its paste block. - List the lowered markers in the PR description. Expect
cloudSyncHooks,cloudWordingandproWordingto drop.
- Run
- Finish.
bun run test:changed, thenbun run quality:fix, then commit.git push origin HEAD:issue-<N>-embedding-seam.gh pr create --repo NodeSpaceAI/nodespace-core --base main --head issue-<N>-embedding-seam, thenbun run gh:status <N> "In Review".- After approval, run
bun run merge <PR#>in the background.
Acceptance criteria
-
git grep -n -E 'apply_remote_embeddings|embeddings_modified_since|upsert_embeddings_with_origin' -- packagesprints nothing. -
git grep -n idx_emb_modified -- packagesprints only the new legacy-index test. -
NodeServicehas no embedding read or write wrappers. - Embedding generation and semantic search still work, through the unchanged
embedding_serviceandcrudpaths. - A fresh database still has
embedding.originandnode.sync_seq, and a new embedding row storesorigin = 'local'. - A database that still has
idx_emb_modifiedpassescreate_schema(the new test). - The executable statements in
SCHEMA_SQLdiffer fromorigin/mainonly by the removed index, and no edited comment contains;. - There is no
#[allow(dead_code)], no compatibility shim, and no issue number in any comment. -
bun run scripts/check-pro-boundary.tsexits 0, andBASELINESequals its printed counts. - Core builds, all tests pass, and the free app is unchanged.
Tests and verification
bun run test:changed. Run Rust through this, not ad hoc: the dev Mac is shared, and this tier takes the machine slot.- For iteration:
.tools/bin/cargo-nextest nextest run -p nodespace-core --lib embedding.tools/bin/cargo-nextest nextest run -p nodespace-core --test it schema_test::.tools/bin/cargo-nextest nextest run -p nodespace-core --test it embedding_service_test::
- Lint and format:
cargo clippy -p nodespace-core --all-targets -- -D warnings -D clippy::unused-async, thencargo fmt --all --check. - Manual check. Use an isolated
NODESPACE_HOMEholding a database created by the current release.- The dev app opens it without the incompatible-database screen.
- Edit a node so it is re-embedded. Semantic search still finds it.
Dependencies
- NodeSpaceAI/nodespace-docs#92 (ADR-083) (ADR-083, proposed): decides that the push/pull API goes and the columns stay.
- Add the Pro-boundary ratchet check and the CLAUDE.md Pro/sync placement rule #3299: provides the ratchet this PR lowers.
- No SYNC gate: nodespace-sync calls none of these APIs.
Risks and rollback
- Placeholder arithmetic. A mistake in step 3 breaks every embedding write. The store tests,
embedding_service_testand the search tests catch it. - Rollback. Revert the PR. The on-disk shape is unchanged. Only databases created while the change was live lack the index.
Plan key: C7.1 (pro-boundary DAG).
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
pro-boundaryPro/core boundary: Pro code moves to nodespace-sync (ADR-081..085)
Activity
mstomar125 commentedon Sep 30, 2026
Completed in #3382 (merged). Auto-close did not fire; closing manually.