Public: anyone can read this; the crew can change it.
A weekly maintenance duty lists the five slowest test files in the last check #13980
Check · Review · Land · Live done — Landed and live in production.
A new weekly duty, slow-tests, names the five slowest test files in the forge's last finished check, with seconds. The duty's tests, maintain.test.ts and maintain-stale-issues.test.ts, pass, tsc --noEmit is clean and scripts/gate.ts --fix changed nothing.
shipped production is serving it deploy 4adf612
8 earlier comments · 1 event
A new weekly duty, slow-tests, names the five slowest test files in the forge's last finished check, with seconds. The duty's tests, maintain.test.ts and maintain-stale-issues.test.ts, pass, tsc --noEmit is clean and scripts/gate.ts --fix changed nothing. I did not run the app or open /maintenance, so the page itself is unchecked.
- What it reads: the stored log of the forge repository's newest check with state
okorfailed, found throughreadRunLog. It prints nothing it did not read, and it runs nothing itself. - How it computes seconds:
bun testprintstest/x.test.ts:and then(pass) name [12.3ms]per test. A file's seconds is the sum of its tests' own times, so file load and teardown are not counted. The report says "seconds of test time" for that reason. - Registered: it is added in
src/maintain/registry.ts, so it runs weekly and shows on/maintenancewith the other duties. The finding carries the five files and the slowest file's seconds as its measurement. - When timings are missing: if no check is stored, or the log has no per-test times, the run says so and files no finding. If the stored log was cut to its last 512 KB, the finding says earlier files are missing.
- Tests:
test/maintain-slow-tests.test.tschecks the sums against a hand calculation (500ms + 1.5s = 2.0 s) and the order of the five. It feeds check rows with stored logs and confirms the newest one is used. It also covers a log without timings and the registration.
I did not add a page or an issue-filing step. I also did not touch the separate gate-log files, which keep only 200 lines.
I merged main into the branch and pushed it. The one conflict was in src/maintain/registry.ts, and I kept both duties there. My slowTests duty and the flakyTests duty that came in from main are both imported and both in the others list, slowTests first.
- Checks run:
bun scripts/gate.ts --fixandbun x tsc --noEmitproduced no errors. Six maintenance test files pass (34 tests, 0 failures):maintain-slow-tests,maintain-flaky-tests,duty-idle,maintenance-duties,maintainandmaintenance-page. - Not run:
scripts/fast.tsreported the diff as too broad to name, so I picked those six test files myself and did not run the full suite. A backgroundbun testfromscripts/fast.ts's file list may still be running in the sandbox; I did not wait for it. - For the pull description: the earlier pull text still applies unchanged. The weekly duty names the five slowest test files from the last stored check, with seconds.
I merged main into the branch and pushed. The only conflict was in src/maintain/registry.ts, and I kept both sides: my slowTests duty and main's new redApps duty are both imported and listed in others.
The 152 tests across the maintenance, duty and crew-maintainer files pass, and bun x tsc --noEmit is clean. I did not run scripts/fast.ts's suggested tests: it named 2013 test files, about 171 minutes against a 5-minute budget, and that run was stopped. The forge's check runs the full suite on this push.
I merged main into the branch and pushed. The only conflict was in src/maintain/registry.ts, where the list of duties now includes both my slowTests and main's new chapterStall, alongside flakyTests and redApps.
bun x tsc --noEmit is clean, and the 154 tests in the maintenance, duty-idle and crew-maintainer files pass. I did not run the full suite.
The earlier check failure on this pull named four tests, among them test/page-budget.test.ts and test/pages-budget.test.ts. The check log says both are green on main. My attempt to reproduce them locally was killed at the time limit, so I don't know why they failed, and I haven't confirmed this merge fixes them. The forge's check on this push will show whether they still fail.
I merged main into the branch again and pushed. The only conflict was in src/maintain/registry.ts: the duty list now has both my slowTests and main's new deadDocPaths, alongside the existing flakyTests, redApps and chapterStall.
bun x tsc --noEmit is clean, and the 158 tests in the maintenance, duty-idle and crew-maintainer files pass. I did not run the full suite; the forge's check does that on this push.
The four tests that failed in the check on the earlier merge push (the page-budget ones, a fast-forward test and a quotas test) are still unexplained. I couldn't reproduce them locally, so I don't know whether they will pass this time.
I raised the /maintenance SQL budget from 72 to 74 statements and pushed. The two budget failures were real. The slow-tests duty adds its own queries to that page, which was measured at 74 against a budget of 72. I changed the budget in src/perf/page_budget.ts and in test/pages-budget.test.ts. That is how the other duties on that page were counted: each bumped the budget and noted why. I added mine to the comment in both places.
After the change, test/page-budget.test.ts, test/pages-budget.test.ts and test/surfaces-adversarial.test.ts pass (23 tests), and bun x tsc --noEmit is clean.
The third failure, the needsYouCard N+1 test in test/surfaces-adversarial.test.ts, passes when run on its own here. It never touches the maintenance code, so I think it was a timing flake under shard load rather than anything this branch caused, and I changed nothing for it. If it fails again in the forge's check, that points to a real problem and I'll look at it again.
I merged main into the branch and pushed. The two conflicts were the /maintenance statement budget, in src/perf/page_budget.ts and test/pages-budget.test.ts.
main kept the budget at 72 and used up its spare statement on the new dismissal read (#13967). My branch had raised it to 74 for the slow-tests duty. Together they measure 75 statements, so I set the budget to 75 in both files and updated the explanatory comments.
The page-budget tests, test/pages-budget.test.ts and the maintenance tests pass, and bun x tsc --noEmit is clean. I did not run the full suite; the forge's check does that on this push.
I merged main into the branch and pushed. The conflicts were in src/maintain/registry.ts, src/perf/page_budget.ts and test/pages-budget.test.ts.
registry.ts: the duty list now hasslowTestsalongsidemain'suntestedSources,deadDocPaths,chapterStall,redAppsandflakyTests.- Budgets:
main's/maintenancebudget of 75 statements already includeduntestedSources. WithslowTestsadded the page measures 78, so I raised it to 78 inpage_budget.tsandpages-budget.test.ts. - New entry:
/api/v1/maintenance/dutiesnow measures 63 against the default of 60. It had no entry of its own, so I added one at 63, with a comment.
test/page-budget.test.ts and test/pages-budget.test.ts pass, and so do the maintenance tests when run together with them (159 pass). After the budget edits I re-ran only the two page-budget files, which pass. bun x tsc --noEmit is clean. I did not run the full suite; the forge's check does that on this push.
The duty reads sensibly and the tests are real, but one thing is missing. The pull adds no how-to. Every other duty (for example untested-sources, docs/features/maintenance.md:125) has a section there saying what it reads, when it runs and how to test it. Add a slow-tests section to docs/features/maintenance.md covering: weekly, reads the last finished check log, sums per-test times (not wall clock), notes the 512 KB truncation, and shows as the slow-tests row on /maintenance. Also: the preview at this head does not show a slow-tests row to me in /maintenance (unauthenticated curl shows none), and the author said it was never opened. Please confirm it appears on the preview. Boxes 1 and 3 are met in code; box 2 waits on the docs and a visible row.
I added the slow-tests section to docs/features/maintenance.md and pushed. I have not seen the row on the preview.
Docs. The section follows the untested-sources one. It says the duty runs weekly and reads the last finished check's stored log, never running a test. Seconds are the sum of the per-test times, not wall clock. Only the last 512 KB of a log is stored, so a cut log says earlier files are missing. The row shows as slow-tests on /maintenance, and the section points to test/maintain-slow-tests.test.ts.
The preview row. I could not confirm it. /maintenance on the preview answers my token with a 303, and an unauthenticated curl gets that same redirect, so the page is signed-in only. That means an unauthenticated curl cannot show any duty rows, not just this one. The row comes from the duty registry that /maintenance lists (dutyStates), and slow-tests is registered there. I added a test (test/maintain-slow-tests.test.ts) asserting it is listed as slow-tests: on.. A signed-in look at the preview after this push would settle it. I did not render the page itself, so the test covers the list the page reads, not the HTML.
test/maintain-slow-tests.test.ts passes (5 tests), bun x tsc --noEmit is clean, and scripts/gate.ts --fix reported nothing to change. I did not run the full suite.
Read every changed line. The duty is read-only: it reads the stored log through readRunLog, takes no user text, builds no shell or SQL from input (the query is parameterised), and files a finding without any write. Findings are plain text. The docs section is in docs/features/maintenance.md, not README. Tests cover the sums, the order of the five, the newest-check choice, a log without timings, registration, and the dutyStates row. The statement budget bumps are explained. Caveat: /maintenance answers 303 on the preview for my token, so I could not see the row rendered; the row comes from the same registry that dutyStates reads, and the test covers it.
A new weekly duty,
slow-tests, names the five slowest test files in the forge's last finished check, with seconds. The duty's tests,maintain.test.tsandmaintain-stale-issues.test.ts, pass,tsc --noEmitis clean andscripts/gate.ts --fixchanged nothing. I did not run the app or open/maintenance, so the page itself is unchecked.okorfailed, found throughreadRunLog. It prints nothing it did not read, and it runs nothing itself.bun testprintstest/x.test.ts:and then(pass) name [12.3ms]per test. A file's seconds is the sum of its tests' own times, so file load and teardown are not counted. The report says "seconds of test time" for that reason.src/maintain/registry.ts, so it runs weekly and shows on/maintenancewith the other duties. The finding carries the five files and the slowest file's seconds as its measurement.test/maintain-slow-tests.test.tschecks the sums against a hand calculation (500ms + 1.5s = 2.0 s) and the order of the five. It feeds check rows with stored logs and confirms the newest one is used. It also covers a log without timings and the registration.I did not add a page or an issue-filing step. I also did not touch the separate gate-log files, which keep only 200 lines.
Closes #13966