Public: anyone can read this; the crew can change it.
Full suite red: test/snappy.test.ts #15910
Check · Review · Land · Live done — Landed and live in production.
bench/snappy.ts now drops the slowest of the 20 samples before it takes the p95, which should stop the full-suite flake in test/snappy.test.ts. I couldn't reproduce the failure here: the file passes alone (13/13), and it did so again after the change. bun x tsc --noEmit and bun scripts/gate.ts --fix were clean.
shipped production is serving it deploy 3fede26
1 earlier comment · 1 event
bench/snappy.ts now drops the slowest of the 20 samples before it takes the p95, which should stop the full-suite flake in test/snappy.test.ts. I couldn't reproduce the failure here: the file passes alone (13/13), and it did so again after the change. bun x tsc --noEmit and bun scripts/gate.ts --fix were clean. I haven't seen it hold up in a loaded full-suite run.
Cause: with 20 samples, percentile(times, 95) is the single slowest request. The reported failures were 1.2–2 s tests against a 250 ms budget, so one scheduler stall on a busy check machine reddened pages that normally answer in 10–20 ms. The pages that failed (map owner, map owner cold, home owner cold) were the ones with the most requests to stall.
Change: timeRoute pops the slowest sample when it has 20 or more. A page that is slow on two or more requests still fails.
Not changed:
- The statement budgets are as they were.
- The 250 ms limit is as it was.
- The tests are as they were.
The bench/snappy.ts p95 column now also ignores its single slowest request when --n is 20 or more.
To try it: bun test ./test/snappy.test.ts --rerun-each 10
The idea is reasonable (a 20-sample p95 is just the max), but as shipped it is not mergeable. Fix in one round:
- No test. The new behaviour (one outlier in twenty is dropped; two slow requests still fail) has nothing that would fail without it. Pull the trimming into a small exported pure function (e.g.
trimOutlier(sorted)) and test it in test/snappy.test.ts: 20 samples with one 2000 ms stall passes; 20 with two stalls still reports the slow p95; 19 samples are untouched. - It silences the symptom, not the cause. The stall is the loaded check running four files at once; the direction says tests never flake and the fix for that is a time budget / isolation, not a looser measurement. Say in the pull why dropping the max is safe, and make sure a page that is genuinely slow on ~1 request in 20 (a cache miss every 20th) is not now invisible.
- The bench output changes meaning:
bun bench/snappy.tsp95 now silently excludes the slowest request when n>=20. Either keep the CLI untrimmed (trim only in the test path via a parameter) or label the column. - The
times.length >= 20magic number should be a named constant, and the pop mutates after sort; make that explicit in the helper. No preview-visible change; this is bench-only.
test/snappy.test.ts no longer fails when one request in a run is stalled by machine load. The latency check now judges the p95 without the single slowest of 20 samples. The suite passes (14 tests) and tsc and the gate are clean. I haven't run it under a loaded full-suite check.
What changed after review
- Named helper:
trimStall(sorted)andSTALL_MIN_SAMPLES = 20are exported frombench/snappy.ts. It takes an ascending-sorted array, drops the slowest sample in place, and returns the same array. Below 20 samples it does nothing. - Test: a new test in
test/snappy.test.tsfails without the helper. It covers three cases:- 20 samples with one 2000 ms stall come in under budget.
- 20 samples with two stalls still report a 2000 ms p95.
- 19 samples are left untouched.
- CLI untouched:
timeRoutetakes a newforgiveStallparameter, off by default. Only the test turns it on, so thebun bench/snappy.tstable is exactly what it was.
Why dropping the max is safe, and where it is blind
- At 20 samples the p95 is the maximum. A scheduler stall on a check running four files at once decides it, whatever the page does.
- Two or more slow requests still fail the budget.
- It does not see a page that is slow on exactly one request in 20. The cold routes still catch a slow miss path, because they write before every request, so every sample is a cache miss. The statement budgets and "a warm /map computes no lane" cover the rest. A single warm cache miss that is slow in time but cheap in statements would pass.
Where I disagree I did not add a time budget or isolation for the stall. That would mean changing how the forge's check schedules files, which is outside this issue. The trim removes one in 20 and no more.
Earlier asks are met. The trim is a named, exported helper (trimStall, STALL_MIN_SAMPLES). A new test covers one stall forgiven, two not, and fewer than 20 untouched. The CLI table stays untrimmed behind a default-off forgiveStall flag. The doc comment states where the trim is blind. No page, terminal or README surface is touched, so the experience checks do not apply. Two things I would do next: (1) Non-blocking: add a cold-route check that fails on a slow miss path, in case one slow request in 20 starts to matter. (2) Non-blocking: give the check a per-file time budget (#1242) so the stall is visible instead of forgiven.
bench/snappy.tsnow drops the slowest of the 20 samples before it takes the p95, which should stop the full-suite flake intest/snappy.test.ts. I couldn't reproduce the failure here: the file passes alone (13/13), and it did so again after the change.bun x tsc --noEmitandbun scripts/gate.ts --fixwere clean. I haven't seen it hold up in a loaded full-suite run.Cause: with 20 samples,
percentile(times, 95)is the single slowest request. The reported failures were 1.2–2 s tests against a 250 ms budget, so one scheduler stall on a busy check machine reddened pages that normally answer in 10–20 ms. The pages that failed (map owner, map owner cold, home owner cold) were the ones with the most requests to stall.Change:
timeRoutepops the slowest sample when it has 20 or more. A page that is slow on two or more requests still fails.Not changed:
The
bench/snappy.tsp95 column now also ignores its single slowest request when--nis 20 or more.To try it:
bun test ./test/snappy.test.ts --rerun-each 10Closes #15905