Files
faunosteo/docs/development/R4_J1.md
T

85 lines
6.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# R4 J1: device acceptance of the Rust import
Plan `.claude/tasks/plans/2026-10-17-rust-r4-pdf-core.md` §A.4 (J1), owner
conditions BDR-058. The import of the application runs in a disposable
worker on the Rust core since R4.3 (`docs/development/RUST.md` §10.5); the
export runs on the core's session since R4.6 and the TypeScript engine left
the repository at R4.8 (§10.8, §10.10): the build under test holds no other
PDF reader or writer. Headless runs in Chromium, Firefox and WebKit are
recorded in RUST.md §10.4, §10.5 and §10.11; nothing below is validated
until it has run on the owner's devices (plan OD-6: a device or browser not
run is reported as not run, never as validated).
## 1. Serve the build on the LAN (owner's machine)
Two surfaces, both on the DEV origin (`scripts/dev-env.sh`,
`FAUNOSTEO_DEV_HOST`), never on every interface:
1. The development server, as for the R3 acceptance: `pnpm dev` (local
stack) or `pnpm dev:offline` (local tool), `http://<FAUNOSTEO_DEV_HOST>:5173`.
No CSP header, HMR on.
2. The production build behind the DEPLOY CSP (what the proofs ran):
`pnpm build:preview` then
`. scripts/dev-env.sh && node scripts/browser/serve.mjs --host "$FAUNOSTEO_DEV_HOST" --port 4173` (the server refuses an empty or unspecified address),
reachable from the devices only once the owner opened port 4173 to the
private subnet for the session (`ENVIRONMENTS.md` §3, the 4173 row:
one `ufw allow` rule, deleted afterwards),
`http://<FAUNOSTEO_DEV_HOST>:4173`. Static files, the nginx SPA fallback,
the DEPLOY `Content-Security-Policy` with `'wasm-unsafe-eval'` on every
response. `--csp without` serves the same build without the keyword (the
import must then show the engine message). Stop it with Ctrl-C; it binds
the one address given. Run both surfaces for the memory items (2 is the
one that matters for the CSP and the worker chunk's caching).
## 2. The kit
`node scripts/r4-j1-kit.mjs [dir]` writes a folder (about 13 MB, synthetic
data only) with `ATTENDU.md` listing the expected message of every file:
- `1-reference/`: Step 5 v2 and v3 PDFs, the R3 exports (FR / EN, with and
without logos, the real-raster export, the store-path export), the Step 6
envelopes. Every one opens the editor.
- `2-hostile/`: the 51 PDFs of the O8 corpus with their message (the four
declared R4 differences applied: `values-1m`, `surrogate-content-overwritten`,
`surrogate-version-overwritten`, `two-files-decoy-first`).
- `3-copies/`: rescue copies (valid, BOM, no extension, invalid UTF-8,
invalid JSON, version 1, oversized 18 MB).
Copy the folder to the devices (AirDrop, a share, a USB key); on iPhone pick
from Files.
## 3. Checks per device (computer, iPhone, low-end Android: the OD-6 list)
Record the device, the browser and its version, and the surface (1 or 2).
| # | Check | Expected |
|---|---|---|
| J1.1 | `1-reference/`: pick each file from Home | the editor opens; the R3 and Step 6 envelopes alert « Restauration complète. Archive Faunosteo importée… »; v2 files alert the migration count; no engine message |
| J1.2 | `2-hostile/`: pick each file | the message of `ATTENDU.md`, the file untouched, Home stays usable (button enabled again) |
| J1.3 | `3-copies/`: pick each file | per `ATTENDU.md`; a refused copy leaves the tab's draft in place |
| J1.4 | Engine unavailable: surface 2 with `--csp without`, pick `r3-demo.fr.logos.pdf` | « Le moteur de lecture n'a pas pu être chargé. Réessayez l'import. »; a second pick shows it again; nothing else changes |
| J1.5 | Engine recovered: back to surface 2 with the keyword, same pick | the editor opens |
| J1.6 | Interrupted import: pick `2-hostile/values-1m.pdf` and tap « Nouveau bilan » at once, or leave Home within the first second | no alert, no editor from the import, the new page intact |
| J1.7 | Offline import: open the editor once (engine loaded), enable airplane mode, back to Home, pick a reference PDF | the editor opens (the worker chunk and the module come from the page and the cache) |
| J1.8 | Large legitimate export: on the computer, import `3-copies/copie-L-60-observations.json` (the 60-observation report as a rescue copy), export it from the editor (the Rust export, about 44 MB with real rasters), then import that file on the phone | the editor opens within the task timer (20 s); note the time to the editor; the tab survives |
| J1.9 | Memory on the phone: 6 imports of the L export in a row (Home → pick → editor → Home) | no reload of the tab by the system, no Safari memory warning; note any slowdown |
| J1.10 | Repetition: 20 picks of `2-hostile/values-1m.pdf` on the phone | 20 times the message, the tab alive |
| J1.11 | Rescue copy under the cap on the phone: `3-copies/copie-valide.json`, then `copie-trop-grande.json` | the editor; the refusal |
| J1.12 | Timing: note the time from the pick to the editor for `r3-demo.fr.logos.pdf` and for the L export per device | reported in RUST.md §10.5; the 20 s timer is confirmed or moved by the §B.3 rule (≥ 10 × the slowest legitimate import) |
| J1.13 | Data kept on error: open a reference PDF, add an observation, go back to Home (« Accueil »), tap « Importer », answer « Remplacer » in « Remplacer le bilan en cours ? », pick `2-hostile/values-1m.pdf`; same again with `3-copies/copie-json-invalide.json` | each refusal shows its message; « Importer » again offers « Ouvrir le bilan en cours », which opens the bilan with the added observation; nothing was replaced or dropped |
Devices and browsers (plan OD-6, the exact list): the computer with Chrome
and with Firefox; the iPhone with Safari iOS (the WebKit path that headless
WPE does not stand for); the low-end Android phone with its browser. A
device or browser not run is reported as not run. Safari iOS stays NON TESTÉ
until the owner reports results from the real iPhone: an iPhone simulator
never stands for it and is never a memory proof (owner, 2026-10-21).
## 4. What to report
The table above with the result per device, the timings of J1.8 and J1.12,
any message that differs from `ATTENDU.md`, any system reload or memory
warning, and the device list actually run. The results go to RUST.md §10.5
and `docs/development/PDF_IMPORT_HARDENING.md` §5 (the gate stays open:
imports are not offered to external users).