bchanot 4499bc740c feat(editor): fifth tab « Références », citations panel from a finding
The reference library moves into a fifth editor tab (Général,
Annotations, Constats, Références, Vérification; under « Plus » below
640 px with Général and Constats). The header « Références » button is
removed. The side panel becomes the citations list of one finding,
opened only from a finding's trigger (owner GO 2026-11-12: never from a
family; the family keeps its inline list with « Retirer »). Selecting a
tab closes it; every close records one pending move applied after the
panel is gone, focus back to the trigger else the active tab button.
Vérification's reference issues land on the tab. e2e seed gains a
reference cited by « Constat A ».

Gates: typecheck, lint, test:run (app 1396), build, e2e:ui 251 passed;
e2e:shell 15 specs on db:sandbox (editor-equine never listed): 107
passed / 95 skipped / 2 failed (test remap dropped its edit), fixed and
rerun: editor-shell.spec 11 passed; full-row data guard: no
pre-existing row changed in any table. editor-equine.spec.ts helper
calls updated, not run.

## R-24 table (removed or rewritten assertions; old = fc3fec7 line, new = current file)

Unit tests:

| file:old line | old | new |
|---|---|---|
| editor-verification.test.tsx:87-96 | `navigate` called with target AND `expect.any(HTMLElement)` | called with the target only (opener dropped) |
| editor-verification.test.tsx:238-241 | `references[0]` path -> `{place:'references', citedBy:null}` | `{place:'tab', tab:'references', section:null}` |
| editor-verification.test.tsx:262-264 | `placeKey(references[9])` = `editor.place.references` | `editor.tab.references` |
| editor-navigation.test.ts:63 | targetOfKey reference -> `{place:'references', key, citedBy:null}` | `{place:'tab', tab:'references', section:null, key}` |
| editor-navigation.test.ts:80 | `referencesMounted` false at start | `citationsOf` null and `libraryReset` 0 |
| editor-navigation.test.ts:95-110 | go_to a reference opens the panel over the place | go_to a reference shows the Références tab with its focus request |
| editor-navigation.test.ts:112-122 | go_to a tab closes the panel (`references` object) | same, via `citationsOf` null |
| editor-navigation.test.ts:124-136 | select_tab keeps the panel | select_tab CLOSES the panel (P21), keeps section, no request |
| editor-navigation.test.ts:138-146 | `clear_cited_by` drops the filter | removed (action gone); replaced by `open_citations` refuses family/zone/view, `show_all_references` (closes, tab, reset bump), plain go_to leaves reset alone |
| editor-navigation.test.ts:160-175 | open/close references keep tab and section | open/close citations, same assertions on `citationsOf` |
| editor-mode.test.ts:100-109 | tabsFor four tabs, small more = general, findings | five tabs, small more = general, findings, references |
| editor-route.test.tsx:46,50 | TABS four, title « four tabs » | five |
| editor-route.test.tsx:139-146 | 640-1023 px four tabs | five tabs, tablist has `flex-wrap` |
| editor-route.test.tsx:149-161 | « Plus » lists Général, Constats | lists Général, Constats, Références |
| editor-route.test.tsx:168-190 | header button opens panel, ✕ returns focus to button | no header button, panel not mounted at start (full panel flow moved to editor-references-panel.test.tsx) |
| editor-route.test.tsx:192-206 | Escape closes, panel content kept for next opening | removed: the panel is no longer kept mounted (design choice 3); Escape/close covered in editor-references-panel + editor-escape |
| editor-route.test.tsx:208-218 | read-only: panel lists references, no edit control | read-only: the Références tab lists them, no textbox, no add button; plus new: tab keeps mounted when left |
| editor-tabs-lists.test.tsx:47,75,114,130 | render `ReferencesPanel` | render `ReferencesTab` |
| editor-tabs-lists.test.tsx:77 | selector `#reference-ref-a-url` | `#tab-reference-ref-a-url` |
| editor-tabs-lists.test.tsx:131-135 | read-only buttons = only « Fermer les références » | no button at all |
| editor-focus-request.test.tsx:166-171,200-202,346 | `ReferencesPanel` with `panel` props and focus | `ReferenceLibrary` with focus (same assertions) |
| editor-focus-request.test.tsx:226 | `ownedBy(ref,'citations')` is the request | `ownedBy(ref,'references')` is the request, `'citations'` undefined |
| editor-focus-request.test.tsx (Probe) | none | new: Vérification « Aller à » reference -> tab + focused row; reference path naming no element -> tab heading |
| editor-keep-alive.test.tsx:71,178-190 | add form survives closing/reopening the panel | survives leaving/returning to the Références tab (`#tab-reference-new-citation`) |
| editor-keep-alive.test.tsx:300-326 | « Aller à » without focus move commits Références text | a tab click without focus move commits it (one undo entry): « Aller à » is not reachable from the Références tab in R2.1 |
| editor-keep-alive.test.tsx:333-347 | Escape in panel reference field commits, panel hides | same, panel opened from a finding node, field `#panel-reference-ref-1-citation` |
| editor-keep-alive.test.tsx:350-363 | header toggle (no focus move) closes after committing | scrim click (no focus move) closes after committing |
| editor-keep-alive.test.tsx:425 | `referencesButton` click in the all-places sweep | `Références` added to the tab loop |
| editor-escape.test.tsx:218-227 | header button toggle, Escape on body closes panel, annotation selection kept | trigger-opened panel (A5), Escape closes it, `aria-expanded` back to false, selection kept after returning to Annotations |
| editor-escape.test.tsx:255-266 | Escape from tab row closes panel | same from the Constats tab button |
| editor-no-loss.test.tsx:146-153 | reference creation form, in the panel | in the Références tab, id `tab-reference-new-citation` |
| editor-no-loss.test.tsx:285-291 | focused header button survives crossing | focused tab button (Constats) survives crossing: no header button left |
| editor-no-loss.test.tsx:293-307 | references search in panel keeps focus/text | same in the Références tab body |
| editor-no-loss.test.tsx:390-400 | `everyPlace` ends by opening the panel | visits Références in the tab loop, no panel open |
| editor-no-loss-decisions.test.tsx:248-259 | open references panel holds the decision back | REMOVED: the panel exists only over Constats, decisions live in Annotations (hidden then); « a widening on another tab opens nothing » (same file) covers the withholding |
| editor-route-recovery.test.tsx:93-97 | recovery offer: header button opens panel, `aria-labelledby` | tab Références shows `editor-tab-references` labelled by `editor-references-title` |
| editor-references-panel.test.tsx (all) | header-button-driven panel tests incl. search, order, add, « Aller à » | split: panel tests (finding path only) stay in this file; library tests moved to new editor-references-tab.test.tsx (search matching, ↑/↓ only without search, counts, Ctrl+Z, read-only, « Aller à », add clears search, refused add keeps it); new: reset signal, ids unique with both mounted (P14), P6 fallback under « Plus » |

e2e (updated only, not run):

| file:old line | old | new |
|---|---|---|
| editor-shell.spec.ts:95-108 | panel keeps form text, no id repeats | Références tab keeps form text (`#tab-reference-new-citation`), ids unique with the panel open |
| editor-shell.spec.ts:121-142 | open panel leaves header and tab row clickable (incl. header Références button, add form) | `openCitations`; header button target and form steps dropped |
| editor-shell-journeys.spec.ts:113-123 | four tabs, `old` list includes « Références » | five tabs, « Références » removed from the old-layout list |
| editor-shell-journeys.spec.ts:246-249 | Aller à reference -> panel visible, close | `place('references')` visible, tab Références selected, row focus key, no close |
| editor-shell-layout.spec.ts:84-103 | overflow on four tabs + panel over drawing | five tabs + `openCitations`/`closeCitations` |
| editor-shell-layout.spec.ts:54-63 | local `goToTab` | removed, uses `openTab` |
| editor-shell-layout.spec.ts:140-158 | canvas width without/with panel over the drawing | E1: width measured before open and after a P21 switch to Annotations, asserted equal |
| editor-shell-layout.spec.ts:161-189 | axe on four tabs + open panel | five tabs + citations panel |
| editor-shell-layout.spec.ts:~255-310 | keyboard order began with `header` (the Références button) | `header` dropped from both orders (no focusable header control while the draft is clean); panel test selects Annotations before walking to `side` |
| editor-access.spec.ts:150-152,191-194,219-220 | axe/overflow with the panel at 320/375/768/800, 1024, read-only | same checks through `openCitations` (`showDrawing` calls dropped) |
| editor-shell-crossing.spec.ts:194-206 | references form with panel open, tab `annotations` | in the tab, focus expected on `editor-tab-references` |
| editor-shell-crossing.spec.ts:264-282 | panel open + add-form text across crossing | citations panel over a crossing, no typed-text step |
| editor-shell-crossing.spec.ts:~385-410 | decision withheld while panel open, Reprendre | REMOVED (state unreachable, see unit row) |
| editor-deselect.spec.ts:226-229 | Escape closes header-opened panel, selection kept | opened via Constats, Escape, back to Annotations, selection kept |
| editor-structures.spec.ts:80-122 | two references added, counts 2/1 | shape now holds `ref-a`: counts 3/2, `nth(1)` after move, saved list `['Référence A','Seconde référence']`, no panel |
| editor-equine.spec.ts:304-305,404-405 | openReferences/closeReferences | `openTab(page, dict, 'references')`: mis à jour, non exécuté, non vérifié |

Fix round 1: 1. e2e/shell/editor-shell.spec.ts « the open citations panel leaves the header and the tab row clickable »: before `openCitations`, the test now opens the Références tab and adds a reference through the library form (`#tab-reference-new-type` book, `#tab-reference-new-citation` « Smith 1999 », « Ajouter la référence »), so the draft is dirty and Save is enabled. All original assertion
2026-11-12 20:29:27 +01:00

Faunosteo

Web app for veterinary osteopaths to write session bilans on animal anatomy SVGs — click zones, build observations, export a self-contained PDF with the full report JSON embedded as a native PDF attachment. Re-importing that PDF restores the state for a follow-up.

Multi-species by design. The MVP ships the horse sheet: a canonical anatomical sheet document (drawing + annotations + findings catalog, crates/core/src/domain/sheet) generated and curated under supabase/seed/anatomical-sheets/equine/. Another species is another sheet document, no code change. See docs/development/ANATOMICAL_SHEET_MODEL.md §6 for how a sheet is produced.


Versions: what is public, what is in development

Where What it is
Public, on faunosteo.com: 0.1.0 (2026-05-21) The local tool alone, open to every praticien: a static application with no account, no backend and no central server. The exported PDF is the long-term record.
develop (not released, not deployed) The local tool on the canonical anatomical sheet and Report v3, the PDF archive envelope, the Rust migration R0 to R5 (domain rules, SVG reader, PDF reader and writer, curation pipeline and files worker in crates/), and the SaaS foundations: Supabase schema under RLS, accounts, the /app space, the profile photo.
release/0.2.0 Cut on 2026-10-11 from plan Steps 3 to 6, never finished or deployed; its fate is TODO RR-9.

Available only in a development environment (they need the local Supabase stack, pnpm db:start, and for the photo the worker container; no production Supabase exists and hosting is undecided, docs/development/OPEN_QUESTIONS.md Q2):

  • sign-up with email confirmation, sign-in, password recovery, OAuth buttons behind configuration;
  • the /app space: dashboard and Mon compte (personal, professional, preferences, security sections);
  • the profile photo, processed by the Rust worker;
  • the curated equine sheet DRAFT in the editor, bundled only with SHEET_BUNDLE=draft (pnpm dev, pnpm build:preview): not medically validated, not published; a default build carries no sheet;
  • the anatomical pipeline and archive tools (pnpm import:equine, pnpm assets:upload, pnpm report:compare).

Planned, not implemented (roadmap in docs/development/IMPLEMENTATION_PLAN.md §0): V1-1 clients and animals (its business decisions ratified, technical design awaiting validation), V1-2 sheets served from Supabase, V1-3 bilans stored in the cloud with history, V1-4 stored PDFs and authorised sharing, V1-5 mobile and accessibility pass; then professional verification, cabinets, entitlements, agenda, public site and the rest of the plan. Nothing on develop authorises a release: the release readiness track (TODO RR-1 to RR-10) comes first.


Features

The local tool as it stands on develop. The public 0.1.0 has the canvas, the detail view, the vertebra picker, the findings tree, PDF export and re-import (report v2), the bilingual UI, the configurable identity and the practitioner cache; laterality, the footer branding, Report v3 with the v2 migration, the sheet document and the rescue copy came after it (CHANGELOG Unreleased).

  • Anatomy canvas — inline SVG drawing with markers rendered from the sheet document (hitbox + visible twin, delegated click listener)
  • Observation builder — group zones into clinical observations with severity and free-text notes
  • Hierarchical findings tree — per-zone picker with breadcrumb drill-down through the expert-authored catalog (26 zones for the horse), vet-referral badges on sensitive leaves, scope-disclaimer modal once per session
  • Vertebra picker — region tabs (C/T/L/S/Cd) with multi-select chip grid for precise vertebral notation
  • Detail views — click the head trigger to open the head view (a crop of the same drawing, or a view's own asset)
  • PDF export — A4 portrait with rasterized views, structured observations, and the full Report v3 JSON as a native PDF attachment; older v2 PDFs import through a generated migration map
  • PDF re-import — open a previously exported PDF to restore the session for a follow-up
  • Rescue copy (JSON): when the tab cannot save the report (storage full) or the computation engine stops, "Télécharger une copie" saves the report in progress as a .json file. To restore it, open the home page, "Choisir un fichier", and pick that file: the report reopens in the editor. The copy holds the report only. It does not replace the original PDF, which stays the archive of record for past reports (the frozen sheet snapshot, logos and labels it was produced with).
  • Bilingual UI — full FR/EN interface with a one-click language switcher; default locale auto-detected from the browser, then persisted
  • Configurable identity — site name, brand, footer, tagline all come from env vars; nothing hardcoded
  • Practitioner cache — last-used practitioner block prefilled via localStorage
  • Laterality — left/right side selection on bilateral zones, reflected in badges and the PDF
  • Footer branding — global footer (copyright, "Powered by ZenQuality", partner logo), on site + PDF

Stack

  • Node.js 24 LTS + pnpm 10.13 (corepack)
  • React 19 + TypeScript 5 (strict)
  • Vite 7 + @vitejs/plugin-react-swc
  • Tailwind CSS v4 (CSS-first, no postcss config)
  • Zustand 5 (state)
  • Zod 3 (schema + runtime validation)
  • PDF reader and writer in the Rust core (crates/core/src/pdf, WebAssembly in the app; no pdf-lib since R4.8)
  • motion 11 (animations)
  • vitest 3 + happy-dom + @testing-library/react
  • Supabase (PostgreSQL 17, Auth, RLS) via the pinned CLI; @supabase/supabase-js 2; PGlite for Dockerless SQL tests

Quick start (dev)

Single process, no Docker:

# Node 24 (see .nvmrc) + pnpm 10.13.1 via corepack, no global install:
corepack enable

pnpm install
cp .env.example .env   # edit APP_* vars if desired
pnpm dev               # http://<FAUNOSTEO_DEV_HOST>:5173 (the DEV origin, never localhost)

Development server on the private network (the DEV origin is the machine's LAN address, scripts/dev-env.sh): pnpm db:start, then pnpm dev and open http://<lan-address>:5173 from any device of the network; Mailpit for the sign-up mails through the DEV gateway on :54325 behind basic auth, pnpm dev:gateway (docs/development/ENVIRONMENTS.md).

Rust (core, browser module, worker): a user-level rustup installs the pinned toolchain from rust-toolchain.toml on first use; see docs/development/RUST.md §1 for the three cargo install / rustup target add lines and the Docker alternative. The files worker (profile photos, Step 8) runs as a container beside the local Supabase stack: pnpm worker:image, then pnpm e2e:avatar (= pnpm db:sandbox avatar-e2e) for the real-stack end-to-end run on the throwaway stack, or docker compose --profile worker up worker with a .env.worker (docs/development/STORAGE.md).

Docker Compose (matches production topology):

cp .env.example .env   # set APP_* identity vars
docker compose up --build
# app at http://localhost:8080

Verifying a change

pnpm typecheck    # TypeScript strict, no emit
pnpm lint         # ESLint 9 flat config, 0 warnings
pnpm test:run     # vitest run (core-wasm, supabase/PGlite, app)
pnpm build        # tsc + vite build → apps/app/dist/
pnpm report:compare <pdf|dir>...   # archive PDF vs its v3 reading, unresolved items flagged (the core's binary; first run compiles)
pnpm rust:check   # native: fmt, clippy -D warnings, cargo test, ts-rs export, cargo deny
pnpm wasm:build   # native: browser module → packages/core-wasm/pkg (the core-wasm proofs run on it)
pnpm check:all    # everything a branch must pass before a merge, in one command (needs Docker for the image stages)

No CI/CD runs on the forge yet: the workflow files under .gitea/workflows/ are prepared for a future runner and call these same scripts.


Build & deploy

pnpm build                  # production build → apps/app/dist/
docker build -t faunosteo .   # multi-stage Docker image
docker compose up --build   # run with env_file: .env

For production deployment (VPS provisioning, firewall, TLS, nginx reverse proxy, backups, hardening) — see DEPLOY.md. It describes the static 0.1.0 deployment; read its status notice before deploying anything built from develop.


Documentation


Project layout

faunosteo/                  pnpm workspace (see docs/development/WORKSPACE.md)
├─ apps/app/                the private application (@faunosteo/app):
├─ vite/sheet-bundle.ts     Vite plugin bundling the reference sheet (SHEET_BUNDLE=draft|none)
├─ src/app/                 routes + ConfigProvider
├─ src/config/              runtime env config resolution
├─ src/sheets/              SheetProvider (bundled implementation) + useSheet hook
├─ src/services/            sheet index (lookups by id) + zone interaction service (pure)
├─ src/i18n/                translation dicts (fr/en) + useT() hook
├─ src/state/               Zustand store (Report v3) + persistence adapter + locale store
├─ src/anatomy/             drawing: sanitised asset + annotation layer → inline SVG per view
├─ src/components/          UI primitives, canvas, observation, report
├─ src/pdf/                 app side of the PDF: snapshot + branding + labels + browser rasterizer → the core's export session
├─ src/lib/                 id, dates, assert utilities
├─ src/styles/              Tailwind v4 CSS + design tokens
├─ tests/unit/              vitest tests on the bundled sheet (+ frozen v2 fixtures)
├─ packages/core-wasm/      @faunosteo/core-wasm: the Rust core in the browser (runtime, generated types, frozen N-1 reader)
├─ crates/                  Rust: core (contracts, rules, SVG, PDF, anatomical pipeline), wasm facade, worker
├─ packages/supabase/       @faunosteo/supabase: typed client, generated types, PGlite SQL test harness
├─ supabase/                CLI config, SQL migrations, local seed (incl. the equine sheet), pgTAP tests
├─ docker/                  entrypoint.sh + nginx.conf
├─ docs/                    conventions, sheet model, PDF spec, development plan
└─ index.html               SPA entry point

Status

Public: 0.1.0 (2026-05-21), the local tool with no backend. develop: plan Steps 0 to 8 and the Rust migration R0 to R5, merged, not released. The merge gate is pnpm check:all (see "Verifying a change"); no CI runs on the forge.

The first species ships as the equine anatomical sheet: the historical Horse.svg, Horse_head.svg and findings catalog (26 zones, 792 nodes) imported, then audited and curated (supabase/seed/anatomical-sheets/equine/, 45 traced changes, 48 references). The application bundles that curated draft in development (SHEET_BUNDLE=draft); it is not medically validated and a production build carries no sheet unless asked. Another species is another sheet document produced the same way.

Manual QA checklist: .claude/audits/MVP-QA.md — walk it through pnpm dev before delivery.

License: MIT.

S
Languages
TypeScript 78.6%
HTML 14.6%
CSS 3.7%
JavaScript 2.2%
Shell 0.7%
Other 0.2%