Repository navigation
fix(affected): handle "edges"-keyed graph.json in load_graph (KeyError: 'links') - #1280
Merged
Merged
Conversation
safishamsi
added a commit
that referenced
this pull request
Jun 12, 2026
rbelem
pushed a commit
to rbelem/graphify
that referenced
this pull request
Jun 12, 2026
safishamsi
added a commit
that referenced
this pull request
Jun 18, 2026
…, #1278) label_communities logged-and-skipped any batch whose LLM response was malformed JSON, silently losing ~100 names per failed batch on large graphs. Split the batch at the midpoint and retry each half (smaller prompt -> smaller output), mirroring _extract_with_adaptive_retry; the base case re-raises so the caller skips just that batch. Removed leftover scaffolding and corrected the docstring. Co-Authored-By: CJdev232 <[email protected]> Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
PerryLin-0420
pushed a commit
to PerryLin-0420/graphify-decouple
that referenced
this pull request
Aug 13, 2026
…-key fix(affected): handle "edges"-keyed graph.json in load_graph (KeyError: 'links')
PerryLin-0420
pushed a commit
to PerryLin-0420/graphify-decouple
that referenced
this pull request
Aug 13, 2026
PerryLin-0420
pushed a commit
to PerryLin-0420/graphify-decouple
that referenced
this pull request
Aug 13, 2026
…phify-Labs#1280, Graphify-Labs#1278) label_communities logged-and-skipped any batch whose LLM response was malformed JSON, silently losing ~100 names per failed batch on large graphs. Split the batch at the midpoint and retry each half (smaller prompt -> smaller output), mirroring _extract_with_adaptive_retry; the base case re-raises so the caller skips just that batch. Removed leftover scaffolding and corrected the docstring. Co-Authored-By: CJdev232 <[email protected]> Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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
graphify affectedfails to load graphs produced bygraphify extract,exiting with
error: could not load graph: 'links'. Every other reader works.Root cause
graphify/affected.py::load_graphcallsjson_graph.node_link_graph(raw, edges="links"), butextractwritesgraph.jsonwith an"edges"key. networkx then raisesKeyError: 'links',which the surrounding
except TypeErrordoes not catch.__main__.pyalready normalizes this everywhere it loads a graph:affected.load_graphis the only loader missing that normalization. Same classof bug as #1198 (benchmark
KeyError: 'links').Fix
Mirror the existing normalization in
affected.load_graphbefore callingnode_link_graph.links-keyed graphs and older networkx fall through unchanged.Repro
Tests
Added
test_affected_cli_loads_edges_keyed_graph— writes an"edges"-keyedgraph (as
extractdoes) and assertsaffectedreverse-traverses it. Theexisting
_write_graphhelper only ever emitted the"links"key, so this pathwas untested. Fails before the fix (
KeyError: 'links'), passes after.Found this while running graphify against a ~8,200-file monorepo (52k nodes /
186k edges) — after the fix,
affectedcorrectly reverse-traverses 621 nodesfrom a core DB accessor. Happy to adjust if you'd rather hoist the
normalization into a shared helper instead of mirroring it per-loader.