Skip to content

mutate: the scheduler is the package's, and held by tests - #18

Merged
aledbf merged 5 commits into
mainfrom
mutate/runner
Sep 29, 2026
Merged

aledbf merged 5 commits into
mainfrom
mutate/runner

Conversation

@aledbf

@aledbf aledbf commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

What runs a change's mutations was ~330 lines of cmd/mutate/main.go, which has no tests, so the gate never broke its own concurrent half. It spreads the cap over functions, builds each package's edits into one binary or alone, asks the tests that reach each line and then the importers', and counts the results. That is now mutate.RunAll and mutate.Spread in internal/mutate/runner.go. main keeps the flags, the plan, and the cost and stale reports, and stays without tests, so the fixtures that use it as "a package with no tests" still hold.

Behaviour:

  • The lines said as each outcome arrives go to the io.Writer RunAll is given (os.Stdout from main). Diagnostics stay on stderr.
  • A failure to prepare an edit (MkdirAll, Overlay) was os.Exit(2) from inside a goroutine. It is now RunAll's error, and main exits 2 on it. The difference: the other edits finish first.

New tests, each on a throwaway module:

  • Spread's rounds and caps.
  • Every edit counted as the tests answered: refused, survived in order, a package with no tests named rather than counted as a survivor, an int64 literal built alone and not reported as slow.
  • A package with no tests asked through its importers.
  • A test broken regardless refuses nothing, both in the binary and alone. This is what coverage protects against.
  • With no coverage, every test is asked (internal test of built).
  • An edit that cannot be asked is an error.

mutate-exempt on three lines, each a cost or a stderr note rather than an outcome: whether coverage is measured when nothing is built, and two stderr diagnostics.

  • task test (coverage 62.8% → 71.2%), task lint: green
  • task mutate: 35 refused, 0 survived (this run is also the new code running itself)

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

aledbf and others added 5 commits September 29, 2026 10:06
What runs a change's mutations - spread over its functions, built into one
binary per package or alone, put to the tests that reach each line and to
the importers', counted - was 330 lines of cmd/mutate, which has no tests,
so the gate never broke its own concurrent half. It is RunAll and Spread in
internal/mutate now; main keeps the flags, the plan and the reports. The
lines it said as each outcome came go to the writer it is given, and an
edit it could not build a way to ask is RunAll's error rather than an exit
from inside a goroutine.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…exempt

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@aledbf
aledbf merged commit 9eefe77 into main Sep 29, 2026
2 checks passed
@aledbf
aledbf deleted the mutate/runner branch September 29, 2026 13:12
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