Backport cluster graphs and multigraph mode (T15) - #6
Open
TimothyNguyen wants to merge 2 commits into
Open
Conversation
kb-core is a stripped fork of graphify and never received upstream PR #2134, which composes several repos into one graph and preserves parallel edges. The scaffolding was already here but dormant: require_multigraph_capabilities() had no call sites and link_shared_type_declarations() was never invoked. Without a composed graph.json there is nothing for kb-core-ui to render across repos. Cluster graphs: a cluster.json spec names member repos and typed cross-repo links, and `kb-core cluster init/add/remove/locate/build/check/status` manages it. A build composes the members into one directed graph, writes a manifest and report, and drops a cluster-ref.json marker in each member so `--cluster [NAME]` resolves the composed graph from inside any of them. Multigraph mode: parallel edges between a node pair survive build, analysis, query and export, each keyed by a content-derived stable_edge_key rather than NetworkX's positional key, so a rebuild does not renumber every edge when the extraction order shifts. Both features are opt-in. The default single-repo path is unchanged, and the tests that pin that default are part of this commit rather than an afterthought. spec/T15-CODEX.md carries the remaining verification steps. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
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
cluster.jsonspec names member repos and typed cross-repo links (api_call,shared_resource,mirrored_file,depends_on,references).kb-core cluster init/add/remove/locate/build/check/statusmanages it. A build composes the members into one directed graph plus a manifest and report, and writes acluster-ref.jsonmarker into each member so--cluster [NAME]resolves the composed graph from inside any of them — wired intoquery,path,explainandaffected.stable_edge_keyinstead of NetworkX's positional key, so a rebuild does not renumber every edge when the extraction order shifts.test_default_build_stays_simple,test_build_merge_defaults_to_simple_without_a_stored_flag) ship in this PR rather than as an afterthought.kb-core is a stripped fork of graphify and never received upstream PR Graphify-Labs/graphify#2134. The scaffolding was already present but dormant —
require_multigraph_capabilities()had no call sites andlink_shared_type_declarations()was never invoked. Without a composedgraph.jsonthere is nothing for kb-core-ui to render across repos.New modules:
kb_core/cluster_graph.py,kb_core/cluster_cli.py,kb_core/cluster_ref.py. Touched:build,global_graph,cluster,analyze,affected,export,watch,serve,manifest_ingest,cli,__main__.Test plan
pytest tests/test_cluster_spec.py— 41 passedpytest tests/test_cluster_links.py— 20 passedpytest tests/test_cluster_build.py— 20 passedpytest tests/test_cluster_refs.py— 28 passedpytest tests/test_cluster_cli.py— 33 passedpytest tests/test_multigraph_build.py— 21 passedcluster init,addx2, one declaredapi_call,checkexit 0,buildproducing graph + manifest + report + per-member markers, thenquery --clusterandaffected --clustercrossing the repo boundary viacalls_api.graph.jsonbyte-stable across a--forcerebuild.6c3f0e2— identical failure sets (72 pre-existing on both sides).cd kb-core-ui && pytest python/tests -qfor shared-import breakage.The two unchecked items and the reasoning behind them are written up in
spec/T15-CODEX.md, along with three known non-bugs so they are not re-investigated.Generated with Claude Code
via Happy