Commit Graph
33 Commits
Author SHA1 Message Date
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 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 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 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 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 1695fbb408 chore(chore): wasm-build refuses any *_for_test export in the shipped module 2026-10-18 16:18:26 +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 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
bchanot 21d34fb9a7 feat(domain): R4.2 scaffold of the pdf reader module (feature pdf-read, miniz_oxide)
Module layout of plan §B.1.1 for the reader (read/{scan,strings,stamp,inflate,probe},
json_js), shared constants and types, index_of; feature-gated test targets; the wasm
facade enables the feature; rust-check runs the gated clippy and tests.
2026-10-18 15:29:58 +02:00
bchanot 4439fd2420 test(tests): R4.1e browser harness and TS baselines (Chromium, Firefox, WebKit)
Playwright harness under scripts/browser: 127.0.0.1 server with the DEPLOY
CSP, export and import baselines of the TypeScript engine under a 4 GiB RSS
watchdog (not a guaranteed memory limit), O9 browser columns in
inflate.browsers.json (26 rows agree with Node in all three engines).
Results of 2026-10-18 committed; the O9 Node test no longer expects browser
columns in inflate.json.
2026-10-18 15:05:28 +02:00
bchanot 4bdfda59ba test(tests): R4.1f O10 report:compare outputs and the R4 test ledger (299 cases) 2026-10-18 06:00:34 +02:00
bchanot c0a5c8c7ce feat(editor): the canvas tells an engine failure (retry) from a view it cannot draw (no retry) 2026-10-15 01:03:16 +02:00
bchanot 967c71c31e test(tests): visual-canvas dom and perf modes (Chromium DOM vs O1, timings, memory) 2026-10-15 00:03:50 +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 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 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 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 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 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 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 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
bchanot 0c6053c174 feat(workspace): real-stack avatar e2e, compose worker service, STORAGE.md contract
packages/supabase/tests/e2e/avatar-flow.e2e.ts (pnpm e2e:avatar through
scripts/avatar-e2e.sh: worker container on the Supabase network, 5 s sweep,
no quarantine grace; a fresh account per run): clean upload and owner-only
download (Bob, anon, quarantine key, direct final-key write refused),
replacement purged after the grace (queue clock shifted through psql), late
bytes through a still-valid signed upload URL swept, hostile and corrupted
uploads rejected with closed codes, removal with the purge queue drained.
Worker: the Storage API answers a missing object with HTTP 400 and
statusCode 404; normalised to 404 so a purge of a never-written key is acked.
docker-compose.yml: service worker under the worker profile (read-only,
cap_drop ALL, no-new-privileges, 512m, 1 cpu, 64 pids, .env.worker, external
Supabase network). docs/development/STORAGE.md: the implementation contract.
2026-10-13 19:39:51 +02:00
bchanot 496f54990a fix(ci): types drift gate fails closed on a git error and sees untracked files whatever the git config
The ci.yml step assigns git status to a variable before testing it (a git
failure now fails the step, as scripts/check-all.sh already did); both gates
pass --untracked-files=all; the rust-check.sh comment names the real gate.
2026-10-13 10:09:15 +02:00
bchanot e58c7be362 fix(workspace): gate fixes after the security pass — warn-only advisories, drift gate sees new files, PATH guard appends, literal rm path, prctl arguments as unsigned long
check-all.sh gains a warn-only cargo deny check advisories stage (no nightly
job runs yet) and the ts-rs drift gate uses git status --porcelain so a new
untracked type file fails too (same in ci.yml); rust-env.sh appends an
absolute ~/.cargo/bin only; wasm-build.sh removes the literal
packages/core-wasm/pkg; the worker passes the unused prctl arguments as
c_ulong and its SAFETY comments no longer claim the kernel checks them.
2026-10-13 09:46:06 +02:00
bchanot f2cf93668e chore(workspace): native Rust toolchain as the primary path, builder image as the reproducible alternative
scripts/rust-check.sh and scripts/wasm-build.sh (moved from docker/) run
natively on the user-level rustup toolchain pinned by rust-toolchain.toml;
scripts/rust-env.sh puts ~/.cargo/bin on PATH for non-interactive shells.
Root scripts: rust:check and wasm:build native, rust:check:docker and
wasm:build:docker through docker/rust-run.sh, check:all = scripts/check-all.sh,
the whole pre-merge gate in one command (rust check, types drift, wasm build,
pnpm check, application image, worker:test, worker:image started read-only).
The native check now runs the worker's unit tests (cargo test --workspace);
the sandbox tests stay feature-gated and Docker-only.
2026-10-13 01:19:13 +02:00
bchanot 8673475293 chore(workspace): move the app to apps/app under a pnpm workspace (step 2)
144 files moved with git mv (pure renames). Root package.json delegates
dev/typecheck/test:run/lint/build to the packages; Node 24 LTS and
pnpm 10.13.1 pinned (.nvmrc, .node-version, engines, packageManager,
root devDependency, engine-strict). Dockerfile builds @faunosteo/app on
node:24-alpine and copies apps/app/dist; nginx and runtime config
unchanged. CI workflow for Gitea Actions. packages/ reserved (README only).
Docs synced: WORKSPACE.md, CLAUDE.md, README, DEPLOY, CHANGELOG, plan.
271/271 tests, typecheck, lint, build green from the root.
2026-10-08 21:51:13 +02:00
Bastien Chanot b047d352c1 feat(species): locale-aware species labels via labelEn
B-6: SpeciesManifest only carried labelFr — EN users saw 'Cheval'.
labelEn required on the manifest, speciesLabel(s, locale) helper in
registry; AnimalForm dropdown + SvgEditor picker localized (locale
passed into initSvgEditor, re-inits on locale change). Scaffolder
template + ADDING-A-SPECIES.md + registry test updated.
2026-07-12 16:23:07 +02:00
Bastien ChanotandClaude Opus 4.7 7dd4f633f8 chore: rename project from osteo-report to zoosteo
Remote moved to git.bchanot.fr/bchanot/zoosteo.git; brand strings
and production URL updated to match new identity.

- package.json: name → zoosteo
- src/config/env.ts: AppConfig DEFAULTS → "Zoosteo"
- docker/entrypoint.sh: APP_*_NAME fallbacks → "Zoosteo"
- src/i18n/{fr,en}.ts: import error message + PDF title prefix
- src/pdf/attachment.ts: embedded description metadata "state v2"
- index.html: <title> fallback
- scripts/scaffold-species.mjs: console banner
- tests/unit/components.Brand.test.tsx: regex
- README.md, CLAUDE.md, CHANGELOG.md, docs/ADDING-A-SPECIES.md:
  brand headings + intro lines
- DEPLOY.md: env defaults table + osteo.example.com → zoosteo.fr
  (clone URL, paths, certbot, curl, container name references)

PDF attachment FILENAME 'osteo-report.json' and the startsWith
contract in src/pdf/attachment.ts:35,40 are preserved — changing
them would break PDF import for every PDF already exported by the
app. docs/superpowers/** and .claude/audits/** left unchanged as
historical records.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 05:53:12 +02:00
Bastien ChanotandClaude 70b7f20f6f feat(species): auto-discover species manifests + scaffold script
Registry
--------
src/domain/species/registry.ts previously hard-coded the species list,
which meant adding a new animal forced an edit in two places. The
registry now uses Vite's `import.meta.glob('./*/index.ts', { eager: true })`
and registers every manifest that default-exports a SpeciesManifest.
Duplicate ids log a warn and the first wins. Existing named imports
keep working — equine/index.ts adds `export default equine` next to the
named export.

The species dropdown is also now sorted alphabetically by labelFr (FR
locale) instead of insertion order, so two species don't shuffle
position based on glob ordering.

Scaffold script
---------------
`pnpm scaffold:species` (scripts/scaffold-species.mjs) is an
interactive Node ESM prompt that asks for the id, FR/EN labels, asset
folder, main SVG filename, detail SVG mappings, and the vertebral
formula, then writes:

  src/domain/species/<id>/index.ts        (with `export default`)
  src/domain/species/<id>/vertebrae.ts
  src/domain/species/<id>/pathologies.ts  (Zod-parses the JSON)
  src/domain/species/<id>/pathologies.json (minimal valid skeleton)
  public/species/<assetFolder>/           (directory placeholder)

The script refuses to overwrite existing files, so it's safe to rerun
after typos. SVG assets are not generated — drop them in the public
folder yourself.

Findings JSON updates
---------------------
No runtime hot-reload mechanism is needed in dev: `pathologies.ts`
imports `pathologies.json` and runs `SpeciesFindingsSchema.parse(data)`
at module load, so a JSON edit triggers Vite HMR + an immediate Zod
validation pass. In prod, rebuild and redeploy.

Docs
----
docs/ADDING-A-SPECIES.md rewritten around the new flow: quick start via
the scaffold script first, manual instructions second, and removed the
stale references to the flat `Pathology[]` model and the no-longer-
required registry edit step.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-20 05:46:33 +02:00