Repository navigation
Zero-dependency mode: exact degree counts + document what the mode costs (#3024) - #3030
Merged
Merged
Conversation
…sts (#3024) - network_risk_sensor: the no-networkx fallback now counts distinct neighbours (one per resolved edge), the same thing the DiGraph's in/out degree reports. popularity, internal_dependency_links, dependency_density, producer_ratio, ecosystem_role, "Popularity Rank" and "Direct Downstream" no longer depend on which optional engines are installed (they used to count import statements in this mode). - galaxyscope: --max-systemic-threat multiplies by blast radius, which only networkx computes, so without it the gate could never fail. It now warns that it was not evaluated and is skipped. - docs/zero_dependency_mode.md: field-by-field reference of what each optional package provides, what is identical / not computed without it, how each output flags the mode, and known caveats (#3027, #3028). - Corrected runtime text that claimed missing metrics are "NULL" (they are NULL only in the DB, 0.0 placeholders elsewhere): startup banner, end-of-run note (now triggers on any missing package), SARIF GG-SYS-ZERO-DEP, LLM-brief banner. - pyproject: `pip install "gitgalaxy[full]"` extra; README installation + zero-dependency section; wiki + recorders README corrected. - Zero-dependency golden master re-blessed: 36 diffs = 18 files x (Popularity Rank, Direct Downstream), all decreases (43 in total); full precision unchanged. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
# Conflicts: # tests/golden_master_zero_dep_audit.json
Contributor
squid-protocol
added a commit
that referenced
this pull request
Sep 14, 2026
…PageRank (#3027) (#3032) * Uncomputed graph metrics are None, and zero-dep mode computes PageRank (#3027) A graph metric that was never computed was written as 0.0 -- every networkx-only metric in zero-dependency mode, closeness above 1,500 files in every mode, everything on a convergence failure -- and consumers read it as a measurement: a false "Containment (Low Risk)" AI verdict, bottleneck rankings of five zero-score files, a 0.0 macro table, zeroed archetype features, a HITL flag and --max-systemic-threat that could never fire. - network_risk_sensor: pure-Python _pagerank() (nx.pagerank's parameters and conventions; max |delta| 6.6e-16 on the crucible graph, identical at the stored 6 dp) so zero-dependency PageRank, blast radius and systemic_threat_vector match full precision. Everything still not computed is None via a shared _network_metrics(). - Consumers made None-aware: AI topology skips insights it can't evaluate; each bottleneck ranking holds only files whose metric was computed; the LLM brief renders n/a; supply_chain_firewall and the --max-systemic-threat gate no longer crash on None. #3030's gate skip is removed -- blast radius is computed in every mode now. - record_keeper reads network columns straight from the sensor instead of NULLing them on the zero-dependency flag (the network half of #3028). - Docs/messages: zero_dependency_mode.md, banner, SARIF, LLM banner, README, wiki, CLAUDE.md, self_scan.py's zero-dep detector. - Golden masters re-blessed. Full precision: 1 diff (fragile_dependency_ chain -> []). Zero-dependency: 2,360 diffs, all from real PageRank -- its composition archetypes / fit z-scores / distribution now equal the full-precision fixture's exactly (52 + 2,275 mismatches -> 0). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * Run the native PageRank in full-precision mode too (#3027) Both graph builders now call one _native_pagerank(), fed identical node and edge order, so the two modes produce the same floats and no networkx release can move them. nx.pagerank is no longer called: in networkx 3.x it dispatches to a numpy/scipy backend networkx does not install, so with networkx alone it raised and every file's PageRank was silently lost. PageRank is also computed outside the networkx try-block now, so a centrality failure can't take it down. Golden masters: both modes unchanged (crucible_check --mode both PASS). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: Joe Esquibel <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[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.
Closes #3024.
Why
Zero-dependency mode exists so people who don't want third-party packages can still get a useful scan. It should give them the best numbers it can, and say plainly which numbers it can't give. Before this PR it fell short on both:
popularity,internal_dependency_links,dependency_density,producer_ratio,ecosystem_role, "Popularity Rank" and "Direct Downstream" all depended on the environment. Degree is one of the few graph measurements the fallback can compute exactly, so it should.0.0everywhere else. The end-of-run note checked only networkx and tiktoken. The README never mentioned the mode, andpyproject.tomloffered no way to install full precision.--max-systemic-threatsilently could never fail without networkx. It multiplies by blast radius, which is always a 0.0 placeholder in that mode. A CI job relying on the gate got no protection and no warning.What
network_risk_sensor.py(internal_dependency_links / popularity count import statements in zero-dependency mode but distinct neighbours with networkx #3024): the fallback counts one per resolved edge, i.e. distinct neighbours, using the same_resolve_edges()edge set the DiGraph wires (Persist the dependency graph edge list (enables neighborhood/interaction-level risk hypotheses) #2992). Degree-derived fields are now identical in both modes.--max-systemic-threat: without networkx it now logs a clear warning that the gate was not evaluated, and skips it (Orchestrator._effective_systemic_threat_ceiling). Behaviour with networkx is unchanged.docs/zero_dependency_mode.md: a field-by-field reference. For each optional package it lists what is identical, what is not computed (and how each output shows that), and the knock-on effects: the gates that can't fire, the guardrail flags, the archetype features. It also shows how each output flags the mode, and has a caveats section linking the open behaviour issues.GG-SYS-ZERO-DEPnote now says NULL in the DB and placeholder 0 elsewhere.pip install "gitgalaxy[full]": a new extra, the same unpinned set CI installs. A plainpip install gitgalaxystill installs nothing.02-16-network-risk-sensorwiki line had described the fallback as "basic in/out degree ratios".edge_datareconciliation note inrecorders/README.mdsaid the modes differ, which is no longer true.Golden master (zero-dependency re-blessed; full precision unchanged)
The re-bless is scoped by an uncapped diff of a fresh zero-dependency scan of language-crucible
v1.2.0against the committed fixture:Popularity RankandDirect Downstream (Dependency Blast Radius).types.py, 34 → 25.crucible_check.py --update; they are not hand-edited.crucible_check.py --mode fullpasses unchanged. Only the no-networkx path moved.Verification
tests/core_engine/test_zero_dependency_gate.py: skip-with-warning without networkx, enforced with networkx, and no noise when the flag is unset.tests/tools_recorders/test_edge_data.py: the zero-dependency test now asserts distinct-neighbour degrees. A newtest_degree_family_is_identical_in_both_modesbuilds the same universe in both modes and assertsin_degree/out_degree/producer_ratio/ecosystem_role/popularityare equal, including the file that imports one target twice.ruff_audit --ci,mypy_audit --cianddead_key_audit --cipass, and the changed files areruff format-clean.Follow-ups filed (behaviour, deliberately not in this PR)
0.0outside the DB. This produces the false "Containment (Low Risk)" AI-topology insight, the 0.0 macro table in brief §3.5,requires_hitlnever firing, and zeroed archetype features. The fix is to carryNonethrough.ai_threat_scoreon the global flag. A scan missing only pyyaml discards real PageRank and ML scores. Also, pandas/numpy are never reported as missing in their own right.Both are documented as current behaviour in the new reference page's caveats section, which should be updated when they land.
Cross-repo
None required. Downstream history consumers (temporal-crucible) should note that zero-dependency snapshots recorded before this merge have statement-count degrees; the reference page's caveats say so.
🤖 Generated with Claude Code