fix(editor): honest stopped state when the draft is unsaved; no dead retry

0279953 chose the stopped message from CoreRuntime.stopped alone: it
promised the report was kept even when the tab's storage refused the
draft (export, the banner's advice, needs the core), four surfaces still
offered a retry that could not work, and a failed recovery below the cap
was a dead end since nothing called retry().

The runtime restarts a failed recovery on the next call (compiled module
reused, cap still counts traps) and notifies status listeners. One
CoreStoppedNotice on the editor, Home, New report and the full-page
notice: reload when saved, else core.stopped_unsaved with a core-free
copy download (also on the storage-full banner) and a beforeunload
guard. Export, import and new report say the stopped message; a core
failure reading an unread draft is FAILED, not held. ESLint census of
the failure keys; core.stopped says "plusieurs erreurs".
This commit is contained in:
bchanot committed 2026-10-16 18:26:10 +02:00
1 parent 0279953e9e
commit 6371523f8c
24 files changed
+839 -83

No files matched your search

+21 -5
View File
@@ -505,11 +505,20 @@ Closed failure kinds: `invalid_json`, `invalid_shape`, `unknown_op`,
imported in advance (no network needed), at most 3 times per page; calls
made meanwhile answer `core_unavailable`. Sheet handles carry the instance
generation and are rebuilt from the retained payload, never called on a
dropped instance.
dropped instance. A recovery that fails below the cap (network lost, spare
record missing) is not final: the next call or `ready()` restarts the
runtime, reusing the compiled module; a restart is not a recovery and does
not touch the counter. A failed first load is restarted by `retry()` only.
`subscribe(listener)` reports status changes after a microtask (a throwing
listener changes nothing); the pages follow `stopped` through it.
- A load failure (CSP, network, old browser) gives `core_unavailable`; the
editor and the new-report page show the notice with "Réessayer" (the retry
clears the runtime, `useSheet` and provider caches), never redirect, never
read or write the draft.
read or write the draft. Once the engine stopped, the notice is the stopped
one (§9.4 item 7), without a retry.
- Editor, storage full while the engine runs: the `editor.save_failed` banner
gains the engine-free "Télécharger une copie" button, and a `beforeunload`
guard asks before a reload or close while the report is only in memory.
- Two builds: `pkg/` ships (no trap export, checked by `scripts/wasm-build.sh`
and a test), `pkg-proofs/` carries the trap exports for the tests. Both
carry `BUILD_STAMP` (hash of the Rust sources); the vitest global setup of
@@ -810,9 +819,16 @@ imports it and restyles `data-state` in place as before.
decision 2026-10-15): the engine did not run (`core_unavailable`,
`internal`: the existing `sheet.core_unavailable` notice with "Réessayer",
the retry builds again on a fresh instance), the engine stopped after its
three recoveries (`CoreRuntime.stopped`: the `core.stopped` notice, "reload
the page, your report is kept in this tab", no retry; the editor's action
alerts say the same instead of "try again") or the view itself cannot be
three recoveries (`CoreRuntime.stopped`: no retry anywhere; the canvas shows
the stopped text, and `CoreStoppedNotice` sits in the editor's banner slot
in place of the storage-full text, at the top of Home and New report, and
replaces the full-page `CoreUnavailable` retry. Two variants: the tab's
copy of the report is saved, `core.stopped` with "Recharger la page"; the
tab's storage refused the last write (`saveFailed`), `core.stopped_unsaved`
with "Télécharger une copie" (the in-memory report as JSON, no engine
needed), never the reload button. Action, export, import and new-report
alerts say the same text instead of "try again"; "Réessayer" on the canvas
restarts the engine before building again) or the view itself cannot be
drawn (`svg_rejected`,
`no_asset`, `unknown_view`, `invalid_character`, a parse failure: the
`canvas.view_unavailable` notice, no retry since nothing would change). The