Repository navigation
Native graph engine: remove networkx from the runtime (#3041) - #3054
Merged
Merged
Conversation
Every graph metric has been native since #3034-#3040, so networkx computed nothing. It still chose the sensor's builder and decided the scan mode; this removes both. - network_risk_sensor: the DiGraph builder, HAS_NETWORKX and `import networkx` are gone. build_dependency_graph is the single linear builder; its output was already identical (#3024, #3035-#3040). - galaxyscope: networkx leaves the Zero-Dependency Mode flag, the banner and end note, and both missing_dependencies maps (audit/GPU JSON, SARIF, SBOM, LLM brief). The mode now means only tiktoken, xgboost/pandas/numpy or PyYAML is missing. - pyproject `full` extra, self_scan.py, crucible_check.py's full venv, and the golden-master tooling's mode detection all drop networkx. - CI installs drop networkx from: golden-crucible full leg, gitgalaxy.yml, release-crucible-archive, rosetta-audit PR build. It is kept in the test jobs (the parity oracle) and rosetta-audit's baseline venv (a pre-#3041 build still reads it). - New test_no_networkx_runtime.py: with networkx unimportable in a subprocess, galaxyscope imports and every graph metric plus the reach counts are computed. - Paired networkx-vs-zero-dependency tests collapse to single-path tests. - graph_parity.py oracles are named functions, so the harness imports and skips without networkx. - Docs: zero_dependency_mode.md, README, CLAUDE.md, 02-16 wiki, and the brief's Zero-Dependency banner text. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ndencies) Uncapped golden_diff scope: exactly 1 difference per mode -- the audit JSON's Forensic Trail / Analysis Context / Missing Dependencies no longer carries a networkx key (false in full precision, true in zero-dependency). Every graph metric is unchanged. The full-precision fixture was blessed from a venv without networkx installed. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Contributor
squid-protocol
added a commit
that referenced
this pull request
Sep 15, 2026
… (#3056) #3054 removed networkx from the engine; these still installed or cited it. - action.yml full_precision step + description, templates/{azure,bitbucket, github,gitlab}, templates/scan.yml, azure-/bitbucket-pipelines.yml: stop installing networkx. - rosetta-audit baseline venv: drop networkx (the baseline is post-#3041 main now). - gitgalaxy/requirements.txt: drop the networkx==3.6.1 pin. - Comments and test docstrings: None now means "past its work budget" or "a failed computation", never "no networkx". Kept: networkx in the smoke/full-suite test installs (the parity oracle). numpy stays: the ML threat model (pandas/xgboost) requires it. 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 #3041. Closes #3033 (the native graph engine epic): this is its last sub-issue.
What changed
networkx is no longer a runtime dependency. Since #3034–#3040, every graph metric has been computed by
gitgalaxy/core/graph_engine.py, so networkx no longer computed anything. It still did two things, and this PR removes both:NetworkRiskSensorhad a networkx DiGraph builder and a pure-Python one, and the two already produced identical output: degrees since internal_dependency_links / popularity count import statements in zero-dependency mode but distinct neighbours with networkx #3024, every metric since Native graph engine: cyclic density (SCC) and articulation points in O(V+E) #3035–Native graph engine: exact security_auditor reach counts (no 500 cap) #3040. The DiGraph builder, theHAS_NETWORKXflag and theimport networkxare gone.build_dependency_graphis now the single linear builder.galaxyscope.pynow leaves networkx out of all of the following:missing_dependenciesmaps, and so the audit JSON, GPU JSON, SARIF, SBOM and LLM briefpip installhintZero-Dependency Mode now means only that tiktoken, xgboost/pandas/numpy or PyYAML is missing.
Packaging and tooling:
pyproject.toml: networkx is removed from thefullextra.self_scan.pyno longer requires networkx.crucible_check.pyfull-precision venv no longer installs it.test_golden_crucible.pyandupdate_golden_master.pydetect the mode without it.CI install lines:
golden-crucible(full leg),gitgalaxy.yml(self-scan),release-crucible-archive, androsetta-audit(PR build).tests/tools/graph_parity.py, as the issue asksgitgalaxy/requirements.txt(a frozen dev environment, not the install contract) is left alone.Tests:
test_no_networkx_runtime.pycovers the acceptance criterion. Withnetworkxmade unimportable in a subprocess, it checks that:gitgalaxy.galaxyscopeimportsgraph_parity.py's two barenx.closeness_centrality/nx.betweenness_centralityoracles become named functions again. The CodeQL lambda cleanup had made the module read networkx at import, so without networkx it crashed instead of letting its tests skip. Nameddefs satisfy both.Docs:
zero_dependency_mode.md: the networkx section becomes "Graph metrics: no optional package", and there's an older-snapshots note.Golden masters
I diffed fresh scans of each mode against the committed fixtures with an uncapped
golden_diff.deep_compare. The scans usedGITGALAXY_DISABLE_GIT_HISTORY=1and the same flags astest_golden_crucible.py. I also checked that the scan imported this branch:HAS_NETWORKXis absent.Forensic Trail / Analysis Context / Missing Dependenciesno longer has anetworkxkey. It wasfalsein the full-precision fixture andtruein the zero-dependency one.Both fixtures are re-blessed in the second commit.
Verification
pytestpasses on the 13 affected suites (633 passed), including the new acceptance test run from an unrelated working directory.audit_check.py: all clear.gitgalaxy/imports networkx (grep).🤖 Generated with Claude Code