Droid incremental reader test flakes: same-size edit within one mtime tick is not detected

Aperta
#2,813 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à
4/5
Tempo stimato
1-2 giorni
Idoneità per principianti
50/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
javascript, node.js
Ambito
backend, testing

Direzione di ricerca

Start with test/plugins/droid.test.js:66 and the failure at line 88, then read hypaware-core/plugins-workspace/droid/src/transcript.js:74-77 to trace how the cursor fingerprint and boundary determine whether to resume reading. Decide whether the test should force a distinct mtime or the reader should handle same-size edits within one timestamp tick. Done means the flaky case is addressed and the test reliably verifies the intended behavior.

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

Descrizione

test/plugins/droid.test.js:66 ("Droid incremental reader handles append, partial UTF-8 lines, header rewrites and same-size edits") fails intermittently on master code. Seen in a full npm test run on a branch whose only change is package.json (#2812), then 1 failure in 5 runs of the file alone on Linux.

Failure, at line 88:

AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
0 !== 5

Likely cause: readDroidTranscript (hypaware-core/plugins-workspace/droid/src/transcript.js:74-77) treats a cursor as still valid at the same file size when cursor.fingerprint === currentFingerprint and the 128 bytes before the offset are unchanged. The fingerprint is dev:ino:size:mtimeMs:ctimeMs. The test rewrites the file twice in quick succession with the same size, and the second edit is to record 1, well before the last 128 bytes. When both writes land in the same kernel timestamp tick (coarse, a few ms on Linux), the fingerprint and boundary are identical, so the reader resumes at the old offset and yields 0 rows.

So this is a test flake and also a small product edge: a same-size edit within one timestamp tick of the previous write is not replayed. The test could wait for a distinct mtime (or set one with fs.utimes) before the same-size edit; whether the reader should also cover the sub-tick case is a separate call.

🤖 Generated with Claude Code

Lingua principale
JavaScript
Stelle
11
Fork
0
Merge medio
2h 55m
PR unite (30g)
294

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 hyparam/hypaware

Tutte le issue di hyparam/hypaware

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.