test(ui-server): the web broker's calls() helper reads calls.jsonl mid-write and throws

Aperta Adatta ai principianti
#4,247 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
87/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
testing

Direzione di ricerca

Inizia dall’helper calls() in packages/ui-server/tests/web-tools-broker.test.ts e dal writer dei fixture in packages/ui-server/tests/fixtures/web-executor.ts. Cerca in packages/ui-server/tests/ altri lettori di calls.jsonl, poi verifica l’helper con un file vuoto e uno che termina con una riga incompleta. Il lavoro è terminato quando tutti i lettori ignorano le righe incomplete e i controlli di accettazione passano.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

agent-ready area: ui-server priority: p3 type: test

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.jsonl readers in packages/ui-server/tests/ for the same race, and fix them the same way.
Lingua principale
TypeScript
Stelle
4
Fork
0
Merge medio
6h 5m
PR unite (30g)
730

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di schlessera/brain-kit

Tutte le issue di schlessera/brain-kit

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.