Repository navigation
Filter is_core schemas out of semantic schema retrieval - #1903
Conversation
workspace_context's semantic schema search was scoped only by node_type == "schema", so core types (text/task/date) were retrievable alongside user-defined ones -- unlike the sibling recently-created-schema injection in local_agent_service.rs, which already guards on is_core. A core type reaching RELEVANT ENTITY TYPES would make the #1897 create_node guidance read it as user-defined and write a bare property key onto it, the ADR-063 violation that guidance exists to prevent. Co-Authored-By: Claude <[email protected]>
Code Review: PR #1903 — Filter
|
malibio
left a comment
There was a problem hiding this comment.
Review verdict: Approve (posting as a comment — GitHub blocks self-approval on your own PR).
Verified independently rather than taking the PR description on trust: the sibling is_core guard at local_agent_service.rs:1878, the ADR-063 premise in skill_pipeline.rs:318-319, and the mutation-verification claim (removed the filter, the new test fails; restored). cargo test -p nodespace-core --lib context_ops: 31 passed.
Non-blocking follow-ups in the detailed review comment above: (1) related_one_hop_schemas outgoing traversal still resolves core types into related_schemas — but renders under the RELATED header, not RELEVANT ENTITY TYPES, so the ADR-063 premise is intact; (2) issue numbers in the new doc comments conflict with the CLAUDE.md documentation standard.
…ue refs from comments - related_one_hop_schemas now filters is_core, closing the same class of gap on the incoming/outgoing relationship traversal: a user-defined schema relating to a core type (e.g. project -> task) could otherwise place that core type in related_schemas. It renders under a different heading than RELEVANT ENTITY TYPES so this wasn't the ADR-063 hazard itself, but there's no reason for a core type in either block, and fixing it removes reliance on core schemas happening to declare no relationships of their own. - Removed #1897/#1900 references from doc comments per the documentation standard (describe behavior directly, cite ADRs not tickets). Co-Authored-By: Claude <[email protected]>
Review addressed —
|
Summary
workspace_context's semantic schema retrieval (context_ops.rs) had nois_corefilter — core types (text/task/date) are stored schema nodes with embeddable content, so unfiltered retrieval could surface them into the RELEVANT ENTITY TYPES block. The sibling recently-created-schema injection inlocal_agent_service.rsalready guards onis_core; this brings the two branches, which write into the samerelevant_schemasvector, into agreement.Why it matters
#1897's
create_nodeguidance treats presence in RELEVANT ENTITY TYPES as proof a type is user-defined (bare property keys) vs. built-in (custom:-prefixed keys). A core type reaching that block would make the model write a bare key onto a core type — the exact ADR-063 violation #1897 was fixed to prevent.Currently latent, not live
Seeding uses raw
store.create_node, which doesn't queue embedding, and the backfill path skips schemas without a legacydescriptionfield (core schemas have none) — so core schema nodes are likely unembedded/unretrievable on a fresh DB today. Nothing prevents this from activating on a future backfill or re-index, though, and nothing would catch it.Change
context_ops.rs: extracted the parse-and-collect step intoparse_and_filter_non_core_schemas, adding.filter(|s| !s.is_core).parse_and_filter_non_core_schemas_excludes_core_types, mutation-verified (fails when the filter is removed).Testing
cargo test -p nodespace-core --lib: 1106 passedbun run rust:testworkspace: all greenbun run test(frontend): 4108 passed, 171 filesbun run test:scripts: 77 passedbun run test:skill: 20 passedcargo clippy --all-targets -- -D warnings: cleanCloses #1900. Split out of #1899's investigation per that issue's closing discussion.
Co-Authored-By: Claude [email protected]