A failure while painting the first frame bypasses the startup guard and the web smoke test

Aperta
#489 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
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
dart, flutter
Ambito
frontend, testing

Direzione di ricerca

Read bootstrapAndRun and runApp to understand where startup ends and the first frame is built; then inspect test/web/smoke/smoke.mjs and the existing widget tests. Add a widget test for a first-build throw and verify the web smoke test fails with the cause when MostroApp.build throws, but passes without the injected failure.

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

Descrizione

Follow-up from #405 (review round 3, finding 3).

What happens

bootstrapAndRun runs startup inside a guard: if anything throws, it paints StartupFailureApp naming the step and publishes the cause to the page (mostroBridgeError), which test/web/smoke/smoke.mjs reads.

runApp only schedules the app; the first frame is built afterwards. A throw during that first frame — MostroApp.build, a provider read on the first build, GoRouter's initial redirect — happens after the guard has returned, so:

  • the user gets Flutter's error widget (red in debug, grey in release) instead of the failure screen;
  • mostroBridgeReady has already been set at the end of startup (#405), so the smoke test passes.

Measured on fd94e2b: with throw StateError(...) as the first line of MostroApp.build, a release web bundle shows Flutter's grey error box and the smoke test passes — ✓ startup finished, ✓ no console or page errors. Neither the failure screen nor CI sees it.

Proposed fix

For the first frame only:

  1. Before runApp, install a FlutterError.onError that paints StartupFailureApp(step: 'showing the first screen', error: …) and calls markBridgeFailed.
  2. In addPostFrameCallback, restore the previous handler, then call markBridgeReady() — moving it from the end of _startup to after the first frame.

How to verify

  • A widget test in which the first build throws: the failure surface must be shown, with that step.
  • The web smoke test with an injected throw in MostroApp.build: it must fail with the cause, and pass without it.
Lingua principale
Dart
Stelle
11
Fork
9
Merge medio
17h 14m
PR unite (30g)
100

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 MostroP2P/app

Tutte le issue di MostroP2P/app

Issue simili

Altre issue su Dart

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.