Skip to content

fix(global): carry the maker's #3014 community offsets and #3007 shared-type links into global add - #26

Merged
Azeem1985 merged 1 commit into
v8from
fix/global-add-community-offset-shared-types
Aug 26, 2026
Merged

Azeem1985 merged 1 commit into
v8from
fix/global-add-community-offset-shared-types

Conversation

@Azeem1985

Copy link
Copy Markdown

The gap

Upstream fixed community-id fusion in 0.9.50 (Graphify-Labs#3014: merge-graphs offsets each input's community ids past the running maximum, keeping the original in local_community) and added cross-repo same_type_as links in 0.9.49 (Graphify-Labs#3007: link_shared_type_declarations, called after merge-graphs composes). Both live ONLY in the merge-graphs path (cli.py). Our whole-machine map is built by graphify global add, and global_graph.py had neither mechanism.

Measured on the live 1.21M-node FalkorDB map before this fix:

  • 15 repos carry community ids on 60,209 nodes; their 4,734 per-repo community ids collapse into 2,399 global ids — 992 ids are claimed by 2+ repos, and id 0 is claimed by all 15 repos at once, fusing 1,042 unrelated nodes into "one" community.
  • same_type_as edges in the whole map: 0, while the store demonstrably holds 14 type declarations shared across repos (Temporalio .NET contracts between sdk-dotnet and nexgen, GraphifyDemo fixtures across three graphify clones).

The fix — his shape, adapted only where the streamed writer requires

Proof

  • Memory bound kept (PR perf(global): update one repo's slice by streaming, not by loading the whole store #24's whole point): refreshing the 27,706-node cockpit slice of the real 1.9GB store — pre-fix code 231.2MB peak RSS, this branch 233.9MB (+1.2%). No whole-map load reintroduced.
  • Rehearsal on a copy of the real store: re-adding nexgen produced exactly the 4 predicted same_type_as edges (Temporalio.Workflows contracts to sdk-dotnet) and 490 community ids with zero collision against any other repo.
  • Tests: community ids unique per repo after adds and after a refresh; same_type_as shape and no-duplication on refresh; output unchanged against the pre-streaming oracle once the two new effects are peeled off; existing byte-identity tests pass untouched. Full suite: 4,888 passed; the 16 failures present are identical at the base commit (environment-dependent: terraform/HCL grammar, ollama, wheel-build, detect-ignore) — none introduced here.
 graphify/cli.py                      |   3 +
 graphify/cross_repo_types.py         |  27 +++++--
 graphify/global_graph.py             |  95 +++++++++++++++++++++---
 tests/test_global_graph_streaming.py | 140 ++++++++++++++++++++++++++++++++++-
 4 files changed, 246 insertions(+), 19 deletions(-)

🤖 Generated with Claude Code

…Labs#3007 shared-type links into global add

The maker fixed community-id fusion (0.9.50, Graphify-Labs#3014) and added cross-repo
same_type_as links (0.9.49, Graphify-Labs#3007) — but only inside merge-graphs
(cli.py's compose path). Our whole-machine store is built by `graphify
global add`, whose writer had neither: measured on the live 1.21M-node
map, 15 repos' 4,734 per-repo community ids collapsed into 2,399 global
ids (992 ids claimed by 2+ repos; id 0 claimed by all 15, fusing 1,042
unrelated nodes), and zero same_type_as edges existed anywhere.

Port both mechanisms into the streamed slice writer, keeping its bounded
memory:

- Community offset (Graphify-Labs#3014, prefix_graph_for_global's shape in build.py):
  pass 1 — which already reads every surviving node — now tracks the
  highest surviving community id, and the incoming slice is offset past
  it, keeping each node's own partition id in local_community. The first
  slice into an empty store keeps its ids, exactly like merge-graphs'
  first input. Applied in the writer rather than through the prefixer's
  parameter because only pass 1 knows the surviving maximum without a
  second full read of the store.

- Shared-type links (Graphify-Labs#3007, link_shared_type_declarations' shape,
  attribute for attribute): pass 1 also indexes the surviving repos'
  namespaced type declarations — the candidacy predicate now lives in
  cross_repo_types.declaration_key so the in-memory and streamed passes
  can never drift — and the incoming slice's declarations are joined
  across the repo boundary. Edges only, never node merging. A refreshed
  slice's old cross-repo links die with its removed node ids, so
  re-linking cannot duplicate.

Measured on the real 1.9GB store, refreshing the 27,706-node cockpit
slice: 231.2MB peak RSS before, 233.9MB after (+1.2%); the whole-map
load stays gone. Re-adding the nexgen repo linked its 4 Temporalio
contract types to sdk-dotnet's, as the earlier scan predicted.

Tests: community ids unique per repo after adds and after a refresh;
same_type_as appears across repos with the maker's exact edge shape and
does not duplicate on refresh; with the new fields peeled off, output is
unchanged against the pre-streaming oracle; existing byte-identity tests
still pass untouched.

Co-Authored-By: Claude Fable 5 <[email protected]>
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