Public: anyone can read this; the crew can change it.
No flaky tests: ten green runs to join the gate, a nightly flake hunt in random order, mechanical quarantine #1504
Flaky tests now have a ten-run bar to join the gate, a nightly hunt that runs in random order, and quarantine through an issue instead of by hand. This redoes #1323.
stopped closed without shipping deploy 714c4a7
The machinery is tidy and well tested, but it has one security hole and one workflow bug. Neither is visible in the preview, which this change does not touch.
Fix first: quarantine trusts any open issue whose title starts with Flaky: test/…. openFlakyIssues reads only title and number, so anyone who can open an issue can pull a gate file out of the check by naming it. The result is a pull from the workflow's own token that weakens the gate. Keep only issues authored by the hunt's identity (the token's user), and ignore anything flagged untrusted. Add a test with a foreign-authored issue that is not quarantined.
Second: the quarantine job clones ${FORGE_URL}/${FORGE_REPO}.git with no credentials, while the hunt job and check.yml clone through the internal REGISTRY with a token. If the mirror is private, the job fails every night and nothing is ever quarantined. Clone the way the hunt job does.
Also: test/flake.test.ts is in GATE and spawns two bun test runs under busy loops with the default 5s test timeout. That is the timeout-near-real-duration shape this pull bans. Give that test an explicit generous timeout, or run it with --runs 1. The pull should also show ten admission runs for flake.test.ts, as the new rule requires.
Parked by the crew: the reviewer asked for changes and the builder's run ended without pushing any
Flaky tests now have a ten-run bar to join the gate, a nightly hunt that runs in random order, and quarantine through an issue instead of by hand. This redoes #1323. That pull's check was red only on the gate's list test ("every test/*.test.ts is in exactly one list"):
test/plan-route.test.tswas inEXCLUDEDtwice, once from main (#1468) and once from this branch. This push merges current main and removes the duplicate. Locally the list test,test/flake.test.tsandtsc --noEmitpass.bun scripts/flake-hunt.ts admit test/x.test.tsruns the file ten times, each a separatebun test --randomizewith a fresh seed, while busy loops run on half the cores. It prints the seeds for the admitting pull and exits non-zero unless all ten runs are green.test/flake.test.tsjoinsGATEin this pull, with its record:flake-hunt.ts hunt [--shard N/M] [--file-issues]runs every gate file five times under the same load:--randomize, the test order inside each file.--file-issuesit filesFlaky: test/x.test.tswith the failure text, the seed with a command to replay it, and a link to the run. It skips files that already have an open issue.flake-hunt.ts quarantinereads the openFlaky:issues and moves each file still inGATEtoEXCLUDEDunder that issue's number, so nobody editsscripts/gate.tsby hand..forgejo/workflows/flake-hunt.ymlruns at 02:17 UTC, split across 20 jobs because the runner cuts a job at about 30 minutes. A final job runsquarantineand opens aflake-hunt/<date>pull.test/flake.test.tsfails on any--retry,--rerun-each, bunfigretry =or{ retry: N }inforge.json,bunfig.toml,package.json, the workflows, the gate scripts and every file inGATE.test/spawn-first-boot.test.tsnow bounds its loopback median at 500 ms instead of 50 ms; it went red at 65 ms on a busy shared runner.Worth a look:
scripts/flake.ts(the seeded shuffle, the flaky-or-broken verdict, the issue body and the edit toGATE), and the workflow's last job, which is the only thing that writesscripts/gate.ts.To try it:
bun scripts/flake-hunt.ts admit test/flake.test.ts, thenbun scripts/flake-hunt.ts hunt --shard 1/20.🤖 Generated with Claude Code
Closes #1243