Repository navigation
Make check_node_completeness direction-aware for required in-relationships - #2935
Conversation
…ships (closes #2921) An in-direction declaration is the target's view of a forward edge stored under its reverse_name with this node as out_node. The completeness check looked up an outbound edge by the in-declaration's own name, which is never stored, so a required in-relationship was permanently reported missing. Route In declarations through a new inbound existence query instead. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Pragmatic Code Review: PR #2935Review Type: Initial Review SummaryA small, well-scoped fix for a real bug. For the canonical write spelling, the forward edge ( The model has one gap: it is not the only way an Requirements Check (#2921)
Code Review Findings🟡 1.
|
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
…e type - A required in-relationship is also satisfied by an edge written through the in name itself (stored from this node's own end), which the write path accepts. - Inbound forward-name edges only count when the source satisfies the declared targetType (itself or an ADR-078 descendant), since another schema may declare the same forward name toward this type. - Import RelationshipDirection instead of fully qualified paths. Skipped: merging the two existence queries into one column-parameterized helper (the inbound query now returns source types, so they no longer duplicate); moving the in-direction tests to their own file (they share the fixture helpers and the completeness subject). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Review addressed (0b45ffa)✅ 🟡1 — edges written under the ✅ 🟡2 — inbound edges are narrowed by source type. ✅ Nit — local import. ⏭️ Nit — shared query helper: skipped. The inbound query now returns source types instead of a count, so it no longer duplicates ⏭️ Nit — separate test file: skipped. The new tests reuse the file's fixture helpers and test the same function. ⏭️ 🟢3 — Out-only last-edge removal guard: out of scope. The issue's non-goals exclude write-path The pre-push gate passed ( |
Pragmatic Code Review: PR #2935 (Re-Review)Review Type: Re-Review. Scope: Previous Review Summary: 7 recommendations. 3 addressed (🟡1, 🟡2, the local- Requirements Check (#2921)
Verification of prior findings🟡1 (in-name spelling): addressed correctly. Every declaration now runs the 🟡2 (source-type narrowing): addressed correctly.
Nits and 🟢3: skips accepted. Now that the query returns types instead of a count, the shared-helper nit no longer applies. The test-file-name nit is cosmetic. The write-path removal guard is correctly left to a follow-up. Please make sure a follow-up issue actually gets filed for that guard, and for normalizing or rejecting writes made through an Code Review Findings🟢 1.
|
Re-review addressed⏭️ 🟢1 — the extends map reloads for each source type: skipped. The cost is bounded: it only applies to required ⏭️ 🟢2 — an error from No code changes, so no re-review is needed. |
Closes #2921
Problem
check_node_completenesschecked every required relationship withcheck_relationship_exists(node_id, name)(in_node = node_id AND relationship_type = name). Anin-direction declaration is the target's view of a forward edge, which is stored under the forward name (the declaration'sreverse_name) with the source asin_nodeand this node asout_node. The lookup could never match, so a requiredinrelationship was always reported missing.Fix
SqliteStore::check_inbound_relationship_exists(target_id, rel_type)(out_node = target_id).check_node_completenessbranches onrelationship.direction:Outkeeps the existing lookup byname;Inuses the inbound lookup byreverse_name.Tests
Added to
node_completeness_extends_chain_test.rs, using a self-referentialsupersedes/superseded_bypair:inrelationship with no edge is reported missingI checked that the satisfied-case test fails without the fix. The pre-push gate passed.
🤖 Generated with Claude Code