Commit Graph
159 Commits
Author SHA1 Message Date
Bastien ChanotandClaude Opus 4.6 2d6ed809e2 chore: rename Zoosteo → Faunosteo across entire project
Brand strings, config defaults, i18n dicts, PDF attachment metadata,
HTML titles, Docker container name, package name, repo URLs, deploy
paths, and all documentation updated. Git remote switched to
faunosteo.git. Domain URLs (zoosteo.fr) preserved — DNS update is
separate. 155/155 tests green.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-22 21:44:21 +02:00
Bastien ChanotandClaude 89e010cc5d fix(ui): vertical centering — h-full → flex-1 on route containers
h-full (height:100%) doesn't resolve when the parent only has flex-1
without an explicit height. flex-1 (flex-grow) works because the
parent App.tsx <main> IS a flex container — no explicit height needed.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-22 06:38:28 +02:00
Bastien ChanotandClaude 43fdb7e189 fix(ui): vertical centering — make app main a flex column
App.tsx <main> was flex-1 but not a flex container itself, so child
routes with h-full + grid place-items-center couldn't resolve their
height for vertical centering.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-22 06:33:27 +02:00
Bastien ChanotandClaude 66c737188b fix(ui): center editor cards and remove redundant title
Remove h1 heading from editors page, use same centered grid layout
as home page — cards vertically and horizontally centered in viewport.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-22 06:30:34 +02:00
Bastien ChanotandClaude 08fbf093a8 fix(ui): home and editors pages fit viewport without scroll
Replaced min-h-screen with h-full on both routes — App.tsx flex layout
already provides min-h-screen + flex-1, so the inner min-h-screen was
doubling the minimum height and pushing the footer off-screen.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-22 06:26:50 +02:00
Bastien ChanotandClaude dee98e3eac chore(memory): capitalize session decisions and learnings
BDR-020 (pathology editor standalone), BDR-021 (zoneMatch inline port),
LRN-025 (importNode XSS), LRN-026 (inline port pattern). Journal
updated for 2026-05-22 sessions.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-22 06:17:32 +02:00
Bastien ChanotandClaude f2c9c9bdb7 feat(i18n): pathology editor header navbar + full FR/EN translation
Header with brand link + FR/EN segmented toggle reading/writing
osteo:locale localStorage key. 76 translation keys covering all
UI strings. View state tracked for re-render on locale switch.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-22 06:17:03 +02:00
Bastien ChanotandClaude 1673302b09 feat(i18n): SVG editor header navbar + full FR/EN translation
Compact header (Brand + LanguageSwitcher) above the SVG editor.
All 58 hardcoded strings in JSX template and vanilla JS replaced with
t() calls via TFn passed to initSvgEditor. Editor re-inits on locale
change. CSS drop overlay uses data-drop-label attr for translated text.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-22 06:16:49 +02:00
Bastien ChanotandClaude 5e24c2f3d7 feat(ui): editors listing page, footer links, and i18n keys
New /editors route listing SVG editor and pathology editor with
descriptions and CTAs. Footer gains Éditeurs link, Paws iin Harmony
credit, and pipe-separated layout. 69 i18n keys added (editors.*,
footer.*, svg_editor.*) in both FR and EN dicts.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-22 06:16:37 +02:00
Bastien ChanotandClaude 569e57197f feat(editor): locale-aware hover tooltip on anatomy zones
Custom floating tooltip replaces native SVG <title> — follows cursor,
shows zone name in active locale (FR/EN), dark pill style with 120ms
fade. getAnnotatedElement() helper added to svgConvention.ts.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-22 06:16:17 +02:00
Bastien ChanotandClaude Opus 4.6 7855220d52 docs: update CLAUDE.md and README for pathology editor
Add pathology-editor.html to folder structure, specs listing, and
README feature list.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-22 04:43:28 +02:00
Bastien ChanotandClaude Opus 4.6 9cca51c504 feat(editor): add standalone pathology editor tool
Standalone HTML page for editing species pathology JSON via SVG-based
zone selection. Supports pre-wired species list and manual SVG+JSON
upload. Features fuzzy zone matching (ported from zoneMatch.ts),
recursive tree editor with full CRUD, auto ID generation, and safe
JSON export preserving all zones and root fields.

Includes SVG sanitization (script/foreignObject/on* stripping),
unsaved changes protection, and French error messages.

Also copies pathologies.json to public/ for HTTP access from the editor.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-22 04:42:07 +02:00
Bastien ChanotandClaude Opus 4.6 9e60131de7 fix(editor): hide footer on SVG editor, contain SVG to viewport
Extract AppShell with useLocation to conditionally hide Footer on
/svg-editor. Add max-height: 100% + width: auto to SVG canvas CSS
so loaded SVGs fill available space without overflowing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-22 03:10:51 +02:00
Bastien ChanotandClaude Opus 4.6 ce84caea04 fix(editor): SVG editor UX — AbortController cleanup, icons, labels
AbortController on all addEventListener calls fixes React StrictMode
double-mount causing duplicate listeners, stale "Upload SVG first"
alerts, and double file dialogs. Mode buttons get icons (☝●▬), file
button shows context-aware label, polygon validate/cancel get
green/red styling. Inline SVG style overrides removed (CSS-only now).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-22 03:10:46 +02:00
Bastien ChanotandClaude Opus 4.6 ce29457d8b chore(memory): capitalize SVG editor integration
BDR-017 (vanilla JS wrap decision), LRN-023 (DOMParser SVG loading),
journal entry for 2026-05-22 session.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-22 02:14:10 +02:00
Bastien ChanotandClaude Opus 4.6 832666b269 docs: update CLAUDE.md folder structure for SVG editor
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-22 02:14:06 +02:00
Bastien ChanotandClaude Opus 4.6 ea81d8cfa3 feat(editor): integrate SVG anatomy editor as /svg-editor route
Wrap standalone vanilla JS SVG annotation editor (~1630 lines) into
React via useRef+useEffect. CSS restyled to Zoosteo design tokens.
Route registered at /svg-editor with noindex meta tag and back-to-home
link. DOMParser used for safe SVG file loading. Zero behavior loss
from original editor.html.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-22 02:14:01 +02:00
Bastien ChanotandClaude Opus 4.7 4dd6432ed6 fix(editor): boost findings-tree slide to be perceptible on mobile
Previous 16px / 180ms transition was barely visible on a 360-420px
wide mobile viewport. Adjustments:
- Slide distance 16px → 32px so the off-position is clearly off-axis
  on small screens.
- Duration 180ms → 220ms — slightly longer keeps the slide visible
  through the iOS/Android touch-event paint cycle.
- Hint with willChange: 'transform, opacity' so mobile Safari
  promotes the ul to its own compositor layer up front, avoiding a
  first-frame flicker on weaker GPUs.

No behavioural change to direction logic; tests still 155/155.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 07:28:28 +02:00
Bastien Chanot 5093418950 chore(memory): journal line for findings-tree level transition 2026-05-21 07:23:08 +02:00
Bastien ChanotandClaude Opus 4.7 adbab1bc87 feat(editor): directional slide transition between findings-tree levels
Opening a finding category (e.g. "Dysfonction ostéopathique") and
backing out felt abrupt — list content swapped instantly with no
visual continuity. Now the list animates a short slide+fade between
levels:
- Drill down → new list enters from the right (+16px → 0).
- Back / breadcrumb up → new list enters from the left (-16px → 0).

Implementation:
- Wrap the list in `motion.ul` keyed by the path string so React
  remounts when the level changes; motion's `initial`/`animate`
  variants then play on every remount.
- A direction state (1 | -1) feeds the `enter` variant via `custom`
  so forward vs. back have opposite slide directions.
- All path mutations go through `goInto` / `goBack` / `goToDepth`
  helpers that set direction before calling `setPath`.
- 180ms ease-out — perceptible but does not block interaction.

AnimatePresence was deliberately omitted: it defers DOM swap, which
broke the existing synchronous `getByLabelText` assertions in
components.FindingsTreePicker.test.tsx. The key-based remount keeps
the new content reachable immediately while still providing a
direction-aware entrance.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 07:22:55 +02:00
Bastien Chanot ef0ef62f2d chore(memory): journal lines for footer + header refactor + editor scroll fix 2026-05-21 07:09:24 +02:00
Bastien ChanotandClaude Opus 4.7 1b01744efc fix(editor): scroll to top on mount instead of restoring prior position
Navigating to /editor (either from /new or by re-importing a PDF)
landed the user at the bottom of the page because the browser
restored its previous scroll position on a long route. Force a
one-shot scroll to (0,0) on mount with an empty-deps effect so the
report opens at the header.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 07:08:59 +02:00
Bastien ChanotandClaude Opus 4.7 06a22aec11 feat(ui): unify page header — tagline left, lang switcher far right
Make the header consistent across Home, New report, and Editor:
- Tagline (cfg.tagline) now sits next to the brand on the left for
  every page, instead of right-aligned on Home only.
- LanguageSwitcher moved to the far right of the action group on
  every page (previously sandwiched between brand and report info on
  Editor).
- Dropped the redundant "← Accueil" ghost button on New report and
  Editor headers; the brand itself is already a link to "/", so two
  controls were doing the same job. Aria label preserved on the
  brand link.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 07:08:56 +02:00
Bastien ChanotandClaude Opus 4.7 caac14904d feat(ui): global footer with copyright + Powered by ZenQuality
Adds a single Footer component mounted in App.tsx via a flex-column
layout so it sticks to the bottom of every route (Home, NewReport,
Editor, NotFound).

Content per locale:
- "© <year> <footerName>. Tous droits réservés. / All rights reserved."
- "Propulsé par / Powered by [ZenQuality logo]" — logo wraps an
  external link to https://zenquality.fr (target=_blank +
  rel=noopener noreferrer).

footerName comes from runtime config (APP_FOOTER_NAME); year is
computed at render time. Two new i18n keys added in parity in
fr.ts + en.ts (footer.all_rights_reserved, footer.powered_by) —
dict parity test stays green (155/155).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 06:56:03 +02:00
Bastien ChanotandClaude Opus 4.7 0fcc526c46 fix(docker): use plain \${PORT} in nginx template — envsubst can't expand bash defaults
`listen ${PORT:-8080};` in docker/nginx.conf used bash-style default
expansion. envsubst (GNU gettext) does not implement `:-default`; it
either leaves the token literal or substitutes only `${PORT}` and
keeps `:-8080`, producing `listen 8080:-8080;`. Either way nginx
errors with "invalid port in '${PORT:-8080}' of the listen
directive" and the container restart-loops.

entrypoint.sh already exports PORT with a bash default
(`PORT="${PORT:-8080}"`) before calling envsubst, so the template
only needs `${PORT}`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 06:47:44 +02:00
Bastien ChanotandClaude Opus 4.7 7d214ed586 chore(docker): pin container name to zoosteo-web
Docker Compose v2 always appends a replica index (-1) to container
names by default. Single-instance service doesn't need scaling →
pin container_name for stable references in scripts and docs.
DEPLOY.md log-prune command updated to match.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 06:42:03 +02:00
Bastien ChanotandClaude Opus 4.7 dbd2bf30e9 chore(memory): correct BLK-005 + LRN-022 — pnpm 11.x line needs Node 22
Initial hypothesis ("pnpm@latest pulled a newer 11.4+ with new Node
floor") was wrong. Investigation after the second VPS crash showed
the whole pnpm 11.0+ line imports node:sqlite from its store-index
module. Local dev was misleading because pnpm install never re-ran
on the Node 20 host (lockfile already resolved, child scripts don't
load the store module).

Updates:
- BLK-005: replace single-fix line with iteration log
  (@latest → @11.1.3 → @10.13.1, last one resolved).
- LRN-022: rewrite headline + body to reflect pnpm 11 ↔ Node 22.13
  coupling, not just pnpm 11.4. Add pnpm/Node compat matrix.
- journal 2026-05-21: append v2 fix entry referencing commit 990c8e7.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 06:16:08 +02:00
Bastien ChanotandClaude Opus 4.7 990c8e700c fix(docker): downgrade Dockerfile to pnpm@10.13.1 (pnpm 11 needs Node 22)
Prior pin pnpm@11.1.3 was insufficient — pnpm 11.x itself imports
`node:sqlite` and requires Node 22.13+, not just 11.4 as the previous
blocker entry assumed. Local builds passed only because no `pnpm
install` ran on Node 20 (lockfile already resolved). VPS cold build
still crashes `ERR_UNKNOWN_BUILTIN_MODULE: node:sqlite`.

Switch to pnpm 10.13.1 — already cached on the dev host via corepack,
last major before the node:sqlite cache backend, reads lockfile v9.0
unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 06:14:36 +02:00
Bastien ChanotandClaude Opus 4.7 202110ddd2 chore(memory): capitalize zoosteo rename + Docker pnpm pin — BLK-005, LRN-022, journal
- BLK-005: VPS Docker build crash on pnpm@latest pulling pnpm >=11.4
  needing Node 22.13 (node:sqlite import) against node:20-alpine image.
  Resolved by pinning pnpm@11.1.3.
- LRN-022: never use floating pnpm@latest (or any unpinned upstream
  tag) in Dockerfiles — pnpm minor bumps can silently raise Node floor.
  Fix paths: pin exact + mirror in packageManager field; audit CI too.
- journal 2026-05-21: two lines for the rename commit and the Docker
  pin commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 06:07:28 +02:00
Bastien ChanotandClaude Opus 4.7 7dccde72f8 fix(docker): pin pnpm@11.1.3 to keep Node 20 compatibility
`corepack prepare pnpm@latest` now resolves to pnpm >=11.4, which
imports `node:sqlite` and requires Node 22.13+. The builder stage
runs `node:20-alpine`, so the install crashes with
`ERR_UNKNOWN_BUILTIN_MODULE: node:sqlite`. Pinning to the same
version the host already uses (pnpm 11.1.3) restores a reproducible,
Node-20-safe build.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 06:04:35 +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 Chanot fad3cb178a docs: add CHANGELOG.md — v1.0.0 entry (Keep a Changelog format)
First versioned changelog for the project. v1.0.0 entry covers the
shipped state on master at this commit: scaffold + B0..B3 (findings
schema, Report v2, FindingsTreePicker, i18n FR/EN), catalog v2.0
adoption, WinAnsi PDF hotfix, docs refresh, branch rename main →
master, push to https://git.bchanot.fr/bchanot/osteo-report.git.

Added / Changed / Fixed sections + Known limitations + a "Pre-1.0
milestones" appendix referencing git history for the un-tagged
scaffold / editor-polish / findings-tree-pivot / catalog-v2.0
sessions.

Note: package.json `version` field is still 0.1.0 — bump to 1.0.0
deliberately deferred until you're ready to tag the release on the
Gitea remote.
2026-05-21 04:13:37 +02:00
Bastien Chanot 98117b3b7f docs: add DEPLOY.md — VPS deploy guide (Docker + nginx + Certbot)
Production deploy playbook for Osteo Report. Single nginx:alpine
container behind a host reverse proxy; no backend, no database, no
server-side state. Praticien data lives in the browser and in the
exported PDFs themselves.

Sections cover:
- Topology + container/host port table.
- Required environment (.env): APP_SITE_NAME / BRAND_NAME /
  FOOTER_NAME / TAGLINE + optional PORT. No secrets.
- VPS provisioning (Ubuntu 24.04 LTS, 1 vCPU / 1-2 GB RAM, DNS,
  baseline apt packages).
- Firewall — cloud provider security group + UFW on the VM, with
  explicit "do NOT expose 8080" note.
- Docker install + tuned daemon.json (json-file log driver capped
  10MB × 5, live-restore).
- First-time setup, routine deploys via `git fetch + reset --hard
  origin/master + docker compose up --build -d`.
- Data persistence + backups: just the .env file (no volumes).
  Daily cron + retention + off-VPS sync.
- TLS reverse proxy — Option A (host nginx + Certbot with security
  headers HSTS/XFO/XCTO/Referrer-Policy/Permissions-Policy/CSP),
  Option B (Caddy auto-TLS Caddyfile).
- Sanity checks — TLS redirect, env.js cache headers, no-public-8080
  verification via nc + nmap.
- Hardening — non-root deploy user, disable root + password SSH,
  optional SSH port move, unattended security upgrades, fail2ban,
  external lockdown nmap.
- Rollback (git reset + rebuild — no data to restore).
- Health checks table, troubleshooting (9 common failures with
  recipes), operational notes (log destinations, manual prune,
  provider-specific RAM hints).

README.md DEPLOY.md link now points at a real document.
2026-05-21 04:13:28 +02:00
Bastien Chanot 8385b49bbe docs: sync drift after catalog v2.0 + i18n + WinAnsi hotfix
doc-syncer audit applied 10 AUTO patches and 1 HUMAN reword (#5)
across the doc set.

README.md:
- Test count "7 tests pass on skeleton" / "88 tests across 23 files"
  → "155 tests" / "155 tests across 29 files".
- Reword "Observation builder" bullet + add hierarchical findings
  tree + browser-detected locale bullets (HUMAN #5).
- Status paragraph: pathology DB "intentionally empty" → full
  26-zone v2.0 catalog (792 nodes, 612 leaves, 41 vet leaves).
- Documentation section: add PATHOLOGIES-FORMAT.md link; tidy the
  DEPLOY.md mention (DEPLOY.md itself comes in the next commit).

CLAUDE.md:
- Architecture block: "embedFonts (Inter body + Fraunces heading)"
  → reality (Helvetica + TimesRoman / WinAnsi StandardFonts; TTF
  Inter/Fraunces planned).
- PDF convention: "Fonts are TTF" → "Fonts are StandardFonts
  (Helvetica/TimesRoman, WinAnsi)" with the ASCII-surrogate caveat.
- Folder map: add src/anatomy/labels.ts, include zoneMatch.ts in
  src/lib/{...}.ts.
- i18n: locale default "fr" → "navigator-detected fr/en, or 'fr'
  if no match" to match commit 9cf8a66.

docs/PATHOLOGIES-FORMAT.md:
- "PDF surface: snapshot label is prefixed ⚠" → "(!)" in two
  places (after WinAnsi hotfix 143fdc3). Picker ⚠ statement
  kept — browser renders U+26A0 natively.

docs/ADDING-A-SPECIES.md:
- data-anno-category: "Free-form" → enum of 7 valid values per
  ANATOMY-SVG-CONVENTION.md; parser throws SvgConventionError on
  unknown values.
- Section 4 (findings catalog): cross-link to
  docs/PATHOLOGIES-FORMAT.md so authors find the v2.0 contract.
2026-05-21 04:13:13 +02:00
Bastien Chanot f4bb7cf9e0 chore(memory): capitalize ⚠ WinAnsi hotfix — LRN-021 + EVAL-003 + journal
- LRN-021: pdf-lib StandardFonts use WinAnsi (cp1252) — any non-Latin-1
  codepoint throws on measure or draw. Fix paths: ASCII surrogate
  (quick) or embed TTF via pdfDoc.embedFont (right). CLAUDE.md spec
  prescribed TTF; current StandardFonts is a documented drift.
- EVAL-003: bug slipped past 154/154 CI because roundtrip tests had no
  observation with a requires_vet_referral leaf. Regression test now
  measures a prefixed label via widthOfTextAtSize to canary any future
  non-WinAnsi marker reintroduction.
- journal 2026-05-21 appended with the hotfix note and the
  TTF-migration follow-up.
2026-05-21 03:34:56 +02:00
Bastien Chanot 143fdc3208 hotfix(pdf): swap vet-referral marker ⚠ → (!) for WinAnsi compatibility
Root cause: src/pdf/fonts.ts embeds StandardFonts.Helvetica /
HelveticaBold / TimesRoman, which use WinAnsi encoding (Latin-1
only). PDF export threw `WinAnsi cannot encode "⚠" (0x26a0)` the
moment the text-height estimator measured a vet-flagged leaf
label (countSegmentedLines → widthOfTextAtSize).

Fix: replace the PDF prefix "⚠ " with WinAnsi-safe "(!) ". The
picker DOM keeps the original "⚠" since browsers render U+26A0
natively — the limitation is purely on the PDF side.

Regression test exercises embedFonts + widthOfTextAtSize on a
realistic prefixed label; would catch any future non-WinAnsi
marker re-introduction.

Follow-up (not in scope): switch the PDF body to embedded TTF
(Inter / Fraunces per CLAUDE.md spec) so the catalog can carry
arbitrary glyphs. CLAUDE.md states TTFs should be used; current
StandardFonts is a drift from intent.

155/155 tests green, typecheck clean.
2026-05-21 03:33:59 +02:00
Bastien Chanot f5307ce61c chore(memory): /close — BDR-016 + LRN-020 + BLK-002 resolve + journal 2026-05-21
- BDR-016: pathologies.json v2.0 — boolean source of truth, generic
  vet description_fr purged, full 26-zone horse coverage.
- LRN-020: forward-compat Zod schema absorbs catalog version bump
  zero-code (optional fields + boolean-driven logic since B0).
- BLK-002 resolved — catalog no longer empty (612 leaves > 40-60 target).
- journal entry 2026-05-21 logs the in-place v2.0 swap, the hyoïde
  case alignment fix, and the doc refresh.
- TODO refreshed: Phase C item 1 (full horse.json) done,
  PATHOLOGIES-FORMAT.md v2.0 refresh done, B4 PDF observationPage
  marked partially done (scope_disclaimer footer still TBD).
2026-05-21 03:23:38 +02:00
Bastien Chanot 57b58b3af1 docs(species): refresh PATHOLOGIES-FORMAT for v2.0 contract
- schema_version "2.0" everywhere; new Changelog section with
  v1.0 → v2.0 entries highlighting the breaking change.
- New Scope (legal périmètre) section listing inclusions / exclusions
  and the two flag mechanisms (root scope_disclaimer + leaf boolean).
- Clarified SVG ↔ JSON link via strict label equality (not data-anno-id)
  and cranio-caudal zone ordering rule.
- Documented the 3 standardized categories per zone
  (*-dysfunctions / *-observations / anamnesis) and the 5 dysfunctions
  taxonomy patterns (head SSB / head peripheral / articular /
  vertebral hinge / vertebral region).
- Documented structural authoring rules (depth ≤ 4, ≥ 2 children per
  intermediate, sibling-scoped ID uniqueness).
- Spelled out the v2.0 requires_vet_referral / description_fr policy
  (boolean = source of truth; description_fr survives only on
  differential leaves) and the breaking-change notice for any consumer
  relying on description_fr.includes('vétérinaire').
- Rewrote the minimal example using v2.0 contract (boolean only,
  description_fr only when it adds a differential).
- Noted Zod's silent strip of unknown fields (e.g. species.notes,
  per-leaf metadata).
- Added current horse.json stats table (26 zones / 792 nodes /
  612 leaves / 41 vet leaves).
2026-05-21 03:23:30 +02:00
Bastien Chanot 6eda7ebc39 feat(species): adopt horse catalog v2.0 — full 26-zone coverage
Catalog bumped v1.2 → v2.0 by domain expert.

- schema_version "2.0"; 26 zones (9 head + 17 body), 792 nodes,
  612 leaves, 41 requires_vet_referral leaves.
- requires_vet_referral becomes the sole source of truth for the
  vet-orientation flag. Generic "orienter vers vétérinaire" wording
  purged from description_fr on 25 leaves; the 16 leaves carrying a
  clinical differential keep their description_fr.
- Existing Zod schema (findings.ts) and consumers (FindingsTreePicker,
  PDF observationPage) already key off the boolean — zero code change
  required.
- Aligns SVG Horse_head.svg "hyoïde" → "Hyoïde" so all 26
  data-anno-name-fr / -en values match zone.name_fr / name_en
  strictly (v2.0 authoring rule prescribes exact equality;
  src/lib/zoneMatch.ts fuzzy fallback retained as safety net).

154/154 tests green, typecheck clean.
2026-05-21 03:23:15 +02:00
Bastien ChanotandClaude Opus 4.7 9cf8a66dad feat(i18n): navigator-detect default locale + locale-aware bone labels
- localeStore.readInitial now consults navigator.language(s) when
  localStorage is empty (first fr/en hit, FR fallback). Persisted user
  choice still wins.
- New helper src/anatomy/labels.ts (boneLabel(b, locale, fallback))
  with cross-language fallback so missing labels never render blank.
- AnatomyCanvas rewrites native SVG <title> tooltips per locale on
  mount and on locale change (upstream SVG ships titles as "FR / EN"
  concat; we replace with the active-locale label only). Detail-popup
  trigger titles ("🔍 Zoom: …") left intact.
- DetailModal + EditorRoute detail title prefix + vertebra picker
  title now route through useT()/boneLabel.
- ObservationCard.describeZone takes locale, picks bone.fr / bone.en.
- PDF: buildZoneLabels returns Map<id, { fr, en }> instead of FR-only;
  observationPage picks per locale with cross-language fallback.
- Tests: FindingsTreePicker + VertebraPicker reset locale to 'fr' in
  beforeEach (navigator-detect may land on EN in happy-dom).
- pdf.zoneLabels test updated to assert the new pair shape.

154/154 tests pass, lint clean, typecheck clean, build OK.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 07:56:22 +02:00
Bastien ChanotandClaude Opus 4.7 31bd82de58 chore(memory+docs): /ship-feature B3 capitalize — BDR-014/015 + LRN-017..019 + EVAL-002 + journal + TODO
Memory registry capitalization after B3 i18n FR/EN ship.

- decisions.md  +BDR-014 (PDF locale = render preference, store-driven, not Report schema field — dual label snapshot already carried).
- decisions.md  +BDR-015 (typed ImportError discriminant kind + foundVersion; UI resolves message via dict; review caught hardcoded FR in domain layer).
- learnings.md  +LRN-017 (i18n dict parity test: Object.keys().sort() equality + non-empty value assertion — cheapest drift guard).
- learnings.md  +LRN-018 (useT hook pattern: selector subscribe + dict closure-per-render, no prop drilling, missing-key dev-warn + key-literal fallback).
- learnings.md  +LRN-019 (exhaustive-deps trap when closures over store values appear inside useMemo deps — inline or useCallback).
- evals.md      +EVAL-002 (B3 review caught critical FR leak in pdf/import.ts + attachment.ts that grep+analyzer both missed — i18n migrations must enumerate ALL string-emitting files including error paths).
- journal.md    session 3 entry under 2026-05-20.
- TODO.md       B3 subsection rewritten as DONE with checked checkboxes + cross-refs.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 07:43:11 +02:00
Bastien ChanotandClaude Opus 4.7 9916c42484 fix(i18n): localize PDF import error messages
Review surfaced 3 critical paths where hardcoded French leaked into
the EN UI:
- src/pdf/import.ts ImportError default message
- src/pdf/attachment.ts IncompatibleReportVersionError message
- src/app/routes/HomeRoute.tsx propagated err.message verbatim

Refactor:
- ImportError carries a typed `kind` discriminant
  ('invalid_pdf' | 'incompatible_version' | 'no_attachment') plus
  optional `foundVersion`. Removes hardcoded localized strings.
- IncompatibleReportVersionError keeps `foundVersion` only; message
  collapses to an internal sentinel.
- HomeRoute resolves the user-facing message via the active i18n
  dict using `err.kind`, with `{version}` template substitution for
  the incompatible-version case.
- 3 new dict keys (fr+en): home.import.error_invalid_pdf,
  home.import.error_no_attachment, home.import.error_incompatible_version
- pdf.roundtrip v1 case asserts ImportError instance + kind +
  foundVersion instead of grepping the message text.

154/154 tests pass, lint clean, typecheck clean, build OK.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 07:36:34 +02:00
Bastien ChanotandClaude Opus 4.7 fa3eb51394 test(pdf): cover roundtrip under locale=fr and locale=en
3 new cases:
- exports with locale=fr roundtrips
- exports with locale=en roundtrips
- both produce non-empty byte streams and the imported JSON payloads
  match (locale lives outside the Report, so finding labelFr/EnSnapshot
  are byte-identical between exports — only the static dict labels
  rendered into the PDF differ, verified manually since pdf-lib font
  subsets make byte-grep unreliable per LRN-016)

154/154 tests pass.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 07:12:05 +02:00
Bastien ChanotandClaude Opus 4.7 d6027266bc feat(i18n): migrate site + PDF to locale-aware rendering
- formatDate(iso, locale) replaces formatDateFr in src/lib/dates.ts
- exportReportToPdf(report, { locale }) takes explicit locale option
- LanguageSwitcher segmented FR | EN toggle added; integrated in
  ReportHeader, HomeRoute, NewReportRoute
- All routes (Home, NewReport, Editor, NotFound) + observation
  components (FindingsTreePicker, ObservationCard, FreeTextFindingInput,
  SeveritySelector, VertebraPicker, ObservationList) + report forms
  (PractitionerForm, AnimalForm, ConclusionPanel, NextAppointmentPicker)
  route hardcoded FR via useT()
- PDF render functions (export.ts, header.ts, footer.ts,
  observationPage.ts, conclusionPage.ts) take a locale arg and read
  static labels from the dict snapshot at call time
- Catalog finding leaf labels rendered via labelFr/EnSnapshot per locale
- description_fr / scope_disclaimer stay FR-only (out of scope —
  vet-expert authoring needed for EN copy)
- LanguageSwitcher unit test (2) + lib.dates locale tests (7) cover
  the new behavior

151/151 tests pass, lint 0, typecheck clean, vite build OK
(902KB main + 15KB lazy pathologies chunk).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 07:11:40 +02:00
Bastien Chanot 359104ce88 feat(i18n): add fr/en dicts + useT hook 2026-05-20 07:00:31 +02:00
Bastien Chanot a57047505d feat(i18n): add localeStore with localStorage persistence 2026-05-20 06:55:43 +02:00
Bastien ChanotandClaude Opus 4.7 0a05c479a0 docs(plan): B3 i18n FR/EN implementation plan
12 tasks, TDD per task, file paths + full code shape + verification.
Locale store + dicts + useT separate green commits; PDF + route
migrations land as one atomic green-build commit (formatDate +
exportReportToPdf signature change cross the boundary).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 06:50:15 +02:00
Bastien ChanotandClaude Opus 4.7 d559f565ac docs(spec): B3 i18n FR/EN site + PDF design
Approved design before implementation. Locale = render preference
(store, not Report schema). PDF export takes explicit locale arg.
Finding leaf labels via existing dual snapshot; catalog descriptions
+ scope_disclaimer stay FR-only this iteration.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 06:44:28 +02:00
Bastien ChanotandClaude bffa6fba26 chore(memory): /close — BDR-012/013 + LRN-013..016 + journal 2026-05-20 (session 2)
Capture the second-session findings-tree iteration learnings before
they fade:

Decisions
- BDR-012 species auto-discovery via Vite import.meta.glob default-export
  contract (alternatives: hardcoded registry, runtime registerSpecies()).
- BDR-013 SVG↔JSON zone bridge via fuzzy FR/EN label match (alternatives:
  rename SVG ids, add new data-anno-finding-zone attribute).

Learnings
- LRN-013 import.meta.glob + default-export as a plugin-discovery pattern.
- LRN-014 normalize + Levenshtein recipe for human-string cross-walk.
- LRN-015 per-source try/catch beats wrapping a loop with one outer catch.
- LRN-016 pdf-lib subset-font output: latin1/utf-8 bytes-grep won't find
  user-visible text — extract the JSON attachment or test through a
  refactored helper instead.

Journal
- Logs the 11 commits between b7b0945 and 70f21cc with one-line summaries
  + cross-refs to the new registry entries.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-20 06:21:39 +02:00
Bastien ChanotandClaude 70f21ccf37 docs: add PATHOLOGIES-FORMAT spec for the findings JSON catalog
Documents the canonical pathologies.json shape next to the existing
ANATOMY-SVG-CONVENTION and PDF-FORMAT guides. Mirrors the Zod
contract in src/domain/schema/findings.ts:

- Top-level frame (schema_version, scope_disclaimer, species, zones).
- ZoneFindings shape and how name_fr/name_en bridge to SVG labels.
- Recursive FindingNode (leaf vs intermediate, optional description,
  vet-referral flag, sources).
- SourceRef enum + URL validation.
- A minimal worked example.
- How leaf selections become persisted Findings, with the labelFr/En
  snapshot contract that protects already-exported reports from
  retroactive catalog edits.
- Authoring workflow that defers to `pnpm scaffold:species` and Vite
  HMR-driven validation.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-20 06:15:26 +02:00