docs(docs): L1 resolved, lone surrogates refused and set aside (RUST.md 8.7, PDF-FORMAT, CHANGELOG)

This commit is contained in:
bchanot committed 2026-10-14 21:49:40 +02:00
1 parent 5020954433
commit f8a8b25614
3 files changed
+26 -7

No files matched your search

+2 -1
View File
@@ -10,7 +10,8 @@ Versions follow [Semantic Versioning](https://semver.org/).
- **The application's domain rules run in Rust** (`crates/core`, through the wasm facade and `@faunosteo/core-wasm`): sheet, report and archive contracts with the Zod semantics reproduced, the 21 sheet integrity rules and the publish check, the sheet index, the v2 → v3 migration, the rebase on the loaded sheet, the sheet snapshot, the layered archive reading, the editor's click chain and reducers, the findings and vertebra rules, report creation and the observation list operations. Consumers switched: the editor, the pickers, the store, the draft restore, the PDF import (after the engine's byte scan) and export (snapshot), the Supabase publish gate (fails closed). The module (340 KB gzip) loads only on the sheet pages; sign-in, the `/app` space and Home never request it. Without `'wasm-unsafe-eval'` in the CSP the editor shows a degraded notice with a retry and leaves the session's draft untouched (DEPLOY.md: set the keyword before deploying an R2 image; R2 images are never built on the VPS).
- **Session data never dropped silently**: an unreadable draft or archive is set aside under `osteo:quarantine:*` with a notice; a draft rebased with unresolved items keeps its raw text.
- Behaviour differences, declared in `docs/development/RUST.md` §8.7: drafts and attachments written in contract order (values unchanged, the previous build reads them, D-R11); a lone UTF-16 surrogate escape reads as U+FFFD (L1, to confirm); typed errors on inputs the interface never produced.
- Behaviour differences, declared in `docs/development/RUST.md` §8.7: drafts and attachments written in contract order (values unchanged, the previous build reads them, D-R11); typed errors on inputs the interface never produced.
- **Lone UTF-16 surrogates refused, never altered** (L1, owner decision): a draft, archive or attachment whose JSON escapes a lone surrogate is no longer read with U+FFFD in its place. The draft or archive is set aside verbatim under its quarantine key with the existing notice; a PDF import is refused with a new message (malformed text, file not modified); an editor action is refused and the report left as it was.
- Proofs: contracts byte-equal to the Zod output on the reference documents, the three archive envelopes frozen before the switch and deep-equal after, 924 cases and verdicts frozen from the TypeScript, permanent N-1 reader test, generated pgTAP conformance file (real stack 446/446), CSP proof on the real image. No interface, archive format, database or graphic change; release 0.2.0 untouched.
### Changed (development environment, 2026-10-13)
+5 -1
View File
@@ -156,7 +156,11 @@ never lost because of its wrapper:
contains `faunosteo-archive`, else `no_attachment`. A stamped file saved
with object streams (before BLK-009) hides its stamp and reads as
`no_attachment`.
3. The report is located (`data.report` inside an envelope, `data` for a
3. An attachment whose JSON escapes a lone UTF-16 surrogate is refused
whole (`lone_surrogate`, "malformed text, import refused, file not
modified"): the core cannot hold it without altering it and never
rewrites it (L1, `docs/development/RUST.md` §8.7).
The report is located (`data.report` inside an envelope, `data` for a
bare attachment) and read with the report reader: v3 as is, v2 migrated
through the sheet's `report-migration-map.json` (items the map cannot
place are kept with their labels and flagged `unresolved: true`), any
+19 -5
View File
@@ -136,8 +136,9 @@ under a 10 s CPU limit.
`JSON.stringify(v, null, 2)` / `JSON.stringify(v)` byte for byte (proof
§5.2). Every facade output goes through them.
- `faunosteo_core::domain::js`: the JavaScript and Zod semantics the
contracts depend on (`JSON.parse` duplicate keys, lone surrogates → U+FFFD
(L1, §8.7), `.int()` as `JsInt`, UTF-16 lengths, the id / region / colour /
contracts depend on (`JSON.parse` duplicate keys, a lone surrogate escape
refused as `lone_surrogate` (L1, §8.7), `.int()` as `JsInt`, UTF-16
lengths, the id / region / colour /
sha256 / base64 / uuid / URL patterns, optional fields absent and never
`null`, nullable fields required). Fields are declared in the Zod schema
order (D-R11). `cargo test -p faunosteo-core --features ts` writes the
@@ -595,9 +596,22 @@ application itself builds.
### 8.7 Behaviour differences (declared)
1. **L1**: a lone UTF-16 surrogate escape in a draft or an attachment reads
as U+FFFD instead of being kept (TypeScript kept it, Rust strings cannot
hold it). Owner confirmation requested.
1. **L1** (owner decision 2026-10-14, BDR-051): a JSON text that escapes a
lone UTF-16 surrogate is refused whole with the closed kind
`lone_surrogate`, never altered (TypeScript kept the surrogate; a Rust
string cannot hold it, and the U+FFFD replacement delivered first was
refused). serde_json rejects the escape like any other error and
`js::parse_json` classifies the failure with a strict escape scan, run on
failures only. A draft goes to `osteo:quarantine:draft` verbatim with the
existing quarantine notice; an archive kept beside a draft goes to
`osteo:quarantine:archive`; an import is refused with
`home.import.error_lone_surrogate` and the file is not modified; an
editor action on a report holding one (only a pasted malformed text can
bring it) is refused with `core.action_failed` and the report is left as
it was; the publish gate reads it as `invalid_shape`. Keeping such a
string byte for byte would need a JSON reader of our own and a lossless
string type across the contracts (rejected for R2, the refusal leaves
that door open: nothing is lost).
2. Drafts and the attachment's report are written in contract order instead
of insertion order (D-R11); values unchanged, the N-1 reader parses them.
3. An unreadable draft or archive is set aside under `osteo:quarantine:*`