Commit Graph
553 Commits
Author SHA1 Message Date
bchanot 264c5fa3fc 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 2026-10-19 02:49:42 +02:00
bchanot cdcdda8e1c docs(docs): R4.6 J2 recette (procedure, results grid, kit script), export harness phases and dist override, export series script, ledger targets of the app PDF suites, CLAUDE.md export flow; export driver publishes its User Timing split 2026-10-19 01:41:57 +02:00
bchanot 9cb3cb75d4 test(tests): R4.6 session suite imports every R4 export back through the module's reader (export Rust → import Rust, no loss) 2026-10-19 01:28:03 +02:00
bchanot d492bf7112 feat(pdf): R4.6 app export on the core's session: export.ts drives ExportSession (rasters one by one, warnings in the engine's order, abort on unmount), labels moved to the app, EditorRoute downloads the Blob of the parts; suites read the file's content streams (pdfRead helper), app-path bytes = R4 digests, hex strings upper-case as pdf-lib 2026-10-19 01:26:13 +02:00
bchanot 9e688b6801 feat(domain): R4.6 ExportSession (incremental export, OD-2): rasters decoded and written on arrival, chunked file handed out in parts, views composed by the core, raster_size_of (O4); wasm ExportSession and CoreExportSession; R4 digests re-frozen (catalog and page tree written last, B2) 2026-10-19 01:15:43 +02:00
bchanot 8d16be577c chore(memory): TODO R4.6 plan (session, facade, app driver, suites, browsers, docs, recette) 2026-10-19 00:38:43 +02:00
bchanot a0d0a384c7 docs(docs): RUST.md §10.7 poppler pixel total corrected (150,193,611 over the 14 runs) 2026-10-19 00:27:27 +02:00
bchanot 99a6e542e4 chore(memory): R4.5 closed in the TODO; journal 2026-10-18 23:40:01 +02:00
bchanot b44dd80af2 fix(domain): R4.5 gate hardenings: self-check without the import size cap, Ref(0) safe, pdf-write implies pdf-read; §10.7 records the gate 2026-10-18 23:39:31 +02:00
bchanot d2376a4574 docs(docs): RUST.md §10.7 R4.5 serialiser record; TODO R4.5a-e ticked 2026-10-18 23:29:43 +02:00
bchanot babe7b76d2 test(tests): R4.5 timing of the L export with real rasters (ignored by default, release only) 2026-10-18 23:28:45 +02:00
bchanot ba6ac078be test(tests): R4.5 export-side security cases; ledger rows of the writer cases point at cargo (only the R4.7 compare rows pending) 2026-10-18 23:24:37 +02:00
bchanot 50c8fe0b33 feat(domain): R4.5e wasm proof export, resources per page, N-1 and TS-engine read-back, cost comparison
export_pdf_for_test on the proofs build (ExportInput JSON + base64 rasters): the 14 O2
runs give the native digests through wasm; the frozen O11 scanner reads every R4 PDF and
the N-1 Zod readers accept its envelope; a stripped R4 PDF answers attachment_stripped;
the TypeScript engine reads the R4 PDFs back to the R3 outcome; E2 size ≤ R3 + 5 %. Page
resources list the images the page draws (listing every embed cost 9 MB on CAP). Node,
stub rasters, TS → Rust: demo 198 → 36 ms, L 772 → 57 ms, CAP 5.7 s → 0.22 s; files
236 KB, 386 KB, 1.6 MB against 243 KB, 463 KB, 2.2 MB. Module with the writer linked
(proofs build): 531.6 KB gzip; shipped unchanged at 426 KB until R4.6 links it.
2026-10-18 23:21:05 +02:00
bchanot 4d45de5745 feat(domain): R4.5b/c serialiser, export driver, self-check, from_envelope; O2 parity suite
objects.rs (own minimal writer: numbered objects, streams, classic xref, pdf-lib's string
forms; pdf-writer not used: every number spelt through numberToString, no f32), serialize.rs
(catalog with names tree and AF, pages, 3 Type1 WinAnsi fonts, image XObjects with the
DeviceGray SMask, Link annotations with hex ASCII URIs, Info with Producer/Creator
Faunosteo, the Flate attachment with Params and Filespec), export.rs (checks → envelope
as JSON.stringify(_, null, 2) → layout → file → self-check through the R4 reader;
export_from_envelope). cargo pdf_serialize against the 14 R3 PDFs: content streams equal
after resource-name resolution, image planes and SMasks equal, links equal, Info equal
but Producer/Creator, attachment bytes equal (store path: values equal, D-R11 order);
qpdf --check clean, pdfdetach lists the attachment, poppler 150 dpi 0 pixel differs on
14 runs; R4 PDF → Rust import = R3 PDF import, re-export from the envelope byte-identical;
R4 output digests frozen in goldens/r4/pdf.*.sha256.
2026-10-18 23:10:18 +02:00
bchanot d7984449ed feat(domain): R4.5a PNG gate (pngIssue port) and UPNG-rule decoder (O6 108/108)
The branding gate in pngIssue's order; the decoder reproduces UPNG's decode and toRGBA8
(typed-array semantics, first-row filter rewrite, the Average first-row pre-pass at
absolute offsets, the 16-bit grey tRNS key at off + x, 16-bit high byte, palette tRNS by
declared length), pdf-lib's alpha drop; caps checked before any allocation; crafted
files refused (animated, text chunks without NUL, broken streams) where UPNG spun or
threw. 108 O6 rows equal; 50 hostile files return in under 20 ms.
2026-10-18 23:07:28 +02:00
bchanot d420f67352 feat(domain): R4.5a content stream emitter: pdf-lib operator sequences and numberToString byte for byte
drawText/drawImage/drawLine/drawRectangle as pdf-lib 1.17.1 emits them (cleanText, 24 TL,
upper-case hex, the doubled m of drawLine, the h f of a filled rectangle); numberToString
with the e-N / e+N branches and V8's Math.pow(10, k) one-ULP quirk at k = 23 and 210;
WinAnsi text encoding. The 12 R3 PDFs' 60 content streams (224,534 bytes) equal the
emitter's output from the O1 logs with only the resource names renamed; 703 O4 cases.
2026-10-18 22:54:04 +02:00
bchanot 5dd4c26f18 chore(domain): R4.5 scaffold: content and png modules, test targets, lopdf as a dev-dependency 2026-10-18 22:41:46 +02:00
bchanot e0540ed006 chore(memory): BDR-061 R4.4 validated, R4.5 go; R4.5 subtasks 2026-10-18 22:37:41 +02:00
bchanot 4874913669 docs(docs): RUST.md §10.6 R4.4 layout record; TODO R4.4 closed; journal 2026-10-18 21:52:44 +02:00
bchanot 1550d2160a test(tests): R4.4 layout timing on L and CAP; ledger rows of the text and layout cases point at cargo 2026-10-18 21:51:40 +02:00
bchanot 70007e0c93 feat(domain): R4.4 layout to a draw log: text rules, AFM metrics, dates (O4, O5, O6) and the page layouts (O1)
pdf::write: text (safe_text with the frozen V8 classes, js_upper from the O4 tables,
js_trim, measure = Σ(WX || 250 + KPX) × size / 1000 over WinAnsi bytes, wrap_lines on JS
\s), afm_data generated by scripts/r4-afm-data.mjs from O5 and O4, dates (Date.UTC years
0-99 → 19xx, fr-FR / en-US long dates), input checks (branding and labels schemas,
snapshot gate with the R3 SVG reader, sheet mismatch, page caps), the header, footer,
observation and conclusion layouts into a DrawLog (per page, footers last, links by page).
cargo: O4 55,992 widths bit-exact, 1,168 wraps, safeText over every code point, upper
1,580, O6 6,468 cells + 22; O1 12 runs 2,124 ops equal at full precision; the Step 6 text
and image goldens (24) derive from the log. ts-rs: ExportInput, ExportErrorKind,
ExportWarning, LogoSlot.
2026-10-18 21:47:40 +02:00
bchanot 71bcb742c9 feat(domain): R4.4 scaffold of the pdf writer module (feature pdf-write, text contract, test targets) 2026-10-18 21:31:10 +02:00
bchanot a3f756513c chore(memory): BDR-060 R4.3 provisional, R4.4 go; R4.4 subtasks 2026-10-18 21:28:33 +02:00
bchanot 73706c074e docs(docs): J1: iPhone deferred by the owner, stays not tested; computer run reported without failure 2026-10-18 21:22:06 +02:00
bchanot 769544a1e8 docs(docs): J1 device run recorded as reported (no failure; devices and measures pending confirmation) 2026-10-18 21:18:34 +02:00
bchanot d2647505b0 chore(memory): BDR-059 J1 authorised with the WebKit reserves; kit carries the L report 2026-10-18 20:23:56 +02:00
bchanot ee71a375a2 docs(docs): J1 kit carries the L report as a rescue copy; results template 2026-10-18 20:23:26 +02:00
bchanot 57125e8975 chore(memory): R4.3 closed in the TODO; journal 2026-10-18 19:55:05 +02:00
bchanot b08373a89b docs(docs): RUST.md §10.5 completed (application build results, residual risks); R4 J1 procedure and kit
docs/development/R4_J1.md: the two LAN surfaces (dev server, production build behind the
DEPLOY CSP through serve.mjs --host on the DEV origin), the kit folder generated by
scripts/r4-j1-kit.mjs (reference PDFs, the O8 hostile corpus with expected messages,
rescue copies), twelve checks per device, what to report.
2026-10-18 19:52:25 +02:00
bchanot 08f01ef363 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.
2026-10-18 19:48:31 +02:00
bchanot 8ddf185aa6 fix(app): import worker hardenings from the security gate; restore_copy size cap in the core
Page messages validated by field (size and chunk length as safe byte counts, length within
the buffer); the task post wrapped so a refused clone leaves no orphan worker; a second
ready ignored; the 16 MiB copy cap enforced in facade::restore_copy as well as in the
worker (the uncommitted part of R4.3a). Gate verdict PASS, 7 LOW.
2026-10-18 19:07:06 +02:00
bchanot e0127b0726 docs(docs): RUST.md §10.5 draft of the R4.3 worker (amendment to B.1.5, messages, memory, leak series) 2026-10-18 19:00:24 +02:00
bchanot e659924ec0 feat(app): R4.3a the page reads the file chunk by chunk and streams it to the worker's sink
Measured at R4.3a (RUST.md §10.5): reading a file inside a WebKit worker costs about
180 MiB of content RSS whatever the method (arrayBuffer, stream, BYOB), 14 MiB on the
page; a page-side BYOB read feeding the worker's FileBytes gives 106 MiB on a 50 MiB file
against 272 in the worker and 76 for the TypeScript. Protocol v1 gains chunk / ack / end:
one 1 MiB buffer travels (transferred) and comes back after each push, so the page holds
one chunk and the worker's sink the only whole copy; no byte is parsed on the page. The
worker refuses an oversize announced before any chunk and a size that changes while
reading. Tests adapted (handler, client with a scripted ack, read failure on the page).
2026-10-18 18:57:55 +02:00
bchanot 49591c53cd test(tests): R4.3a browser re-measure of large files, leak series, WebKit repetition (stream sink, BYOB)
Streaming into FileBytes removes the file's JavaScript copy in Chromium and Firefox
(50 MiB: 65 and 67 MiB summed growth against 56 and 79 for the TypeScript); WebKit keeps
about 180 MiB for any file read inside a worker (272 against 76), a main-thread BYOB read
feeding the worker's sink measured at 106. Corpus 666/678 on the stream path. Leak series
(3 engines × 3 documents × 3 repetitions): Chromium ≤ 0.5 MiB over the last 5, Firefox
within ±3 (idle only), WebKit copy +13 then level (12-import series −2.3). 20 dense
imports in WebKit: no worker error event.
2026-10-18 18:50:47 +02:00
bchanot 8924d50edf docs(docs): DEPLOY.md: the import worker under the CSP and the Firefox 114 line (OD-1) 2026-10-18 18:24:36 +02:00
bchanot 6d1cce6e06 feat(app): R4.3b/c import worker, client, controller; HomeRoute on the disposable worker
Protocol v1 (task → ready → result | failed with phase and kind), the worker entry with
the glue bundled statically and the page's compiled Module posted, the file streamed into
the module's memory; client with start and task timers (paused while hidden), settle-once,
terminate always, error events never masked; module-level controller (one import at a
time, cancel on leaving Home, worker chunk prefetched once the engine is loaded); the
settlement mapped to the B.1.8 messages (OD-5: a trap, a timeout or an unreadable file is
« Erreur de lecture du PDF. », never a corrupt PDF). HomeRoute keeps its routing and size
pre-checks, loads its own index after acceptance, drops a result when the session changed.
Tests: handler and client in-process, the corpus message test (O8 51, O7 stored inputs,
O2/O3/Step 5), the six existing suites migrated to the real worker logic.
2026-10-18 18:10:42 +02:00
bchanot 52471dbbc0 feat(domain): R4.3a FileBytes sink and the bytes entries of the wasm facade
FileBytes gathers a file chunk by chunk in linear memory (capacity reserved from the
announced size, refused above the PDF cap); SheetHandle.import_pdf_bytes and
restore_copy_bytes consume it, so the worker streams file.stream() and the file lives
once, never as a JavaScript ArrayBuffer nor as a JSON-wrapped string. restore_copy:
strict UTF-8, one BOM, the OD-3 budget, draft.restore's kinds. Node: same envelopes as
import_pdf on the 51 O8 cases; rescue-copy parity with draft.restore.
2026-10-18 17:45:39 +02:00
bchanot f41dd59b2c chore(memory): BDR-058 R4.2 validated and R4.3 gates; LRN-061, LRN-062; R4.3 subtasks 2026-10-18 17:41:12 +02:00
bchanot 6deee65b79 docs(docs): RUST.md §10.4 browser results of the Rust import; TODO R4.2 closed, journal 2026-10-18 16:59:37 +02:00
bchanot c84186b032 test(tests): R4.2e browser measurements of the Rust import (module worker page, same perimeter as the TS baseline)
r4-import.mjs runs the 226 baseline files and the hostile classes through a disposable
module worker calling SheetHandle.import_pdf in Chromium 156, Firefox 157 and WebKit 27.2
under the RSS watchdog (not a guaranteed limit); compare-imports.mjs prints TS vs Rust;
serve.mjs gains opt-in mounts (/r4/, /pkg/). Results 2026-10-18-r4-import.json: 666/678
agreements, the 12 others are the 4 declared files; W4 met (max 68 MiB linear); the
1 GiB ceiling traps in every engine.
2026-10-18 16:58:42 +02:00
bchanot cad485b13c test(tests): fix the pinned value count past the depth cap (65 + 1000 + 65); doc comment 2026-10-18 16:35:54 +02:00
bchanot 83a66a23dc docs(docs): RUST.md §10.3 records the R4.2 security gate findings and the fix 2026-10-18 16:29:07 +02:00
bchanot 593893a7c2 fix(domain): OD-3 value count runs past the depth cap; the rescue-copy guard covers the archive text
Security gate finding (R4.2): prescan stopped counting once the depth exceeded 64, so a
16 MiB rescue copy nested 65 deep passed the value budget with 66 values and built its
792 MiB tree. The count now runs to the end (the depth verdict unchanged, the PDF probe
unchanged); the class is in the budget suite (48 MiB, refused) and pinned in cargo.
2026-10-18 16:28:32 +02:00
bchanot 1695fbb408 chore(chore): wasm-build refuses any *_for_test export in the shipped module 2026-10-18 16:18:26 +02:00
bchanot 2661a68b16 test(tests): R4.2 seeded mutation robustness of the PDF reader (no panic on content) 2026-10-18 16:17:36 +02:00
bchanot 0d2c687b79 docs(docs): RUST.md §10.3 R4.2 reader record (parity, OD-4 explanation, OD-3 thresholds, Node budgets) 2026-10-18 16:16:31 +02:00
bchanot ebcae06ac1 test(tests): R4.2 ledger: reader rows point at their cargo tests, census checks they exist
69 ported rows of scan, inflate, read and the security import cases now name the O7/O9
cargo tests; r4-ledger.mjs refuses a ported cargo target absent from cargo test --list.
2026-10-18 16:14:10 +02:00
bchanot 6ee04c96c5 feat(domain): R4.2e OD-3 value cap (400,000), rescue-copy guard, 1 GiB linear ceiling, budget measurements
json_js::MAX_JSON_VALUES from the R4.2e measurements (CAP envelope 39,652 values, 612-leaf
export 23,803; ~100 B of tree per value, a 16 MiB dense document 784 MiB with the cap off,
16 MiB with it); draft.restore refuses an over-budget copy as invalid; --max-memory 1 GiB
proven to trap on the proofs build; cargo pdf_budget prints the value table, the Node
budget suite prints the per-class cost (fresh instance, W4 asserted).
2026-10-18 16:06:36 +02:00
bchanot f8579bc19a feat(domain): R4.2d attachment probe, import_pdf and SheetHandle.import_pdf on the wasm facade
locate_attachment (shared 16 MiB budget, JS-path steps in the TypeScript order, OD-3 cap
hook off until measured), pdf::import, facade import_pdf with the PdfImportKind kinds
(ts-rs exported). cargo: O7 144 inputs (locate, read, archive rows) and O8 51 cases equal
to the R3 path, 3 OD-4 differences declared (lone surrogate in an overwritten duplicate
value). Node through the shipped module: the same O8 outcomes, every reference PDF.
Module 421.7 KB gzip (W1 budget 600 KB).
2026-10-18 15:55:46 +02:00
bchanot 9850a8341a feat(domain): R4.2c json_js: JS-path side effects of the attachment probe
starts_json_object, depth and value prescan (OD-3 proxy), TextDecoder-parity lossy decode
(400-case oracle generated by scripts/r4-utf8-oracle.mjs, 0 difference), overflow → null
rewrite with the JSON number grammar, lone-surrogate neutralised probe (OD-4).
2026-10-18 15:44:54 +02:00