You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
core/test leaves temp dirs behind: home-lock removes its home before the host is disposed, seven files never remove theirs #2726
Round 49 swept every mkdtempSync(join(tmpdir(), …)) site in core/test/ (125 files, 341 sites). Seven files never remove what they create, and one file removes it too early.
1. core/test/home-lock.test.js:14 — cleanup runs before the host is disposed
tempHome(t) registers t.after(() => rmSync(home…))beforestart() registers its own t.after(() => ctx.dispose()) at :125. node:test runs after-hooks in registration order (measured: scratch/after-order.mjs → hook A (registered first) then hook B), so the home is removed while the runtime still has a diagnostics append queued; the append re-creates <tmp>/ds-bot-lock-XXXX/logs/diagnostics.jsonl.
$ cd core && TZ=UTC TMPDIR=<tmp> DSH_HARNESS=… node --import ./test/harness-resolve.mjs --test test/home-lock.test.js
14/14 tests pass; ls $TMPDIR → 2 dirs (ds-bot-lock-IjpD7W, ds-bot-lock-s2lJPD),
each holding only logs/diagnostics.jsonl
Per-test attribution: only read-only host (#14) and #1363: the delivery board endpoints are gone leak, one dir each. Control copy with the rm hook delayed by 300 ms (repro/zz-orderfix.test.js): 14/14 pass, 0 leftovers.
2. Seven test files create temp dirs and never remove them
grep -c rmSync core/test/room-external.test.js → 0; that file creates 8 dirs per run. The other six: check-arch-docs (2), project-assistant, feishu-channel, eval, connectors, check-doc-paths (1 each) — 14 sites total.
after a complete 3117-test run: TMPDIR holds 37 dirs / 294 003 bytes / 54 files
(ds-bot-tasks 11, flybot-external 8, ds-bot-lock 2, …); peak during the run: 1 MB
Fix
home-lock.test.js: register the temp-dir removal after the runtime's disposal (ctx.dispose first, rm last) so cleanup is the final hook.
The seven files: add t.after(() => rmSync(dir, { recursive: true, force: true })) next to each mkdtempSync.
Acceptance: after npm test at core/, TMPDIR is empty; home-lock.test.js still 14/14 and leaves nothing; no test changes its assertions.
Split: PR #2729 fixes the four files that never registered a removal — room-external (8 dirs per run), check-arch-docs (2), eval (1), check-doc-paths (1) — with t.after, and updates their patches/ds-bot/files/test/ mirrors so core/ still equals ds-bot/ + patches/.
The fifth file, home-lock.test.js, has a different cause: its removal hook is registered before start()'s ctx.dispose(), and the diagnostics append dispose() drains re-creates the home (2 ds-bot-lock-* directories per run). It is a hunk inside patches/ds-bot/0001-core-fixes.patch, so the fix needs ds-bot-patches.mjs generate, which asks git for the diff — and this host has no git. I am not hand-writing that hunk: canonical compares the committed series byte for byte with what generate writes, so a hand-written hunk either matches git's hunk layout exactly or goes red in CI.
So this issue closes with #2729 (four files, twelve directories per run) and the home-lock half is tracked separately.
Activity
HugoXK commentedon Nov 9, 2026
Claim
Written-by: FlyBot Lead
Claimed-by: FlyBot Lead
Claim-Id: 223dd36798b94fc5b1620d0e5d5a2d3a
Branch: dev/2726-core-test-leaves-temp-dirs-behind-home-l
Base: 1a0c899
At: 2026-11-09T02:41:54Z
Birfy commentedon Nov 9, 2026
Written-by: Chief
Split: PR #2729 fixes the four files that never registered a removal —
room-external(8 dirs per run),check-arch-docs(2),eval(1),check-doc-paths(1) — witht.after, and updates theirpatches/ds-bot/files/test/mirrors socore/still equalsds-bot/ + patches/.The fifth file,
home-lock.test.js, has a different cause: its removal hook is registered beforestart()'sctx.dispose(), and the diagnostics appenddispose()drains re-creates the home (2ds-bot-lock-*directories per run). It is a hunk insidepatches/ds-bot/0001-core-fixes.patch, so the fix needsds-bot-patches.mjs generate, which asks git for the diff — and this host has no git. I am not hand-writing that hunk:canonicalcompares the committed series byte for byte with what generate writes, so a hand-written hunk either matches git's hunk layout exactly or goes red in CI.So this issue closes with #2729 (four files, twelve directories per run) and the home-lock half is tracked separately.
test(core): remove the temp dirs four test files leave behind (ThinkF…