Skip to content

Test hardening: kill the mutants the whole-project review found surviving - #35

Merged
ggapp1 merged 8 commits into
mainfrom
test/suite-hardening
Oct 29, 2026
Merged

ggapp1 merged 8 commits into
mainfrom
test/suite-hardening

Conversation

@ggapp1

@ggapp1 ggapp1 commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

A mutation-testing pass over the security-critical core found ~28 mutations that survived the whole suite. This PR adds tests that kill every one of them except one equivalent mutant. Test-only: src/ is untouched. Each new test was mutation-checked (the mutation makes it fail; reverted, it passes).

  • Env leak fixed. monkeypatch.delenv(var, raising=False) records nothing for an absent var, so DUDAMEL_WEB_TOKEN written by an in-process run leaked into every later test. That silently voided test_missing_configured_token_rejects_any_bearer's precondition: with auth.py mutated to fail open, it passed when run after test_cli.py. An autouse os.environ snapshot/restore in conftest.py closes it; the victim now self-checks its precondition, and the misleading docstrings are corrected.
  • Web auth negatives: wrong-but-present CSRF token (incl. a 16-char-prefix near miss) → 403; bogus session cookie → 401; session TTL boundary and expired-entry removal; bearer with trailing characters → 401.
  • Confirmation lifecycle: double-approve runs the tool once; resolved rows untouched by later messages; TTL wiring; declined/expired statuses; resumed calls re-validated into typed args; a hallucinated tool name does not taint a batch.
  • Compaction taint at the router seam: an MCP call compacted out of the window produces a tainted Summary and the next turn's native write is still gated.
  • Migrations: a non-first suite lane behind is reported; a core behind (not merely unapplied) is reported; lanes apply in name order; upgrade_all takes a backup.
  • Sanitizers: every boundary codepoint of the unsafe class, through both cleaners, plus neighbours that must survive; strip-before-trim order; truncation at exactly the max; whitespace in URLs.
  • Budget day: instants where the framework-zone date differs from the UTC date, both behind (New York) and ahead (Tokyo).
  • Telegram action tokens: an absolute 59/61-minute lifetime check.

Not killable: turn_tainted = turn_tainted or summary.tainted in router.py is equivalent, covered by the newest-summary seed and the dropped-span recompute.

Fast suite: 1106 passed locally; ruff check and format --check clean.

@ggapp1
ggapp1 merged commit fccab67 into main Oct 29, 2026
6 checks passed
@ggapp1
ggapp1 deleted the test/suite-hardening branch October 29, 2026 11:55
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