Skip to content

Rename relationship get's JSON key from related_nodes to nodes - #2913

Merged
mstomar125 merged 1 commit into
mainfrom
issue-2811-relationship-get-key
Sep 23, 2026
Merged

mstomar125 merged 1 commit into
mainfrom
issue-2811-relationship-get-key

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Summary

nodespace relationship get --json nested its results under related_nodes, while every other list-returning command (node query, search, schema list) wraps results as {"count": N, "nodes": [...]}. Because jq silently returns nothing for a missing key, a caller parsing .nodes[] against relationship get got empty output instead of an error — indistinguishable from "no edges exist."

Changes

  • packages/cli/src/commands/relationship.rs: renamed the JSON output key from related_nodes to nodes, matching every other list-returning command.
  • scripts/eval/graph.ts (readRelatedIds) and its test in scripts/eval/end-state.test.ts: this is the one downstream consumer that parses the CLI's relationship get --json output directly (used by the agent-matrix eval harness to snapshot graph edges) — updated to read the nodes key in lockstep so it doesn't silently stop finding edges.

Scope notes

  • The sibling keys (node_id, relationship_name, count) were left snake_case, unchanged — no wider casing sweep.
  • packages/agent/src/local_agent/tools.rs's get_related_nodes tool already emits {"count": N, "nodes": [...]} — it was already correct and needed no change. (Also: this is Michael's-lane territory under packages/agent/src/local_agent/, so I checked it rather than touching it.)
  • The internal Rust struct field RelatedNodesOutput.related_nodes (packages/core/src/ops/rel_ops.rs) and the gRPC wire field related_nodes_json (daemon↔CLI transport) are unrelated internal names, not observed by external callers of the CLI's --json output, and are out of scope for this rename.
  • packages/skill/references/cli.md already documents the general list-command shape as {"count": N, "nodes": [...]} and explicitly includes relationship get under it — the docs were already correct; only the code was inconsistent with them, so no doc changes were needed.

Test plan

  • cargo check -p nodespace-cli
  • cargo test -p nodespace-cli --test cli_integration relationship (4 passed)
  • bun run test:scripts (587 passed, includes the updated readRelatedIds fixtures)
  • bun run quality:fix clean
  • Full pre-push gate (test:all + cargo build --bin nodespaced + test:e2e) passed

Closes #2811

🤖 Generated with Claude Code

Every other list-returning CLI command (node query, search, schema
list) wraps results as {"count": N, "nodes": [...]}. relationship get
was the one exception, nesting under related_nodes instead — a caller
parsing `.nodes[]` against it got silent empty output rather than an
error.

Also updates scripts/eval/graph.ts's readRelatedIds, the only
downstream consumer that parses the CLI's relationship get --json
output directly, so the eval harness's edge snapshotting keeps
working under the new key.

Closes #2811

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@mstomar125

Copy link
Copy Markdown
Contributor Author

Address-Review Summary

/pragmatic-code-review (medium effort) ran against this diff and returned zero findings: the reviewer traced every consumer of related_nodes across the repo and confirmed the PR's scope claims (internal Rust struct field and gRPC wire field are genuinely unrelated to the CLI's JSON stdout key; no other script/doc/test references the old key). No off-by-one, no missing await, no removed invariant — a pure string-literal rename plus the one matching downstream-consumer update.

  • ✅ Addressed: 0 recommendations (none raised)
  • ⏭️ Skipped: 0
  • 📝 Commits created: 0 (no changes needed)
  • 🧪 Tests: full pre-push gate passed (test:all + cargo build --bin nodespaced + test:e2e)

Re-Review Decision

Decision: NO RE-REVIEW NEEDED

Rationale: The review found no issues and no code was changed as a result of it. The PR is unchanged from what was already reviewed.

@mstomar125
mstomar125 merged commit 258e701 into main Sep 23, 2026
@mstomar125
mstomar125 deleted the issue-2811-relationship-get-key branch September 23, 2026 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

relationship get nests results under related_nodes while every other command uses nodes, so .nodes[] silently returns empty

1 participant