Get CI under a minute without letting it lie

Make a repository's CI answer every pull request in under a minute, by measuring first and keeping every check honest.

Prompt · works with Any coding agent · adapted from Pontus Abrahamsson

Make this repository's CI as fast as it can be while staying honest. Target: a pull request gets its result in under 1 minute at the median and under 2 minutes at p95.

Honest outranks fast. These three rules beat every budget below:

- **The full suite gates main.** Everything runs in a merge queue before it reaches main. Test selection only narrows the feedback on pull requests.
- **Failures stay visible.** A check that needs a retry has a bug: find it and fix it. Retries, longer timeouts and skipped tests only hide it.
- **Checking only grows.** Lint rules and required checks stay or increase.

## 1. Audit

Pull the last 150 CI runs and split every job's time into waiting, setup and running, at p50 and p95. Fix the biggest bucket first, and measure again after each change.

## 2. Hit the budgets

Each budget is a ceiling, measured on real runs.

- **Waiting, under 5 s.** Cancel a branch's in-progress run when a new commit lands. Pick the runner in step 3.
- **Setup, under 15 s.** Bake the toolchain into the runner image. Get cache hits on pull requests above 95% by seeding caches from main, and cache `node_modules` itself. Clone blobless (`filter: blob:none`).
- **Slowest job, under 35 s.** No required job waits on another. Lint, typecheck, build and tests run in parallel; the small checks fold into one job that lists every failure.
- **Format, lint and typecheck together, under 5 s.**
- **Tests, under 30 s per shard.** Isolate modules, not processes, reset state after every file, and run files in random order to flush out leaks.
- **Shards.** Add cores before shards, match workers to cores, and give each shard its own throwaway database. Split any test file over 20 s. Balance shards from the file times main records on every full run, and prove the shards together ran every file.
- **Selection.** On pull requests, run only the tests the diff can reach, and list the inputs that rerun everything. Then hide a real change from the selection on purpose and confirm CI goes red.
- **Fewer tests, on evidence.** For two weeks, log every test failure you fix as a caught regression or a change detector. Delete the files that only detect change, and ban their patterns in `AGENTS.md`. Tests for authorization, privacy, migrations and concurrency stay whatever the log says.
- **Local, under 9 s.** Git hooks: pre-commit formats and lints staged files; pre-push runs the same check as CI. A hook, because agents skip steps that live only in `AGENTS.md`.
- **Staying fast.** Fail any job that exceeds its budget.

## 3. Runners

Choose runners on evidence from [runnersbench.com](https://runnersbench.com/), which benchmarks GitHub Actions runner providers weekly on the same script. Match its metric to the bucket your audit says is biggest:

- **Waiting**: queue time.
- **Setup**: package installs, download speed and `actions/cache` save and restore.
- **Running**: CPU and build time, on the architecture you run (Linux x64, Linux arm64 or macOS).
- **Cost**: per job at your measured durations. A provider that bills by the minute charges a 25-second job as a full minute, so once jobs drop under a minute, per-second billing decides the bill.

Shortlist two or three providers, run your own workflow on each for a few days, and keep the one that wins on your numbers. The benchmark picks the shortlist; your runs pick the winner.

## 4. Tools

The stack is Vite+ (`vp`), and its built-in command is the default for each job. Keeping an old tool needs a measured reason.

- **Install and runtime**: `vp install`. Vite+ picks the Node.js version and the project's package manager.
- **Format, lint and typecheck**: `vp check`, one pass of Oxfmt, Oxlint and tsgo. It replaces Prettier, ESLint and `tsc`. Turn on every lint rule you can, type-aware ones included.
- **Tests**: `vp test`, which is Vitest. It replaces Jest.
- **Build**: `vp build`.
- **Scripts and tasks**: `vp run`, which caches tasks by their inputs. Reuse that cache across CI runs (`node_modules/.vite/task-cache`) only after a second run in a row reports a hit and the restore costs less than the rerun; Vite+ marks this as experimental.
- **Hooks**: `vp hooks` with `vp staged` for staged files. It replaces Husky, lint-staged and similar tools.
- **CI setup**: `voidzero-dev/setup-vp`, pinned to an exact release or commit SHA.

Before each switch, run old and new side by side and list anything the new one misses.

## 5. Deliver

Open one small pull request per change, each with before and after numbers from real runs. Do everything you can without me first, then bring me one list of what needs an account, a secret or a bigger bill, with the expected monthly cost of each. You're done when every budget is met or that list explains why it can't be. End with total CI time and cost, before and after.