Skip to content

fix(metrics): stop double-counting high_risk_execution in cognitive_load - #1061

Merged
squid-protocol merged 2 commits into
mainfrom
fix-1052-cog-load-double-count
Aug 5, 2026
Merged

squid-protocol merged 2 commits into
mainfrom
fix-1052-cog-load-double-count

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

  • high_risk_execution was weighted in both _calc_cog_load (small-file density sum, and heavy_logic via danger_density/danger_mult) and _calc_safety (danger_weight, its intended home dimension). A single dangerous call (eval/exec/shell execution) was double-counted across two risk dimensions, compressing the risk axis and reducing signal fidelity on other structural dangers.
  • Removed high_risk_execution from cognitive_load; safety_score retains it as designed. Dropped the now-unused danger_mult tuning key from RISK_EQUATION_TUNING.
  • Also includes a small, unrelated docs cleanup: corrected a few README passages that overclaimed indentation-based Big-O/recursion-depth inference and referenced a removed "Memory Exhaustion Vulnerability Detector" that no longer exists in the code.

Differential Scan

Per CLAUDE.md's Differential Scan protocol, re-blessed both golden-master fixtures via python tests/tools/update_golden_master.py (full-precision and zero-dependency modes). All 213 diffs in each fixture are cognitive_load / Raw Cognitive Density decreases across the corpus -- exactly the expected effect of removing the double-count, no other dimensions shifted.

python tests/tools/crucible_check.py passes clean on both full_precision and zero_dependency after the re-bless.

Test plan

  • tests/core_engine/test_signal_processor.py -- 51 passed (updated test_signal_processor_inline_suppressions, which relied on high_risk_execution to force max cognitive_load, to use state_mutation/concurrency instead)
  • Full pytest tests/ -- 5447 passed, 0 failed
  • tests/tools/audit_check.py --regenerate -- ruff baseline re-synced (pure line-shifts only), mypy/dead-key clean
  • ruff format --check -- clean
  • tests/tools/crucible_check.py -- PASS on both full_precision and zero_dependency

Fixes #1052.

🤖 Generated with Claude Code

squid-protocol and others added 2 commits August 5, 2026 16:11
high_risk_execution was weighted in both _calc_cog_load (small-file
density sum, and heavy_logic via danger_density/danger_mult) and
_calc_safety (danger_weight, its home dimension). This double-counted
a single dangerous call (eval/exec/shell) across two risk dimensions,
compressing the risk axis and reducing signal fidelity on other
structural dangers. Removed the signal from cognitive_load; safety_score
keeps it as intended. Dropped the now-unused danger_mult tuning key.

Per the Differential Scan protocol, re-blessed both golden-master
fixtures via update_golden_master.py -- the diffs are exclusively
cognitive_load / Raw Cognitive Density decreases across the corpus,
consistent with removing the double-count.

Fixes #1052.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Several READMEs described capabilities the engine doesn't actually have:
indentation-based Big-O/algorithmic-complexity and recursion-depth
inference (detector.py only counts control-flow branch signatures from
the lexical stream), and a "Memory Exhaustion Vulnerability Detector"
in signal_processor.py that no longer exists. Corrected the descriptions
to match current behavior and documented the two intentional recall
boundaries (aperture.py's monolith exclusion, detector.py's per-file
function-extraction cap).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 2462e48 into main Aug 5, 2026
28 checks passed
@squid-protocol
squid-protocol deleted the fix-1052-cog-load-double-count branch August 5, 2026 20:15
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/METRICS] Double-counting of high_risk_execution between cognitive_load and safety_score

1 participant