test(ui-server): the web broker's calls() helper reads calls.jsonl mid-write and throws
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 87/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- testing
Research direction
Start with the calls() helper in packages/ui-server/tests/web-tools-broker.test.ts and the fixture writer in packages/ui-server/tests/fixtures/web-executor.ts. Search packages/ui-server/tests/ for other calls.jsonl readers, then check the helper with an empty file and one ending in an incomplete line. Done when incomplete lines are ignored by all readers and the acceptance checks pass.
Written by the indexing model from the issue text.
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.
- Dominant language
- TypeScript
- Stars
- 4
- Forks
- 0
- Avg merge
- 6h 5m
- Merged PRs (30d)
- 730
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from schlessera/brain-kit
-
agent-ready area: ui-server priority: p3 type: test
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
schlessera/brain-kit#4249 ·
Maintainers usually reply within 1 day
-
agent-ready area: ci area: docs priority: p2 type: docs
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
schlessera/brain-kit#4144 ·
Maintainers usually reply within 1 day
-
ui-server: run-session's error-result test waits only 200 one-millisecond ticks for the first promptOpenagent-ready area: ui-server priority: p3 type: test
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
schlessera/brain-kit#4066 ·
Maintainers usually reply within 1 day
-
agent-ready area: ci area: ui-sdk priority: p2 type: test
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
schlessera/brain-kit#4047 ·
Maintainers usually reply within 1 day
-
agent-ready area: ci priority: p2 type: test
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
schlessera/brain-kit#4003 · 1 comment ·
Maintainers usually reply within 1 day
All issues in schlessera/brain-kit
Similar issues
-
documentation tool triaged
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
can1357/oh-my-pi#19608 · 2 comments ·
Maintainers usually reply within 1 day
-
dependencies tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
bcgov/nr-waste-plus#1549 ·
Maintainers usually reply within 1 day
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
blixvip/solana-token-meta#17 ·
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
blixvip/solana-tx-parse#18 ·
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100