fix(scoring): apply 1.3x multiplier only to findings from executable files
Summary
Addresses the scoring concern in #103: the 1.3x executable-script multiplier was applied globally to ALL findings when any executable file existed. This meant documentation, teaching content, deny-lists, and anti-examples in .md files received the same score inflation as actual executable code — making thoroughly documented security skills appear MORE dangerous.
Fix
_compute_risk_score() now accepts optional component_metadata and builds a file-path lookup. The 1.3x multiplier is applied only to findings whose file is marked as executable in the component metadata. Findings from markdown, text, json, yaml, and toml files receive base severity weight (no multiplier).
Before
score = sum(severity_weights)
if has_executable_scripts:
score = int(score * 1.3) # inflates ALL findings
After
for each finding:
weight = severity_weight
if has_executable_scripts AND finding's file is executable:
weight = int(weight * 1.3) # only executable-file findings
score += weight
Testing
- 622 tests pass (all existing + new
test_report_doc_findings_no_multiplier) - Backward compatible: when
component_metadatais None, behavior is unchanged
Please resolve merge conflicts.
Rebased on current upstream/main — merge commit replaced with a clean linear history. Resolved the conflict in _compute_risk_score: upstream added severity-rank sorting in the same region; the rebased commit now includes both the sort and the per-file executable lookup, in that order.