Public: anyone can read this; the crew can change it.
scripts/test-budget.ts names each test file over 20 s and each test over 2 s from plain times, with no test run #12209
Closed 18d 22h ago
This adds scripts/test-budget.ts and its test, the first half of the per-test budget (#1242). The pull's diff is still only these two files; this push merges current main into the branch. Nothing calls the module yet.
-
Reviews
No review yet.
-
Checks
stopped closed without shipping deploy a57b7fc
-
History
- Merge remote-tracking branch 'origin/main' into torque/12136-scripts-test-budget-ts-names-each-test-f a57b7fc
- A device grant a hosted forge begins under its parent's application leaves an event on the parent: which forge, which host, never a code a20d391
- The gate's judgement is proven answer by answer: a declared name with one private answer among public ones is refused under an exact, a wildcard and a forges-beside entry, a name nobody declared is refused before it is looked up and nothing is dialled, and proxy variables reach git only in a cell d4e594c
- A hosted forge reaches the public git hosts, its parent and the forges its parent holds beside it (one name ending in --<parent's host>), and no other name under the parent's domain: the list never holds a wildcard on a domain, which under a shared suffix was *.co.uk or *.fly.dev 6104f28
- A data query runs in a process of its own: SQLite's heap limit is the whole process's, and a query that set it in the forge's made every connection fail with out of memory cc205a8
- Every app a spawn sent ends each pass in one stated condition, the repair takes updates by default, and a copy that moved is found by its history f69fe13
- Data diet: the drains no page reads are the serving thread's and out of the write clock; the age rule and the backfill are the engine's eb2664b
- Merge remote-tracking branch 'origin/main' into torque/12136-scripts-test-budget-ts-names-each-test-f 79cab43
- Data diet: event_repo (repo_id, id) is dropped: 162.6 MB of 2.4M entries, and the one statement that planned on it plans on event_repo_kind_number_at 4f47a7d
- Data diet: the retention jobs run as paced slices; what a deploy first put live is a row per pull, not 2,500 per deploy; wake-up events live 6 h; machine samples 24 h / 7 d / 180 d 0ff2185
- One app's link that cannot be made no longer stops the others, and /forges serves its rows from memory e56c7c8
- The feed and the asks list the newest decisions with a known outcome through a partial index in that order, for a reader with many repositories: 92 ms becomes 0.4 ms on a copy of production (28,490 decisions) 2a250d0
- A cold thread no longer meets the first visitors with the pipeline answer, the displays and the busiest plans still to read: they are read before the listener opens, while the previous release answers; on a copy of production the first second after listen goes from one 1,723 ms stall to 329 ms, the slowest first answer from 1,650 ms to 450 ms, and the 30 seconds' stall from 2,344 ms to 1,086 ms c15bd18
- The pull page reads the pulls that revert it and its branch's pull through their own indexes, and the tell words read an issue's merge from the repository-and-kind event index: 27 ms, 26 ms and 25 ms per call become 1.2 ms, 3.7 ms and 0.01 ms on a copy of production c4f3b4f
- The map is built by a worker with a read-only handle of its own, posted plain data only, and read on the thread only when there is no file to share or the worker failed (said once in the log): on a copy of production the map's 420 ms of one thread every 16 s become 4 to 24 ms of loop lag per poll, the answer still 400 ms, still never older than the last write 3f70ac8
- The everyday account is asked for in one line of the home's needs-you row and made on its own page, with no email where there is no mail 11ca711
- A new forge's owner makes one passkey: no email asked where there is no mail, no on/off badge, the wait says what is happening, and the link comes with a QR code f79880b
- An app a spawn sends down follows the repository it came from: same history, taking updates by default, severed in one action 2dca344
- The run_kind_state index is dropped: it served one question (checks queued, which now names run_queued) and lured 45 of the 271 statements that touch run, because with no statistics SQLite takes it for any statement that names a kind; on a copy of production all 45 plan through the index built for them, the sentinel's streak read goes from 364 ms to 136 ms, and the sentinel's pair list no longer needs a scan a22aa98
- The account menu reads in two seconds: three groups, one row for appearance; the theme gallery lives in settings 2048ac8
This adds scripts/test-budget.ts and its test, the first half of the per-test budget (#1242). The pull's diff is still only these two files; this push merges current main into the branch. Nothing calls the module yet. scripts/test-shards.ts and scripts/gate.ts are unchanged, so the gate's output stays the same.
The module:
breaches({files, tests}, slow = SLOW): names each file over 20 s and each test over 2 s. A time exactly at a limit is within budget. Breaches in aSLOWfile are set aside with their{issue, reason}. It also returns the five slowest tests with their share of the run.- Bad times are refused: a time that is NaN, infinite or negative throws a
RangeError, so a broken table can't pass as under budget. SLOWis empty: no issue exists yet to rewrite a slow file, so none is listed.budgetBinds(tier, changed, file): true only on thefasttier, and only for a.test.tsamong the pull's changed files.summaryLines(result): writes the five slowest, thenover the budget: N, SLOW aside: M, then each breach by file and test.
Tests: test/test-budget-run.test.ts uses fixture times only. It covers:
- a run under budget, including the exact limits;
- a file over 20 s and a test over 2 s being named;
- a
SLOWfile being set aside; - the shares checked against a hand calculation;
- bad times being refused;
- a breach on the full tier, or in an unchanged file on the fast tier, not binding.
Why the earlier check was red, and why it may be red again: the 52 failures on pull #12142 came from main, not from this change. On origin/main at a20d391ac, with this change absent, four tests fail on their own:
test/unreached.test.ts: nothing importssrc/crew/week_burn.ts.test/now-fit.test.ts: the /now page still usesclass="truncate".test/design-audit.test.ts: the audit has 105 entries for 106 pages.test/settings-routes.test.ts: a route outside settings is in the settings block.
Nothing in those tests reaches the two new files. Try 3 went beyond the issue's scope by editing docs to fix them; I left them alone, as the issue says to touch nothing else. They need their own fix on main, and until then this pull's check will fail on them too.
Checks run here: bun scripts/gate.ts and bun x tsc --noEmit pass. test/test-budget-run.test.ts and test/unused-exports.test.ts pass (14 tests).
🤖 Generated with Claude Code
This adds
scripts/test-budget.tsand its test, the first half of the per-test budget (#1242). The pull's diff is still only these two files; this push merges currentmaininto the branch. Nothing calls the module yet.scripts/test-shards.tsandscripts/gate.tsare unchanged, so the gate's output stays the same.The module:
breaches({files, tests}, slow = SLOW): names each file over 20 s and each test over 2 s. A time exactly at a limit is within budget. Breaches in aSLOWfile are set aside with their{issue, reason}. It also returns the five slowest tests with their share of the run.RangeError, so a broken table can't pass as under budget.SLOWis empty: no issue exists yet to rewrite a slow file, so none is listed.budgetBinds(tier, changed, file): true only on thefasttier, and only for a.test.tsamong the pull's changed files.summaryLines(result): writes the five slowest, thenover the budget: N, SLOW aside: M, then each breach by file and test.Tests:
test/test-budget-run.test.tsuses fixture times only. It covers:SLOWfile being set aside;Why the earlier check was red, and why it may be red again: the 52 failures on pull #12142 came from
main, not from this change. Onorigin/mainat a20d391ac, with this change absent, four tests fail on their own:test/unreached.test.ts: nothing importssrc/crew/week_burn.ts.test/now-fit.test.ts: the /now page still usesclass="truncate".test/design-audit.test.ts: the audit has 105 entries for 106 pages.test/settings-routes.test.ts: a route outside settings is in the settings block.Nothing in those tests reaches the two new files. Try 3 went beyond the issue's scope by editing docs to fix them; I left them alone, as the issue says to touch nothing else. They need their own fix on
main, and until then this pull's check will fail on them too.Checks run here:
bun scripts/gate.tsandbun x tsc --noEmitpass.test/test-budget-run.test.tsandtest/unused-exports.test.tspass (14 tests).🤖 Generated with Claude Code
Closes #12136