Repository navigation
Add structural backstop for legitimate multi-schema splits - #1907
Conversation
) Backstops ONE_SCHEMA_PER_REQUEST with code instead of restating it in prose: a second create_schema call within one skill invocation is now refused with an actionable error, and a relationship's targetType is validated to exist before create_schema/update_schema/ add_schema_relationship persist it — previously a dangling target type was silently accepted, leaving a split schema unlinked with no error. Co-Authored-By: Claude <[email protected]>
Code Review SummaryNet positive, well-scoped fix. Both structural backstops are correctly localized (per-turn for the duplicate- Requirements Check (issue #1905)
FindingsCritical IssuesNone. Suggested Improvements
Nitpicks
RecommendationAPPROVE |
malibio
left a comment
There was a problem hiding this comment.
Review recommendation: APPROVE (self-approval blocked by GitHub — see full review comment above for findings; no blocking issues found).
Address-Review SummaryReviewed the pragmatic-code-review findings on this PR. No blocking (🔴 Critical / 🟡 Important) issues were raised — the review recommendation was APPROVE. 🟢 Suggestions (3):
No code changes required. Working tree is clean; no new commits. Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: The original review found zero blocking issues and recommended APPROVE. The only actionable suggestion (documentation) was already addressed via the PR body update; the remaining two suggestions were explicitly marked by the reviewer as not warranting a change. No code was modified in this pass, so there is nothing new for a re-review to evaluate. The PR is ready for merge, pending your decision. |
Summary
Split out of #1896 / follow-up to #1904. #1896's second acceptance criterion — "if a split is ever correct, the resulting types are actually linked and both are populated — no silently empty half" — was still unaddressed after #1904 fixed the routing symptom.
create_schemacall in one skill invocation is now refused. Nothing previously stopped a secondcreate_schemacall within the same skill invocation (Schema Creation'smax_iterations: 3permits it, andstage2_toolsdoesn't enforce call counts). The ReAct loop now tracks this turn's tool executions and refuses a second successfulcreate_schemacall with an actionable error, backstopping the existingONE_SCHEMA_PER_REQUESTprose rule.targetTypeis now validated to exist before being persisted.handle_create_schema,handle_update_schema(add_relationships), andhandle_add_schema_relationshipall previously stored a relationship'stargetTypeverbatim with no existence check — a model that ignoredTARGET_TYPE_MUST_EXIST(or referenced a second schema before it existed) got a silent success and a dangling reference, exactly the symptom Model splits one tracking request into two schemas, populates one, and leaves the other empty and unlinked #1896 originally measured. All three paths now reject atargetTypethat doesn't name an existing schema (core or custom), while still allowingtargetType: None— the documented escape hatch for "the type doesn't exist yet."Note on divergence from the issue's proposed mechanism: the issue's "one approach to evaluate" suggested backstopping this via the generic
create_relationshiptool (which links two already-persisted nodes). This PR instead validatestargetTypeon a schema's own inlinerelationshipsfield — the actual place a dangling reference could be introduced, sinceONE_SCHEMA_PER_REQUEST/TARGET_TYPE_MUST_EXISTalready describe relationships as declared inline oncreate_schema/update_schema, not via a separatecreate_relationshipcall. This closes the same hole more directly and makes thecreate_relationship-tool-failure scenario moot for schema authoring.Test plan
cargo test -p nodespace-core -p nodespace-agent --lib— 1114 passed, including 4 new relationship-target-validation tests and 4 new second-schema-guard testsbun run test:all— no new failures vs baseline (171 frontend files / 4108 tests, Rust suite green)bun run quality:fix— clean (0 lint errors/warnings, clippy clean, cargo fmt clean on touched files)🤖 Generated with Claude Code
https://claude.ai/code/session_01DkqjrfV1G6kugsEjvyU9wU