Skip to content

tools: add direct-invocation tier-parity audit harness for epic #1056 - #1097

Merged
squid-protocol merged 1 commit into
mainfrom
tools-1056-audit-risk-equations
Aug 6, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
tools-1056-audit-risk-equations

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

  • Adds tests/tools/audit_risk_equations.py, a reusable harness for epic Epic: Systematically audit tier-aware risk equations in signal_processor.py #1056's audit of tier-aware _calc_*() risk equations in signal_processor.py, following the same direct-invocation methodology that found [BUG/METRICS] safety_score's tier2/tier3 systems_buffer flat subtraction wipes attack signal #1055's systems_buffer bug (synthetic raw_signals held identical across tier1/tier2/tier3, varying only the tier constants each equation actually receives).
  • Checks two distinct things per swept (loc, hits) combo, per the documented Universal Exposure Framework philosophy (Irc = additive opacity baseline, Fc = defense-credit discount for implicit languages):
  • Auto-classifies each in-scope equation via inspect.signature as tier-parameterized (fc/irc/ot present) or not — an equation that never receives a tier constant can't exhibit tier distortion by construction, so it's reported N/A instead of swept.

Mirrors the reusable-tool pattern from epic #1069's audit_strict_coverage.py rather than one-off scratch scripts per equation.

Findings from running it (posted separately)

Part of #1056.

Test plan

  • python tests/tools/audit_risk_equations.py — runs clean, no direction violations
  • Tool-only change (no signal_processor.py/language_standards.py edits), so no golden-master/crucible re-verification needed

🤖 Generated with Claude Code

Reusable, checked-in harness (mirrors audit_strict_coverage.py's pattern from
epic #1069) for the systematic audit epic #1056 requests: sweeps LOC x
signal-hit density x tier1/2/3 for each tier-aware _calc_*() risk equation in
signal_processor.py, holding raw_signals identical across tiers per the same
direct-invocation proof method that found #1055's systems_buffer bug.

Two checks per (loc, hits) combo, not just a magnitude ratio:
- DIRECTION: per the documented Universal Exposure Framework philosophy (Irc
  as an additive opacity baseline, Fc as defense-credit discount), tier1
  should never score above tier2/tier3 for identical evidence in either a
  risk-only or defense-only scenario. A violation here is the #1055 shape
  specifically (tier ordering inverted), not just "moved a lot."
- MAGNITUDE: flags any combo whose max/min tier ratio exceeds a threshold
  (default 5x, matching the epic's own stated bar).

Also auto-classifies each in-scope equation via inspect.signature as
tier-parameterized (fc/irc/ot present) or not -- an equation that never
receives a tier constant cannot exhibit tier distortion by construction, so
it's reported N/A rather than swept.
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 5d619dc into main Aug 6, 2026
28 checks passed
@squid-protocol
squid-protocol deleted the tools-1056-audit-risk-equations branch August 6, 2026 14:45
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.

1 participant