Commit Graph
441 Commits
Author SHA1 Message Date
bchanot d1aa35e97c test(pdf): R3 freeze O3 highlighted compositions as trees 2026-10-14 23:29:05 +02:00
bchanot 969b872b98 test(anatomy): R3 freeze O2 layer trees with attribute order 2026-10-14 23:27:46 +02:00
bchanot 47c5f49014 test(tests): R3 freeze O1 canvas trees and the visual comparison script 2026-10-14 23:26:20 +02:00
bchanot fbc9526e57 chore(chore): R3 plan rev 1 2026-10-14 23:21:08 +02:00
bchanot aab61c2fe1 Merge bugfix/r2-maintenance into develop
ci / rust (push) Canceled after 0s
ci / check (push) Canceled after 0s
ci / docker (push) Canceled after 0s
ci / supabase (push) Canceled after 0s
2026-10-14 23:20:32 +02:00
bchanot ad79fb88fa chore(memory): R2 maintenance closed (TODO, journal) 2026-10-14 23:20:30 +02:00
bchanot c97b0e7c67 fix(store): banner on a refused archive write, rescue download kept alive 2026-10-14 23:18:33 +02:00
bchanot a37c50b9ee fix(store): drop the replaced archive when the new one cannot be written 2026-10-14 23:15:54 +02:00
bchanot e5e2211476 chore(chore): R2 maintenance contract oracle count after dry run 2026-10-14 23:13:01 +02:00
bchanot eb741b62a6 chore(chore): R2 maintenance verify contract 2026-10-14 23:12:46 +02:00
bchanot 3be827b02e docs(docs): CLAUDE.md map and session-text rule after maintenance B 2026-10-14 23:12:07 +02:00
bchanot e34b7f282e fix(store): hold session texts whose set-aside fails, never overwrite them 2026-10-14 23:11:59 +02:00
bchanot 1312b366b1 chore(supabase): stop tracking the CLI's .temp/cli-latest cache 2026-10-14 22:27:40 +02:00
bchanot f99b4a581f fix(worker): bump rustls to 0.23.46 (RUSTSEC-2026-0346..0349) 2026-10-14 22:26:39 +02:00
bchanot 484f8515fd chore(memory): R2 merged into develop, BLK-010 resolved (worktrees removed)
ci / rust (push) Canceled after 0s
ci / check (push) Canceled after 0s
ci / docker (push) Canceled after 0s
ci / supabase (push) Canceled after 0s
2026-10-14 21:57:56 +02:00
bchanot c3f28d8325 Merge feature/rust-r2-domain-core into develop
ci / rust (push) Canceled after 0s
ci / check (push) Canceled after 0s
ci / docker (push) Canceled after 0s
ci / supabase (push) Canceled after 0s
2026-10-14 21:57:30 +02:00
bchanot f768e94c5a chore(memory): R2 closure — L1 refusal (BDR-051), LRN-055, EVAL-021, journal, TODO, L1 verify contract 2026-10-14 21:57:19 +02:00
bchanot 8d7a56fbf8 docs(docs): RUST.md 8.6/8.7 module size after L1 and the JSON.stringify boundary invariant 2026-10-14 21:56:53 +02:00
bchanot f8a8b25614 docs(docs): L1 resolved, lone surrogates refused and set aside (RUST.md 8.7, PDF-FORMAT, CHANGELOG) 2026-10-14 21:49:40 +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 20d03cf7fd fix(domain): refuse lone UTF-16 surrogates instead of replacing them (L1)
serde_json already refuses a lone surrogate escape; the U+FFFD pre-pass
is gone and parse_json classifies the refusal (strict escape scan, on
failure only) so callers name it: closed kind lone_surrogate from
operation inputs, sheet.check, draft.restore and archive.import.
Oracles untouched: the two L1 cases and the Zod verdict now assert that
TypeScript kept the surrogate and Rust refuses the text.
2026-10-14 21:49:28 +02:00
bchanot 36316cf67f fix(domain): sheet.check reads its document without an intermediate copy; RUST.md states the copy behaviour exactly
Second security pass on e49009e: PASS with two LOW items, both applied.
Module 1,044,559 B raw / 340,154 B gzip; core 135, core-wasm 25, app 313.
2026-10-14 01:07:17 +02:00
bchanot 651f1fef13 chore(memory): R2 delivered — BDR-050, LRN-054, BLK-010, EVAL-020, journal, TODO, verify contract 2026-10-14 01:05:13 +02:00
bchanot e49009e363 fix(domain): security audit follow-ups — deserialise JSON by reference, literal delete paths in the wasm build
The security gate (PASS, 0 blocking) reported LOW items: an imported
attachment's Value was copied for the wrapper and the snapshot gate (a
hostile 16 MiB attachment multiplied linear memory), and wasm-build.sh
deleted its outputs through a variable. Every JSON input is now read with
T::deserialize(&Value) (same errors, no copy); one deserialiser instead of
two also shrinks the shipped module from 1,180,281 to 1,046,498 bytes raw
(372,132 → 340,929 gzip). The two outputs are removed on their literal
paths. RUST.md records the numbers, the quarantine retention and the
base-image tag residual.
2026-10-14 01:02:30 +02:00
bchanot 8e8c58efca docs(docs): R2 — RUST.md §8 (migrated components, operations, runtime, census, proofs, measurements, behaviour differences, risks), CLAUDE.md, DEPLOY.md (CSP before an R2 image, never built on the VPS), WORKSPACE, TEST_STRATEGY, packages README, CHANGELOG 2026-10-14 00:51:44 +02:00
bchanot 7be94d4ce6 chore(docker): R2 application image with the Rust core — wasm stage, precompressed module, CSP proof on the image
Dockerfile stage 0 (rust:1.99.0-bookworm, wasm32 target, wasm-bindgen-cli
at the builder's pinned version, cargo cache mounts) builds the shipped
module with scripts/wasm-build.sh (WASM_BUILD_SHIPPED_ONLY=1); the Node
stage copies packages/core-wasm (manifest + pkg/); the runner gzips the
module and nginx serves it with gzip_static (application/wasm, 1,180,153
bytes raw, 372,275 served). docker/csp-proof/app-image.sh runs the real
image behind the DEPLOY.md CSP in headless Chromium: with
'wasm-unsafe-eval' a report is created and a zone click is applied by the
core with no script or wasm violation; without it the editor shows the
degraded notice, stays put and leaves the draft untouched; /login,
/app/account and / never request the module (15/15 checks).
2026-10-14 00:45:51 +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 6891f9ea25 feat(supabase): publish gate on the Rust core's sheet.check, fail closed
publishSheetVersion(client, versionId, validate) takes the core's
sheet.check (the package never loads the module itself); anything but a
publishable verdict refuses publication before the RPC: invalid_shape,
not_publishable (same message as before: first error code), and
validator_unavailable when the core cannot run. Tests run on the real
Node core; the shape case now asserts the closed kind instead of any
throw. The package no longer depends on @faunosteo/domain.
2026-10-14 00:29:03 +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 3639c8778e feat(domain): R2.3 editor rules in Rust — zone click chain, reducers, finding toggle, vertebra selection, report operations
zoneInteraction (decision + reducers, collectVertebrae concatenated-key
dedup, syncVertebrae Map order), FindingsTreePicker.toggleLeaf (clicked
leaf by position, parents first-wins), VertebraPicker toggle/all/none and
the store's newReport/add/remove/move, checked against 49 cases frozen
from the TypeScript (41 byte-equal, 8 equal up to key order: contract
order replaces insertion order, D-R11) and the 13-case service suite.
Typed error kinds where the TypeScript would throw or corrupt a list.
2026-10-14 00:17:22 +02:00
bchanot 0c47d0f837 feat(domain): R2.2 sheet integrity rules, publish check, SheetIndexData and SQL conformance in Rust
The 21 rules of validateSheetDocument ported with identical codes,
severities, paths and messages (frozen from the TypeScript on 26
conformance fixtures), createEmptySheetDocument, the publish check
(strict shape then rules), and the index data React reads once (positions
with Map semantics, names, spine ids, finding-path keys). The fixtures
also carry the codes private.sheet_document_issues returns: a cargo test
generates supabase/tests/011_sheet_conformance.sql and refuses drift
(PGlite 12/12 files, real stack 446/446). .prettierignore keeps the
byte-exact oracles and generated fixtures out of pnpm format.
2026-10-14 00:17:21 +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 22fea8736d feat(domain): Rust sheet index and loaded sheet (bundle payload → document, migration map, positions)
Lookups follow the TypeScript index: by-id maps keep the last duplicate as
new Map does, spine annotations and finding paths take the first match as
Array.find does; a document without a main view cannot be indexed.
2026-10-14 00:05:26 +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 1a7ee7d9ac Merge chore/dev-lan-access into develop
ci / rust (push) Canceled after 0s
ci / check (push) Canceled after 0s
ci / docker (push) Canceled after 0s
ci / supabase (push) Canceled after 0s
2026-10-13 23:24:12 +02:00
bchanot 9cee85752e chore(memory): LAN access validated on computer and phone 2026-10-13 23:24:11 +02:00
bchanot 30737549a2 chore(memory): LAN firewall applied by the owner, refusals verified from another device 2026-10-13 23:23:18 +02:00
bchanot e633169a00 fix(workspace): LAN exposure via host firewall — the Supabase CLI forces 0.0.0.0, so PostgreSQL / Studio / raw Mailpit close by UFW rules on the LAN interface; gateway reduced to Mailpit behind basic auth on 54325
Owner run: the CLI prints 'All services bind to 0.0.0.0' and ignored the
rootless daemon's default address; the gateway could not share 54321/54324
with 0.0.0.0 listeners. Now: Kong serves the API directly; the DEV gateway
serves only Mailpit with basic auth on <DEV host>:54325; ENVIRONMENTS.md §3
gives the exact UFW rules (interface-scoped deny on 54322-54324, two cases
by current UFW state), rollback and impact; dev:net-check proves the
allowed surfaces from a distinct Docker network (5/5 OK) and prints the
refusal checks to run from another device, since a rootless container's
traffic to the host is delivered locally and cannot see the LAN firewall.
LRN-053 corrects LRN-052.
2026-10-13 23:01:19 +02:00
bchanot a8edd59059 chore(memory): LRN-052 rootless port restriction and permission trap, journal 2026-10-13 22:38:54 +02:00
bchanot 3e48b0d848 chore(workspace): DEV least-privilege exposure — nginx DEV gateway (API on the LAN, Mailpit behind basic auth), network check from a distinct origin, loopback default for the rootless daemon documented
The Supabase CLI publishes 54321-54324 on every interface with no bind
option. Design: the rootless daemon binds published ports on loopback by
default (~/.config/docker/daemon.json {"ip":"127.0.0.1"}, owner action,
not applied), and the DEV gateway (Compose service dev-gateway, profile
dev, container faunosteo_dev_gateway) re-publishes only the API (Kong) and
Mailpit behind HTTP basic auth on FAUNOSTEO_DEV_HOST; Studio and PostgreSQL
stay loopback (SSH tunnel for Studio). pnpm dev:gateway generates the Mailpit
credentials (gitignored; htpasswd 644 because the rootless container user
cannot read a 600 file, hash only). pnpm dev:net-check probes from a
throwaway container on its own Docker network: app, API health, REST 401,
Mailpit 401/200, PostgreSQL and Studio closed. Gateway proven on alternate
ports (health 200, password login 200, Mailpit 401 / 200).
2026-10-13 22:38:40 +02:00
bchanot 5a12596195 chore(memory): R1 validated and merged, identity and environments, LAN rule — BDR-049, journal, TODO 2026-10-13 22:07:00 +02:00
bchanot dd4c35c061 chore(workspace): DEV origin on the private network — scripts/dev-env.sh (FAUNOSTEO_DEV_HOST detected or set), Supabase CLI wrapper, pnpm dev on the LAN address, config.toml URLs via env(); ENVIRONMENTS.md (identity Faunosteo / faunosteo.com, DEV / STAGING / PROD, exposure table, owner procedure)
The owner tests from other devices of the private network: every test
surface is addressed by the machine's LAN address, never 127.0.0.1 or
localhost, never hard-coded. scripts/dev-env.sh decides the host once
(hostname -I, FAUNOSTEO_DEV_HOST override, production hosts refused);
scripts/supabase.sh exports it for every CLI call (pnpm db:*, pnpm supabase)
because config.toml now reads api.external_url (mail links), auth.site_url
and studio.api_url with env(); scripts/dev.sh = pnpm dev on that origin,
pnpm dev:offline keeps the local tool alone; dev-lan.sh removed.
Verified: GoTrue API_EXTERNAL_URL and Studio SUPABASE_PUBLIC_URL on the LAN
address, a signup mail linking to http://<lan>:54321/auth/v1/verify, the
four published ports answering from a separate Docker network, and the
10-step procedure in headless Chromium at the LAN origin with every request
URL audited (no 127.0.0.1 / localhost).
2026-10-13 22:06:25 +02:00
bchanot f5865f073f Merge feature/step-08-files-foundation into develop
ci / rust (push) Canceled after 0s
ci / check (push) Canceled after 0s
ci / docker (push) Canceled after 0s
ci / supabase (push) Canceled after 0s
2026-10-13 21:59:54 +02:00
bchanot 5cfb6f1456 Merge feature/rust-r0-foundation into develop
ci / rust (push) Canceled after 0s
ci / check (push) Canceled after 0s
ci / docker (push) Canceled after 0s
ci / supabase (push) Canceled after 0s
2026-10-13 21:59:46 +02:00
bchanot 4804827bd7 chore(supabase): LAN development — API external URL and site URL on the host address so confirmation mails link to the network 2026-10-13 21:51:38 +02:00
bchanot edf1145c81 chore(supabase): LAN development — private-network redirect URLs for auth links, pnpm dev:lan (Vite on 0.0.0.0, Supabase by the host address) 2026-10-13 21:36:39 +02:00