Skip to content

refactor(build): share the graph-json loader and prefixed-merge across multi-repo paths#2120

Closed
StuartMVG wants to merge 1 commit into
Graphify-Labs:v8from
StuartMVG:pr1-shared-graph-loader
Closed

refactor(build): share the graph-json loader and prefixed-merge across multi-repo paths#2120
StuartMVG wants to merge 1 commit into
Graphify-Labs:v8from
StuartMVG:pr1-shared-graph-loader

Conversation

@StuartMVG

@StuartMVG StuartMVG commented Jul 23, 2026

Copy link
Copy Markdown

What

Pure refactor, no behavior change: merge-graphs and 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 edgeslinks normalization, type coercion) existed in three copies — the global-graph load, global_add's source load, and merge-graphs — and the external-dedup/remap/self-loop-skip merge lived only inside global_add. The copies had already drifted slightly (merge-graphs didn'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-graphs on a malformed JSON input now prints error: ... and exits 1 instead of an unhandled traceback.

Stack

  1. → this PR — shared graph-json loader
  2. feat(cluster): cluster graphs — link multiple repos into one connected graph #2121 — cluster graphs (multi-repo linked graphs)
  3. feat: multigraph mode — preserve parallel relations end to end #2122 — multigraph mode (parallel relations)

Testing

  • Full suite passes (3,608 passed, 3 skipped).
  • Covered by the existing test_merge_graphs_cli.py / global-graph tests; no test changes needed.

🤖 Generated with Claude Code

…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.
@StuartMVG

Copy link
Copy Markdown
Author

Closing in favor of #2134 — same content, consolidated into a single PR at the author's preference.

@StuartMVG StuartMVG closed this Jul 23, 2026
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.

1 participant