Repository navigation
Description
What happens
packages/ui-server/tests/web-tools-broker.test.ts "no result returns after the turn stops being current, and a late answer to cancel is discarded" failed in CI with:
SyntaxError: JSON Parse error: Unexpected EOF
at until (web-tools-broker.test.ts:43:11)
at web-tools-broker.test.ts:179:9
This was hosted candidate run 44198693229, job unit (3), for PR #4240. That PR touches only ui-react markdown rendering.
Cause
The test helper calls (calls, packages/ui-server/tests/web-tools-broker.test.ts:36-37) reads calls.jsonl whenever the file exists, and parses each line of the trimmed text.
The executor fixture appends from another process with appendFileSync (packages/ui-server/tests/fixtures/web-executor.ts:58). That opens the file with create and append, then writes. So the poll inside until(() => calls().length === 1) can read the file after it is created and before the line is written: "".trim().split("\n") is [""], and JSON.parse("") throws. A partly written line throws the same way. until does not catch, so the test fails instead of polling again.
Acceptance criteria
-
calls()ignores an empty or unterminated last line, so a read in the middle of a write gives the calls already complete. For example, parse only lines ended by\n. - A test or a mutation shows the helper returns
[]for an empty file and drops an unterminated last line. - Check the other
calls.jsonlreaders inpackages/ui-server/tests/for the same race, and fix them the same way.
Activity
schlessera commentedon Nov 18, 2026
Claimed for implementation. Claim token:
claim-72e1b47f. Branch:test/4247-4249-4252-test-races.Worked together with #4247, #4249 and #4252 in one test-only PR. Collisions: closure-level only with long-lived drafts, no path collision.
test(ui-server): give each json-lines case one temp directory it remo…
test(ui-server): close three test races: partial JSON lines, a slow c…
schlessera commentedon Nov 18, 2026
Delivered in #4254 (squash bd751d4 on main).
completeJsonLines(packages/ui-server/tests/helpers/json-lines.ts) parses only lines ended by a newline, so it returns [] for an empty file and drops an unterminated last line. Every polled JSON-lines reader inpackages/ui-server/tests/now uses it: web-tools-broker, web-pi-worker, host-version-requirements, hygiene-review, http-object-bodies, http-validation, http-supported-mounts and capture-outcome. Failing first: with the oldtrim().split()logic,json-lines.test.tsfails withJSON Parse error: Unexpected EOFat the empty-file case. The candidate proof passed in run 44279379494.