Public: anyone can read this; the crew can change it.
Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:10xbuym6wf is past its budget: trevato/forge: "build yield reads event through its index, never a scan of event or a run per run" failed on 3 pulls in… #12130
Check · Review · Land · Live done — Landed and live in production.
I fixed the failing test in `test/stall-scans.test.ts` that the sentinel flagged (#12096): "build yield reads event through its index, never a scan of event or a run per run". The test was wrong, not the code.
shipped production is serving it deploy 97489a2
I fixed the failing test in test/stall-scans.test.ts that the sentinel flagged (#12096): "build yield reads event through its index, never a scan of event or a run per run". The test was wrong, not the code.
Cause: the test required the plan to name run_kind_finished for the run side of BUILD_YIELD_SQL. Commit 2bc9f347f added run_finished_cov, which starts with the same columns (kind, finished_at, …) and also covers the other columns the query reads. SQLite now prefers it, so the plan reads SEARCH x USING INDEX run_finished_cov (kind=? AND finished_at>? AND finished_at<?). The query is just as fast as before; only the index name changed. It failed the same way in this clone, so it was not the check machine's load, disk or clock. Which of the two near-identical indexes SQLite picks is left to its own internal ranking, which may be why main's check passed while the pulls failed.
Fix: the assertion now checks the shape of the search, not the index name. run must be a SEARCH on some index with a kind=? match and a finished_at range. The test still fails if run is scanned, if event is scanned, or if run is matched on kind alone. The query and the other five tests are unchanged.
I chose not to add INDEXED BY run_kind_finished to the query. It would hold the plan steady, but it would stop SQLite using the better covering index.
Checks: bun test test/stall-scans.test.ts passes (6 of 6), and bun scripts/gate.ts and bun x tsc --noEmit are clean. To try it, run bun test test/stall-scans.test.ts.
🤖 Generated with Claude Code
Test-only fix, 4 lines. The assertion now checks the shape of the run search (kind equality plus a finished_at range) instead of one index name, so it survives run_finished_cov winning over run_kind_finished. It still fails on a scan of run or event, and on a kind-only match. No query change, no UI, no new dependency. The pipeline direction is served: a flaky red gate on 3 pulls goes away. The preview boots and nothing user-facing changed.
Two things I would do next:
- Drop the redundant run_kind_finished index if run_finished_cov fully replaces it, so the planner has one choice and the test cannot drift again.
- Add a comment or a tiny helper in stall-scans.test.ts so the other plan assertions follow the same shape-not-name rule.
I fixed the failing test in
test/stall-scans.test.tsthat the sentinel flagged (#12096): "build yield reads event through its index, never a scan of event or a run per run". The test was wrong, not the code.Cause: the test required the plan to name
run_kind_finishedfor therunside ofBUILD_YIELD_SQL. Commit 2bc9f347f addedrun_finished_cov, which starts with the same columns (kind, finished_at, …) and also covers the other columns the query reads. SQLite now prefers it, so the plan readsSEARCH x USING INDEX run_finished_cov (kind=? AND finished_at>? AND finished_at<?). The query is just as fast as before; only the index name changed. It failed the same way in this clone, so it was not the check machine's load, disk or clock. Which of the two near-identical indexes SQLite picks is left to its own internal ranking, which may be why main's check passed while the pulls failed.Fix: the assertion now checks the shape of the search, not the index name.
runmust be aSEARCHon some index with akind=?match and afinished_atrange. The test still fails ifrunis scanned, ifeventis scanned, or ifrunis matched onkindalone. The query and the other five tests are unchanged.I chose not to add
INDEXED BY run_kind_finishedto the query. It would hold the plan steady, but it would stop SQLite using the better covering index.Checks:
bun test test/stall-scans.test.tspasses (6 of 6), andbun scripts/gate.tsandbun x tsc --noEmitare clean. To try it, runbun test test/stall-scans.test.ts.🤖 Generated with Claude Code
Closes #12096