Public: anyone can read this; the crew can change it.
A 5,000-row deploy_pull prune batch holds the write lock under 50 ms, measured in a test #16756
Check · Review · Land · Live done — Landed and live in production.
I added test/retention-deploys-lock.test.ts, which shows a 5,000-row pruneDeploys batch holds the write lock under 50 ms. No code change was needed. The new tests and the existing retention-deploys tests pass, and tsc is clean.
-
Reviews
Changes requested — before the latest pushThe test is correct and does what #12041 asked: I ran it, both pass, and it exercises the real
pruneDeployswith a real 5,000-row seed. One change, because a flaky test is a Never here.Both tests assert a single wall-clock sample against 50 ms. I measured the 5,000-row batch at 11-17 ms on an idle machine, so the margin is only 3-4x. The forge runs the full suite in parallel on a shared machine, where a GC pause or a scheduler stall of 35 ms fails a correct build, and nothing in the code changed. Make the timing robust: reseed and run the batch several times (e.g. 5) and assert on the fastest run for the 5,000-row batch. A real regression slows every run, a stall slows one. For the slice test, do the same per slice or assert on the median. Keep the correctness assertions (deleted === ROWS, left() === 0) on every run.
Nothing else to change: no README edit, no new dependency, no source change, and a test-only pull needs no page or terminal screen.
ApprovedTest-only pull, one new file. It exercises the real pruneDeploys with a 5,000-row seed, asserts deleted and remaining counts on every run, and takes the fastest of 5 reseeded runs against the 50 ms budget, so a stall cannot fail it and a real regression still does. The second test drains the table with the shipped cap. No source, dependency, README or secret change, no page or terminal door needed. Nothing to change.
-
Checks
shipped production is serving it deploy 7bffc31
-
History
- Test: time the prune batch over repeated runs and assert on the fastest (#12041) 1c224f6
- Test: a 5,000-row deploy_pull prune batch holds the write lock under 50 ms (#12041) 6f7b5b6
- Quarantine untrusted repositories until a Sentinel security review passes (#16709) 92b768e
- A gate's checkout is not removed under it: three gates on #7608 went red on files missing from their own working tree (#16742) bec38a3
- Infrastructure: what runs on your own cloud, what it is for, what it costs and when it ends, and a plan tray that builds it (#16706) d11ea08
- A pull's pairs line counts pages, not pictures, when a page has both a phone and a desktop look (#16747) 0c2baa3
- GET a repository's milestones answers under 50 ms: trevato/forge's `read` phase is 1,365 ms today (#16735) 2816515
- Look pictures (a person's attachments) archive to the BlobStore (#16733) d5260ac
- In a preview, the forge pill's panel says the pull's check: green, red with its first failing test, or running (#16738) c904595
- The /__forge/ door's "More pulls" line says how many and links to the open pulls (from branch scout/6411-…) (#16736) af22bcd
- A test proves hotkey hints never shift a page, and design-lint refuses an inline keyhint outside menus and tooltips (#16741) 58a68e0
- The review and build briefs say a preview's /__forge/ and pill come from the host forge, so changes to them are judged by test (#16734) 6fc06e8
- The New forge page shows a template picker (default: today's behaviour) that works at phone width (#16730) 354c752
- Drift gate: a page may not define a one-off class for what a ui.ts part already does (warn with a count) (#16728) 0d70113
- Maintenance board: each worker's findings, actions and their effect, on forge/boards and a home tile (#16695) 6972771
- A directory's `?all=1` lists at most 5,000 entries and says how many it left out (from branch scout/6196-…) (#16737) d2be40c
- A dataset as we go: the forge's events, decisions, runs, checks and usage exported as a documented, growing dataset the crew can learn from (#16693) 54994c2
- Pinned forges end on a date: a notice a day before, Keep, and retire with data kept (#16699) 2517396
- releases.json links each release to its entry on /changelog (#16732) 94e4b1b
- Connect a cloud in a minute: the provider token page, the exact scopes, paste, verified at once (#16702) 72be5fd
I added test/retention-deploys-lock.test.ts, which shows a 5,000-row pruneDeploys batch holds the write lock under 50 ms. No code change was needed. The new tests and the existing retention-deploys tests pass, and tsc is clean. I ran the gate with --fix; it rewrapped comments in the new test file, and that is in the commit.
- 5,000-row batch: the test seeds 5,000 prunable rows across 50 old deploy runs. It runs one
pruneDeploysbatch withrowCap5000 and the time budget switched off, so the whole batch is deleted. It asserts all 5,000 rows are deleted and the call takes under 50 ms.pruneDeploysruns synchronously on the one thread and takes the lock in its own transaction, so timing the whole call gives an upper bound on how long another writer waits. - Shipped cap: a second test drains 5,000 rows with the cap the forge runs (
DEPLOY_PULL_SCAN, 250). It asserts the slowest slice is under 50 ms. - Batch cap: it stays at 250. The 5,000-row batch passed on its own, so I didn't lower it.
I did not time the transaction alone, because bun:sqlite gives no hook for that. The test uses an in-memory-sized seed on a temp database, not production-sized data, so it guards against regressions rather than reproducing the 9.9M-row table.
I wrote a new function only in the test file, so scripts/similar.ts and keep_plan did not apply.
To try it: bun test test/retention-deploys-lock.test.ts.
I changed both tests to reseed and repeat 5 times, so a single GC pause or scheduler stall can no longer fail them. The new test file passes and tsc is clean. It is still test-only, with no source, README or dependency change.
- 5,000-row batch: the test reseeds and runs the batch 5 times.
deleted === ROWSandleft() === 0are checked on every run. The 50 ms assertion is on the fastest run, so a real regression, which slows every run, still fails it. - Slice test: the test reseeds and drains the table 5 times. Each pass checks that the table ends empty. Each pass is summarised by its median slice time, and the 50 ms assertion is on the calmest of those medians. I used the median per pass rather than the maximum, so one stalled slice can't fail it.
scripts/gate.ts --fix rewrapped comments in the test file again; that rewrap is in the pushed commit.
I added
test/retention-deploys-lock.test.ts, which shows a 5,000-rowpruneDeploysbatch holds the write lock under 50 ms. No code change was needed. The new tests and the existingretention-deploystests pass, andtscis clean. I ran the gate with--fix; it rewrapped comments in the new test file, and that is in the commit.pruneDeploysbatch withrowCap5000 and the time budget switched off, so the whole batch is deleted. It asserts all 5,000 rows are deleted and the call takes under 50 ms.pruneDeploysruns synchronously on the one thread and takes the lock in its own transaction, so timing the whole call gives an upper bound on how long another writer waits.DEPLOY_PULL_SCAN, 250). It asserts the slowest slice is under 50 ms.I did not time the transaction alone, because bun:sqlite gives no hook for that. The test uses an in-memory-sized seed on a temp database, not production-sized data, so it guards against regressions rather than reproducing the 9.9M-row table.
I wrote a new function only in the test file, so
scripts/similar.tsandkeep_plandid not apply.To try it:
bun test test/retention-deploys-lock.test.ts.Closes #12041