Skip to content

Copy max_big_o back onto the file dict, not just the graph node (#372) - #383

Merged
squid-protocol merged 1 commit into
mainfrom
fix/372-max-big-o-not-copied-back
Jul 24, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fix/372-max-big-o-not-copied-back

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Closes #372. dev_agent_firewall.py's Agentic Black Hole check reads file_data.get("max_big_o") directly, but the only producer, network_risk_sensor.py, set it exclusively as a networkx graph node attribute (G.nodes[path]) -- a different object entirely. The function already reads max_big_o back OUT of the graph node to compute is_algorithmic_bottleneck, it just never wrote that same value onto the file dict itself. One-line fix at the exact point telemetry is already written back to the file node.

Also fixed the Zero-Dependency Mode fallback path (_fallback_build_graph), which didn't compute max_big_o at all -- it doesn't actually need networkx (it's pure Python off "functions"), so there's no reason Zero-Dependency Mode should be any more broken here than the main path.

Test plan

  • test_network_risk_sensor.py: assertions on both the main networkx path and the Zero-Dependency Mode fallback proving file_data["max_big_o"] is now populated correctly for both a simple and a complex function.
  • test_dev_agent_firewall.py: new end-to-end test (test_black_hole_detection_from_real_network_risk_sensor_output) that runs the REAL NetworkRiskSensor.build_dependency_graph() and feeds its real output into the REAL DevAgentFirewall.evaluate_ecosystem(), proving the Agentic Black Hole guardrail now fires on genuine O(N^4) complexity -- not just a hand-mocked "max_big_o": 3 like the existing unit test.
  • tests/dead_key_audit_baseline.json: "max_big_o" removed now that it's fixed (python tests/dead_key_audit.py --ci confirmed clean at 6 baselined keys, zero regressions).
  • python -m pytest tests/ -q -- full suite, 859 passed, 1 pre-existing xfail.
  • flake8 . --count --select=E9,F63,F7,F82 -- 0.

🤖 Generated with Claude Code

dev_agent_firewall.py's Agentic Black Hole check reads
file_data.get("max_big_o") directly, but the only producer,
network_risk_sensor.py, set it exclusively as a networkx graph node
attribute (G.nodes[path]) -- a different object entirely. The function
already reads max_big_o back OUT of the graph node to compute
is_algorithmic_bottleneck, it just never wrote that same value onto the
file dict itself. One-line fix at the exact point telemetry is already
written back to the file node.

Also fixed the Zero-Dependency Mode fallback path (_fallback_build_graph),
which didn't compute max_big_o at all -- it doesn't actually need
networkx (it's pure Python off "functions"), so there's no reason
Zero-Dependency Mode should be any more broken here than the main path.

Tests:
- test_network_risk_sensor.py: assertions on both the main networkx path
  and the Zero-Dependency Mode fallback proving file_data["max_big_o"]
  is now populated correctly for both a simple and a complex function.
- test_dev_agent_firewall.py: new end-to-end test
  (test_black_hole_detection_from_real_network_risk_sensor_output) that
  runs the REAL NetworkRiskSensor.build_dependency_graph() and feeds its
  real output into the REAL DevAgentFirewall.evaluate_ecosystem(),
  proving the Agentic Black Hole guardrail now fires on genuine O(N^4)
  complexity -- not just a hand-mocked "max_big_o": 3 like the existing
  unit test.

tests/dead_key_audit_baseline.json: "max_big_o" removed now that it's
fixed (`python tests/dead_key_audit.py --ci` confirmed clean at 6
baselined keys, zero regressions).

Full suite: 859 passed, 1 pre-existing xfail.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@squid-protocol
squid-protocol merged commit cedc989 into main Jul 24, 2026
20 of 21 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol deleted the fix/372-max-big-o-not-copied-back branch July 24, 2026 16:06
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.

[BUG/APPSEC] Dev Agent Firewall's Agentic Black Hole check reads "max_big_o" off file_data, but it only ever lives on a networkx graph node

1 participant