test(tests): R4.3d browser proofs on the production build: app import baseline on the Rust path, CSP with and without the keyword, leak series, WebKit repetition
Same perimeter as the TS baseline (226 files, 3 engines, real Home page): 666/678 outcome and message agreements, the 12 others the 4 declared files; W5 0 long tasks (TS 91 and 173 ms); 50 MiB file in WebKit 145/126 MiB against 324 with the worker read and 76 for the TS. CSP: editor opens with the keyword, the engine message without, in 3 engines, the worker's wasm-eval refusal reported by Chromium and Firefox. Leak series on the app: Chromium ≤ 2 MiB per import after init, Firefox GC sawtooth reclaimed, WebKit grows with same-tab navigations (control too) and levels off on one page; 20/20 WebKit workers closed.
This commit is contained in:
1 parent
8ddf185aa6
commit
08f01ef363
17 files changed
+26759
-28
No files matched your search
@@ -1,4 +1,4 @@
|
||||
# Browser harness (R4.1e, R4.2e, R4.3a)
|
||||
# Browser harness (R4.1e, R4.2e, R4.3a, R4.3d)
|
||||
|
||||
Measures the application in real browser engines (Chromium, Firefox, WebKit)
|
||||
through Playwright: the TypeScript baselines of R4 (export and import time
|
||||
@@ -6,7 +6,10 @@ and memory, plan `.claude/tasks/plans/2026-10-17-rust-r4-pdf-core.md` O12,
|
||||
§B.3, §B.4, §B.8) and the browser columns of the O9 inflate oracle. Since
|
||||
R4.2e it also measures the Rust import in a disposable module worker on the
|
||||
baseline's perimeter, its hostile classes and its memory protections; since
|
||||
R4.3a, the worker's two read paths on the large files and the leak series.
|
||||
R4.3a, the worker's two read paths on the large files and the leak series;
|
||||
since R4.3d, the application itself on the Rust path (its import worker):
|
||||
the import baseline against the TypeScript one, the CSP proof, the leak
|
||||
series and the WebKit repetition through the real Home page.
|
||||
|
||||
> **Watchdog caveat.** Every browser runs under a 4 GiB RSS watchdog that is
|
||||
> **not a guaranteed memory limit**. It samples every 50 ms, so a faster
|
||||
@@ -59,6 +62,10 @@ All from the repository root.
|
||||
| `node scripts/browser/compare-imports.mjs <ts.json> <r4.json>` | TS baseline vs Rust import: durations, RSS growth, per-file outcome agreement |
|
||||
| `node scripts/browser/r4-large-files.mjs` | files of 10 MiB and more, both read paths, `results/<date>-r4-large-files.json`, table |
|
||||
| `node scripts/browser/r4-leak-series.mjs` | leak series per engine and document, WebKit repetition, `results/<date>-r4-leak-series.json` |
|
||||
| `node scripts/browser/import-baseline.mjs --out <file>` | R4.3d: the same baseline on the Rust application build (`results/<date>-r4-app-import.json`) |
|
||||
| `node scripts/browser/compare-app-imports.mjs <ts.json> <rust.json>` | two application import baselines: groups, large files, outcome and message per file |
|
||||
| `node scripts/browser/r4-app-csp.mjs` | the import under both CSP variants and `report-uri`, `results/<date>-r4-csp.json` |
|
||||
| `node scripts/browser/r4-app-leak-series.mjs` | leak series and WebKit repetition on Home, `results/<date>-r4-app-leak-series.json` |
|
||||
|
||||
Options of the baseline scripts: `--engines chromium,firefox,webkit` (default
|
||||
all three), `--out <file>`, `--reports demo,L,CAP` (export runs to keep),
|
||||
@@ -72,8 +79,13 @@ the module copies live during the run, default the OS temporary directory).
|
||||
<ts-baseline.json>` (default the newest `results/*-ts-baseline.json`),
|
||||
`--scratch`, `--out`. `r4-leak-series.mjs` takes `--engines`, `--sections
|
||||
leak,webkit-repeat`, `--reps 3`, `--imports 6`, `--webkit-imports 20`,
|
||||
`--read`, `--scratch`, `--out`. The results files are written before the
|
||||
tables are printed.
|
||||
`--read`, `--scratch`, `--out`. `r4-app-csp.mjs` takes `--engines`, `--out`;
|
||||
`r4-app-leak-series.mjs` takes `--engines`, `--sections leak,webkit-repeat`
|
||||
(add `control` for the navigation-only control),
|
||||
`--reps 3`, `--imports 6`, `--webkit-imports 20`, `--scratch`, `--out`. The
|
||||
results files are written before the tables are printed. Exit codes:
|
||||
`compare-app-imports.mjs` and `r4-app-csp.mjs` exit 1 when a difference is
|
||||
not declared or a run is not as expected.
|
||||
|
||||
## The server (`serve.mjs`)
|
||||
|
||||
@@ -93,12 +105,19 @@ tables are printed.
|
||||
`/pkg/` and `/pkg-proofs/` (`packages/core-wasm`). A mounted path is a
|
||||
file or a 404, never the SPA fallback, and never a file outside its
|
||||
directory. Without the option the server answers exactly as before.
|
||||
- `startServer({ reportViolations: true })` (R4.3d, `r4-app-csp.mjs`; no CLI
|
||||
option) appends `report-uri /__csp-report` to the policy, its directives
|
||||
unchanged, and keeps every report the browser POSTs there (64 KiB cap per
|
||||
report) in `server.reports`.
|
||||
|
||||
## What each script measures
|
||||
|
||||
Every run records the engine version; every results file records the host
|
||||
(CPU, RAM, MemAvailable at start and end), the build (mtime, chunk sizes,
|
||||
HEAD), the served CSP and the watchdog facts with its caveat.
|
||||
HEAD), the served CSP and the watchdog facts with its caveat. `headCommit`
|
||||
is HEAD when the run starts, which is not always the commit the build was
|
||||
made from; since R4.3d the build facts carry each chunk's sha256 (sheet,
|
||||
entry, wasm, import worker), which identify the build itself.
|
||||
|
||||
Memory comes from the watchdog's samples of the browser's process tree:
|
||||
summed VmRSS of all its processes, the content processes alone (Chromium
|
||||
@@ -299,8 +318,76 @@ The perimeter is the same files, groups, engines, RSS metrics and watchdog;
|
||||
the page is not. The TS baseline ran the application (Home, core loaded
|
||||
during the import, hydrate, navigation to `/editor`); the Rust runs use the
|
||||
measurement page, which compiles the module at page load and stops at the
|
||||
parsed result. The R4.3 application will be measured by `import-baseline.mjs`
|
||||
itself.
|
||||
parsed result. The R4.3 application is measured by `import-baseline.mjs`
|
||||
itself and compared by `compare-app-imports.mjs` (below).
|
||||
|
||||
### Application comparison (`compare-app-imports.mjs`, R4.3d)
|
||||
|
||||
Two results files of `import-baseline.mjs`: the TypeScript application
|
||||
(R4.1) and the Rust one (the import worker), so the page, files, groups,
|
||||
engines, RSS metrics and watchdog are the same and only the build differs.
|
||||
Per engine and group: files, same outcome, same outcome and message, median
|
||||
Node-clock durations, max summed and content RSS growth, the longest
|
||||
Chromium main-thread long task on each side (W5: none over 50 ms; the
|
||||
`longtask` entry type only reports tasks over 50 ms) and the Rust runs that
|
||||
had one. The message is what the practitioner sees: the inline error text,
|
||||
or the alert lines after an import that opened the editor, compared as
|
||||
exact text. The declared differences (plan §A.3) are expected with their
|
||||
own message in every engine: `values-1m` → `error_attachment_stripped`
|
||||
(OD-3), `surrogate-content-overwritten`, `surrogate-version-overwritten`,
|
||||
`two-files-decoy-first` → `error_lone_surrogate` (OD-4), the TS side opening
|
||||
the editor. Any other outcome or message difference is printed as `NOT
|
||||
DECLARED`; it, a declared file not as declared, or a pair present on one
|
||||
side only sets exit code 1. A last table puts the `read` group's files of
|
||||
10 MiB and more side by side, per engine.
|
||||
|
||||
### CSP proof (`r4-app-csp.mjs`, R4.3d)
|
||||
|
||||
One reference PDF (`pdf/r3/demo.fr.logos.pdf`) picked on Home, a fresh
|
||||
browser per engine and policy, four passes: the served policy `with`
|
||||
(DEPLOY.md, `'wasm-unsafe-eval'`) must open the editor with no violation
|
||||
other than the footer's external image; `without` (the keyword removed) must
|
||||
show the inline line « Le moteur de lecture n'a pas pu être chargé.
|
||||
Réessayez l'import. », the pick button enabled again, no page error, and a
|
||||
second pick of the same file must show the line again (counted by a
|
||||
`MutationObserver` on the error line, `lib/page-probes.mjs`
|
||||
`countErrorLines`). Then both policies again with `report-uri` appended
|
||||
(the enforced directives unchanged). Observed: the document's
|
||||
`securitypolicyviolation` events, every console message of the page and its
|
||||
workers (`ConsoleMessage.worker()`), the workers created and closed, and in
|
||||
the reporting passes the reports the browser POSTs (document or worker
|
||||
path, directive, blocked URI). A worker's own violation event fires in its
|
||||
scope, out of the harness's reach: the reports are the channel that names
|
||||
it, where the engine sends them.
|
||||
|
||||
### Application leak series (`r4-app-leak-series.mjs`, R4.3d)
|
||||
|
||||
The documents: the L envelope and the 16 MiB dense numbers built by
|
||||
`lib/hostile-classes.mjs` with `packages/core-wasm/pkg` (its wasm digest is
|
||||
recorded beside the build's), and a rescue copy, `report-v3.demo.json`
|
||||
copied as `copie-de-secours-demo.json`; all in a scratch directory removed
|
||||
at the end. Per engine, document and repetition, a fresh browser and ONE
|
||||
tab: Home, the start level (forced GC + 1 s in Chromium, 5 s idle
|
||||
elsewhere), then one import (the init cost, counted apart) and six more,
|
||||
each by `page.goto('/')` and the pick button; when the session in progress
|
||||
brings up « Remplacer le bilan en cours ? », « Remplacer » opens the picker
|
||||
(Playwright's `filechooser`), which gets the file. The end of an import is
|
||||
the first of: `/editor`, an alert, the inline error line (120 s timeout);
|
||||
then 2 s idle and a reading (Chromium: forced GC + 1 s first; Firefox and
|
||||
WebKit: idle only, indicative), 5 s idle and a final reading after the
|
||||
last. A reading after an import that opened the editor includes the editor
|
||||
page and its own core instance. The row keeps the levels (content and
|
||||
summed), the init delta, the six per-import deltas, the growth over the
|
||||
last five (L7 − L2) and at the final reading against the 10 MiB tolerance
|
||||
of BDR-058, the series peak, each import's outcome, message and durations,
|
||||
the workers created and closed, and the console errors (page or worker).
|
||||
`webkit-repeat`: WebKit, one Home page without navigation, 20 consecutive
|
||||
picks of the 16 MiB dense document; the inline lines with their counts,
|
||||
page errors, console errors (worker ones and the footer image apart),
|
||||
workers created and closed, the content level after each import and the
|
||||
series peak. `control` (opt-in, `--sections control`): the series without
|
||||
the pick, the same tab, `page.goto('/')` steps, idle and readings, so the
|
||||
navigations' own cost can be told from the imports' (rows in `control`).
|
||||
|
||||
## Layout
|
||||
|
||||
@@ -309,6 +396,7 @@ scripts/browser/
|
||||
├─ serve.mjs, ts-baseline.mjs, export-baseline.mjs, import-baseline.mjs
|
||||
├─ inflate-verdicts.mjs, summarize.mjs
|
||||
├─ r4-import.mjs, compare-imports.mjs, r4-large-files.mjs, r4-leak-series.mjs
|
||||
├─ compare-app-imports.mjs, r4-app-csp.mjs, r4-app-leak-series.mjs (R4.3d)
|
||||
├─ r4-import-page/ index.html, main.js (compile, routing, one worker per
|
||||
│ import, worker events), worker.js (the import worker, both read
|
||||
│ paths), proofs-worker.js
|
||||
|
||||
Reference in new issue
Block a user