Commit Graph
42 Commits
Author SHA1 Message Date
bchanot 51a5a80192 fix(app): safeNextPath refuses a next value that normalises into //host (/..//, /%2e%2e//); dot-segment, scheme, encoding and consumer tests 2026-10-21 18:15:08 +02:00
bchanot dcc79400de fix(ui): bundle the footer's ZenQuality logo (production CSP img-src 'self' refused the hotlink); CSP proof counts every violation; gitleaks allowlist carries the owner's [gated 2026-10-18] marker 2026-10-21 15:47:18 +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 cdcdda8e1c docs(docs): R4.6 J2 recette (procedure, results grid, kit script), export harness phases and dist override, export series script, ledger targets of the app PDF suites, CLAUDE.md export flow; export driver publishes its User Timing split 2026-10-19 01:41:57 +02:00
bchanot d492bf7112 feat(pdf): R4.6 app export on the core's session: export.ts drives ExportSession (rasters one by one, warnings in the engine's order, abort on unmount), labels moved to the app, EditorRoute downloads the Blob of the parts; suites read the file's content streams (pdfRead helper), app-path bytes = R4 digests, hex strings upper-case as pdf-lib 2026-10-19 01:26:13 +02:00
bchanot 8ddf185aa6 fix(app): import worker hardenings from the security gate; restore_copy size cap in the core
Page messages validated by field (size and chunk length as safe byte counts, length within
the buffer); the task post wrapped so a refused clone leaves no orphan worker; a second
ready ignored; the 16 MiB copy cap enforced in facade::restore_copy as well as in the
worker (the uncommitted part of R4.3a). Gate verdict PASS, 7 LOW.
2026-10-18 19:07:06 +02:00
bchanot e659924ec0 feat(app): R4.3a the page reads the file chunk by chunk and streams it to the worker's sink
Measured at R4.3a (RUST.md §10.5): reading a file inside a WebKit worker costs about
180 MiB of content RSS whatever the method (arrayBuffer, stream, BYOB), 14 MiB on the
page; a page-side BYOB read feeding the worker's FileBytes gives 106 MiB on a 50 MiB file
against 272 in the worker and 76 for the TypeScript. Protocol v1 gains chunk / ack / end:
one 1 MiB buffer travels (transferred) and comes back after each push, so the page holds
one chunk and the worker's sink the only whole copy; no byte is parsed on the page. The
worker refuses an oversize announced before any chunk and a size that changes while
reading. Tests adapted (handler, client with a scripted ack, read failure on the page).
2026-10-18 18:57:55 +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 2b8000e5ab fix(editor): PDF export download keeps its URL alive (WebKit may cancel) 2026-10-18 04:53:45 +02:00
bchanot 9bd9acaf58 fix(app): rescue copy importable, trapping draft held, replace confirmed
The JSON rescue copy could not be restored in the app, a draft that traps
the engine left the tab on a reload screen and spent a recovery on every
read, and an unsaved or in-progress report could be lost by a reload
outside the editor or by New report / Import without warning.

Home import reads the copy (content-sniffed, 16 MiB cap, strict UTF-8)
through the core's draft.restore before any session change; a trapping
(draft, archive) pair is held in the resolution panel and only re-read
on Retry; ReplaceSessionDialog guards New report and Import; the
beforeunload guard is app-wide while unsaved. Supersedes BDR-055's
"never held" for `internal` only.
2026-10-17 12:58:57 +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 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 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 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 e34b7f282e fix(store): hold session texts whose set-aside fails, never overwrite them 2026-10-14 23:11:59 +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 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 926dd7df8c feat(app): profile photo — avatar upload in Mon compte, photo in the sidebar, drawer and top bar
packages/supabase assets module: closed AssetFailure kinds, begin / quarantine
upload (upsert off) / confirm / remove, own-row state read with an explicit
column list, download under the SELECT policy. App: client transport (magic
byte sniff, never SVG, createImageBitmap, canvas 1024 px, JPEG 0.9, 5 MiB
cap), AvatarSection (preview, save, 1 s polling up to 30 s, rejection and
failure messages per closed code, removal with confirmation, in-flight row
resumed at mount), auth store blob URL revoked on change and sign-out,
AvatarCircle in UserBadge and the top bar link to Mon compte (D3), FR/EN
strings, fake client extended, 27 new tests (app 300).
2026-10-13 19:32:37 +02:00
bchanot 9771d997f4 fix(app): failed sign-out reported (local session still cleared); reauthentication_needed phrased; docs(docs): exact production redirect allowlist 2026-10-11 23:45:14 +02:00
bchanot 1aed64b4ef fix(app): safeNextPath resolves next= against a sentinel origin (closes the /\host and tab/newline open redirect); tests; contract amended 2026-10-11 23:44:00 +02:00
bchanot aeea1f2e9b chore(app): drawer honours prefers-reduced-motion; chore(memory): BDR-041, LRN-047, journal, TODO 7.x 2026-10-11 23:40:11 +02:00
bchanot c517ea267b feat(app): identity screens and /app shell — auth store, login/signup/reset flows, dashboard, account
- state/authStore: session subscription (initialize + onAuthStateChange), profile + roles load, recovery flag, URL failure; services/localeSync: profiles.locale <-> localeStore
- routes: /login, /signup, /forgot-password, /reset-password, /auth/callback; guards RequireAuth (next=) and RedirectIfSignedIn; /app (dashboard), /app/account behind the guard
- shell: AppLayout (desktop sidebar, light top bar, mobile drawer), SidebarNav, UserBadge, SignOutButton
- account: personal / professional / preferences / security sections, one save each, Zod validation with i18n keys
- ui: Icon, FormField, Notice, ButtonLink (buttonClassName shared), PasswordField, OAuthButtons (config-driven)
- Home header: Mon espace / Se connecter when Supabase is configured; local tool routes untouched
- i18n: auth.*, shell.*, dashboard.*, account.*, home.space.* in fr + en
2026-10-11 23:29:13 +02:00
bchanot b10b227ee9 feat(supabase): auth, profile and roles services; professional columns on profiles; OAuth + TOTP config
- packages/supabase: signIn/signUp/OAuth/reset/updatePassword/signOut wrappers with a closed AuthFailure kind, fetch/update own profile, own platform roles
- migration 20261011100000: practice_name, professional_title, siret (format-checked, column grants); pgTAP 009; database.types regenerated
- config.toml: TOTP enroll/verify on, [auth.external.google|apple] via env(), wildcard redirect URLs
- app config: authProviders (APP_AUTH_PROVIDERS / VITE_AUTH_PROVIDERS), entrypoint env.js, DEPLOY table
- TODO: Step 7 plan
2026-10-11 23:16:13 +02:00
bchanot 62b8a43e09 feat(home): import messages open with a full-restoration or partial-recovery headline; BDR-040 recorded 2026-10-11 16:31:37 +02:00
bchanot e8f1734424 feat(editor): tell the practitioner when a restored draft was rebased on a different sheet 2026-10-11 16:15:13 +02:00
bchanot 293a6e0b36 fix(pdf): bundle the branding assets into the app (no fetch at export), export returns its warnings and the editor reports missing elements 2026-10-11 16:09:39 +02:00
bchanot 1f417b21fd fix(pdf): security hardening — hex-encoded link URIs, strict branding URL schema, branding and labels re-validated at export, PNG dimension budget, CSS escape and parenthesis rules in the sanitiser, finite raster size, file size checked before read 2026-10-11 13:54:18 +02:00
bchanot 9bd5173a9c feat(app): export and import through @faunosteo/pdf — snapshot, archived branding and labels, browser rasterizer, imported archive kept in session, explicit rebase with messages; legacy PDF modules removed 2026-10-11 13:32:14 +02:00
bchanot cdc0943f35 feat(domain): archive contracts — sheet snapshot (lean document, caps, integrity), envelope v1 layered reader, branding and label schemas, report rebase, sheet index moved from the app; bundle carries asset hashes 2026-10-11 12:30:57 +02:00
bchanot 1f0b710b6e fix(editor): drop the permanent will-change on the findings list, its text blurred on screen 2026-10-10 22:15:09 +02:00
bchanot b1b3e4927e fix(pdf,tests): report:compare escapes control characters, prints names and free text only with --full, stats before read, missing file as a per-file failure; inferRegionCode regression test; import.ts JSDoc reattached 2026-10-10 15:53:07 +02:00
bchanot dc78a00835 feat(pdf): archive check tool pnpm report:compare (attachment vs its v3 reading, unresolved items flagged, --diff/--summary/--identity); readAttachedDocument split out of extractReportJson; stale scaffold:species script removed; docs 2026-10-10 15:44:20 +02:00
bchanot e7f4167ada fix(domain,app): own-key lookups for untrusted ids in the v2 migration, attachment and PDF size caps; EVAL-011, journal, TODO 2026-10-10 12:23:03 +02:00
bchanot 17a6d9b323 test(app): former PDF, observation card, route and schema assertions restored on v3; foreign JSON attachment reported as no_attachment; doc counts 2026-10-10 12:21:19 +02:00
bchanot 09d8b01a54 fix(app): editor route split into dialogs and pickers components, canvas without lint suppression, findings picker coverage restored; golden test pins every generated draft file; stale doc lines 2026-10-10 11:55:57 +02:00
bchanot ce2ec26112 feat(app): application on the canonical sheet — report v3 store with v2 draft migration, bundled SheetProvider (SHEET_BUNDLE), annotation layer rendered from the document, zone interaction service, pickers and cards on the sheet index, PDF v3 export with v2 archive import; legacy registry, matchers, editors and assets removed 2026-10-10 11:36:14 +02:00
bchanot ab04b2e43d style(supabase): prettier pass on the new TypeScript files 2026-10-08 22:46:37 +02:00
bchanot d239374d81 feat(app): optional Supabase connection in runtime config + lazy typed client
- env.ts: supabase: SupabaseConnection | null resolved from env.js
  (supabaseUrl/supabaseAnonKey), VITE_SUPABASE_*, else null; half config refused
- lib/supabase.ts: getSupabaseClient() null when unconfigured, one client per URL
- entrypoint.sh writes the two public values; .env.example placeholders
- Dockerfile copies packages/supabase manifest for the install layer
- no UI change; 7 new tests (278 app)
2026-10-08 22:43:18 +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