test: trail_analyze.test.ts leaks an unhandled ReadableStream rejection (Node 24) #57
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
public/wanderer#57
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Running the web unit tests locally (Node 24 on spl-vm05), vitest reports 1 unhandled rejection from
web/src/lib/server/trail_analyze.test.ts:ERR_INVALID_STATE/ "ReadableStream is already closed" (undici). It reproduces with only that file, and all of its tests pass. Locally vitest then exits 1; CI (Node 20) stays green, e.g. on PR #52.It was seen by four agents on 2026-11-05 (PRs #52, #54, #55, #56). It is likely a stream that is closed twice, or a response body read after cancel, in the test mocks or in the trail-analyze proxy. That is harmless under Node 20 but stricter in Node 24.
🤖 Generated with Claude Code
Root cause found. It is a test fixture issue, not a bug in the proxy:
RequestfromFormData. WhenlimitedUpload(request_body.ts) hits the cap, it cancels the reader.Request, Node 24's undici still enqueues the trailing multipart boundary into the cancelled stream, which throwsERR_INVALID_STATE.Fix: the test uses the existing
streamed()helper (a hand-builtReadableStream), plus an assertion that reading stops near the cap. Commit82616e5donfix/57-trail-analyze-stream, which will be shipped with the next batch. Node 24: the file passes 63/63 in 3 runs and the whole suite passes 1093 with exit 0 and no errors.Correction: CI runs the web job on Node 22 (
setup-node), not 20. Recommendation: add Node 24 as a matrix entry or a non-blocking job once the runner queue has capacity.🤖 Generated with Claude Code