Skip to content

mutate: daily runs, iPhone suite, boundary mutants, survivors issue and auto-fix PR - #449

Open
alexkroman wants to merge 10 commits into
mainfrom
claude/magical-hamilton-avccoc
Open

alexkroman wants to merge 10 commits into
mainfrom
claude/magical-hamilton-avccoc

Conversation

@alexkroman

@alexkroman alexkroman commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

What & why

Mutation testing (scripts/mutate.sh) was the one test suite CI could run but only ran when someone started it by hand. It also only tried mutations that flip a condition, and it didn't cover the iPhone code at all. This PR changes all three, and kills every mutant the new setup found.

Result

Final confirming run, on this branch:

Suite Mutants caught Survived
Engine (swift test) 306 0
iPhone (BlurtiOSTests) 236 + 43 rerun on Bounce.swift after its fix 0

The first runs found 24 engine and 34 iPhone survivors. Each one now has either:

  • a test that catches it (20 engine, 26 iPhone). Most are exact-boundary cases nothing tested: a budget, deadline, cap or threshold hit exactly; the press and stop handshake's deadlines and retries at their exact instants; a named key logged as return, never enter; window placement from an offset display.
  • a // mutate-ok: <reason> on the line (4 engine, 8 iPhone), for a change no input can affect. For example: a counter only ever compared for equality, a guard whose case the next guard already returns, or keep-the-words on a window that has none. Where a line held several conditions, I split them so the exemption covers only the one.

What changed

Runs daily and reports

  • Daily run: 09:17 UTC on main. It still runs from the Actions tab, with a suite choice (all / engine / ios).
  • Survivors issue: one open issue labelled mutation-testing lists the latest survivors and target candidates. Each daily run rewrites it, and the first complete run with neither closes it. A partial run adds a warning and never closes it. It only needs GITHUB_TOKEN.
  • Auto-fix PR: the fix job gives the survivors to Claude (anthropics/claude-code-action, pinned to v1.0.270). Claude adds the test that catches each one, or a reasoned mutate-ok, and can't change app code. The job opens a PR labelled mutation-testing that refers to the issue, and links the PR from the issue.
    • It runs only on the daily run, and only when every shard finished.
    • It skips while a mutation-testing PR is still open, and never pushes to main.
    • It uses the Claude GitHub App's token, so check runs on the PR.
    • Without the ANTHROPIC_API_KEY secret it skips and leaves a notice.

Tries more mutations (scripts/mutate.sh)

  • Boundaries: >= → >, <= → <, < → <=, > → >=.
  • A dropped prefix !, never !=, x!, try! or as!.
  • Spaced arithmetic: - → +, * ↔ /, -= → +=, += 1 → -= 1.
  • <, > and arithmetic match only with a space on each side. Swift requires a binary operator's spacing to match on both sides, and generics, ->, unary minus and ..< never have it.

Adds an iPhone suite

  • --suite ios mutates 22 BlurtiOSCore files and runs BlurtiOSTests on a simulator, with parallel testing off so a hung mutant can't leave simulator clones running.
  • --files picks the suite from the paths, and --print-targets prints a suite's list. check.sh validates both lists.

Suggests new targets (scripts/mutate-candidates.sh)

  • Lists files at ≥ 95% line coverage, with mutants to try, that are in neither target list. // mutate-not-target: <reason> retires one.

Workflow layout

  • Shards: 8 for the engine (about 13 min each) and 10 for the iPhone.
  • iPhone limit: 150 minutes per shard. Ten shards took 41–86 min, because the runner's suite baseline varied 66–177 s, and a mutant that hangs the suite costs five baselines.
  • Summary: a per-suite score table, plus a candidates job per suite.

Setup needed for fix: an ANTHROPIC_API_KEY repo secret and the Claude GitHub App installed on the repo.

Cost: about 8 engine runner-hours plus up to 10 iPhone runner-hours a day, two candidates jobs, and up to 2 hours for fix on days something survives.

How it was tested

  • CI: check is green on the head, 2c9b430. Along the way, two UI jobs failed once each and passed on one rerun without any change to what they cover:

    • ios-audits (a), the consent sheet and Dynamic Type checks;
    • live-tests, LivePerformerTests' button press.
  • Mutation runs: the results above come from dispatched mutate runs on this branch: 46057617256 for both suites, then 46067618841 for Bounce.swift.

  • Local checks: scripts/check.sh --portable passes, and actionlint and zizmor report nothing.

  • Not exercised yet: the issue and fix jobs only run on the daily schedule on main, so the first daily run after merge is their first real test.

  • scripts/check.sh passes (or CI will, if I'm not on a Mac)

  • I read AGENTS.md and this doesn't reintroduce anything deliberately removed

  • Docs updated if behavior changed

🤖 Generated with Claude Code

https://claude.ai/code/session_01DS5B1V7g5uezBz3pgTSgD8

The mutate workflow now runs on a daily schedule as well as by hand. On the
daily run, a new fix job hands the survivors to claude-code-action, which adds
the assertion that kills each one (or a mutate-ok exemption for a provably
equivalent mutant), and opens a PR labelled mutation-testing with the Claude
GitHub App token so check runs on it. At most one such PR is open at a time;
without the ANTHROPIC_API_KEY secret the job skips with a notice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1V7g5uezBz3pgTSgD8
@alexkroman
alexkroman enabled auto-merge November 27, 2026 14:31
@alexkroman
alexkroman added this pull request to the merge queue Nov 27, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 27, 2026
@alexkroman
alexkroman added this pull request to the merge queue Nov 27, 2026
@alexkroman
alexkroman removed this pull request from the merge queue due to a manual request Nov 27, 2026
The daily run now keeps one open issue labelled mutation-testing with the
latest survivors, rewritten each run and closed by the first complete run
with none. A partial run updates it with a warning but never closes it.
The fix job's PR references the issue and is linked from it, so the list
is visible even when no fix PR can be opened.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1V7g5uezBz3pgTSgD8
@alexkroman alexkroman changed the title mutate: run daily and open a PR for surviving mutants mutate: run daily, track survivors in an issue, open a PR to kill them Nov 27, 2026
…idates

- New mutants: boundaries (>= -> >, <= -> <, < -> <=, > -> >=), a dropped
  prefix !, and spaced arithmetic (- -> +, * <-> /, -= -> +=, += 1 -> -= 1).
  Angle brackets and arithmetic match only with a space on each side, which
  Swift guarantees is a binary operator. Engine mutants: 182 -> 317.
- --suite ios mutates 22 BlurtiOSCore files (241 mutants) and runs
  BlurtiOSTests on a simulator via xcodebuild; --files picks the suite from
  the paths; --print-targets prints a suite's list. check.sh validates both.
- scripts/mutate-candidates.sh lists well-covered files with mutants that
  are in neither target list; // mutate-not-target: <reason> retires one.
- The workflow runs 8 engine + 6 iPhone shards, scores each suite, runs a
  candidates job, lists candidates in the issue, and lets the fix job handle
  iPhone survivors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1V7g5uezBz3pgTSgD8
@alexkroman alexkroman changed the title mutate: run daily, track survivors in an issue, open a PR to kill them mutate: daily runs, iPhone suite, boundary mutants, survivors issue and auto-fix PR Nov 27, 2026
The first mutation run with the new mutations left 24 engine survivors.

Tests for the 16 that a test can catch: a named key logged as the
instruction spells it, never an alias; an app name with a digit; a key-term
list, a prompt and a typed step exactly at their caps; a plan of exactly
maxSteps; a label exactly at labelCap; a menu search cut at exactly its
limit; the largest web area by area with the first winning a tie; a busy
window leaving the page its share; the overlay's display by overlap area;
the next-display move from an offset display and from a window as wide or
tall as its display; a tap timed from its press; the first of two
equal-length prefix matches; a slider value spelled past 1e15.

mutate-ok for the rest, each provably unable to change behaviour: a caret
at the very end, the mid-character index search, clip at exactly maxChars,
and the enhanced-interface generation counter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1V7g5uezBz3pgTSgD8
Tests: an answer or a tick exactly at the press deadline is late (timed
from the reference date, where the deadline's instant is exact); a press
at the instant a lease ends says suspended; a record that names no
utterance has none; only a blurt://start link is a start link; a typing
result of exactly the minimum sets the speed.

mutate-ok: stopping an interrupted window closes it with keepWords false,
but an interrupted window never has an utterance, so it has no effect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1V7g5uezBz3pgTSgD8
@github-actions github-actions Bot added the ios label Nov 27, 2026
Tests: a phase goes stale only past its instant (notice and in-flight,
from the reference date so the instant is exact); a start link that gives
a field twice is read from the first; a fresh listening-window machine has
read no live mic.

mutate-ok: closing an interrupted window on foregrounding with the session
turned off (no utterance, so keepWords has no effect), and Bounce's x-room
guard (with no room on x, x.hits is 0 and the next guard returns the same).
The guard's three conditions now sit on their own lines so the exemption
covers only the one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1V7g5uezBz3pgTSgD8
Tests for 13: a press's and a stop's retry and a stop's deadline at their
exact instants (from the reference date); a lift held exactly the hold
threshold is a hold; a terminal phase naming no dictation ends a stop;
matching the best typing speed isn't a new best; a record names no live
mic by default; a command is stale at its freshness window's instant; a
spent reopen doesn't reopen again; 10,000 is the first compact count; a
near-miss corner at y's first wall, landing when the later wall is touched.

mutate-ok for 3, each unable to change behaviour: URLComponents' base
resolution for an absolute URL, and Bounce's no-room guards for y and for
building an axis. The stop's timing tests move to a +Timing extension to
keep the suite under type_body_length.

The iPhone shards ran 56-100 min against a 100-min limit (86-113 s per
mutant), and one timed out; ten shards of ~25 mutants leave room.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1V7g5uezBz3pgTSgD8
Ten shards ran 41-86 min on the confirming run; the spread is the runner
(a 66-177 s suite baseline, and a hung mutant costs five), so 100 left a
slow runner too little room.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1V7g5uezBz3pgTSgD8
@alexkroman
alexkroman added this pull request to the merge queue Nov 27, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 27, 2026

Copy link
Copy Markdown
Collaborator Author

Dequeued on ios-audits (a) alone (merge-queue run 46076656594). Every other job passed, including macos, ios-build and live-tests.

The failure is testSettings reporting Dynamic Type on "AssemblyAI's privacy policy", "Powered by AssemblyAI" and "How fast can you type?" on the iPhone Settings screen. I don't think this PR causes it:

It should go back in the queue as is.


Generated by Claude Code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants