Repository navigation
Description
Problem
The high_risk_execution raw signal is being counted twice in the risk exposure calculations, artificially inflating cumulative risk without adding new information:
Cognitive Load Dimension (_calc_cog_load):
- Small-file path (line ~1299): Included directly in the
total_densitysum alongside branch/state_mutation/concurrency/reflection_metaprogramming - Main path (lines ~1319, 1326): Computed as
danger_density = raw_signals.get("high_risk_execution", 0) / safe_loc, then weighted bydanger_mult(default 5.0) and added toheavy_logicuncapped
Safety Score Dimension (_calc_safety):
- Line ~1355:
high_risk_executionis weighted highest atdanger_weight(default 4.0) - Lines ~1365-1366: Function short-circuits to
0.0ifattack_hits == 0, makinghigh_risk_executionthe gating signal; without it, safety_score literally doesn't exist - This is the signal's "home" dimension by design
Impact: A single dangerous call (e.g., eval(), exec(), shell execution) gets counted heavily in both cognitive_load and safety_score. When these dimensions are summed in generate_forensic_report's get_cumulative_risk (lines ~1787-1794), the evidence is double-weighted, compressing the risk axis and reducing signal fidelity on other structural dangers that should be independently significant.
Proposed Fix
Remove high_risk_execution/danger_density from _calc_cog_load:
- Delete from small-file early-return density sum (~line 1299)
- Delete from main-path
heavy_logicsum (~lines 1323-1327)
Note: verification dimension's minor use of high_risk_execution as an unweighted addend (see _calc_verification) was reviewed and accepted as out-of-scope; only the cognitive_load usage is the problem.
Test & Verification
Per the Differential Scan protocol (CLAUDE.md), any change to signal_processor.py's risk equations must:
- Be verified locally with
python tests/tools/crucible_check.pybefore pushing - Include a golden-master re-bless via
python tests/tools/update_golden_master.pywith explanation in the PR description - This will shift
cognitive_loadandcumulative_riskscores across the golden-master test corpus
References
signal_processor.pylines 1278-1348 (_calc_cog_load)signal_processor.pylines 1350-1388 (_calc_safety)- CLAUDE.md "Differential Scan" section
Activity