Repository navigation
Description
Part of #2812 (Phase 2; decision D1 in docs/contract_roadmap.md, approved 2026-09-06). Pairs with #2765, which cannot be answered while the number it is asking about already carries a weight.
The leak
core/spatial_correlation.py runs six proximity pairs after detection (documented in core/README.md's proximity table; the ×3 flux was documented and pinned by #2631 for #2546) and writes the result into the recorded signal count:
# Block 6, The OOM Bomb
counts["state_mutation"] += cascading_flux * 2 # +2 on top of the raw hit = x3 net
mitigations["amplified_cascading_flux"] = mitigations.get(...) + cascading_fluxSo state_mutation in file_data, every recorder (SARIF, SBOM, SQLite, the LLM brief), both golden masters and every keyword-rosetta manifest is raw + 2 × cascading, not a count. The same shape applies to the silencer dampener on high_risk_execution and the race/exfiltration amplifiers. #2631 made the raw count recoverable (raw = recorded − 2 × amplified), which was the right first move; this issue is the second: the recorded number becomes the raw count and the weight is applied where it is consumed.
Why it matters beyond tidiness: the corpus plants two mutations per language and reads 2–6 depending on whether a decoy string sits within 150 characters of them (ledger state-flux-branch-weighting, 11 cells; string-literal-selective-shielding, 38 cells after #2535's re-reading). A weighted count cannot be held equal by any corpus, and a contract for state_mutation (#2765) written against it would be a contract for a score.
Fix shape (score-neutral by construction)
spatial_correlation.py:apply_dampener_correlations/apply_amplifier_correlationsstop mutatingcounts; they write only tomitigations(the keys already exist:amplified_cascading_flux,amplified_race_conditions,amplified_leaks,amplified_rce, the mitigated counts).signal_processor.py: one helper,_weighted(raw_signals, mitigations, key), returning exactly what the recorded count used to be (state_mutation:raw + 2 × amplified_cascading_flux, etc.). Every consumer of an affected signal reads it —_calc_state_flux, the flux density at ~L1382, the tech-debt term at ~L1431, the bottleneck ledger at ~L1940,spatial_correlation.py's own downstream reads at L164/L273, andsecurity_lens.pyif it reads the recorded value.- Recorders: keep a weighted figure under its own key (
state_mutation_weightedor the telemetry block) so user-facing SARIF/SBOM numbers do not change meaning silently; the audit report's "Contextual Mitigations & Amplifications" already shows the components. tests/core_engine/test_spatial_correlation.py: the five docs(core): document + pin the ×3 cascading-flux weighting (closes #2546) #2631 pins move from assertingcounts[...]to assertingmitigations[...]+ the helper's output; add one pin that_weighted()reproduces the old recorded value on the same fixtures.core/README.mdproximity table: "recorded count" column becomes "weighted view".
Proof
- Both golden masters: every
risk_*column byte-identical before and after; the bless diff is signal-column-only (attribute per language before blessing — CLAUDE.md "Scoping a bless"). - keyword-rosetta:
state_mutationlands on the planted 2 in the ~21 languages the ledger lists;state-flux-branch-weightingflipsstill_reproduces: falsewith the verifying scan; the report'scorrelationcategory goes to 0. audit_risk_equations.py,audit_length_invariance.pyunchanged.
Label rosetta:rebless-owed; corpus re-bless PR against engine main after merge.
Activity
fix(core): blank statically-dead C preprocessor branches before count…