Repository navigation
fix(global): carry the maker's #3014 community offsets and #3007 shared-type links into global add - #26
Merged
Conversation
…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]>
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.
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-reposame_type_aslinks 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 bygraphify global add, andglobal_graph.pyhad neither mechanism.Measured on the live 1.21M-node FalkorDB map before this fix:
same_type_asedges 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
merge-graphsdoes not namespace thecommunitynode attribute, so communities collide across repos and the aggregated HTML view fuses unrelated ones into a single meta-node Graphify-Labs/graphify#3014): the maker's shape isprefix_graph_for_global(..., community_offset=)(build.py) driven by a running maximum in merge-graphs (cli.py). In the streamed writer, pass 1 already reads every surviving node, so it now tracks the highest surviving community id and offsets the incoming slice past it — same fields (communityshifted, original kept inlocal_community), same first-input-keeps-its-ids rule. Applied in the writer, not through the prefixer's parameter, because only pass 1 knows the surviving maximum without a second full read of the 1.9GB store.cross_repo_types.declaration_key()so the in-memory pass and the streamed pass can never drift; pass 1 indexes the surviving repos' namespaced type declarations and the incoming slice's declarations are joined across the repo boundary with the maker's exact edge attributes (relation=same_type_as, context=cross_repo, confidence=INFERRED, confidence_score=0.9, weight=1.0, _src/_tgt). Edges only, never node merging. A refreshed slice's old cross-repo links die with its removed node ids, so re-linking cannot duplicate.Proof
same_type_asedges (Temporalio.Workflows contracts to sdk-dotnet) and 490 community ids with zero collision against any other repo.same_type_asshape 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.🤖 Generated with Claude Code