refactor(build): share the graph-json loader and prefixed-merge across multi-repo paths#2120
Closed
StuartMVG wants to merge 1 commit into
Closed
refactor(build): share the graph-json loader and prefixed-merge across multi-repo paths#2120StuartMVG wants to merge 1 commit into
StuartMVG wants to merge 1 commit into
Conversation
…s multi-repo paths Extract two helpers into build.py, both extracted verbatim from existing call sites (no behavior change): - load_graph_json: size cap + legacy "edges"->"links" normalization (Graphify-Labs#738) + coercion of directed/multi inputs to a plain undirected Graph (Graphify-Labs#1606), previously triplicated across merge-graphs, global_graph, and the global-graph loader. - merge_prefixed_into: the external-library dedup-by-label + edge rewiring from global_add (the one existing cross-repo identity behavior). merge-graphs and graphify global now call the shared helpers. Groundwork for cluster graphs, which need the same compose semantics.
This was referenced Jul 23, 2026
Author
|
Closing in favor of #2134 — same content, consolidated into a single PR at the author's preference. |
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.
What
Pure refactor, no behavior change:
merge-graphsand the global graph now share one persisted-graph loader (build.load_graph_json) and one prefixed-merge with external-node dedup (build.merge_prefixed_into).Before this, the load-a-graph.json dance (size cap, legacy
edges→linksnormalization, type coercion) existed in three copies — the global-graph load,global_add's source load, andmerge-graphs— and the external-dedup/remap/self-loop-skip merge lived only insideglobal_add. The copies had already drifted slightly (merge-graphsdidn't apply the size cap consistently).Why now
This is the first of a 3-PR stack: the cluster-graphs feature (#2121) composes member graphs through exactly these two helpers, so extracting them first keeps that PR reviewable and guarantees the three multi-repo paths (merge-graphs, global graph, clusters) can't drift again.
One observable improvement (not a behavior change to valid inputs):
merge-graphson a malformed JSON input now printserror: ...and exits 1 instead of an unhandled traceback.Stack
Testing
test_merge_graphs_cli.py/ global-graph tests; no test changes needed.🤖 Generated with Claude Code