fix(app): rescue copy importable, trapping draft held, replace confirmed
The JSON rescue copy could not be restored in the app, a draft that traps the engine left the tab on a reload screen and spent a recovery on every read, and an unsaved or in-progress report could be lost by a reload outside the editor or by New report / Import without warning. Home import reads the copy (content-sniffed, 16 MiB cap, strict UTF-8) through the core's draft.restore before any session change; a trapping (draft, archive) pair is held in the resolution panel and only re-read on Retry; ReplaceSessionDialog guards New report and Import; the beforeunload guard is app-wide while unsaved. Supersedes BDR-055's "never held" for `internal` only.
This commit is contained in:
1 parent
9464651140
commit
9bd9acaf58
22 files changed
+1090
-68
No files matched your search
@@ -518,7 +518,9 @@ Closed failure kinds: `invalid_json`, `invalid_shape`, `unknown_op`,
|
||||
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.
|
||||
guard (`app/useUnsavedGuard.ts`, called once in `App`, on every page) asks
|
||||
before a reload, a close or a full-page redirect 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
|
||||
@@ -643,7 +645,18 @@ application itself builds.
|
||||
(`reason: 'held'`, alert, then the panel) while such a text is held, and
|
||||
first reads through the core any draft this page never opened: an
|
||||
unreadable one is set aside before the new session replaces it, a
|
||||
readable one is replaced as before. The draft mirror is written only
|
||||
readable one is replaced as before. R3 final checks (2026-10-17): a draft
|
||||
the engine traps on (`draft.restore` answering `internal`, an out-of-memory
|
||||
trap on a very large draft) is held too, as the `engine_failure` row with
|
||||
its archive as `companion` (`session.held.notice_engine`), kept as is; the
|
||||
store remembers the (draft, archive) pair that trapped and answers held
|
||||
without calling the core again, from the editor, New report and Import
|
||||
alike (`ActionResult.engine`, alert `session.held_blocked_engine`), until
|
||||
the panel's "Réessayer" (`retryTrapped`) or a confirmed discard; other core
|
||||
failures keep their behaviour (`core_unavailable`: the reload screen). New
|
||||
report and the Home file pick ask first (`ReplaceSessionDialog`: cancel,
|
||||
open the bilan in progress, replace) whenever a report is in memory or a
|
||||
draft sits in the slot. The draft mirror is written only
|
||||
when the report changes (an unrelated store change never removes it);
|
||||
a refused write keeps the previous text and shows the `editor.save_failed`
|
||||
banner until a write succeeds; a refused archive write at a new session
|
||||
@@ -839,6 +852,16 @@ imports it and restyles `data-state` in place as before.
|
||||
(owner decision 2026-10-15: until then both name attributes and its title
|
||||
held the French name). Display only; the frozen oracles stay as frozen and
|
||||
the tests apply this declared change before comparing.
|
||||
9. R3 final checks (owner decisions 2026-10-17). The rescue copy (the
|
||||
"Télécharger une copie" JSON, byte format of `osteo:draft`) is importable:
|
||||
the Home picker accepts it beside the PDF, routed by content from the first
|
||||
KiB (`%PDF-` goes the PDF path), refused above `MAX_ATTACHMENT_BYTES`,
|
||||
decoded as strict UTF-8, read by the core's `draft.restore` (no archive) and
|
||||
opened like an import; a copy the core refuses is `home.import.error_invalid_copy`
|
||||
(file and session untouched), a rebased one shows `editor.draft_rebased`.
|
||||
The copy lacks the archive envelope, which the original PDF keeps. A draft
|
||||
that traps the engine opens the resolution panel and is read once (§8.7
|
||||
item 3); importing the copy of a trapping draft runs the same input again.
|
||||
|
||||
### 9.5 Measurements
|
||||
|
||||
|
||||
Reference in new issue
Block a user