28 Commits
Author SHA1 Message Date
bchanot 9e87016399 feat(domain): R5.6 fingerprint switch to sha256-rfc8785-validated-v1
The Rust pipeline is the official seed writer (pnpm import:equine); sheet-ref.json
and report-migration-map.json carry 12d78872...74e2 and the v1 block, the only two
seed files changed. 27c7383c...2660 stays a registered alias, honoured only through
LoadedSheet::recognises_historical_stamp (verified v1, recomputed document). M1: the
snapshot of an old report keeps its stamp; export, archive reader strict. Historical
oracles run in their pre-switch context; equivalence is crate-private.
2026-10-25 02:02:42 +01:00
bchanot 0dc1ba27c7 refactor(pdf): R4.8 the TypeScript PDF engine leaves: packages/pdf, pdf-lib, the TS CLI and import path, the oracle generators deleted; test read-back on an own reader of the writer's files (pdfFile.ts), view goldens from the session's SVGs, import helper on the module's reader, N-1 scanner exported by core-wasm/n-1; app no longer depends on @faunosteo/domain; r4.census suite 2026-10-19 12:17:01 +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 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 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 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 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 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 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 7ecbee9aae test(tests): R4.1a frozen TS scanner (N-1 PDF reader) and synthetic L/CAP reports 2026-10-18 05:19:41 +02:00
bchanot 6371523f8c fix(editor): honest stopped state when the draft is unsaved; no dead retry
0279953 chose the stopped message from CoreRuntime.stopped alone: it
promised the report was kept even when the tab's storage refused the
draft (export, the banner's advice, needs the core), four surfaces still
offered a retry that could not work, and a failed recovery below the cap
was a dead end since nothing called retry().

The runtime restarts a failed recovery on the next call (compiled module
reused, cap still counts traps) and notifies status listeners. One
CoreStoppedNotice on the editor, Home, New report and the full-page
notice: reload when saved, else core.stopped_unsaved with a core-free
copy download (also on the storage-full banner) and a beforeunload
guard. Export, import and new report say the stopped message; a core
failure reading an unread draft is FAILED, not held. ESLint census of
the failure keys; core.stopped says "plusieurs erreurs".
2026-10-16 18:26:10 +02:00
bchanot 0279953e9e feat(editor): a clear final state once the engine spent its three recoveries (canvas and action alerts) 2026-10-15 17:58:11 +02:00
bchanot 157c854ed1 fix(anatomy): prescan closers searched after their opener; ASCII-only href trim; root painting attributes removed (security audit R3) 2026-10-15 00:25:43 +02:00
bchanot 09a6cf7def feat(editor): the canvas draws the view the Rust core composed; denylist and anatomy dependency removed 2026-10-14 23:59:46 +02:00
bchanot 43a370aed1 feat(anatomy): text and output caps, hostile corpus through the shipped wasm within budgets; SheetSession poisons on non-closed throws 2026-10-14 23:55:22 +02:00
bchanot 842797b440 feat(anatomy): view.canvas op on the loaded sheet; drawings read once at load 2026-10-14 23:51:45 +02:00
bchanot 5020954433 chore(workspace): drop isCoreBuilt, unused since the stamp gate replaced the skip helper 2026-10-14 21:49:39 +02:00
bchanot da8a0370cb fix(app): set lone-surrogate texts aside or refuse them with a message (L1)
A draft the core refuses as lone_surrogate is unreadable content: it
goes to osteo:quarantine:draft verbatim with the existing notice. An
import is refused as ImportError('lone_surrogate') with the owner's
wording (home.import.error_lone_surrogate, FR/EN), the file untouched.
The publish gate reads the kind as invalid_shape. Tests on the real
core: quarantine keeps the exact text, an editor action leaves the
report as it was, normal text with pairs and literal backslashes reads
unchanged.
2026-10-14 21:49:39 +02:00
bchanot 74fcb37564 feat(app): R2 switch — the application runs its domain rules in the Rust core
Consumers now fed by the core (crates/core through @faunosteo/core-wasm):
- the sheet: the bundled payload is parsed and indexed by the core
  (SheetHandle, SheetIndexData); SheetIndex reads precomputed tables only;
- the store: new report, add / remove / move observation, draft restore
  (v2 migration + rebase) through the core, actions answering { ok };
- the editor click chain (zone.click), laterality and vertebra pickers
  (zone.add_sides, vertebra.initial / sync / select), the findings picker
  (finding.toggle by clicked leaf position), zone removal;
- the import: engine byte scan (TypeScript until R4), then the core's
  layered reading and rebase in one call; the export: the core builds the
  sheet snapshot, the frozen TypeScript engine writes the PDF (R4).
Lazy core: Home and the new-report form read the sheet availability from
the bundle and load the module on import / submit only; the auth shell
never references it. Degraded states (core_unavailable, invalid_sheet)
show the validated notice with a retry and never redirect or touch the
draft; an unreadable draft or archive is set aside under
osteo:quarantine:* (only content kinds; a failed write keeps it in place
and the editor stays), a rebase that flags items keeps the raw pre-rebase
draft. Four strings, wording validated by the owner.
Deleted: services/zoneInteraction.ts and its suite (13 cases ported to
cargo), the TypeScript Finding builder and vertebra selection rules of the
pickers, store rules, persistence parsing, hydrateReport. ESLint forbids
@faunosteo/domain in apps/app/src; the report:compare CLI keeps the frozen
domain until R4 (scripts/compare/sheet.ts). App suite 313/313 on the real
core (24 new tests: quarantine, degraded editor, core failures, N-1
reader); step6 goldens and the frozen envelopes unchanged.
2026-10-14 00:41:34 +02:00
bchanot 794dfd9d0b test(workspace): R2 measurements of the shipped core module next to the TypeScript it replaces
Load, sheet handle + index data, zone.click, draft.restore,
archive.import, archive.snapshot and the linear memory, printed for
RUST.md, with order-of-magnitude budgets; the frozen N-1 TypeScript
runs the same inputs for comparison.
2026-10-14 00:30:55 +02:00
bchanot 21906c4358 feat(domain): R2.2 report migration, rebase, sheet snapshot and layered archive reading in Rust; draft restore and archive import operations
migrateReportV2ToV3 / readReportDocument (version read on the raw value,
JS truthiness kept, a malformed mapped path still fails the read),
rebaseReportOnSheet (??= labels, archived names first-match),
buildSheetSnapshot / assertSnapshot (raw depth, shape, caps in UTF-16 and
UTF-8, integrity), readArchiveDocument (layered: report first, wrapper,
snapshot gate, sheet invariant, unsupported_envelope origin quirk).
Checked against 84 cases frozen from the TypeScript and 765 Zod verdicts
(one declared difference: L1, a lone surrogate reads as U+FFFD), the
ported report and archive suites and the 612 legacy leaves. Facade:
draft.restore (content kinds invalid / unsupported_version, rebase_failed
never a content kind), archive.import (incompatible_version with found,
no_attachment), archive.snapshot.
2026-10-14 00:28:02 +02:00
bchanot 6c0533c1da feat(workspace): R2 facade operations for the editor rules, the publish check and the sheet index data
Free ops: sheet.check, report.new, report.add_observation,
report.remove_observation, report.move_observation, vertebra.select.
Sheet ops: index_data, zone.click, zone.add_sides, zone.remove_at,
vertebra.initial, vertebra.sync, finding.toggle. Input contracts exported
to TypeScript; a JavaScript index that names no position removes nothing
in the filters and is refused by the move (the TypeScript swap would have
written a hole). Shipped module 999 KB raw, 319 KB gzip (budget 600 KB).
2026-10-14 00:19:20 +02:00
bchanot 343d6f4c1f feat(workspace): R2.4 core runtime — lazy load, poison on trap, offline re-instantiation, per-generation sheet handles
packages/core-wasm: browser-safe CoreRuntime (synchronous calls once ready;
a WebAssembly.RuntimeError poisons the instance, the call answers internal,
a fresh instance comes from the kept compiled module and a glue record
imported in advance; at most 3 recoveries per page; retry after a load
failure), SheetSession (handle rebuilt per instance generation, never
called on a dropped one; invalid_sheet without poisoning), Node source.
crates/wasm: SheetHandle (sheet held in the module memory). Two builds:
pkg/ shipped without trap exports (checked), pkg-proofs/ for the trap
tests; BUILD_STAMP (hash of the Rust sources) refused when missing or
stale by the vitest global setup instead of skipping. Failure envelope
carries a numeric found version; compact JS-number output.
2026-10-14 00:12:04 +02:00
bchanot ee0700887f feat(domain): R2.1 Rust contracts of the sheet, report and archive documents
Sheet document v2, report v3 / v2 / identity, migration map, sheet snapshot,
branding, PDF labels and archive envelope ported from the Zod schemas with
their exact semantics: strict objects where Zod is strict, optional fields
absent (never null), nullable fields required, integers as JavaScript
numbers, UTF-16 caps, hand-checked patterns, url crate for .url(), lone
surrogate escapes read as U+FFFD (L1, owner confirmation pending).
Fields in Zod schema order (PDF labels in the engine dictionary order):
the curated and legacy sheets, the demo report and the three frozen
archive envelopes print byte for byte as their Zod / attachment form.
ts-rs types regenerated; plan rev 2 after three plan challenges.
2026-10-14 00:04:01 +02:00
bchanot 3114d67959 test(tests): R2 freeze — archive envelopes of the three golden reports and the frozen N-1 reader
Envelopes exported by the TypeScript domain before the Rust switch (FR, no
logos, fixed export time) are the semantic oracle of the switch (D-R11:
key order may change, values may not). The shipped Zod schemas are copied
verbatim under packages/core-wasm/tests/n-1 (develop 1a7ee7d) so a rollback
reader stays testable after packages/domain is deleted at R5.
2026-10-13 23:53:12 +02:00
bchanot 2a38fa37b5 chore(workspace): Rust workspace R0 — builder image, core crate (JS-compatible JSON, report contracts, facade), wasm facade, core-wasm package with proofs 2026-10-13 00:01:25 +02:00