Commit Graph
132 Commits
Author SHA1 Message Date
bchanot d8562f60f5 fix(anatomy): V1-2.2 refuse a root visibility that hides the markers
Both composers append the marker layer as the root's last child, so a
root visibility="hidden" whose children set visible back drew the
drawing without a marker (0 marker pixels in Chromium and Firefox, PDF
and canvas). The reader refuses any root visibility but visible
(root_visibility); cleaning, verdict, preview, PDF gate and both
composers answer it.
2026-10-30 18:56:48 +01:00
bchanot 08efd9a792 fix(anatomy): V1-2.2 reserve the PDF halo id in the reader and composers
A drawing defining filter#osteo-halo replaced the PDF halo (a transparent
filter erased the marker); an element holding the id before the first
defs won its resolution. The reader refuses the id in any letter case
(reserved_id), both composers refuse such a tree, the halo is always the
engine's. Exact name only: osteo-overlays stays.
2026-10-30 17:30:48 +01:00
bchanot e823655f09 fix(anatomy): V1-2.2 owner arbitrations on SVG references and bytes
Refuse local references to ids a drawing does not define, scope canvas
ids per view, upload every drawing in one stored form checked by the
verdict and the preview, keep strict numeric rgb() colours, and commit
real Inkscape 1.4.3 exports with their generator.
2026-10-29 16:24:07 +01:00
bchanot ca31b787b6 fix(domain): V1-2.2 second review round, linear walks, bounds, CSS loaders
Verifier ECARTS(3) and security PASS on 8294d54: one indexed walk per
view chain in sheet.edit, a set for referenced drawings, released
preview parses, xml:base and CSS loaders refused, fail-closed PI scan,
PI drawings rejected by the preview, the builder naming its cap.
2026-10-29 13:58:32 +01:00
bchanot 8294d5471c fix(anatomy): V1-2.2 review findings, PIs and HTML refused, bounds
Security audit (PASS, 2 MEDIUM, 2 LOW) and verifier (ECARTS 6) on
741c25c: processing instructions and HTML fetchers refused, active
content under a long title classified, linear review groups, full
fixpoint check, bounded preview drawings, missing cap fixtures and
property checks, record wordings.
2026-10-29 13:38:33 +01:00
bchanot 8ae756534c feat(domain): V1-2.2 wasm facade, contract types, module proofs
PreviewBuilder, PreviewSheet and clean_svg on the browser module, the
31 ts-rs types and their index, the glue interface, and the proofs on
the shipped module; the module stays under its 600 KB budget.
2026-10-29 13:14:22 +01:00
bchanot 2379d28d9b test(supabase): V1-2.1 number-walk timing on a small base document 2026-10-28 20:42:52 +01:00
bchanot 538d10369f fix(supabase): V1-2.1 walk the document's numbers in linear time
jsonb_path_query row by row is quadratic on PostgreSQL 17: a document of
200k numbers under the cap ran into the statement timeout. One
jsonb_path_query_array call, then its elements. pgTAP 017 saves 600 000
numbers; the perf suite times 600k (saved) and 1M (closed code) over HTTP.
2026-10-28 20:34:35 +01:00
bchanot b1de87b5d0 fix(supabase): V1-2.1 owner self-review grant and the text size measure
M6 option A: grant_catalog_right no longer refuses an owner granting
itself sheet_reviewer; authors stay refused at acknowledgment, approval
and publication. The document cap is the UTF-8 bytes of the JSON text:
check_document_structure drops pg_column_size and M5 replaces the base
table CHECK by octet_length(content::text). pgTAP 015 and 017 cover the
owner-reviewer journey and cap - 1, cap, cap + 1, multi-byte, dense.
2026-10-28 19:32:57 +01:00
bchanot ef1f4b593f test(supabase): V1-2.1 re-runnable sandbox suite, two-session cases, caps timing
F18 and workspaces no longer leave the seed owner changed. Ten two-session
scenarios with a blocking session, seed-owner AR-1 acceptance, shim columns
against the image, save/submit/approve/publish timed at the caps.
2026-10-28 18:14:10 +01:00
bchanot d05f75da84 fix(supabase): V1-2.1 audit M1 M2 M3 and LOW fixes in M5
Approval needs an active sheet (lock sheet, version, round); a base only
from a still-published round version; rights.mfa before rights.capability;
withdrawal of a published round refused; approver separation at publish;
deprecate and working copy serialised; closed codes; append-only acks;
upload policy bound to the registering editor. pgTAP 017-019 added.
2026-10-28 18:14:09 +01:00
bchanot 3914eaa866 fix(supabase): V1-2.1 harden M5 after the security and verifier gates
Fresh security audit PASS; verifier ECARTS(10) addressed:
- publish re-checks the approver's sheet_reviewer grant (publish.approval.invalid)
- scope disclaimer enforced at approve and publish (publish.disclaimer.missing, O6)
- to_confirm split from inherited (publish.to_confirm.open distinct from publish.inherited.present)
- save_sheet_draft requires an active sheet; working copy adds the 2 MiB octet_length check
- delete_sheet_asset EXECUTE revoked from service_role (§5.4 surface)
- species table comment updated (§7.2); lease columns dropped from the reviews grant
- lock order sheet->version->round in decide/publish; conflict_retry kind (40001/40P01) in sheets.ts
Tests: pgTAP 016 (omitted status, separation, revoked-reviewer + renewal, ack carry,
inactive-species publish refusal, deprecated-delete, schema_version 1, content-write
without actor, working-copy positive), 001 census (no other writer of profile_roles).
871 real-stack pgTAP / 122 PGlite / 4 sandbox green; typecheck, lint, types drift clean.
2026-10-28 16:20:51 +01:00
bchanot 77e5fa4cf5 feat(supabase): V1-2.1 M4/M5 secure sheet access and review workflow
M4 20261028100000_sheet_access_hardening + M5 20261028110000_sheet_review_workflow
(applied together; no unprotected window). Implements contract §5-§14.

- Catalogue rights table + owner RPCs; has_mfa / has_aal2_session (live
  auth.sessions check); grant_active vs caller_has split; catalogue reader
  predicate; can_edit_sheet on the sheet_editor capability (F14).
- AR-1 B: aal2 required on every platform role change, target verified factor,
  race-free last-owner guard (F18/F19); service_role loses table privileges on
  the catalogue + profiles/profile_roles and EXECUTE on the role RPCs (F12/F17).
- Reviewed lifecycle: version provenance + review columns, content/freeze/
  author triggers, rounds/comments/acknowledgments, save/submit/withdraw/
  comment/acknowledge/decide, atomic publish_sheet_version(review_id) on the
  stored verdict, deprecate/archive/restore, species RPCs, equine working copy,
  uploads with the storage check (F7) + editor INSERT policy + 2 MiB bucket.
  F1-F3,F5,F6,F8,F9,F13,F15,F16 closed. Verdict is a fixture until M6 (V1-2.3).
- O22: SQL business mirror removed, declared status check kept; pgTAP 011 and
  the Rust generator's SQL parts deleted, ledger retargeted.
- Access layer sheets.ts (closed SheetFailure kinds); old client publish gate
  deleted; types regenerated; upload tool reads via get_sheet_asset_state.

Tested on the throwaway sandbox only; DEV untouched. pgTAP 850 (real stack) /
122 (PGlite) green; real-GoTrue AR-1 B + F18 race green; fresh install and
M3->M5 upgrade green; V1-1 regression green; rust:check, typecheck, lint,
build, types drift clean. BDR-084, LRN-095.
2026-10-28 15:52:49 +01:00
bchanot e22357630f feat(supabase): animals and relations access layer
animals.ts: POST search with species filter and a probe row, read by id with
explicit columns, create with the optional first client in one call, update,
archive. relations.ts: an animal's relations in one select (voided left out),
create, end, dates, void. Kinds duplicate_relation and already_ended added.
2026-10-26 17:11:23 +01:00
bchanot a0e069959b feat(supabase): workspaces and clients access layer with closed failures
fetchPersonalWorkspaceId, client search (keyset, one probe row), read by id
with explicit columns, create (request id), update (every field), archive,
client animals and archive preview, species labels; RecordFailure kinds of
contract §9.4 plus session_expired and network; RPC answers checked by Zod.
Unit tests and the same functions against real PostgREST on the sandbox.
2026-10-26 01:34:45 +01:00
bchanot 533a1c497d test(supabase): close the gaps two M3 mutations went through
A client whose only link was voided while current must not count the animal;
B linking its own animal to a client of A must not wait on A's lock. Also a
relation create racing the archive of its animal, and a replay changing the
initial relation's role.
2026-10-26 00:57:38 +01:00
bchanot b54c8e5bd8 feat(supabase): animals and relations M3 with RPCs, history and caps
Species rows (8 + other), animals with the D6b birth model, relations with
composite workspace keys, current/ended/voided states and a partial unique
index; definer RPCs for animals and relations (one lock order, shared write
budget, caps), invoker reads (search_animals, list_client_animals,
client_archive_preview) and search_clients with current_animal_count.
pgTAP 014 (254), parity test, sandbox suite, types from the isolated stack.
2026-10-26 00:52:22 +01:00
bchanot 4adbfcb608 feat(supabase): clients M2 with RPCs, search and per-workspace budget
V1-1.2 (contract V1-1_OWNERS_ANIMALS.md §5, §9, §10). public.clients (person or organization, display name only, optional contact, folded search keys), create/update/set_archived as definer RPCs (identical not_found, idempotent create with divergent-replay refusal, revisions, archive read-only), search_clients invoker with keyset pages and phone search, write budget per workspace in UTC hour/day windows under a row lock, 20 000-client cap, ids-only audit hidden from platform staff (N9), nothing for anon or service_role. pgTAP 013 (130), field-limits parity test, sandbox suite (concurrency, budget races, 20 000-client search), types regenerated.
2026-10-25 21:09:45 +01:00
bchanot 08abe42c48 test(supabase): isolated Supabase stack and real-stack suite for M1
scripts/db-sandbox.sh (pnpm db:sandbox): DEV images on an own network, loopback ports distinct from DEV, no volume, secrets generated outside Git; fresh and upgrade modes through the CLI's migration up, test db and gen types with --db-url. packages/supabase/tests/sandbox: M1 sign-up and confirmation, reads and refusals per role, residual GoTrue admin path, correlation cap, concurrent sessions.
2026-10-25 20:57:09 +01:00
bchanot 7bf4fb6079 feat(supabase): workspaces M1, one personal workspace per account
V1-1.1 (contract V1-1_OWNERS_ANIMALS.md §4, §8, §9). Tables workspaces and workspace_members, created with the profile by trigger through one atomic, idempotent write path; deferred invariant (a personal workspace has exactly its account as holder); backfill of existing profiles; access helpers caller_workspace_ids (active profile, confirmed email) and writable_workspace_ids; RLS select for members only; no privilege for anon or service_role. log_event keeps x-correlation-id only as a short token. pgTAP 012 (85 checks), census and types updated, config test.
2026-10-25 19:53:16 +01:00
bchanot 4e0a6c04d6 docs(docs): R5.7 census, ledger, reproducibility, RUST.md 11.23
CLAUDE.md, WORKSPACE, packages/README, README, sheet model, SUPABASE, TEST_STRATEGY,
PDF-FORMAT and ANNOTATION-RENDERING follow the deletion; RUST.md 11.23 records the census,
counts, the historical TS replay procedure and hashes; CHANGELOG, TODO, R5.7 plan and
contract.
2026-10-25 04:00:15 +01:00
bchanot 1b359598ab chore(workspace): R5.7 delete packages/anatomy and packages/domain
The TS pipeline, domain, upload script and legacy scripts leave; xmldom out of the
lockfile, Dockerfile copies trimmed. LEDGER.tsv (407 cases) and FILES.tsv (112 files)
record each disposition; r4 and r5 census tests guard the tree, lockfile and
production imports.
2026-10-25 04:00:07 +01:00
bchanot 0da7d3ab9f test(domain): R5.7 port the contracts only the TS suites checked
612 leaves and 26 legacy ids (curation_leaves), region inference, R5.1 ledger rows,
generated folder lists, migration-map oracle entry by entry, overlay removal, halo
filter, CHG-000 and dollar-tag refusals; report-v2 fixtures moved to crates/core/tests
(sha256 unchanged).
2026-10-25 03:59:49 +01:00
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 2c445063a4 feat(supabase): R5.5 upload-sheet-assets in Rust, R5.4 caps and FLOOR clarification
Core rules curation::upload (manifest, local destination, bytes through the SVG reader,
plan from observed state); binary upload-sheet-assets over ureq (handshake, no overwrite,
confirm after verify, bounded retries, key never printed); pnpm assets:upload repointed,
e2e:sheet-assets for the local stack. 4 MiB cap on changes.json and references.json.
FLOOR clarification for audit prose with its negative proof.
2026-10-23 21:15:22 +02:00
bchanot 88e42749ec docs(docs): R5.4 emoji refusal named at the guard, round 12 residuals declared 2026-10-23 17:13:30 +02:00
bchanot aeb5050502 fix(anatomy): R5.4 field segments and code spans on the generator alphabet, wiki and liquid brackets refused in list items, linear guard 2026-10-23 13:58:14 +02:00
bchanot bc5d0ad038 fix(anatomy): R5.4 authored backticks refused, underscores paired across code spans refused; sweep cites probe_ref and probe_ref_ 2026-10-23 13:21:28 +02:00
bchanot dcef2eb79c fix(anatomy): R5.4 guard rules & (legacy references), image references, nested padded wiki links; linear URL checks 2026-10-23 13:02:21 +02:00
bchanot 124d954a0d fix(anatomy): R5.4 report guard as an allowlist (report_guard.rs), sweep of 762 probes incl. seeded random strings, NUL refused in field segments 2026-10-23 12:39:17 +02:00
bchanot df82424107 fix(anatomy): R5.4 guard covers links, autolinks, references, CJK underscores; ids validated at the op; prescan before the drawing comparison 2026-10-23 12:10:35 +02:00
bchanot 94f8b35105 fix(anatomy): R5.4 Markdown guard from a TypeScript sweep, strict drawing comparison, unwritable characters refused, indexed renderers 2026-10-23 11:51:41 +02:00
bchanot fef21d67ef feat(anatomy): R5.4 review files in Rust (CHANGELOG, REVIEW-REPORT, review overlays, app drawings) and the whole-draft --check 2026-10-23 11:21:49 +02:00
bchanot f245b3ec25 fix(anatomy): R5.3 __proto__ field segments refused, seed identity guard over the whole seed tree, hashed id comparisons 2026-10-23 10:51:39 +02:00
bchanot 07d63076d3 fix(anatomy): R5.3 authored values read as JSON.parse does (key order, big integers), non-list children refused, document value bound, --check and seed guard by identity 2026-10-23 10:32:44 +02:00
bchanot 86273b6206 fix(anatomy): R5.3 non-object children refused at add, reads confined to the seed, array length in the shape check, only run-created folders, seed guard tested in place 2026-10-23 10:11:51 +02:00
bchanot 776c7095b3 fix(anatomy): R5.3 shapes refused as Zod did (struct as array, enum as map), reads bounded to regular files, --check never follows links, plain names in --out 2026-10-23 01:33:01 +02:00
bchanot 9901106a62 test(anatomy): R5.3 characterisation: Object.prototype member as a plain key, migration-map cascade debt, refusal reasons compared by stage 2026-10-23 00:50:22 +02:00
bchanot e0f149b28a feat(anatomy): R5.3 curated draft in Rust (changeset applier, migration map, stats, seed SQL) and pnpm r5:import-equine
crates/core/src/curation/draft behind the curation feature: strict changeset and references parsing as JSON.parse + Zod, the six ops, rename cascades, the B/C review rule, the R2 shape and integrity gate, migration map, document stats, seed SQL. import-equine writes both folders; --check reproduces legacy-import/ and the R5.3 draft files byte for byte (12 files, 0 differences), --out claims an absent or empty, non-symlink destination and never deletes. Parity: 825 records, 46 changes, stats, 612 leaves 442/141/29, 58 synthetic TypeScript cases (oracle r5/curation-synthetic.json).
2026-10-23 00:10:55 +02:00
bchanot 03bdb5eaa0 feat(anatomy): R5.2 legacy importer in Rust (curation feature, import-equine --check/--out), Prettier JSON and table layout, JS semantics; parity oracles frozen from the TypeScript 2026-10-22 21:14:45 +02:00
bchanot 60cc0f5fa8 test(anatomy): R5.1 freeze of the TypeScript pipeline (oracles r5: intermediates, ids, fingerprint matrix) and the D-R5 study scripts; RUST.md §11 2026-10-22 20:18:12 +02:00
bchanot f36dbdd4ae docs(docs): RUST.md §10.10 R4.8 record (deleted, replaced, kept with reasons, census, non-regression table, risks, R5 prerequisites); CLAUDE.md, README, WORKSPACE, packages/README, TEST_STRATEGY, PDF-FORMAT, DEPLOY rollback R4 note and module size, hardening §5 pdf-lib closed, fixtures README, CHANGELOG R4 entry; TODO R4.8 closed; memory BDR-064, journal 2026-10-19 12:17:02 +02: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