Skip to content

Remove logic_bomb and algorithmic_dos metrics from the risk engine - #1029

Merged
squid-protocol merged 1 commit into
mainfrom
fix-logic-bomb-algorithmic-dos-1015
Aug 4, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fix-logic-bomb-algorithmic-dos-1015

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

  • Removes the logic_bomb and algorithmic_dos risk metrics engine-wide: both generate systematic false positives by criminalizing standard patterns (defensive validation code, deeply-indented-but-harmless server loops) via unrelated regex hit-count co-occurrence rather than any real control/data-flow analysis.
  • Deletes _calc_logic_bomb/_calc_algorithmic_dos and every schema/config entry that fed them (RISK_SCHEMA, RISK_EQUATION_TUNING, NATIVE_WEIGHTS, ECOSYSTEM_MISMATCH_WEIGHTS, CONTEXT_VIOLATION_MATRIX, FRIENDLY_MAP, EXPOSURE_LABELS, ThreatPolicy thresholds), plus every downstream consumer (audit_recorder.py, llm_recorder.py, supply_chain_firewall.py, a stale galaxyscope:ignore comment in state_rehydrator.py).
  • Deletes the two dedicated wiki pages and fixes doc mentions/index links that used these metrics as examples.

This is sub-issue #1015 of epic #1025 (post-db_complexity overreaching-metrics removal wave), first in execution order since #1015 absorbs the duplicate #1016 and algorithmic_dos is mathematically built on big_o_depth (#1014, next in the epic).

Closes #1015.

Test plan

  • python -m pytest tests/ — 5447 passed, 0 failed, 2 skipped, 11 xfailed (pre-existing), 3 xpassed
  • python tests/tools/audit_check.py — clean (ruff baseline regenerated for pure line-shifts only)
  • ruff format --check — no new drift from this change
  • Golden master fixtures regenerated via python tests/tools/update_golden_master.py in both full-precision and zero-dependency venvs (.crucible_venvs/) — diff is exactly the two removed keys disappearing from every scanned file's risk vector, confirmed no other output moved

🤖 Generated with Claude Code

Both metrics generate systematic false positives by criminalizing standard
programming patterns. logic_bomb multiplies branching logic by defensive
payloads (panics/cleanup), so any safe function that validates input and
raises on failure -- log rotators, garbage collectors -- scores as a
"Logic Bomb" purely from keyword co-occurrence, with no AST-level link
between trigger and payload. algorithmic_dos layers on top of it, deriving
"Big-O" purely from whitespace indentation depth and compounding it with
unrelated io/api signals, so deeply nested but harmless server loops (e.g.
Django's runserver.py) get flagged as intentional DoS attacks.

Removes both from signal_processor.py (calc functions, exposure vector,
tuning lookups) and analysis_lens.py (RISK_SCHEMA, RISK_EQUATION_TUNING,
NATIVE_WEIGHTS, ECOSYSTEM_MISMATCH_WEIGHTS, CONTEXT_VIOLATION_MATRIX,
FRIENDLY_MAP, EXPOSURE_LABELS, ThreatPolicy thresholds), plus every
downstream consumer: audit_recorder.py, llm_recorder.py,
supply_chain_firewall.py, and the stale galaxyscope:ignore suppression
comment in state_rehydrator.py. Deletes the two dedicated wiki pages and
fixes the doc mentions/index links. Golden master fixtures (both
full-precision and zero-dependency mode) regenerated via
update_golden_master.py -- the diff is exactly the two removed keys
disappearing from every file's risk vector, nothing else moved.

Closes #1015.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 0ed2903 into main Aug 4, 2026
28 checks passed
@squid-protocol
squid-protocol deleted the fix-logic-bomb-algorithmic-dos-1015 branch August 4, 2026 14:43
squid-protocol added a commit that referenced this pull request Aug 4, 2026
…engine (#1032)

- Deletes the indentation-based Big-O tracker and the name-occurrence-count
  recursion heuristic in detector.py, plus the FunctionNode fields they fed.
  Both generated systematic false positives: whitespace geometry doesn't
  measure algorithmic complexity, and counting a function's own name inside
  its body triggers on docstrings, comments, logging, and super().setUp()
  patterns.
- Removes every downstream consumer beyond the issue's own checklist, found
  via grep: the magnitude/impact complexity_multiplier in detector.py, the
  "Algorithmic Network Bottleneck" feature in network_risk_sensor.py (a
  networkx graph attribute + telemetry field with no other consumer),
  signal_processor.py's max_algorithmic_complexity telemetry string, the
  big-O term in the documentation-risk "opaque execution" formula, the
  concurrency "resource exhaustion guard" starvation multiplier, and
  dev_agent_firewall.py's Context Window Exhaustion gate (now token_mass
  alone, consistent with #1013's choice not to invent a replacement
  AST-less heuristic).
- Updates the two wiki pages and CLAUDE.md/ANTIGRAVITY.md self-scan-DB
  example queries that referenced these fields.

This is sub-issue #1014 of epic #1025, next after #1015 since algorithmic_dos
(#1015, merged via #1029) was mathematically built on big_o_depth.

Closes #1014.

Test plan:
- python -m pytest tests/ -- 5444 passed, 0 failed, 2 skipped, 11 xfailed, 3 xpassed
- python tests/tools/audit_check.py --regenerate -- clean (ruff/mypy baselines
  regenerated, all pure line-shifts)
- ruff format --check -- clean
- Golden master fixtures regenerated via update_golden_master.py in both
  full-precision and zero-dependency venvs -- diff is magnitude/impact and
  the concurrency/documentation risk scores shifting downward across the
  corpus now that the fake complexity multipliers are gone; crucible_check.py
  passes clean on both modes after blessing.

🤖 Generated with Claude Code

Co-authored-by: Joe Esquibel <[email protected]>
Co-authored-by: Claude Sonnet 5 <[email protected]>
squid-protocol added a commit that referenced this pull request Aug 7, 2026
- Rewrite 106 file:///home/joe/... absolute-path links (82 files) into
  working links: source-code references now point at GitHub blob URLs,
  internal cross-links now use relative wiki paths. These previously
  resolved only on the author's own machine and were dead for every
  reader of the deployed site.
- Drop the mkdocs.yml nav entry for 08-20-logic-bomb-exposure.md, whose
  underlying metric was removed from the risk engine in #1029; the page
  was never created, leaving a dangling nav link.
- Remove the dead teardown-of-rails.md link from the Museum of Code
  index -- no such page was ever authored.

Co-authored-by: Joe Esquibel <[email protected]>
Co-authored-by: Claude Sonnet 5 <[email protected]>
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.

Remove logic_bomb and algorithmic_dos metrics

1 participant