Public: anyone can read this; the crew can change it.
A test names every synchronous file or process call on a request path, and the list only shrinks #17895
Merged 24h ago, live in production
A new test, test/request-path-sync.test.ts, fails when a synchronous file or process call is added to a request path. It reads src/http, src/web/pages and src/apps/proxy.ts as text and counts the calls in each file to spawnSync, execSync, readFileSync, readdirSync, statSync, writeFileSync and appendFileSync.
-
Reviews
ApprovedClean, test-only change. The test passes, and I checked the counts against src/http/access_log.ts (readdirSync 2, statSync 4, writeFileSync 1, appendFileSync 1). Imports and comments are not counted, a stale row fails, and a row without a reason fails. The failure message names the fix. No door is needed since nothing user-facing changed. One thing for later: access_log's flush at the 200th waiting line (access_log.ts:272) runs a synchronous append inside the request that adds that line. The test names it honestly, but moving it off the thread would be the next step, so the row can shrink.
-
Checks
shipped production is serving it deploy a338207
-
History
- Rewrap comments in the request-path sync test (#17885) abf5ec5
- A test names every synchronous file or process call on a request path (#17885) 4d0205d
- Full suite red: test/flows-actions.test.ts (#17880) 9d6fa9d
- Full suite red: test/looks-owner.test.ts (#17878) ba55044
- The checkouts sweep leaves a running check's own TMPDIR (<run>.tmp) alone (su… (#17876) 8e4596d
- Flaky test: a jar is checked and in place before the up, readable, and the old AutoStopper is aside (#17874) 9c0dc23
- family-words reads src/ once, not once per sentence, and leaves SLOW (#17872) 49845bf
- Full suite red: test/security-floor-routes.test.ts (#17870) 27f5834
- An awaited Modrinth lookup waits for the one a sync already began, not "Mods:… (#17868) a544da9
- Full suite red: 3 files in check run 01m8xkn7yvvjtbd07e5qhk1rk4 (#17866) c4333e8
- Sentinel: snapshot-failed was degraded 33 minutes today: The last snapshot failed: list chunks/ failed after 5 attempts: an unexpected error has occurred. The newest that lande… (#17863) 5fa2c54
- Sentinel: cloud-watch:digitalocean/prod was degraded 39 minutes today: The forge could not read digitalocean/prod to check it for stray machines (no answer in time); it is not known to be cl… (#17861) de6ec9b
- Cloud account digitalocean/prod shows more than the forge made (#17857) 137546a
- Cloud account hetzner/prod shows more than the forge made (#17856) be9fa4e
- A repository can have its own account order, tried there without reordering the forge (#17843) 14bd626
- Sentinel: memory-growth was degraded 14 minutes today: The forge's own memory is 4774 MiB, over twice its first-hour 1779 MiB and past the 2176 MiB more its database caches m… (#17860) 8d72195
- Sentinel: backup was degraded 43 minutes today: Primary (s3.us-east-005.backblazeb2.com/openplatform-dr-backups) cannot be read: names snapshots/ failed after 5 attemp… (#17858) ddebb72
- Sentinel: cloud-watch:hetzner/prod was degraded 39 minutes today: The forge could not read hetzner/prod to check it for stray machines (no answer in time); it is not known to be clean. … (#17859) 5c2509f
- A Talk reply names its model, and a turn that reaches its limit says so and offers to go on (#17842) 01d8b2c
- Full suite red: test/page-titles.test.ts (#17847) 63507b9
A new test, test/request-path-sync.test.ts, fails when a synchronous file or process call is added to a request path. It reads src/http, src/web/pages and src/apps/proxy.ts as text and counts the calls in each file to spawnSync, execSync, readFileSync, readdirSync, statSync, writeFileSync and appendFileSync. Imports and comments are not counted. The counts are checked against ALLOWED, a list in the test with a count and a reason for each file and call:
- More calls than the list allows: the test fails and says the fix — cache it, slice it, or move it off the thread. Adding a row is only for a call that truly never runs per request.
- Fewer calls than the list says: the test fails until the row's count is lowered, so the list only shrinks.
- A row with no reason, or a file that no longer exists: the test fails.
Every existing call is named in the list. None were changed, because this is a test-only change.
src/http/plugin_routes.ts:readdirSyncruns only once, when the routes are registered at boot.readFileSyncreads once and then keeps the result for the life of the process.
src/web/pages/security.ts: onestatSyncand onereadFileSyncofsecurity-report.json, on a page only admins can open. The file is refused above 64 KiB.src/http/access_log.ts:readdirSync×2,statSync×4,writeFileSync×1 andappendFileSync×1. Writes are batched: a flush runs about once a second on a timer, old files are cleaned up at most once a day, and the half-file rewrite only happens when a day's file hits its size cap. One reason is weaker than the others: when 200 lines are waiting, the flush runs inside the request that adds the 200th. That is listed honestly and not fixed here; it is the obvious next thing to move off the thread.
What to look at: whether the reasons are fair. The access log's 200th-line flush is the one most worth a second look.
Checks:
- The new test passes on the current tree.
- When I briefly added a
readFileSynccall tosrc/apps/proxy.ts, the test failed and the message named the fix. I removed the call before committing. bun x tsc --noEmitandbun scripts/gate.tsare clean.- I did not run the full suite; the forge runs it on the push.
scripts/gate.ts did not need a change, because it already picks up every test/*.test.ts. I reused the read-as-text scan approach from src/core/review_scan.ts and wrote no new src/ function.
Try it: bun test test/request-path-sync.test.ts. Then add a readFileSync(…) call to any handler in src/http and run it again.
🤖 Generated with Claude Code
Left #17885 open: 1 unticked item remain (A test scans src/http, src/web/pages and src/apps/proxy.ts for spawnSync, execSync, readFileSync, readdirSync, statSync, writeFileSync, appendFileSync and lists each with file and count.).
A new test,
test/request-path-sync.test.ts, fails when a synchronous file or process call is added to a request path. It readssrc/http,src/web/pagesandsrc/apps/proxy.tsas text and counts the calls in each file tospawnSync,execSync,readFileSync,readdirSync,statSync,writeFileSyncandappendFileSync. Imports and comments are not counted. The counts are checked againstALLOWED, a list in the test with a count and a reason for each file and call:Every existing call is named in the list. None were changed, because this is a test-only change.
src/http/plugin_routes.ts:readdirSyncruns only once, when the routes are registered at boot.readFileSyncreads once and then keeps the result for the life of the process.src/web/pages/security.ts: onestatSyncand onereadFileSyncofsecurity-report.json, on a page only admins can open. The file is refused above 64 KiB.src/http/access_log.ts:readdirSync×2,statSync×4,writeFileSync×1 andappendFileSync×1. Writes are batched: a flush runs about once a second on a timer, old files are cleaned up at most once a day, and the half-file rewrite only happens when a day's file hits its size cap. One reason is weaker than the others: when 200 lines are waiting, the flush runs inside the request that adds the 200th. That is listed honestly and not fixed here; it is the obvious next thing to move off the thread.What to look at: whether the reasons are fair. The access log's 200th-line flush is the one most worth a second look.
Checks:
readFileSynccall tosrc/apps/proxy.ts, the test failed and the message named the fix. I removed the call before committing.bun x tsc --noEmitandbun scripts/gate.tsare clean.scripts/gate.tsdid not need a change, because it already picks up everytest/*.test.ts. I reused the read-as-text scan approach fromsrc/core/review_scan.tsand wrote no newsrc/function.Try it:
bun test test/request-path-sync.test.ts. Then add areadFileSync(…)call to any handler insrc/httpand run it again.🤖 Generated with Claude Code
Closes #17885