Repository navigation
fix(metrics): stop double-counting high_risk_execution in cognitive_load - #1061
Merged
Merged
Conversation
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]>
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
high_risk_executionwas weighted in both_calc_cog_load(small-file density sum, andheavy_logicviadanger_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.high_risk_executionfromcognitive_load;safety_scoreretains it as designed. Dropped the now-unuseddanger_multtuning key fromRISK_EQUATION_TUNING.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 arecognitive_load/Raw Cognitive Densitydecreases across the corpus -- exactly the expected effect of removing the double-count, no other dimensions shifted.python tests/tools/crucible_check.pypasses clean on bothfull_precisionandzero_dependencyafter the re-bless.Test plan
tests/core_engine/test_signal_processor.py-- 51 passed (updatedtest_signal_processor_inline_suppressions, which relied onhigh_risk_executionto force max cognitive_load, to usestate_mutation/concurrencyinstead)pytest tests/-- 5447 passed, 0 failedtests/tools/audit_check.py --regenerate-- ruff baseline re-synced (pure line-shifts only), mypy/dead-key cleanruff format --check-- cleantests/tools/crucible_check.py-- PASS on both full_precision and zero_dependencyFixes #1052.
🤖 Generated with Claude Code