Repository navigation
Make resolve_relationship_name's forward-name lookup extends-chain aware - #2894
Merged
Merged
Conversation
rel_ops::resolve_relationship_name checked a relationship name against node_type's own schema only (get_schema_node), never the ADR-078 extends-chain-merged set NodeService::resolve_relationships already provides. A relationship declared Forward only on an ancestor schema and inherited (not redeclared) by a subtype was invisible to it, so resolution fell through to InvalidParams even though create_relationship's write path is already chain-aware and had attached a real edge. GraphResolver:: fetch_related_nodes treats that error as "undeclared, not a failure" and silently returns an empty result, so a subtype instance with genuine attached data resolved as if nothing were there. Same fix pattern as workflow_state.rs, validation.rs, and graph_resolver.rs's is_declared_many_relationship: resolve via resolve_relationships instead of a direct own-schema lookup. The error-path relationship listing further down the function now draws from the same chain-merged set for consistency. Adds regression coverage at both the fetch layer (graph_resolver.rs) and the rel_ops layer directly: a real edge attached to a subtype instance via the extends chain is now actually readable back, not just correctly classified. Closes #2868 Co-Authored-By: Claude Sonnet 5 <[email protected]>
CLAUDE.md forbids embedding GitHub issue numbers in code comments; the pre-push gate's check-code-references ratchet catches it. Describe the regression directly instead. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…owing Two more own-schema-only reads in the same file, same bug class as the forward-name-check fix: - get_node_relationships's outbound-group loop consulted get_schema_node directly, so a relationship declared only on an ancestor and inherited by a subtype rendered no outbound group at all in the relationship viewer -- not empty, just absent -- even though the write path already accepted edges under it. Now resolved via resolve_relationships. - get_related_nodes's Reverse-narrowing filter compared a related node's concrete node_type against the declaring schema's exact id, not its whole extends-chain descendant set. A subtype instance's edge (e.g. one issue blocking another, where "blocks" is declared only on the shared ancestor task type) was silently dropped by this exact-match filter -- reading as "nothing blocks this" rather than as an error. Fixed with the same resolve_type_chain + memoized verdict pattern graph_resolver.rs already uses for the identical problem in its own reverse-segment walk. Also adds regression coverage proving the type-system extends name itself keeps resolving (not erroring) now that the chain-merged forward check excludes it, and that an inherited forward name still wins over a same-spelled reverse name declared elsewhere -- the same precedence rule that already applied to a subtype's own directly-declared relationships, now correctly extended across the chain. Three further sibling call sites with the identical own-schema-only pattern (find_duplicate_for, detect_unique_field_collisions, check_node_completeness) are filed separately (core#2898, core#2899) rather than fixed here -- each touches a different subsystem (uniqueness/duplicate-detection, completeness-checking) than this PR's relationship-resolution scope. A systemic guard against this bug class recurring is filed as core#2900. Co-Authored-By: Claude Sonnet 5 <[email protected]>
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rel_ops::resolve_relationship_name's forward-name check resolved a relationship name vianode_service.get_schema_node(node_type)— the node's own schema only, never the ADR-078extends-chain-merged set thatNodeService::resolve_relationshipsalready provides. A relationship declaredForwardonly on an ancestor schema and inherited (not redeclared) by a subtype was invisible to it.The write path (
create_relationship, viaresolve_declared_relationship) is already chain-aware, so a subtype instance could carry a real, attached edge — but reading it back through this resolver fell through toOpsError::InvalidParams, whichGraphResolver::fetch_related_nodestreats as "undeclared, not a failure" and silently returns an empty result for. Since this resolver is shared with the CLI's read path, the same silent-empty-result class likely reached CLI relationship reads too.Changes
packages/core/src/ops/rel_ops.rs:resolve_relationship_name's forward-name lookup now goes throughNodeService::resolve_relationships(the chain-merged set) instead of a directget_schema_nodelookup. The downstream error-path relationship listing (used when a name resolves in neither direction) now draws from the same chain-merged set for consistency.packages/core/src/playbook/graph_resolver.rs: adds a regression test alongside the existinginherited_many_relationship_with_zero_matches_resolves_to_empty_collectiontest — this one attaches a REAL edge to a subtype instance via the extends chain and assertsresolve_pathreturns a populatedCollectioncontaining it, not an empty one.packages/core/tests/rel_ops_forward_name_extends_chain_test.rs(new): regression coverage directly at therel_opslayer — an inherited forward name resolves asForward(notInvalidParams), a real edge attached to a subtype instance is actually readable back throughget_related_nodes, and an undeclared name on a subtype still correctly errors.Same fix pattern as the earlier fixes for this bug class in
workflow_state.rs,validation.rs, andgraph_resolver.rs'sis_declared_many_relationship.Test plan
cargo test -p nodespace-core --test rel_ops_forward_name_extends_chain_test(3 tests)graph_resolverregression test passes alongside its siblingrel_ops/relationship integration suites pass unchanged (relationship_reverse_name_traversal_test,relationship_editing_test,schema_relationship_declarations_test,core_task_link_relationships_test)bun run test:allpre-push gate passes (frontend, scripts, skill, Rust unit + integration + Tauri-seam)Closes #2868
🤖 Generated with Claude Code