Repository navigation
Dampen Silent Mutation Risk with real test coverage (#373) - #384
Merged
Merged
Conversation
dev_agent_firewall.py's "Cascading State Flux (Silent Mutation Risk)" rule read telemetry["has_tests"], a key no producer anywhere ever wrote -- so `not has_tests` was always True, and a high-flux, high-in-degree file could never have this guardrail dampened by genuine test coverage, no matter how thoroughly tested it actually was. Unlike most of #325's other findings, this was a false-positive risk, not a false-negative one. file_data["test_coverage_map"] (galaxyscope.py, backed by network_risk_sensor.py's outbound-call mapping from test files to the production functions they actually invoke) is a real, already-computed signal for exactly this: a non-empty map means at least one function in this file is genuinely exercised by a test. Swapped the dead telemetry read for bool(file_data.get("test_coverage_map", {})). Tests: the existing Silent Mutation Risk test updated to use test_coverage_map (empty, matching the "still triggers" case it was already proving), plus a new test proving the mirror case -- identical high-flux/high-in-degree conditions, but with real coverage now correctly suppressing the guardrail. Also updated the Clean Baseline test to grant real coverage via test_coverage_map instead of the dead telemetry flag, and dropped the now-inert has_tests field from the short-vectors edge case test. tests/dead_key_audit_baseline.json: "has_tests" removed now that it's fixed (`python tests/dead_key_audit.py --ci` confirmed clean at 5 baselined keys, zero regressions). Full suite: 860 passed, 1 pre-existing xfail. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Contributor
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
Closes #373.
dev_agent_firewall.py's "Cascading State Flux (Silent Mutation Risk)" rule readtelemetry["has_tests"], a key no producer anywhere ever wrote -- sonot has_testswas alwaysTrue, and a high-flux, high-in-degree file could never have this guardrail dampened by genuine test coverage, no matter how thoroughly tested it actually was. Unlike most of #325's other findings, this was a false-positive risk, not a false-negative one.file_data["test_coverage_map"](galaxyscope.py, backed bynetwork_risk_sensor.py's outbound-call mapping from test files to the production functions they actually invoke) is a real, already-computed signal for exactly this: a non-empty map means at least one function in this file is genuinely exercised by a test. Swapped the dead telemetry read forbool(file_data.get("test_coverage_map", {})).Test plan
test_coverage_map(empty, matching the "still triggers" case it was already proving).test_silent_mutation_risk_dampened_by_real_test_coverage) proving the mirror case -- identical high-flux/high-in-degree conditions, but with real coverage now correctly suppressing the guardrail.test_coverage_mapinstead of the dead telemetry flag; dropped the now-inerthas_testsfield from the short-vectors edge case test.tests/dead_key_audit_baseline.json:"has_tests"removed now that it's fixed (python tests/dead_key_audit.py --ciconfirmed clean at 5 baselined keys, zero regressions).python -m pytest tests/ -q-- full suite, 860 passed, 1 pre-existing xfail.flake8 . --count --select=E9,F63,F7,F82-- 0.🤖 Generated with Claude Code