Skip to content

rel_ops::resolve_relationship_name's forward-name lookup is not extends-chain aware #2868

Closed

Description

@mstomar125

Context

Same bug class as core#2769/#2819/#2837, found in a fourth location while reviewing PR #2865 (core#2837's fix).

Problem

resolve_relationship_name's forward-name check (packages/core/src/ops/rel_ops.rs, ~lines 210-218) resolves a relationship name via:

let own_schema = node_service.get_schema_node(node_type).await?;
if let Some(schema) = &own_schema {
    if schema.get_relationship(relationship_name).is_some() {
        return Ok(ResolvedRelName::Forward);
    }
}

get_schema_node(node_type) returns only node_type's own directly-declared relationships, not the ADR-078 extends-chain-merged set that NodeService::resolve_relationships (packages/core/src/services/node_service/schema.rs) already provides. A relationship declared Forward only on an ancestor schema and inherited (not redeclared) by a subtype is invisible to this check.

Impact

Because the forward check misses, resolution falls through to the reverse-name checks (irrelevant for a forward-declared relationship name), and — finding no match in either direction — the function returns OpsError::InvalidParams, its "undeclared name" error.

GraphResolver::fetch_related_nodes (packages/core/src/playbook/graph_resolver.rs) explicitly treats OpsError::InvalidParams from this call as "undeclared in either direction — an empty traversal, not a failure" and short-circuits to Ok(vec![]). The result: a subtype node CAN have a real edge attached (the write path, resolve_declared_relationship, is already extends-chain aware, so create_relationship succeeds normally) — but reading that same edge back through GraphResolver/CEL condition evaluation silently returns an empty result, indistinguishable from "no edges yet."

This is a distinct, deeper bug from core#2837: core#2837 fixed is_declared_many_relationship's cardinality classification (so a zero-match inherited many-relationship now correctly resolves to Collection([]) instead of Missing), but does not touch the underlying data fetch. A subtype instance with a genuinely inherited relationship and one or more real attached rows still resolves to an empty Collection today, because the fetch itself never finds the rows — not because of a cardinality-inference gap.

Per resolve_relationship_name's own doc comment, this same resolution is also shared with the CLI's read path, so the same class of silent-empty-result likely reaches CLI relationship reads on a subtype node too, not just GraphResolver's condition evaluation.

Suggested approach

Not prescribed. NodeService::resolve_relationships already does the extends-chain merge this needs — the forward-name check likely wants to go through it instead of get_schema_node directly, mirroring the fix already applied in core#2769 (workflow_state.rs), core#2819 (validation.rs), and core#2837 (graph_resolver.rs's is_declared_many_relationship).

Non-goals

No change to the reverse-name resolution logic below the forward check, or to GraphResolver's traversal/caching architecture — scoped to the forward-name lookup reading the merged relationship set, matching the same non-goals scoping as core#2837.

Activity

  1. mstomar125 commented on Sep 23, 2026

    @mstomar125
    ContributorAuthor

    Frontend: 262 test files / 5264 tests passed (baseline before Rust fix to rel_ops.rs)

  2. self-assigned this
    on Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions