docs(docs): RUST.md §10.8 R4.6 record (buffers, memory, parity, E3/E4 three engines, release series, W1, risks); ledger targets filled; compare-exports script; roundtrip raster-failure case; TODO R4.6 closed; memory BDR-062, LRN-063/064, journal

This commit is contained in:
bchanot committed 2026-10-19 02:49:42 +02:00
1 parent cdcdda8e1c
commit 264c5fa3fc
14 files changed
+5230 -38

No files matched your search

+6
View File
@@ -469,3 +469,9 @@ Status: active.
Context: R4.4 report (RUST.md §10.6: O1 12 runs 2,124 calls, O4/O5/O6 exact). Owner decision 2026-10-18.
Decision: R4.5 on the branch: content emitter + numberToString, pdf-writer, PNG gate and decode, links, Info, attachment, self-check, from_envelope. Gates: parity with O2, O4, O6 and applicable goldens (declared differences kept, oracles never edited to hide a gap); `qpdf --check`, poppler 150 dpi 0 px vs R3, O11 reads; restoration compat: R4 PDF read by Rust reader + kept TS reader, envelope/N-1 copies, no bilan data loss on export → import; PNG and PDF structure protections before large allocations (plan caps), invalid cases and messages checked; measure performance, allocations, real wasm size with the writer linked (W1 600 KB per plan), compared with TS baselines on same files/conditions; R4.3 import and worker guarantees untouched; WebKit reserves and iOS recette still blocking merge; gates green; RUST.md documented. Stop at R4.5 checkpoint: components, oracle/golden results, compat, perf/memory, wasm size, gaps/risks, R4.6 recommendation.
Status: active.
## BDR-062 | 2026-10-19 | R4.5 validated; R4.6 session export authorised; chunked file, decode on arrival, catalog last
Context: owner decision 2026-10-19 on the R4.5 report (RUST.md §10.7). R4.6 brief: ExportSession + app driver, rasters as bytes one by one, OD-2 buffers documented, `view_raster_failed` on raster failure, parity + restoration (Rust → Rust, Rust → TS reader, N-1), E3/E4 three engines same data, shipped W1 measured, TS engine kept until R4.8, no merge, stop at R4.6.
Decision (design, measured): session in main instance per OD-2. File written in chunks never reallocated (target 1 MiB doubling to 8 MiB), image object written at `add_raster` (PNG + planes freed in the call), logos kept until branding batch completes (slot order as engine), catalog + page tree objects written last, file handed to JS in parts → `new Blob(parts)`, self-check scans attachment chunk behind header. R4 digests (own bytes, not TS oracle) re-frozen once for it; O2 suite + qpdf + poppler re-run green. Hex strings upper-case as pdf-lib (B4). Alternatives measured and dropped: single `Vec` doubling (125 MiB for 44 MiB file, realloc spike), two buffers (2 × file at finish), 1 MiB fixed chunks (0.12 MB fragmentation per view).
Status: active; owner checkpoint R4.6 pending.
+1
View File
@@ -292,3 +292,4 @@ Owner validated R4.0 plan with conditions (BDR-057, plan §A.6, LRN-059/060). R3
- 2026-10-18 R4.4 done (70007e0, 1550d21): pdf::write text/afm_data/dates (O4 55,992 widths bit-exact, 1,168 wraps, safeText every code point, upper 1,580 = Rust to_uppercase, O5 tables, O6 6,468 cells), input checks, layouts → DrawLog; O1 12 runs 2,124 calls equal, step6 text/images 24 derived. Layout L 3 ms, CAP 24 ms release. Nothing wired, module size unchanged. STOP before R4.5.
- 2026-10-18 owner validated R4.4; R4.5 go (BDR-061). Subtasks R4.5a-f in TODO. Tooling present: qpdf 12.3.2, poppler 26.01 (pdftoppm, pdfdetach), crates.io reachable.
- 2026-10-18 R4.5 done (d420f67..b44dd80): content emitter (60 streams byte-equal, numberToString 703 + V8 pow10 quirk), PNG gate + UPNG decoder (O6 108/108), own object writer (pdf-writer dropped: numberToString everywhere, no dep), serialiser, export + self-check, from_envelope; O2 14 runs equal (streams after B3, planes, links, Info, attachment), qpdf clean, poppler 0 px, O11 + N-1 + TS reader read R4 PDFs, wasm = native digests; Node TS→Rust demo 198→36 ms, L 772→57, CAP 5.7 s→0.22 s; writer linked 531.6 KB gzip (proofs build), shipped 426 KB. Gate PASS 4 LOW → hardenings. Open: one-shot path holds PNGs twice (R4.6 session must stream), L real rasters 5 s native (deflate 6), E3 judged at R4.6. STOP before R4.6.
- 2026-10-19 owner validated R4.5; R4.6 go (BDR-062). R4.6 done (9e688b6..): ExportSession (decode on arrival, chunked never-realloc file 1→8 MiB, catalog last, parts → Blob, self-check on attachment chunk), views.rs (compose_highlight requests, raster_size_of O4 57/57), wasm ExportSession + CoreExportSession, app export.ts on session (abort on unmount, User Timing), labels.ts; app suites read content streams (pdfRead.ts), app-path bytes = R4 digests (re-frozen: object order B2, hex upper-case B4), Step 6 goldens via app path, 14 O2 runs through module = digests, request SVG = TS compose text, export Rust → import Rust / TS reader / N-1 ok. E3 Chromium demo 0.67, L 0.74 (Firefox 0.66/0.67, WebKit 0.91/0.95); E4 CAP completes 3 engines (TS stopped by ceiling); peaks lower (L Chromium 805→470 MiB). Linear memory L real 62 MiB flat over 7 exports; Chromium per-export RSS growth ≈ 20 MiB on L same as TS control, plateau after 8. Shipped 519.7 KB gzip (W1). rust-check 0, pnpm check 1,099 tests, ledger 11 pending (R4.7). J2 kit + procedure. STOP before R4.7.
+13
View File
@@ -478,3 +478,16 @@ Apply: any shared pre-scan / lexer feeding several caps (R4.3 worker, R5 pipelin
- `parseVersioned` tested `typeof version === 'number'` on `JSON.parse` output: `1e999` → `Infinity`, a number, so the probe accepted; `JSON.stringify` then wrote `null`, so the core saw no version → `no_attachment`. A Rust port that rewrote overflow → `null` before the probe gave `attachment_stripped` (3 O8 rows).
- Fix: probe on a copy where overflowing tokens stay finite numbers (`rewrite_overflow_numbers_as_finite`, `0`), hand the `null` form to the core. Same family as LRN-059 (overflow, lone surrogates): every JS parse → stringify hop is a transformation to reproduce step by step, in order.
Apply: porting any JS reader whose acceptance test ran between parse and stringify (R4 writer inputs, R5 pipeline, server validation).
## LRN-063 | 2026-10-19 | wasm linear memory: never grow one big Vec; long-lived chunks big enough not to interleave with transients
- Growing `Vec<u8>` for a 44 MiB file in wasm (dlmalloc) peaked 125 MiB: realloc keeps old + new while copying; decode transients (≈ 10 MB per PNG) sit between file and heap top so no in-place growth. Linear memory never shrinks → spike is the high-water for the page.
- Fixed chunks (never realloc) remove the spike. 1 MiB chunks still cost 0.12 MB per view (long-lived alloc every other raster interleaved with transients → fragmentation); 8 MiB chunks cost 0. Adaptive target 1 → 8 MiB: small files pay one small chunk, big files few long-lived allocs. `shrink_to_fit` on seal gives slack back.
- Hand chunks to JS one by one (`take_part`, freed in module), `new Blob(parts)`: file never held twice across heaps.
Apply: any wasm producer of large outputs (R5 pipeline, future image work): measure stage by stage with `memory.buffer.byteLength`, never trust the estimate.
## LRN-064 | 2026-10-19 | Test facts from the produced PDF, not from draw-call spies; recorder order ≠ file order
- Step 6 goldens were recorded by spying pdf-lib `drawText`/`drawImage`: footers recorded after every page's content (global call order). Read back from content streams, facts come page by page. Same set, same within-page order: compare against the golden stably sorted by page.
- `tests/helpers/pdfRead.ts`: pdf-lib loads the file, inflates each content stream, parses `Tf/Tm/Tj/ET` and `cm … Do`, resolves `/F1` through page resources, WinAnsi = windows-1252. Lets 16 roundtrip + 7 goldens cases run unchanged on the Rust output.
Apply: when an implementation is swapped under a test that spied the old one, read the artefact instead of mocking the new one; keep the old generator pinned to the old engine (r4.writer-oracles → `exportReportArchive`).
+8 -8
View File
@@ -242,14 +242,14 @@ feat/findings-tree-v2 merged (FindingsTreePicker tracked in HEAD); all work belo
- [x] R4.5e wasm: proofs export `export_pdf_for_test` (input JSON + rasters) → wasm digests == native digests; module size with the writer linked (W1 ≤ 600 KB gzip); Node timings/allocations on demo, L, CAP vs TS baseline (same files)
- [x] R4.5f (done 2026-10-18; STOP before R4.6) record RUST.md §10.7, ledger targets, suites green; STOP before R4.6
- [ ] R4.6 app export (owner go 2026-10-19; session in main instance per OD-2; stop before R4.7)
- [ ] R4.6a core `pdf/write/session.rs` `ExportSession` (B.1.4 state machine: `new` → branding batch → observation k batches → done; `add_raster` decodes + writes the image object on arrival, PNG and planes dropped; `raster_failed` → warning; closed kinds `unknown_key` `duplicate_key` `out_of_order`); `views.rs` (`raster_size_of` on O4, `compose_highlight` per (observation, view), branding SVG requests); `objects.rs` streams into one buffer (catalog/pages written at the end, B2: R4 digests re-frozen once, declared); layout split (branding / observation / finish) over an `ImageSink`; `export_pdf(input, &Rasters)` = a driver over the session (one code path); decode failure of a view → `view_raster_failed` (TS `embedPng` throw), not `self_check_failed`
- [ ] R4.6b cargo: O1/O4/O6 and O2 suites green on the session; view SVG = TS `renderHighlightedView` text (compose oracle), raster sizes = O4; state-machine refusals; warnings order (rejection order then view order); memory: linear high-water on demo/L/CAP via the proofs build vs PDF size
- [ ] R4.6c facade: `ExportSession` wasm-bindgen struct (`new(input)`, `next()` → `ExportStep` JSON, `add_raster(key, bytes)`, `raster_failed(key)`, `finish()` → bytes, `warnings()`), ts-rs `ExportInput` `RasterRequest` `ExportStep` `ExportWarning` `ExportErrorKind`; `CoreRuntime` session wrapper (generation-bound, `invoke`, `free` in finally); proofs export kept for the digests
- [ ] R4.6d app: `apps/app/src/pdf/labels.ts` (verbatim from `packages/pdf/src/i18n`), `export.ts` on the session (snapshot, branding, `new Date()`, `next` loop, `browserRasterizer` under `Promise.all`, `raster_failed` in rejection order then `add_raster` in request order, `finish`, free); EditorRoute alerts unchanged; `exportReportToPdf` keeps its signature; `@faunosteo/pdf` leaves `apps/app/src` (tests keep it until R4.8)
- [ ] R4.6e app suites: pdf.goldens (Step 6 text/images/links via the app path, Rust output), pdf.roundtrip, pdf.export.app (re-export via core), EditorRoute.export, coreStopped/coreFailures mocks; app-path bytes = R4 digests (stub rasters, FIXED_EXPORTED_AT); 612 leaves exported + re-imported on Rust; export Rust → import Rust, → TS reader, → N-1 (O11 + Zod): no loss
- [ ] R4.6f browsers (scripts/browser): Rust vs TS composed-view rasters pixel-identical (Chromium, Firefox, WebKit); E3/E4 harness demo/L/CAP, same data, TS vs Rust: total, raster, serialise, linear memory, JS heap, RSS; release proof on success / raster error / cancel (unmount) / recovery (trap mid-session); W1 shipped module with the writer linked (gzip -9; report > 550 KB)
- [ ] R4.6g docs: RUST.md §10.8 (buffers ownership and lifetimes, allocations, release proofs, E3/E4 tables, W1, deviations: catalog at the end, decode at arrival, logo batch order), DEPLOY.md if the module size line moves, fixtures README, ledger rows (pdf.goldens, pdf.roundtrip targets filled), memory (BDR, LRN, journal)
- [ ] R4.6h owner recette procedure (visual + functional on the owner's devices: FR/EN, logos, annotations, real rasters, links, L on the phone), report, STOP before R4.7
- [x] R4.6a core `pdf/write/session.rs` `ExportSession` (B.1.4 state machine: `new` → branding batch → observation k batches → done; `add_raster` decodes + writes the image object on arrival, PNG and planes dropped; `raster_failed` → warning; closed kinds `unknown_key` `duplicate_key` `out_of_order`); `views.rs` (`raster_size_of` on O4, `compose_highlight` per (observation, view), branding SVG requests); `objects.rs` streams into one buffer (catalog/pages written at the end, B2: R4 digests re-frozen once, declared); layout split (branding / observation / finish) over an `ImageSink`; `export_pdf(input, &Rasters)` = a driver over the session (one code path); decode failure of a view → `view_raster_failed` (TS `embedPng` throw), not `self_check_failed`
- [x] R4.6b cargo: O1/O4/O6 and O2 suites green on the session; view SVG = TS `renderHighlightedView` text (compose oracle), raster sizes = O4; state-machine refusals; warnings order (rejection order then view order); memory: linear high-water on demo/L/CAP via the proofs build vs PDF size
- [x] R4.6c facade: `ExportSession` wasm-bindgen struct (`new(input)`, `next()` → `ExportStep` JSON, `add_raster(key, bytes)`, `raster_failed(key)`, `finish()` → bytes, `warnings()`), ts-rs `ExportInput` `RasterRequest` `ExportStep` `ExportWarning` `ExportErrorKind`; `CoreRuntime` session wrapper (generation-bound, `invoke`, `free` in finally); proofs export kept for the digests
- [x] R4.6d app: `apps/app/src/pdf/labels.ts` (verbatim from `packages/pdf/src/i18n`), `export.ts` on the session (snapshot, branding, `new Date()`, `next` loop, `browserRasterizer` under `Promise.all`, `raster_failed` in rejection order then `add_raster` in request order, `finish`, free); EditorRoute alerts unchanged; `exportReportToPdf` keeps its signature; `@faunosteo/pdf` leaves `apps/app/src` (tests keep it until R4.8)
- [x] R4.6e app suites: pdf.goldens (Step 6 text/images/links via the app path, Rust output), pdf.roundtrip, pdf.export.app (re-export via core), EditorRoute.export, coreStopped/coreFailures mocks; app-path bytes = R4 digests (stub rasters, FIXED_EXPORTED_AT); 612 leaves exported + re-imported on Rust; export Rust → import Rust, → TS reader, → N-1 (O11 + Zod): no loss
- [x] R4.6f browsers (scripts/browser): Rust vs TS composed-view rasters pixel-identical (Chromium, Firefox, WebKit); E3/E4 harness demo/L/CAP, same data, TS vs Rust: total, raster, serialise, linear memory, JS heap, RSS; release proof on success / raster error / cancel (unmount) / recovery (trap mid-session); W1 shipped module with the writer linked (gzip -9; report > 550 KB)
- [x] R4.6g docs: RUST.md §10.8 (buffers ownership and lifetimes, allocations, release proofs, E3/E4 tables, W1, deviations: catalog at the end, decode at arrival, logo batch order), DEPLOY.md if the module size line moves, fixtures README, ledger rows (pdf.goldens, pdf.roundtrip targets filled), memory (BDR, LRN, journal)
- [x] R4.6h (done 2026-10-19; STOP before R4.7) owner recette procedure (visual + functional on the owner's devices: FR/EN, logos, annotations, real rasters, links, L on the phone), report, STOP before R4.7
- [ ] R4.7 report-compare in Rust
- [ ] R4.8 deletions + docs + ledger census
- [ ] R4.9 verifier + security + owner final acceptance → merge on owner signal
+43
View File
@@ -13,6 +13,7 @@ import { dirname, resolve } from 'node:path'
import type { Observation, Report } from '@faunosteo/core-wasm/types'
import { composeHighlightedViewSvg } from '@faunosteo/pdf'
import { exportReportToPdf } from '@/pdf/export'
import { browserRasterizer } from '@/pdf/browserRasterizer'
import { defaultPdfLabels } from '@/pdf/labels'
import { importReportFromPdf, ImportError } from '@/pdf/import'
import { formatDate } from '@/lib/dates'
@@ -305,6 +306,48 @@ describe('PDF content on a two-observation report', () => {
})
})
describe('a raster the browser cannot draw', () => {
it('is a view_raster_failed warning; the export continues without that image', async () => {
const report = minimalReport(sheet, { observations: [fullObservation()] })
const whole = await readDrawing(await exportPdf(report, 'fr'))
const failing = vi.mocked(browserRasterizer)
failing.mockImplementation(async (svg) => {
// The head view's picture is framed on the head's own viewBox.
if (svg.includes('viewBox="60 100 500 380"')) {
throw new Error('canvas lost')
}
const { ONE_PX_PNG } = await import('../helpers/goldens')
return ONE_PX_PNG
})
try {
const { pdf, warnings } = await exportReportToPdf(report, sheet, {
locale: 'fr',
})
expect(warnings).toEqual([
{ kind: 'view_raster_failed', observationId: 'obs-full', viewId: 'head' },
])
const bytes = await bytesOf(pdf)
const { images, texts } = await readDrawing(bytes)
// One image fewer on the observation page (the head view), the logos and
// the main view drawn; the page keeps its texts and the file still
// carries the whole report.
expect(images.filter((i) => i.page === 0)).toHaveLength(
whole.images.filter((i) => i.page === 0).length - 1,
)
expect(texts.map((t) => t.text)).toContain(fr['pdf.view.general']!)
expect(texts.map((t) => t.text)).not.toContain(
`${fr['pdf.view.detail_prefix']}TÊTE (VUE LATÉRALE GAUCHE)`,
)
expect((await readBack(bytes)).report).toEqual(report)
} finally {
failing.mockImplementation(async () => {
const { ONE_PX_PNG } = await import('../helpers/goldens')
return ONE_PX_PNG
})
}
})
})
describe('attachment rejection', () => {
async function pdfWith(name: string, payload: unknown): Promise<Uint8Array> {
const doc = await PDFDocument.create()
+30 -28
View File
@@ -14,40 +14,41 @@ apps/app/tests/unit/pdf.browserRasterizer.test.ts browserRasterizer > returns PN
apps/app/tests/unit/pdf.browserRasterizer.test.ts browserRasterizer > falls back to toDataURL when toBlob returns null kept vitest (same case) - -
apps/app/tests/unit/pdf.export.app.test.ts the archive survives its resources > T2 catalog changed: the envelope re-exports the archived sheet, not the revised one ported cargo pdf_serialize::restoration_round_trip_loses_nothing - export_from_envelope
apps/app/tests/unit/pdf.export.app.test.ts the archive survives its resources > scenario 3 branding changed: the envelope re-exports the archived branding and never fetches ported cargo pdf_serialize::restoration_round_trip_loses_nothing - export_from_envelope
apps/app/tests/unit/pdf.goldens.test.ts golden inputs > the 2×1 PNG decodes as 2×1 and the 1×1 as 1×1 replaced R4.4/R4.5 cargo goldens (pending) O6 pdf-lib embedPng check of the golden rasters
apps/app/tests/unit/pdf.goldens.test.ts golden inputs > the 2×1 PNG decodes as 2×1 and the 1×1 as 1×1 replaced vitest (same case); cargo pdf_png::every_o6_decode_matches_pdf_lib O6 pdf-lib embedPng check of the golden rasters
apps/app/tests/unit/pdf.goldens.test.ts golden inputs > the demo report covers the sheet features the goldens must freeze kept vitest (same case) - inputs of the kept views cases
apps/app/tests/unit/pdf.goldens.test.ts golden inputs > the v2unresolved report really carries unresolved findings kept vitest (same case) - inputs of the kept views cases
apps/app/tests/unit/pdf.goldens.test.ts goldens of v2full > nologos > text, images and links per locale; same pagination across locales replaced R4.4/R4.5 cargo goldens (pending) O1 Step 6 text, images and links goldens
apps/app/tests/unit/pdf.goldens.test.ts goldens of v2full > logos > text, images and links per locale; same pagination across locales replaced R4.4/R4.5 cargo goldens (pending) O1 Step 6 text, images and links goldens
apps/app/tests/unit/pdf.goldens.test.ts goldens of v2full > nologos > text, images and links per locale; same pagination across locales; app-path bytes = native digest replaced vitest (same case, read from the file); cargo pdf_layout::step6_text_and_image_goldens_derive_from_the_log, pdf_serialize::o2_streams_images_links_info_and_attachment_match_the_r3_build O1 Step 6 text, images and links goldens
apps/app/tests/unit/pdf.goldens.test.ts goldens of v2full > logos > text, images and links per locale; same pagination across locales; app-path bytes = native digest replaced vitest (same case, read from the file); cargo pdf_layout::step6_text_and_image_goldens_derive_from_the_log, pdf_serialize::o2_streams_images_links_info_and_attachment_match_the_r3_build O1 Step 6 text, images and links goldens
apps/app/tests/unit/pdf.goldens.test.ts goldens of v2full > highlighted views: same facts but titles and data attributes kept vitest (same case) - app path
apps/app/tests/unit/pdf.goldens.test.ts goldens of demo > nologos > text, images and links per locale; same pagination across locales replaced R4.4/R4.5 cargo goldens (pending) O1 Step 6 text, images and links goldens
apps/app/tests/unit/pdf.goldens.test.ts goldens of demo > logos > text, images and links per locale; same pagination across locales replaced R4.4/R4.5 cargo goldens (pending) O1 Step 6 text, images and links goldens
apps/app/tests/unit/pdf.goldens.test.ts goldens of demo > nologos > text, images and links per locale; same pagination across locales; app-path bytes = native digest replaced vitest (same case, read from the file); cargo pdf_layout::step6_text_and_image_goldens_derive_from_the_log, pdf_serialize::o2_streams_images_links_info_and_attachment_match_the_r3_build O1 Step 6 text, images and links goldens
apps/app/tests/unit/pdf.goldens.test.ts goldens of demo > logos > text, images and links per locale; same pagination across locales; app-path bytes = native digest replaced vitest (same case, read from the file); cargo pdf_layout::step6_text_and_image_goldens_derive_from_the_log, pdf_serialize::o2_streams_images_links_info_and_attachment_match_the_r3_build O1 Step 6 text, images and links goldens
apps/app/tests/unit/pdf.goldens.test.ts goldens of demo > highlighted views: same facts but titles and data attributes kept vitest (same case) - app path
apps/app/tests/unit/pdf.goldens.test.ts goldens of v2unresolved > nologos > text, images and links per locale; same pagination across locales replaced R4.4/R4.5 cargo goldens (pending) O1 Step 6 text, images and links goldens
apps/app/tests/unit/pdf.goldens.test.ts goldens of v2unresolved > logos > text, images and links per locale; same pagination across locales replaced R4.4/R4.5 cargo goldens (pending) O1 Step 6 text, images and links goldens
apps/app/tests/unit/pdf.goldens.test.ts goldens of v2unresolved > nologos > text, images and links per locale; same pagination across locales; app-path bytes = native digest replaced vitest (same case, read from the file); cargo pdf_layout::step6_text_and_image_goldens_derive_from_the_log, pdf_serialize::o2_streams_images_links_info_and_attachment_match_the_r3_build O1 Step 6 text, images and links goldens
apps/app/tests/unit/pdf.goldens.test.ts goldens of v2unresolved > logos > text, images and links per locale; same pagination across locales; app-path bytes = native digest replaced vitest (same case, read from the file); cargo pdf_layout::step6_text_and_image_goldens_derive_from_the_log, pdf_serialize::o2_streams_images_links_info_and_attachment_match_the_r3_build O1 Step 6 text, images and links goldens
apps/app/tests/unit/pdf.goldens.test.ts goldens of v2unresolved > highlighted views: same facts but titles and data attributes kept vitest (same case) - app path
apps/app/tests/unit/pdf.goldens.test.ts report-v3.bare.pdf > is the demo report exported bare by Step 5 and imports with no archive kept vitest (same case) - bare v3 import
apps/app/tests/unit/pdf.import.test.ts importReportFromPdf error kinds > no_attachment for a PDF without the attachment replaced R4.3/R4.5 (pending) - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.import.test.ts importReportFromPdf error kinds > attachment_stripped for a stamped archive whose attachment was removed replaced R4.3/R4.5 (pending) - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.import.test.ts importReportFromPdf error kinds > invalid_pdf for an oversized file, before parsing it replaced R4.3/R4.5 (pending) - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.import.test.ts importAttachment on the core (L1) > refuses an attachment with a lone surrogate as lone_surrogate, never rewritten replaced R4.3/R4.5 (pending) - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.import.test.ts importAttachment on the core (L1) > imports normal text with pairs and literal backslashes unchanged replaced R4.3/R4.5 (pending) - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts export on a full v3 report (FR) > produces one page per observation plus the conclusion, labels from the sheet replaced R4.3/R4.5 (pending) - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts export on a full v3 report (FR) > attaches the envelope and roundtrips in both locales replaced R4.3/R4.5 (pending) - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts export on a full v3 report (FR) > highlights the observation zones of a view and omits the other markers replaced R4.3/R4.5 (pending) - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts PDF content on a two-observation report > prints the empty marker for a zoneless observation and keeps its findings replaced R4.3/R4.5 (pending) - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts PDF content on a two-observation report > prints an unknown annotation id and an unknown finding zone raw replaced R4.3/R4.5 (pending) - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts PDF content on a two-observation report > draws the EN dictionary, annotation names and finding snapshots replaced R4.3/R4.5 (pending) - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts PDF content on a two-observation report > draws free findings, comments, the conclusion page and the header on every page replaced R4.3/R4.5 (pending) - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts PDF content on a two-observation report > sets the PDF metadata and the archive keyword replaced R4.3/R4.5 (pending) - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts PDF content on a two-observation report > embeds the four bundled logos without any network request replaced R4.3/R4.5 (pending) - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts PDF content on a two-observation report > attaches osteo-report.json as a Flate EmbeddedFile, AFRelationship Data, "Faunosteo report archive v1" replaced R4.3/R4.5 (pending) - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts attachment rejection > reports no_attachment for a foreign JSON attachment (no version) replaced R4.3/R4.5 (pending) - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts attachment rejection > reports no_attachment for a v3 report failing validation replaced R4.3/R4.5 (pending) - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts import of the frozen v2 archive PDFs > migrates the full v2 report: ids, views, paths, severities, unresolved findings replaced R4.3/R4.5 (pending) - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts import of the frozen v2 archive PDFs > keeps a v2 finding whose node was removed and a zone whose id is unknown, both flagged replaced R4.3/R4.5 (pending) - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts import of the frozen v2 archive PDFs > migrates the minimal v2 report replaced R4.3/R4.5 (pending) - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts import of the frozen v2 archive PDFs > refuses unknown versions and unrelated PDFs with typed errors replaced R4.3/R4.5 (pending) - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.import.test.ts importReportFromPdf error kinds > no_attachment for a PDF without the attachment replaced vitest (same case, export on the core); cargo pdf_import (kinds), pdf_serialize::restoration_round_trip_loses_nothing - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.import.test.ts importReportFromPdf error kinds > attachment_stripped for a stamped archive whose attachment was removed replaced vitest (same case, export on the core); cargo pdf_import (kinds), pdf_serialize::restoration_round_trip_loses_nothing - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.import.test.ts importReportFromPdf error kinds > invalid_pdf for an oversized file, before parsing it replaced vitest (same case, export on the core); cargo pdf_import (kinds), pdf_serialize::restoration_round_trip_loses_nothing - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.import.test.ts importAttachment on the core (L1) > refuses an attachment with a lone surrogate as lone_surrogate, never rewritten replaced vitest (same case, export on the core); cargo pdf_import (kinds), pdf_serialize::restoration_round_trip_loses_nothing - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.import.test.ts importAttachment on the core (L1) > imports normal text with pairs and literal backslashes unchanged replaced vitest (same case, export on the core); cargo pdf_import (kinds), pdf_serialize::restoration_round_trip_loses_nothing - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts export on a full v3 report (FR) > produces one page per observation plus the conclusion, labels from the sheet replaced vitest (same case, read from the file); cargo pdf_serialize::restoration_round_trip_loses_nothing from R4.8 - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts export on a full v3 report (FR) > attaches the envelope and roundtrips in both locales replaced vitest (same case, read from the file); cargo pdf_serialize::restoration_round_trip_loses_nothing from R4.8 - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts export on a full v3 report (FR) > highlights the observation zones of a view and omits the other markers replaced vitest (same case, read from the file); cargo pdf_serialize::restoration_round_trip_loses_nothing from R4.8 - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts PDF content on a two-observation report > prints the empty marker for a zoneless observation and keeps its findings replaced vitest (same case, read from the file); cargo pdf_serialize::restoration_round_trip_loses_nothing from R4.8 - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts PDF content on a two-observation report > prints an unknown annotation id and an unknown finding zone raw replaced vitest (same case, read from the file); cargo pdf_serialize::restoration_round_trip_loses_nothing from R4.8 - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts PDF content on a two-observation report > draws the EN dictionary, annotation names and finding snapshots replaced vitest (same case, read from the file); cargo pdf_serialize::restoration_round_trip_loses_nothing from R4.8 - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts PDF content on a two-observation report > draws free findings, comments, the conclusion page and the header on every page replaced vitest (same case, read from the file); cargo pdf_serialize::restoration_round_trip_loses_nothing from R4.8 - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts PDF content on a two-observation report > sets the PDF metadata and the archive keyword replaced vitest (same case, read from the file); cargo pdf_serialize::restoration_round_trip_loses_nothing from R4.8 - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts PDF content on a two-observation report > embeds the four bundled logos without any network request replaced vitest (same case, read from the file); cargo pdf_serialize::restoration_round_trip_loses_nothing from R4.8 - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts PDF content on a two-observation report > attaches osteo-report.json as a Flate EmbeddedFile, AFRelationship Data, "Faunosteo report archive v1" replaced vitest (same case, read from the file); cargo pdf_serialize::restoration_round_trip_loses_nothing from R4.8 - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts a raster the browser cannot draw > is a view_raster_failed warning; the export continues without that image replaced vitest (same case, read from the file); cargo pdf_serialize::restoration_round_trip_loses_nothing from R4.8 - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts attachment rejection > reports no_attachment for a foreign JSON attachment (no version) replaced vitest (same case, read from the file); cargo pdf_serialize::restoration_round_trip_loses_nothing from R4.8 - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts attachment rejection > reports no_attachment for a v3 report failing validation replaced vitest (same case, read from the file); cargo pdf_serialize::restoration_round_trip_loses_nothing from R4.8 - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts import of the frozen v2 archive PDFs > migrates the full v2 report: ids, views, paths, severities, unresolved findings replaced vitest (same case, read from the file); cargo pdf_serialize::restoration_round_trip_loses_nothing from R4.8 - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts import of the frozen v2 archive PDFs > keeps a v2 finding whose node was removed and a zone whose id is unknown, both flagged replaced vitest (same case, read from the file); cargo pdf_serialize::restoration_round_trip_loses_nothing from R4.8 - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts import of the frozen v2 archive PDFs > migrates the minimal v2 report replaced vitest (same case, read from the file); cargo pdf_serialize::restoration_round_trip_loses_nothing from R4.8 - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/pdf.roundtrip.test.ts import of the frozen v2 archive PDFs > refuses unknown versions and unrelated PDFs with typed errors replaced vitest (same case, read from the file); cargo pdf_serialize::restoration_round_trip_loses_nothing from R4.8 - pdf-lib leaves the app; read-back moves to cargo/lopdf or the wasm reader
apps/app/tests/unit/r4.compare-oracles.test.ts R4 O10 report:compare outputs of the TS CLI > builds byte-stable scenario PDFs (MAKE_R4_ORACLES writes) deleted - O10 generator; oracle files kept (R4.8)
apps/app/tests/unit/r4.compare-oracles.test.ts R4 O10 report:compare outputs of the TS CLI > records every invocation (written under MAKE_R4_ORACLES) deleted - O10 generator; oracle files kept (R4.8)
apps/app/tests/unit/r4.compare-oracles.test.ts R4 O10 report:compare outputs of the TS CLI > covers the 11 scenarios and marks every A.3 class at least once deleted - O10 generator; oracle files kept (R4.8)
@@ -85,6 +86,7 @@ apps/app/tests/unit/routes.EditorRoute.export.test.tsx EditorRoute export > call
apps/app/tests/unit/routes.EditorRoute.export.test.tsx EditorRoute export > passes the active locale (EN) kept vitest (same case) - mocks rewritten at R4.3 / R4.6
apps/app/tests/unit/routes.EditorRoute.export.test.tsx EditorRoute export > downloads bilan-<animal>-<date>.pdf through a blob URL it revokes after a delay kept vitest (same case) - mocks rewritten at R4.3 / R4.6
apps/app/tests/unit/routes.EditorRoute.export.test.tsx EditorRoute export > downloads then alerts editor.export_warnings naming the failed logo slots and views kept vitest (same case) - mocks rewritten at R4.3 / R4.6
apps/app/tests/unit/routes.EditorRoute.export.test.tsx EditorRoute export > aborts the export when the editor unmounts mid-way: no download, no alert kept vitest (same case) - mocks rewritten at R4.3 / R4.6
apps/app/tests/unit/routes.EditorRoute.export.test.tsx EditorRoute export > alerts editor.export_failed when the export rejects kept vitest (same case) - mocks rewritten at R4.3 / R4.6
apps/app/tests/unit/routes.HomeRoute.archive.test.tsx HomeRoute import of a Step 6 archive > same sheet: keeps the archive in the store and its mirror, alerts archive_ok, no rebase kept vitest (same case) - mocks rewritten at R4.3 / R4.6
apps/app/tests/unit/routes.HomeRoute.archive.test.tsx HomeRoute import of a Step 6 archive > other sheet: rebases onto the loaded sheet, labels from the archived snapshot, alert with the count kept vitest (same case) - mocks rewritten at R4.3 / R4.6
Can't render this file because it contains an unexpected character in line 44 and column 158.
+269 -1
View File
@@ -905,7 +905,7 @@ imports it and restyles `data-state` in place as before.
needs it.
- WASM budget: 396 KB of 600 KB used; R4 adds the PDF reader and writer.
## 10. R4: the PDF core in Rust (in progress; R4.1 freeze done 2026-10-18)
## 10. R4: the PDF core in Rust (in progress; R4.1 freeze 2026-10-18, export switched 2026-10-19)
Plan and contract: `.claude/tasks/plans/2026-10-17-rust-r4-pdf-core.md`
(revision 2, validated by the owner 2026-10-18 with the conditions of its
@@ -1612,3 +1612,271 @@ Residual risks and open points (R4.5):
- `MAX_ATTACHMENT_BYTES` keeps the 16 MiB envelope cap; an `exportedAt` that
is not an ISO UTC timestamp is a new closed kind `invalid_input`, never
reachable from the application.
### 10.8 R4.6: the application export on the core's session (2026-10-19, export switched)
What runs where. The core (`crates/core/src/pdf/write/session.rs`, `views.rs`)
holds an `ExportSession`: `new(input)` runs the R4.4 checks, builds the
envelope under 16 MiB and opens the file (header, Info, the three fonts);
`next_step()` answers the rasters the next step needs (`RasterRequest { key,
svg, widthPx, heightPx }`: the SVG logos in slot order, then each observation's
views, main view first, composed by R3's `compose_highlight` at the size
`rasterSizeOf` gives, the O4 cases pinned) or `done`; `add_raster(key, png)`
and `raster_failed(key)` answer one key each; `finish()` lays out the
conclusion page and the footers, writes the pages and the attachment, runs
the self-check, and hands the file out in parts (`take_part()`). The refusals
are closed kinds (`unknown_key`, `duplicate_key`, `out_of_order`), never a
trap. The wasm facade exposes the same struct (`crates/wasm`: `ExportSession`,
outcome envelopes); `packages/core-wasm` wraps it (`CoreExportSession`,
`openExportSession`): every call goes through `CoreRuntime.invoke`, so a trap
poisons the instance as any core call, and a session of a dropped instance
answers `core_unavailable` without touching the dead handle. The application
(`apps/app/src/pdf/export.ts`) drives it: the snapshot from the sheet handle,
the bundled branding, the labels (`labels.ts`, moved verbatim from the engine,
same key order), the clock, then the loop (`browserRasterizer` under
`Promise.all` per batch, `rasterFailed` as each raster rejects, `addRaster` in
request order once the batch settled, as the engine embedded), `finish`, a
`Blob` of the parts, `free()` in `finally`; leaving the editor aborts the
export (the session freed, no file). `EditorRoute` and its alerts are
unchanged. `exportReportToPdf` keeps its signature but returns the `Blob`.
Buffers, ownership and lives (OD-2, the owner's R4.6 item 2):
| Buffer | Owner | Lives | Size |
|---|---|---|---|
| the `ExportInput` JSON | the page (a string), copied into linear memory by the glue for `new()` | the call | report + snapshot + branding + labels (demo 338 KB) |
| `CheckedInput` (report, snapshot with its asset texts, index, the sanitised asset trees, branding, labels) | the session | until `free()` | demo: 3.7 MiB of linear memory after `new()` |
| the envelope text | the session | until the self-check | the attachment's size (demo 55 KB) |
| the file being written | the session's `Objects`: chunks never reallocated, the target 1 MiB doubling to 8 MiB per chunk, an object larger than the target in a chunk of its own, a sealed chunk shrunk to its bytes | until `take_part()` moves each one out (copied into the page, freed in the module) | the file |
| a request's SVG text | the core builds it, the page receives it as JSON | the `next_step()` call (module side), the batch (page side) | 143 KB per view |
| a raster PNG | the page's `Uint8Array`, copied into linear memory by the glue for `add_raster` | the call: decoded (RGBA, raw scanlines, RGB and alpha planes), deflated, written, then freed before the call returns | 0.5 MB (PNG), about 10 MB of transients for a 1200 × 943 raster |
| a logo raster | the session, until its batch completes (the branding embeds in slot order, as the engine did) | the branding step | the four logos |
| the draw log | the session | until `finish()` | the text calls (KB) |
So the module holds, at its highest, the file so far plus one decode plus the
parsed input plus the open chunk's slack; nothing of the rasters once their
object is written, nothing of the file once the parts are out. Measured on a
fresh instance per run, the shipped module in Node, the growth of linear
memory from before `new()` to after `free()` (linear memory never shrinks:
the high-water mark), file in parts:
| Run | views | PDF bytes | parts | linear before | linear after | growth / PDF | ms |
|---|---|---|---|---|---|---|---|
| demo, 2 × 1 stub | 7 | 235,948 | 1 | 1.25 MiB | 5.9 MiB | 20.6 | 52 |
| L, stub | 120 | 386,414 | 1 | 1.25 MiB | 6.6 MiB | 14.6 | 179 |
| CAP, stub | 1,000 | 1,599,445 | 2 | 1.25 MiB | 13.7 MiB | 8.2 | 1,195 |
| demo, real 1200 × 943 | 7 | 3,282,540 | 3 | 1.25 MiB | 18.0 MiB | 5.4 | 499 |
| L, real | 120 | 46,464,887 | 8 | 1.25 MiB | 62.3 MiB | 1.38 | 7,062 |
L with real rasters: 62 MiB held for a 44 MiB file, where the 120 PNGs alone
weigh 64 MB and the engine held every decoded plane until `save()` (plan
§B.4: about 0.45 GB); the plan's estimate for the session was 53 MB (file +
9 MB). What the module holds beyond the file is bounded (the test asserts it
under 24 MiB): the parsed input and trees (3.7 MiB), one decode (about 10
MiB), the open chunk's slack (up to 8 MiB). Stage by stage on L real: 1.3 MiB
at start, 5.0 after `new()`, 15.5 after the second raster (the first decode),
then 0.34 MB per raster for 0.364 MB of file per raster, 62.3 before
`finish()`, 62.3 after, 62.3 after the parts are out and the session freed.
Two findings on the way, measured and kept:
- A single growing `Vec` for the file (amortised doubling) spiked to 125 MiB
on L real: the reallocation holds the old and the new buffer while it
copies, and the decode transients sit between the file and the top of the
heap, so dlmalloc could not grow it in place. Chunks never reallocated
remove the spike.
- Chunks of 1 MiB cost 0.12 MB of fragmentation per view (a long-lived
allocation interleaved with 10 MB of transients every other raster: 74 MiB
for the same file); 8 MiB chunks cost none (62.3 MiB). The target starts at
1 MiB and doubles per chunk up to 8 MiB, so a small file pays little slack
(demo: one chunk).
Declared differences, each one a B2 or B4 class of plan §B.2.3, every O2
comparison and the poppler render re-run unchanged:
- The catalog and the page tree (objects 1 and 2) are written last (the xref
maps them); R4.5 wrote them first. The R4 digests (`goldens/r4/pdf.*.sha256`,
the writer's own bytes, not a TypeScript oracle) were rewritten once for
it, with the O2 suite, qpdf, pdfdetach and poppler (0 pixel) green on the
new layout.
- UTF-16BE hex strings are printed in upper case, as pdf-lib printed them
(R4.5 printed lower case: B4, the same decoded value).
- pdf-writer stays unused (R4.5).
- A view raster the decoder refuses is that view's `view_raster_failed`
warning, as `embedPng` throwing was in the engine; R4.5's one-shot path
made it `self_check_failed`.
- The self-check scans the bytes from the attachment stream object to the end
of its chunk, behind the file header, with the R4 reader: the reader finds
the attachment by scanning its bytes, never by the xref, and the file is
never held whole in the module. The bytes scanned are the file's.
Parity and restoration (cargo `pdf_session`, `pdf_serialize`, `pdf_layout`;
Node `pdf-export.session.test.ts`; the app suites):
| Check | Result |
|---|---|
| the session driven key by key = `export_pdf` one-shot (bytes, envelope, warnings); the file grows as the rasters arrive | demo, equal |
| the 14 O2 runs through the shipped module and `CoreExportSession` | the native digests |
| every view request = the TypeScript `composeHighlightedViewSvg` text of that (observation, view); every (observation, view) the snapshot holds requested once | 14 runs, all views |
| the real-raster run: the two SVGs the R4.1 rasteriser drew (`manifest.json` `svgSha256`, 1200 × 263 and 1200 × 943) | equal, sizes equal |
| `rasterSizeOf`, the O4 cases (JS `Number()` on the viewBox parts, the clamps) | 57 cases equal |
| warnings: a raster that fails before any embed, then a PNG the decoder refuses, view order; a logo warning at its slot whatever the arrival | as the engine recorded them |
| refusals: before `next()`, a key not in the batch, answered twice, `next()` with keys unanswered, `finish()` early or twice, after `free()`; garbage, empty and truncated PNGs | closed kinds, no trap |
| a trap mid-session (proofs build) | the instance poisoned, the session answers `core_unavailable`, `free()` safe, a new session on the recovered instance writes the digest |
| export Rust → import Rust (the module's `import_pdf`, the bundled sheet) | 14 runs: `envelope_v1`, the report equal, not rebased |
| export Rust → the kept TypeScript reader (`importReportFromPdf`, the app suites) → the core | the roundtrip, leaves, N-1 and envelope suites (27 cases): equal reports, the 612 leaves (29 unresolved) kept |
| N-1 (O11 scanner and the Zod copy: the R3 build and 0.2.0) | every R4 PDF of the O2 runs read; a stripped one `attachment_stripped` (R4.5 suite, unchanged) |
| the app path (`exportReportToPdf`, stub rasters, the clock fixed at `FIXED_EXPORTED_AT`) | the 12 R4 digests (3 reports × 2 locales × 2 logo modes) |
| the Step 6 goldens (text with page, position, size and font; images; links) read back from the app path's file | 12 runs equal, in page order (the recorder listed every footer last; the file lists each page's footer after its content) |
| `pdf.roundtrip` (16), `pdf.goldens` (13), `pdf.export.app` (2), `routes.EditorRoute.export` (6, abort on unmount added), `routes.coreStopped` (15), `state.coreFailures` (5), `migration.leaves` (2), `n-1.reader` (6), `archive.envelopes` (3) | green on the Rust export; the suites read the file's content streams (`tests/helpers/pdfRead.ts`) where they spied pdf-lib |
| the oracle generator `r4.writer-oracles` (17) | still verifies the frozen O1 / O2 oracles against the TypeScript engine, called directly with the application's inputs |
The engine leaves the application's export path: `apps/app/src` imports
`@faunosteo/pdf` for the kept reader only (`pdf/import.ts`); pdf-lib is no
longer in the application bundle (index chunk 922 KB). `packages/pdf` stays
until R4.8 as the R3 reference of the oracle suites and the tests' reader.
E3 and E4 in the browsers (`scripts/browser/export-baseline.mjs`, 2026-10-19,
`results/2026-10-19-ts-export.json` on the build of the last TypeScript-export
commit, `results/2026-10-19-r4-export.json` on the R4.6 build; both under the
same harness, the same host, the same evening, demo and L three runs each, CAP
once; the production CSP; `compare-exports.mjs` prints the tables). Time is
the page clock from the click to the PDF blob, the median of the runs:
| Engine | Report | TS | Rust | Rust / TS | TS file | Rust file |
|---|---|---|---|---|---|---|
| Chromium 156 | demo | 1,372 ms | 916 ms | 0.67 | 2,852,004 | 2,823,275 |
| Chromium | L | 19,286 ms | 14,218 ms | 0.74 | 43,893,082 | 43,536,994 |
| Chromium | CAP | stopped by the 4 GiB ceiling after 818 PNGs | 117.6 s | | | 360,935,689 |
| Firefox 157 | demo | 1,559 ms | 1,035 ms | 0.66 | 2,872,189 | 2,843,130 |
| Firefox | L | 24,559 ms | 16,574 ms | 0.67 | 44,105,143 | 43,743,780 |
| Firefox | CAP | stopped after 565 PNGs | 138.0 s | | | 362,665,313 |
| WebKit 27.2 | demo | 2,626 ms | 2,386 ms | 0.91 | 2,493,691 | 2,473,027 |
| WebKit | L | 52,251 ms | 49,538 ms | 0.95 | 38,557,714 | 38,286,426 |
| WebKit | CAP | stopped after 962 PNGs | 412.2 s | | | 317,323,081 |
E3 (Rust ≤ 1.2 × the TypeScript on demo and L in Chromium): 0.67 and 0.74,
met; Firefox 0.66 and 0.67, WebKit 0.91 and 0.95. E4: L completes on the
three engines (it did with the engine); CAP completes on the three (1,001
rasters, a 361 MB file) where the engine was stopped by the harness ceiling
on every engine, as at R4.1. The phone part of E4 is the owner's J2.6.
Where the time goes (medians; head = click to the first raster, raster phase
= first `toBlob` start to last `toBlob` end, tail = last raster to the PDF
blob; the Rust driver's User Timing adds the sum of its core calls and of its
rasteriser awaits):
| Engine | Report | TS head / raster phase / tail | Rust head / raster phase / tail | Rust core calls | Rust raster awaits |
|---|---|---|---|---|---|
| Chromium | demo | 62 / 794 / 518 | 27 / 803 / 80 | 487 | 415 |
| Chromium | L | 66 / 11,880 / 7,381 | 27 / 14,014 / 178 | 7,153 | 7,066 |
| Chromium | CAP | | 57 / 117,093 / 495 | 58,970 | 58,521 |
| Firefox | demo | 62 / 841 / 650 | 20 / 942 / 74 | 455 | 573 |
| Firefox | L | 67 / 14,762 / 9,731 | 25 / 16,382 / 173 | 6,684 | 9,862 |
| Firefox | CAP | | 60 / 137,464 / 474 | 55,024 | 82,803 |
| WebKit | demo | 63 / 2,193 / 370 | 20 / 2,283 / 81 | 455 | 1,918 |
| WebKit | L | 70 / 47,227 / 4,957 | 25 / 49,260 / 251 | 6,733 | 42,693 |
| WebKit | CAP | | 54 / 411,048 / 1,091 | 55,372 | 356,032 |
The engine's tail (its `save()`: every plane deflated at the end) is gone:
the Rust tail is the conclusion page, the pages, the attachment and the
self-check (80 to 250 ms on demo and L). The core's own work (decode, deflate
at level 6, write) is 7 s on L and 59 s on CAP in Chromium, interleaved with
the browser's rasterisation, which is the other half (7 s on L in Chromium,
43 s in WebKit); the export is bound by those two, in sequence per batch.
Memory in the browsers (content process RSS, MiB; growth = settled after −
settled before, forced GC in Chromium, idle elsewhere):
| Engine | Report | TS peak | Rust peak | TS growth | Rust growth |
|---|---|---|---|---|---|
| Chromium | demo | 307 | 264 | 17 | 28 |
| Chromium | L | 805 | 470 | 43 | 92 |
| Chromium | CAP | 3,739 (stopped) | 1,787 | | 560 |
| Firefox | demo | 378 | 291 | 77 | 78 |
| Firefox | L | 1,397 | 819 | 183 | 264 |
| Firefox | CAP | 3,487 (stopped) | 1,914 | | 826 |
| WebKit | demo | 658 | 593 | 277 | 144 |
| WebKit | L | 1,191 | 848 | 210 | 218 |
| WebKit | CAP | 3,871 (stopped) | 2,633 | | 552 |
The peak falls everywhere (L: 805 → 470 MiB in Chromium, 1,397 → 819 in
Firefox, 1,191 → 848 in WebKit). The settled growth after the export is
higher on L and CAP: it is the module's linear memory, which never shrinks
(plan §B.4 "the same high-water, until reload"): the file was held once in
the module (44 MB on L, 361 MB on CAP) plus the transients, and that memory
stays reserved for the page's next export instead of being returned. The
engine's growth was JavaScript heap, collected. On CAP the page keeps about
560 to 830 MiB after the export; CAP is the cap, not a bilan, and the engine
never finished it.
Release across exports (`scripts/browser/r4-export-series.mjs`,
`results/2026-10-19-r4-export-series.json`, `…-ts-export-series-chromium.json`,
`…-r4-export-series-chromium-12.json`): one editor tab, the start level, a
first export (init) and six more, the content RSS read after each (forced GC
in Chromium; idle elsewhere, indicative), the import series' criterion of
10 MiB over the last five:
| Engine | Report | Init | Per export | Last 5 | Peak content |
|---|---|---|---|---|---|
| Chromium, Rust | demo | 28.0 MiB | 1.5 / 2.5 / 2.8 / 2.5 / 3.4 / 1.2 | 12.3 MiB | 287 MiB |
| Chromium, Rust | L | 92.2 | 25.5 / 21.1 / 20.1 / 13.3 / 23.9 / 22.4 | 100.8 | 643 |
| Chromium, TypeScript (control) | demo | 16.1 | 3.1 / 3.3 / 2.1 / 1.6 / 2.2 / 1.6 | 10.9 | 330 |
| Chromium, TypeScript (control) | L | 44.6 | 20.7 / 14.8 / 19.6 / 18.3 / 22.1 / 22.7 | 97.6 | 957 |
| Chromium, Rust, 12 exports | L | 95.2 | 19.7 / 27.3 / 11.1 / 29.5 / 14.0 / 28.4 / 16.7 / 22.6 / 4.4 / 1.5 / 3.4 / −4.3 | 27.6 (the last five) | 686 |
| Firefox, Rust | demo | 95.1 | 93.9 / −6.7 / 103.3 / −50.4 / 96.5 / −41.8 | 100.8 | 596 |
| Firefox, Rust | L | 263.8 | 156.8 / 0.7 / 86.9 / −196.3 / 58.7 / 74.1 | 24.0 | 1,024 |
| WebKit, Rust | demo | 139.8 | 91.5 / 225.9 / −216.8 / 108.3 / −90.4 / −0.3 | 26.9 | 946 |
| WebKit, Rust | L | 326.7 | 153.7 / 14.7 / 1.2 / 1.1 / −0.4 / 2.3 | 19.0 | 1,992 |
Reading: the per-export growth of about 20 MiB on L in Chromium is the
browser's, not the session's: the TypeScript build shows the same figures on
the same page (control), and the module's linear memory, read in Node over
seven L exports with real rasters on one instance, stays at 62.3 MiB from
the first export to the last (the session frees everything at `free()` and
the next export reuses it). Over twelve exports Chromium's growth stops
after the eighth (the last five: 27.6 MiB, then a plateau), which points at
a bounded cache (canvas backing stores or the blob URLs kept 30 s by
`downloadBlob`), not at a leak that grows with use. Firefox and WebKit
sawtooth without a forced GC, as in the import series; WebKit L settles
after the second export. The criterion as written (10 MiB over five) is not
met by either build on L in Chromium; the behaviour is the engine's, the
module flat, the plateau reached. Kept as an observation for the owner
(BDR-058's reserves extend to it), with the phone series J2.7 due.
Release on the other paths (cargo `pdf_session`, Node
`pdf-export.session.test.ts`, the route test): success (every part out,
`free()`), a refused input (no session, the runtime stays `ready`), a raster
that fails (its warning, the export continues), a trap mid-session (the
instance poisoned and recovered, the session answers `core_unavailable`,
`free()` a no-op on the dead handle), a cancelled export (the editor left
mid-way: the signal aborts the driver, `free()` in `finally`, no download,
no alert). Dropping the session, finished or not, frees everything it holds
(Rust ownership); nothing of the file survives `free()` in the module.
Module size (W1): the shipped module with the writer and the session linked,
1,535,289 B raw, 519,730 B gzip -9 (the proofs build 531.6 KB at R4.5 held the
trap and allocation proofs too). Under the 550 KB report line and the 600 KB
budget; from 426 KB at R4.3, +94 KB for the whole writer. `DEPLOY.md`'s
served-size note is updated at R4.8 with the final module.
Residual risks and open points (R4.6):
- The settled growth after a large export is the module's linear memory
(the file once, the transients, the chunk slack), kept until reload: 92
MiB after L and 560 MiB after CAP in Chromium. Within the plan (OD-2: "the
same high-water, until reload"); the disposable export worker (S2) stays
the fallback if a device fails L (J2.6).
- The export is bound by the browser's rasterisation and the core's decode
and deflate (level 6) in sequence per batch: L takes 14 s in Chromium and
50 s in WebKit (the engine: 19 and 52). A lower deflate level or
overlapping the next batch's rasterisation with the core's writing would
cut it, at the price of E2 or of a second copy in flight; not done.
- The per-export RSS growth in Chromium is the browser's and plateaus; the
10 MiB criterion is not met by either build on L. Owner decision.
- `view_raster_failed` now also covers a PNG the decoder refuses and a view
that cannot be composed; a raster that never settles still hangs the
export (the engine's residual, unchanged; the abort on leaving the editor
frees the session).
- The headless runs validate nothing on a device: J2 (`R4_J2.md`) on the
owner's computer and iPhone, with the J1 import recette still due.
+114
View File
@@ -0,0 +1,114 @@
// Two export baselines side by side (R4.6, E3 and E4): the TypeScript engine's
// build and the Rust session's build, same reports, same harness, same host.
// Per engine and report: the median export time (page clock, click to the
// PDF blob) and its ratio (E3: Rust ≤ 1.2 × TS in Chromium on demo and L),
// the outcome (E4: L completes everywhere the TS did, CAP completes within
// the harness ceiling), the content-process RSS peak and the settled growth
// (after − before, forced GC in Chromium), the file size, and the phases:
// before the first raster, the raster phase (first `toBlob` start to the last
// `toBlob` end), the tail to the PDF blob, plus the Rust driver's own split
// (core calls, rasteriser awaits) when the build published it.
//
// node scripts/browser/compare-exports.mjs <ts-export.json> <r4-export.json>
import { readFileSync } from 'node:fs'
const [tsPath, r4Path] = process.argv.slice(2)
if (!tsPath || !r4Path) {
console.error('usage: compare-exports.mjs <ts-export.json> <r4-export.json>')
process.exit(2)
}
const load = (path) => JSON.parse(readFileSync(path, 'utf8'))
const runsOf = (result) => result.export?.runs ?? result.runs ?? []
const median = (values) => {
const sorted = values.filter((v) => v != null).sort((a, b) => a - b)
if (!sorted.length) return null
return sorted[Math.floor(sorted.length / 2)]
}
const mib = (bytes) => (bytes == null ? '' : (bytes / 1024 / 1024).toFixed(0))
const ms = (value) => (value == null ? '' : Math.round(value).toString())
const ratio = (a, b) => (a == null || b == null || !b ? '' : (a / b).toFixed(2))
function group(runs) {
const groups = new Map()
for (const run of runs) {
const key = `${run.engine}|${run.report}`
if (!groups.has(key)) groups.set(key, [])
groups.get(key).push(run)
}
return groups
}
function summary(runs) {
const done = runs.filter((r) => r.outcome === 'downloaded')
const outcomes = runs.map((r) => r.outcome)
return {
outcome: [...new Set(outcomes)].join(', '),
exportMs: median(done.map((r) => r.exportMs)),
pdfBytes: median(done.map((r) => r.pdfBytes)),
peakContent: median(runs.map((r) => r.rssPeakContentBytes)),
growth: median(
done.map((r) =>
r.after && r.before ? r.after.rssContentBytes - r.before.rssContentBytes : null,
),
),
heapAfter: median(done.map((r) => r.after?.jsHeapUsedBytes ?? null)),
headMs: median(done.map((r) => r.phases?.headMs ?? null)),
rasterPhaseMs: median(done.map((r) => r.phases?.rasterPhaseMs ?? null)),
tailMs: median(done.map((r) => r.phases?.tailMs ?? null)),
coreMs: median(done.map((r) => r.phases?.driver?.coreMs ?? null)),
rasterSumMs: median(done.map((r) => r.phases?.driver?.rasterMs ?? null)),
rasters: median(done.map((r) => r.rasters?.count ?? null)),
stoppedAt: median(runs.map((r) => r.stoppedAtBytes ?? null)),
rastersBeforeEnd: median(runs.map((r) => r.rastersBeforeEnd ?? null)),
}
}
const ts = group(runsOf(load(tsPath)))
const r4 = group(runsOf(load(r4Path)))
const keys = [...new Set([...ts.keys(), ...r4.keys()])]
console.log('## Time (median of the runs, page clock, click to the PDF blob)\n')
console.log(
'| Engine | Report | TS outcome | Rust outcome | TS ms | Rust ms | Rust / TS | TS PDF | Rust PDF |',
)
console.log('|---|---|---|---|---|---|---|---|---|')
for (const key of keys) {
const [engine, report] = key.split('|')
const a = summary(ts.get(key) ?? [])
const b = summary(r4.get(key) ?? [])
console.log(
`| ${engine} | ${report} | ${a.outcome} | ${b.outcome} | ${ms(a.exportMs)} | ${ms(b.exportMs)} | ${ratio(b.exportMs, a.exportMs)} | ${a.pdfBytes ?? ''} | ${b.pdfBytes ?? ''} |`,
)
}
console.log('\n## Memory (content-process RSS, MiB; growth = settled after − settled before)\n')
console.log(
'| Engine | Report | TS peak | Rust peak | TS growth | Rust growth | TS heap after | Rust heap after | Rust rasters before the ceiling |',
)
console.log('|---|---|---|---|---|---|---|---|---|')
for (const key of keys) {
const [engine, report] = key.split('|')
const a = summary(ts.get(key) ?? [])
const b = summary(r4.get(key) ?? [])
console.log(
`| ${engine} | ${report} | ${mib(a.peakContent)} | ${mib(b.peakContent)} | ${mib(a.growth)} | ${mib(b.growth)} | ${mib(a.heapAfter)} | ${mib(b.heapAfter)} | ${b.rastersBeforeEnd ?? ''} |`,
)
}
console.log(
'\n## Phases (ms; head = click to the first raster, raster phase = first toBlob start to last toBlob end, tail = last raster to the PDF blob; core / raster = the Rust driver\'s User Timing)\n',
)
console.log(
'| Engine | Report | TS head | TS raster phase | TS tail | Rust head | Rust raster phase | Rust tail | Rust core calls | Rust raster awaits | rasters |',
)
console.log('|---|---|---|---|---|---|---|---|---|---|---|')
for (const key of keys) {
const [engine, report] = key.split('|')
const a = summary(ts.get(key) ?? [])
const b = summary(r4.get(key) ?? [])
console.log(
`| ${engine} | ${report} | ${ms(a.headMs)} | ${ms(a.rasterPhaseMs)} | ${ms(a.tailMs)} | ${ms(b.headMs)} | ${ms(b.rasterPhaseMs)} | ${ms(b.tailMs)} | ${ms(b.coreMs)} | ${ms(b.rasterSumMs)} | ${b.rasters ?? a.rasters ?? ''} |`,
)
}
+1 -1
View File
@@ -231,7 +231,7 @@ function table(runs) {
async function main() {
const opts = options()
const build = checkBuild()
const pw = loadPlaywright()
const { pw } = loadPlaywright()
const server = await startServer({ csp: 'with' })
const runs = []
try {
@@ -0,0 +1,376 @@
{
"harness": "scripts/browser/r4-export-series.mjs",
"startedAt": "2026-10-19T00:42:06.405Z",
"readings": "Readings: content RSS of the browser tree after each export (download received, export button enabled again), 2 s idle; Chromium adds a forced GC (CDP HeapProfiler.collectGarbage) + 1 s before each reading, Firefox and WebKit are read after idle only (no forced GC: indicative). Start = editor loaded, before any export. Init = first export (module, fonts, first decode). Recurring = L[last] − L[2]: the last 5 exports for 6.",
"toleranceBytes": 10485760,
"watchdog": {
"ceilingBytes": 4294967296,
"sampleIntervalMs": 50,
"measure": "summed VmRSS (/proc/<pid>/status) of the browser process tree; content = renderer / Web Content / WPEWebProcess processes only",
"onCeiling": "SIGKILL of the tree, run recorded as stopped_by_ceiling",
"caveat": "The 4 GiB RSS watchdog is not a guaranteed memory limit: it samples every 50 ms, so a faster allocation can overshoot it before the kill; summed VmRSS counts shared pages once per process; a process outside the browser's tree is not seen."
},
"host": {
"cpuModel": "11th Gen Intel(R) Core(TM) i7-11700B @ 3.20GHz",
"logicalCpus": 16,
"ramBytes": 15815053312,
"memAvailableBytesAtStart": 11181867008,
"kernel": "7.0.0-38-generic",
"arch": "x64",
"node": "v24.21.0"
},
"build": {
"distDir": "/home/bchanot/Documents/faunosteo/apps/app/dist",
"builtAt": "2026-10-18T23:42:35.418Z",
"sheetChunk": {
"name": "_virtual_faunosteo-sheet-vxifkiH_.js",
"bytes": 377259,
"sha256": "44ef9bf7c6f64dd621f6656dd1de88689f2f74c998ec0b0822483674721d26b8"
},
"entryChunk": {
"name": "index-DHetg9wY.js",
"bytes": 921784,
"sha256": "ef76ac1800c348fc27fb8ded471210dfd620233cad817f8ec1121ac6bd59fc8c"
},
"wasm": {
"name": "faunosteo_wasm_bg-Ah8oVWLN.wasm",
"bytes": 1535289,
"sha256": "77a620f9f3fa8f8526f7621c04d2b3eadbe8a29ba18fe1602afc2f94efc598d3"
},
"importWorker": {
"name": "import.worker-D4IC9usY.js",
"bytes": 8175,
"sha256": "b9c25706d4aa5a2ce51058635723d4e6263115cc48d8a99fff1b7f97083ee420"
},
"headCommit": "cdcdda8"
},
"options": {
"engines": [
"chromium"
],
"reports": [
"L"
],
"reps": 1,
"exports": 12,
"out": "scripts/browser/results/2026-10-19-r4-export-series-chromium-12.json"
},
"runs": [
{
"engine": "chromium",
"engineVersion": "156.0.8078.4",
"report": "L",
"rep": 1,
"outcome": "series",
"exports": [
{
"outcome": "downloaded",
"clickToEndMs": 14281,
"exportMs": 14201.100000023842,
"rastersSoFar": 121,
"driver": {
"startTime": 1275.2999999523163,
"duration": 14192.700000047684,
"coreMs": 7124.499999880791,
"rasterMs": 7050.300000071526,
"requests": 121,
"parts": 8,
"bytes": 43536997
},
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 14223,
"exportMs": 14149.899999976158,
"rastersSoFar": 242,
"driver": {
"startTime": 18620.799999952316,
"duration": 14144.400000095367,
"coreMs": 7075.599999785423,
"rasterMs": 7051.400000214577,
"requests": 121,
"parts": 8,
"bytes": 43536997
},
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 14251,
"exportMs": 14166.699999928474,
"rastersSoFar": 363,
"driver": {
"startTime": 35911.799999952316,
"duration": 14155.200000047684,
"coreMs": 7083.400000691414,
"rasterMs": 7053.799999475479,
"requests": 121,
"parts": 8,
"bytes": 43536997
},
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 14334,
"exportMs": 14234.299999952316,
"rastersSoFar": 484,
"driver": {
"startTime": 53244.299999952316,
"duration": 14223.600000023842,
"coreMs": 7146.500000119209,
"rasterMs": 7059.599999785423,
"requests": 121,
"parts": 8,
"bytes": 43536997
},
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 14226,
"exportMs": 14137.700000047684,
"rastersSoFar": 605,
"driver": {
"startTime": 70598.60000002384,
"duration": 14132.399999976158,
"coreMs": 7096.499999880791,
"rasterMs": 7017.599999904633,
"requests": 121,
"parts": 8,
"bytes": 43536997
},
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 14231,
"exportMs": 14131.200000047684,
"rastersSoFar": 726,
"driver": {
"startTime": 87949.89999997616,
"duration": 14126.5,
"coreMs": 7097.799999952316,
"rasterMs": 7012,
"requests": 121,
"parts": 8,
"bytes": 43536996
},
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 14278,
"exportMs": 14173.099999904633,
"rastersSoFar": 847,
"driver": {
"startTime": 105331.39999997616,
"duration": 14168.600000023842,
"coreMs": 7132.399999976158,
"rasterMs": 7018.500000119209,
"requests": 121,
"parts": 8,
"bytes": 43536997
},
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 14272,
"exportMs": 14133.200000047684,
"rastersSoFar": 968,
"driver": {
"startTime": 122666.5,
"duration": 14128.799999952316,
"coreMs": 7095.900000095367,
"rasterMs": 7015.399999976158,
"requests": 121,
"parts": 8,
"bytes": 43536997
},
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 14262,
"exportMs": 14143.699999928474,
"rastersSoFar": 1089,
"driver": {
"startTime": 139990.79999995232,
"duration": 14132.200000047684,
"coreMs": 7083.500000357628,
"rasterMs": 7030.099999547005,
"requests": 121,
"parts": 8,
"bytes": 43536997
},
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 14226,
"exportMs": 14092.299999952316,
"rastersSoFar": 1210,
"driver": {
"startTime": 157299.20000004768,
"duration": 14087.299999952316,
"coreMs": 7096.200000286102,
"rasterMs": 6973.199999809265,
"requests": 121,
"parts": 8,
"bytes": 43536997
},
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 14279,
"exportMs": 14163.400000095367,
"rastersSoFar": 1331,
"driver": {
"startTime": 174575.79999995232,
"duration": 14158.600000023842,
"coreMs": 7127.600000143051,
"rasterMs": 7012.700000405312,
"requests": 121,
"parts": 8,
"bytes": 43536997
},
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 14254,
"exportMs": 14110.300000071526,
"rastersSoFar": 1452,
"driver": {
"startTime": 191909.20000004768,
"duration": 14105.699999928474,
"coreMs": 7099.999999761581,
"rasterMs": 6988.200000047684,
"requests": 121,
"parts": 8,
"bytes": 43536997
},
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 14341,
"exportMs": 14218.700000047684,
"rastersSoFar": 1573,
"driver": {
"startTime": 209224.10000002384,
"duration": 14214.199999928474,
"coreMs": 7123.399999976158,
"rasterMs": 7073.500000119209,
"requests": 121,
"parts": 8,
"bytes": 43536997
},
"dialogs": 0,
"pageErrors": 0
}
],
"levels": {
"content": [
163192832,
263024640,
283725824,
312401920,
323989504,
354881536,
369524736,
399306752,
416808960,
440496128,
445075456,
446631936,
450240512,
445710336,
441176064
],
"summed": [
499249152,
649281536,
713400320,
742535168,
750792704,
786460672,
802414592,
827043840,
849010688,
868614144,
873193472,
878538752,
878374912,
877867008,
867647488
]
},
"deltas": {
"content": {
"init": 99831808,
"perImport": [
20701184,
28676096,
11587584,
30892032,
14643200,
29782016,
17502208,
23687168,
4579328,
1556480,
3608576,
-4530176
],
"last5": 28901376,
"finalIdle": -4534272,
"last5AtFinal": 24367104
},
"summed": {
"init": 150032384,
"perImport": [
64118784,
29134848,
8257536,
35667968,
15953920,
24629248,
21966848,
19603456,
4579328,
5345280,
-163840,
-507904
],
"last5": 28856320,
"finalIdle": -10219520,
"last5AtFinal": 18636800
}
},
"peakBytes": 1154641920,
"peakContentBytes": 718921728,
"withinTolerance": false,
"pageErrors": [],
"consoleErrors": [
"Loading the image 'https://zenquality.fr/assets/logo-horizontal-1024.png' violates the following Content Security Policy directive: \"img-src 'self' data: blob:\". The action has been blocked.",
"Loading the image 'https://zenquality.fr/assets/logo-horizontal-1024.png' violates the following Content Security Policy directive: \"img-src 'self' data: blob:\". The action has been blocked."
]
}
]
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,329 @@
{
"harness": "scripts/browser/r4-export-series.mjs",
"startedAt": "2026-10-19T00:37:58.403Z",
"readings": "Readings: content RSS of the browser tree after each export (download received, export button enabled again), 2 s idle; Chromium adds a forced GC (CDP HeapProfiler.collectGarbage) + 1 s before each reading, Firefox and WebKit are read after idle only (no forced GC: indicative). Start = editor loaded, before any export. Init = first export (module, fonts, first decode). Recurring = L[last] − L[2]: the last 5 exports for 6.",
"toleranceBytes": 10485760,
"watchdog": {
"ceilingBytes": 4294967296,
"sampleIntervalMs": 50,
"measure": "summed VmRSS (/proc/<pid>/status) of the browser process tree; content = renderer / Web Content / WPEWebProcess processes only",
"onCeiling": "SIGKILL of the tree, run recorded as stopped_by_ceiling",
"caveat": "The 4 GiB RSS watchdog is not a guaranteed memory limit: it samples every 50 ms, so a faster allocation can overshoot it before the kill; summed VmRSS counts shared pages once per process; a process outside the browser's tree is not seen."
},
"host": {
"cpuModel": "11th Gen Intel(R) Core(TM) i7-11700B @ 3.20GHz",
"logicalCpus": 16,
"ramBytes": 15815053312,
"memAvailableBytesAtStart": 11295285248,
"kernel": "7.0.0-38-generic",
"arch": "x64",
"node": "v24.21.0"
},
"build": {
"distDir": "/tmp/claude-1000/-home-bchanot-Documents-faunosteo/3e2be376-ff6d-4b98-9726-e0a97897477f/scratchpad/ts-build/apps/app/dist",
"builtAt": "2026-10-18T23:31:21.799Z",
"sheetChunk": {
"name": "_virtual_faunosteo-sheet-vxifkiH_.js",
"bytes": 377259,
"sha256": "44ef9bf7c6f64dd621f6656dd1de88689f2f74c998ec0b0822483674721d26b8"
},
"entryChunk": {
"name": "index-CqvCXarE.js",
"bytes": 1482294,
"sha256": "fe4fe0fba758cff7565e614b0c72a26fadfb83bb597528403d77ef693d6e01ee"
},
"wasm": {
"name": "faunosteo_wasm_bg-Ah8oVWLN.wasm",
"bytes": 1535289,
"sha256": "77a620f9f3fa8f8526f7621c04d2b3eadbe8a29ba18fe1602afc2f94efc598d3"
},
"importWorker": {
"name": "import.worker-D4IC9usY.js",
"bytes": 8175,
"sha256": "b9c25706d4aa5a2ce51058635723d4e6263115cc48d8a99fff1b7f97083ee420"
},
"headCommit": "cdcdda8"
},
"options": {
"engines": [
"chromium"
],
"reports": [
"demo",
"L"
],
"reps": 1,
"exports": 6,
"out": "scripts/browser/results/2026-10-19-ts-export-series-chromium.json"
},
"runs": [
{
"engine": "chromium",
"engineVersion": "156.0.8078.4",
"report": "demo",
"rep": 1,
"outcome": "series",
"exports": [
{
"outcome": "downloaded",
"clickToEndMs": 1449,
"exportMs": 1403.1000000238419,
"rastersSoFar": 8,
"driver": null,
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 1250,
"exportMs": 1213.8999999761581,
"rastersSoFar": 16,
"driver": null,
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 1275,
"exportMs": 1244.5,
"rastersSoFar": 24,
"driver": null,
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 1290,
"exportMs": 1251.7000000476837,
"rastersSoFar": 32,
"driver": null,
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 1269,
"exportMs": 1229.1000000238419,
"rastersSoFar": 40,
"driver": null,
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 1279,
"exportMs": 1226.4000000953674,
"rastersSoFar": 48,
"driver": null,
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 1279,
"exportMs": 1235.6999999284744,
"rastersSoFar": 56,
"driver": null,
"dialogs": 0,
"pageErrors": 0
}
],
"levels": {
"content": [
163999744,
180899840,
184127488,
187576320,
189792256,
191512576,
193814528,
195522560,
194060288
],
"summed": [
499064832,
526618624,
533164032,
539181056,
545742848,
548929536,
555466752,
559980544,
551366656
]
},
"deltas": {
"content": {
"init": 16900096,
"perImport": [
3227648,
3448832,
2215936,
1720320,
2301952,
1708032
],
"last5": 11395072,
"finalIdle": -1462272,
"last5AtFinal": 9932800
},
"summed": {
"init": 27553792,
"perImport": [
6545408,
6017024,
6561792,
3186688,
6537216,
4513792
],
"last5": 26816512,
"finalIdle": -8613888,
"last5AtFinal": 18202624
}
},
"peakBytes": 703012864,
"peakContentBytes": 346157056,
"withinTolerance": false,
"pageErrors": [],
"consoleErrors": [
"Loading the image 'https://zenquality.fr/assets/logo-horizontal-1024.png' violates the following Content Security Policy directive: \"img-src 'self' data: blob:\". The action has been blocked.",
"Loading the image 'https://zenquality.fr/assets/logo-horizontal-1024.png' violates the following Content Security Policy directive: \"img-src 'self' data: blob:\". The action has been blocked."
]
},
{
"engine": "chromium",
"engineVersion": "156.0.8078.4",
"report": "L",
"rep": 1,
"outcome": "series",
"exports": [
{
"outcome": "downloaded",
"clickToEndMs": 19269,
"exportMs": 19188.399999976158,
"rastersSoFar": 121,
"driver": null,
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 19131,
"exportMs": 19046.800000071526,
"rastersSoFar": 242,
"driver": null,
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 19112,
"exportMs": 19029.399999976158,
"rastersSoFar": 363,
"driver": null,
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 19234,
"exportMs": 19136.299999952316,
"rastersSoFar": 484,
"driver": null,
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 19211,
"exportMs": 19110.299999952316,
"rastersSoFar": 605,
"driver": null,
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 19085,
"exportMs": 18990.400000095367,
"rastersSoFar": 726,
"driver": null,
"dialogs": 0,
"pageErrors": 0
},
{
"outcome": "downloaded",
"clickToEndMs": 19192,
"exportMs": 19091,
"rastersSoFar": 847,
"driver": null,
"dialogs": 0,
"pageErrors": 0
}
],
"levels": {
"content": [
165941248,
212758528,
234496000,
250060800,
270663680,
289832960,
313032704,
336846848,
333029376
],
"summed": [
501661696,
597274624,
664346624,
677937152,
697577472,
716959744,
740782080,
764624896,
715132928
]
},
"deltas": {
"content": {
"init": 46817280,
"perImport": [
21737472,
15564800,
20602880,
19169280,
23199744,
23814144
],
"last5": 102350848,
"finalIdle": -3817472,
"last5AtFinal": 98533376
},
"summed": {
"init": 95612928,
"perImport": [
67072000,
13590528,
19640320,
19382272,
23822336,
23842816
],
"last5": 100278272,
"finalIdle": -49491968,
"last5AtFinal": 50786304
}
},
"peakBytes": 1392840704,
"peakContentBytes": 1003888640,
"withinTolerance": false,
"pageErrors": [],
"consoleErrors": [
"Loading the image 'https://zenquality.fr/assets/logo-horizontal-1024.png' violates the following Content Security Policy directive: \"img-src 'self' data: blob:\". The action has been blocked.",
"Loading the image 'https://zenquality.fr/assets/logo-horizontal-1024.png' violates the following Content Security Policy directive: \"img-src 'self' data: blob:\". The action has been blocked."
]
}
]
}
File diff suppressed because it is too large. Load diff