Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

The bridge's app-liveness tests decide on real time and fail intermittently

Aperta
#277 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à
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
node.js, react-native, typescript
Ambito
testing

Direzione di ricerca

Start with packages/bridge/src/__tests__/app-liveness.test.ts and trace how its real-time failedWithin(ms) races the liveness monitor against sleep(ms). Check how the monitor receives its clock and whether the test can control it while keeping the real bridge and WebSocket setup. Done when the liveness cases decide from the configured budgets and the intermittent timing failures are addressed.

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

Descrizione

Describe the bug

packages/bridge/src/__tests__/app-liveness.test.ts runs the liveness monitor on real timers with budgets tens of milliseconds apart (an idle budget of 150 ms, a file-load budget of 300 ms) and decides each case by racing the monitor's verdict against a real timer: failedWithin(ms) is Promise.race([outcome, sleep(ms)]). When the event loop runs late, a timer meant to land between two budgets lands past one of them, and a case fails although the monitor behaved as specified. On main the file fails about one run in thirty, in different cases:

FAIL  src/__tests__/app-liveness.test.ts > app liveness > gives loading a test file the file-load budget
AssertionError: expected false to be true // Object.is equality
FAIL  src/__tests__/app-liveness.test.ts > app liveness > fails a blocked JS thread after the idle budget, naming the phase
AssertionError: expected false to be true // Object.is equality

so it can fail any PR's test job. The file pairs a real bridge and client over a real WebSocket, so a clock the test controls, handed to the monitor, would let each case decide on the budgets alone.

System Info
System:
  OS: Linux 6.18 Ubuntu 24.04.5 LTS (WSL 2)
  CPU: 32 cores
Binaries:
  Node: 23.11.1
  pnpm: 10.6.1
React Native Harness Version

1.6.0 (main at 81ed195)

Reproduction

https://github.com/callstackincubator/react-native-harness/blob/main/packages/bridge/src/__tests__/app-liveness.test.ts

Steps to reproduce
  1. pnpm install, then build the packages: pnpm nx run-many -t build.
  2. In packages/bridge, run the file thirty times: for i in $(seq 30); do npx vitest run src/__tests__/app-liveness.test.ts; done. One of my thirty runs failed, in the first case above; with every core of the machine kept busy, one of ten failed, in the second.

Expected: every run passes, each case decided by the monitor's budgets alone, however late the event loop runs.

Actual: about one run in thirty fails, with the assertions above, and one in ten while the machine is busy. app-liveness.test.ts is unchanged on main at 26b67ea434.

Lingua principale
TypeScript
Stelle
335
Fork
23
Merge medio
1g 8h
PR unite (30g)
54

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 callstackincubator/react-native-harness

Tutte le issue di callstackincubator/react-native-harness

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.