Fix save_graph dropping per-node graph_id for unified graphs#19
Merged
Fix save_graph dropping per-node graph_id for unified graphs#19
Conversation
save_graph now includes graph_id in per-node serialization when it differs from the top-level graph id. load_graph reads it back when present, falling back to the top-level id for backwards compatibility. Closes #15 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
monneyboi
requested changes
Mar 7, 2026
Contributor
monneyboi
left a comment
There was a problem hiding this comment.
Always serialize graph_id per node — don't conditionally omit it when it matches the top-level id. And on load, read it from the node directly without falling back to the top-level id.
The conditional omit/fallback adds backward-compatibility complexity we don't need. Every node should explicitly carry its graph_id in the JSON.
The tests should be updated accordingly — assert graph_id is always present in the serialized JSON.
- save_graph: always include graph_id on every node in JSON - load_graph: read graph_id directly from node, no fallback to top-level id - Tests updated to assert graph_id is always present Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
save_graphnow includesgraph_idin per-node JSON when it differs from the top-level graph id, preserving source provenance for unified/matched graphsload_graphreads per-nodegraph_idwhen present, falling back to the top-levelidfor backwards compatibility with single-article graph filesCloses #15
Test plan
test_save_load_roundtrip_single_graph— verifiesgraph_idis omitted from JSON for single-article graphs and inferred correctly on loadtest_save_load_roundtrip_unified_graph— verifies per-nodegraph_idis serialized only when it differs, and preserved through save/load round-trip🤖 Generated with Claude Code