Files
faunosteo/.claude/memory/journal.md
T
2026-06-01 03:07:30 +02:00

16 KiB

Journal


2026-05-18

Scaffolded Osteo Report MVP skeleton from approved design spec. Created 80+ files: schemas, stubs, routes, stores, PDF modules, Docker infra. Moved Horse.svg + Horse_head.svg to public/species/equine/. pnpm install + build + typecheck + tests passing. pnpm 11 used (corepack shim broken on host Node 20.20.0).

  • MVP scaffold+impl done. Editor flow works. PDF roundtrip green. Real SVG assets in repo.

2026-05-19

Fixed 3 zone-interaction bugs (b9da4fa). Detail-popup clicks now resolved via detailBones map. Spine zones (data-anno-special="vertebral-precision") auto-open VertebraPicker on click. ObservationCard hides "Vertèbres…" button on non-special zones. Parser reads data-anno-special; convention doc updated.

  • BLK-003 resolved. LRN-004, LRN-005 captured. 91 tests green, lint clean, build OK.
  • VertebraPicker preselects region tab inferred from zone label (b3bd75d). +5 tests.
  • Hotfix: detailBones now accumulate across popup opens; merged allBones passed to ObservationList so detail-popup zone labels survive after modal close.
  • PDF rendering bugfix: titles cleared the header rule, zone-line wrap respects following blocks, non-selected zones hidden + data-anno-* stripped before raster, main SVG skipped when every zone lives in details. BLK-004, LRN-006, LRN-007 captured.
  • PDF styling pass: eyebrow + Times 22 title + 2pt accent rule + uppercase accent section labels + color-coded severity pill (sage/amber/red). Eyebrow/title baseline gap raised to 27pt after first attempt still overlapped. BDR-008, LRN-008 captured.
  • Commits this session: b9da4fa..d7ea99e (10 commits — bugfix + feat + hotfix + PDF styling).

2026-05-19 (session 2)

feat(editor): home-nav (back btn + clickable Brand link to "/") + "Modifier les infos" dialog reusing PractitionerForm/AnimalForm via draft-copy with save/cancel. 3 store setters (setPractitioner/setAnimal/setOwner), 4 setter tests. Cache re-synced on save. 100/100 tests, lint 0, typecheck clean.

  • hotfix(pdf): multi-SVG observation page packed into 2-col grid; pre-rasterize → measure aspect → reserve text-area height → cell budget per row; single-SVG keeps full width; floor prevents zero-cells. Text sections now always visible. LRN-009 captured.
  • hotfix(editor): zone-highlight scoped to active obs only (collapsed obs no longer leave faint 'linked'/'multi' tints). AnatomyCanvas re-paints highlights after async SVG mount so DetailModal popup zones color correctly. NewReportRoute header harmonized with editor — back btn + clickable Brand left-aligned. 3 files (hotfix cap +1, accepted). LRN-010 captured.
  • domain pivot decided: flat Pathology[] → hierarchical findings tree per zone, path+snapshot serialization, FR/EN bilingual site+PDF. ReportSchema bumps v1→v2 (no retro-compat, no prod PDFs). Sample 3-zone JSON v1.1 dropped at src/domain/species/equine/pathologies.json — inert (loader not migrated). TODO rewritten as B0..B5 + C ship gate, ~23h dev.
  • NEXT SESSION: run /ship-feature on B0 (findings Zod schema + JSON loader) + B1 (ReportSchema v2 + observation.findings) + B2 (FindingsTreePicker replacing flat PathologyPicker). I18N (B3) deferred to separate feature. Reconcile JSON species.id (currently "equin") vs registry species.id ("equine") before parse — pick one.

2026-05-20

Bundled B0+B1+B2 shipped on feat/findings-tree-v2. 3 atomic commits.

  • B0 (f80e161): findings.ts Zod schema (recursive z.lazy + explicit ZodType), SpeciesFindingsSchema.parse(JSON) at boot, manifest swaps pathologies→findings, JSON species.id "equin"→"equine", new species.equineFindings test (5).
  • B1 (d08d773): ObservationSchema.findings + freeTextFindings, ReportSchema.version 1→2, store emptyObservation+initReport updated, PDF import detects v1 via IncompatibleReportVersionError + ImportError wraps message (FR), pathology.ts schema + test deleted.
  • B2 (b67f4cd): FindingsTreePicker (breadcrumb, drill, leaf toggle, retour, vet-referral ⚠, description_fr), ObservationCard renders one picker per zone with catalog, FreeTextPathologyInput renamed FreeTextFindingInput, scope_disclaimer modal once/session via osteo:disclaimer-shown sessionStorage flag, PDF observationPage renders findings via labelFrSnapshot with ⚠ prefix on vet-referral. B5 folded in: Toast + ZoneTooltip stubs deleted, CLAUDE.md folder map refreshed.
  • 107/107 tests green, lint 0 warn, typecheck clean, vite build OK (882KB main + 15KB lazy pathologies chunk).
  • BDR-009 (snake_case JSON fields preserved in TS), LRN-011 (Zod recursive via z.lazy + explicit ZodType), LRN-012 (sessionStorage flag pattern for once-per-session UX modals) to capitalize.
  • NEXT: push branch + PR. After merge: B3 (i18n FR/EN) + B4 (PDF observationPage polish for vet-referral) + C (full horse.json + QA + deploy).

2026-05-20 (session 3 — B3 shipped)

B3 (i18n FR/EN site + PDF) shipped on feat/findings-tree-v2 via /ship-feature. 5 new commits:

  • 0a05c47 docs(plan): B3 i18n FR/EN implementation plan
  • a570475 feat(i18n): localeStore + persist
  • 359104c feat(i18n): fr/en dicts + useT hook (~90 keys each, parity-tested)
  • d602726 feat(i18n): migrate site + PDF to locale-aware (25 files, +390/-207)
  • fa3eb51 test(pdf): roundtrip per locale (3 cases)
  • (post-review fix) typed ImportError discriminant for localized PDF import errors
  • 154/154 tests pass, lint clean, typecheck clean, build OK.
  • description_fr + scope_disclaimer stay FR-only this iteration (vet-expert authoring needed).
  • BDR-014 (PDF locale = render preference), BDR-015 (typed ImportError discriminant), LRN-017 (dict parity test), LRN-018 (useT selector+closure), LRN-019 (exhaustive-deps closure trap), EVAL-002 (review caught FR leak in PDF import) captured.
  • NEXT: B4 (PDF observationPage vet-referral polish), C (full horse.json + QA + Scaleway deploy). description_fr/_en EN copy when vet expert provides.

2026-05-21

User dropped catalog v1.2→v2.0 in place. pathologies.json now schema_version "2.0", 26 zones (was 3), 792 nodes, 612 leaves, 41 vet-referral leaves. Generic vet description_fr purged on 25 leaves; 16 kept with clinical differential.

  • Zero code change needed: findings.ts Zod schema already optional description_fr + boolean requires_vet_referral since B0. FindingsTreePicker + PDF already read boolean (no textual fallback). 154/154 tests stay green, typecheck clean.
  • One case mismatch noted then fixed by user: SVG Horse_head.svg data-anno-name-fr="hyoïde"→"Hyoïde". JSON ↔ SVG strict equality now holds for all 26 zones (diff empty). Fuzzy matcher (lib/zoneMatch.ts) no longer needed for this pair but kept as safety net.
  • BDR-016 (v2.0 catalog adoption), LRN-020 (forward-compat schema absorbed change), BLK-002 resolved capitalized.
  • TODO Phase C item 1 "Author full horse.json" → done. B4 still has scope_disclaimer footer decision open.
  • NEXT: B4 disclaimer footer call + C QA + Scaleway deploy.
  • hotfix(pdf): PDF export crashed WinAnsi cannot encode "⚠" on any obs carrying a requires_vet_referral leaf — StandardFonts.Helvetica is WinAnsi-only. Swapped ⚠ PDF marker → (!) (UI keeps ⚠). Regression test added on widthOfTextAtSize + prefixed label. LRN-021, EVAL-003 captured. 155/155 green. Follow-up: migrate PDF body to embedded TTF (Inter/Fraunces per CLAUDE.md spec) so future non-Latin-1 glyphs work.
  • chore: rename project osteo-report → zoosteo → faunosteo (Gitea repo moved). 15 files: repo URLs (CHANGELOG, DEPLOY, package.json), brand strings (env.ts DEFAULTS, entrypoint.sh fallbacks, i18n fr/en, pdf attachment metadata, index.html title, Brand test, scaffold banner, README/CLAUDE/CHANGELOG/ADDING-A-SPECIES headings), example URL osteo.example.com → zoosteo.fr in DEPLOY.md. PDF FILENAME osteo-report.json + startsWith contract preserved. 155/155 tests green. Commit 7dd4f63 + push.
  • fix(docker): pin pnpm@11.1.3 in Dockerfile:7. corepack prepare pnpm@latest re-resolved to pnpm >=11.4 on VPS cold build, which needs Node 22.13 → ERR_UNKNOWN_BUILTIN_MODULE: node:sqlite on Node 20 image. Commit 7dccde7 + push. BLK-005 + LRN-022 captured.
  • fix(docker) v2: 11.1.3 pin insufficient — pnpm 11.x ENTIRE LINE imports node:sqlite (not just 11.4+). Local dev was misleading because pnpm install never re-ran on host. Downgrade Dockerfile to pnpm@10.13.1 (last 10.x cached on host, reads lockfile v9 unchanged). Commit 990c8e7 + push. BLK-005 + LRN-022 corrected with iteration log.
  • chore(docker): pin container_name: faunosteo-web in docker-compose.yml — Compose v2 always appends -1 replica suffix; single-instance service doesn't need scaling. DEPLOY.md log-prune command updated. Commit 7d214ed.
  • fix(docker): nginx template used bash-style ${PORT:-8080} but envsubst doesn't support :-default. Switched to plain ${PORT} since entrypoint.sh already exports PORT with default. Commit 0fcc526.
  • feat(ui): global footer (© year + brand + "Powered by ZenQuality" logo linking to zenquality.fr). New Footer.tsx mounted via flex-column layout in App.tsx so it sticks bottom on every route. Two i18n keys added (footer.all_rights_reserved, footer.powered_by). Commit caac149.
  • feat(ui): unify header — tagline next to brand on left for every page; LanguageSwitcher far right everywhere; dropped redundant "← Accueil" button on /new + /editor (brand is already a link to /). 3 files. Commit 1b01744 part 1.
  • fix(editor): scroll(0,0) on mount — long /editor page was landing at bottom on navigation due to browser scroll restoration. Commit 1b01744 part 2.
  • feat(editor): directional slide+fade between findings-tree levels (motion.ul, key-remount, 180ms). Forward enters from right, back enters from left. AnimatePresence omitted to keep test assertions synchronous. Commit adbab1b.

2026-05-23

feat(i18n): 8 laterality keys added to fr.ts + en.ts after vertebra section. Dict parity test (i18n.dicts.test.ts) + full suite 163/163 green. Committed feat(i18n): add laterality translation keys (FR/EN). feat(schema): LateralSideSchema (z.enum left/right) + LateralSide type added to observation.ts. ObservationZoneSchema gains optional side field. 6 new tests covering accept/reject paths. Bone.lateral already present from prior anatomy commit. 163/163 green, typecheck clean.


2026-05-22 (session 2)

  • feat: locale-aware hover tooltip on anatomy zones (AnatomyCanvas custom floating tooltip, replaces native SVG title).
  • feat: /editors listing page + footer "Éditeurs" link + "Paws iin Harmony" credit.
  • feat(i18n): SVG editor header navbar + 58 FR/EN keys; pathology editor header + 76 FR/EN keys. Both editors fully bilingual.
  • fix(ui): 3 iterations on vertical centering — h-full→flex-1 on route containers (LRN-027). App.tsx main needs flex flex-col for children to grow.
  • Commits 569e571..89e010c (9 commits). 155/155 tests green throughout.

2026-05-22

Integrated standalone editor.html (~1630 lines vanilla JS SVG annotation tool) into React app at /svg-editor route. Vanilla JS wrapped in useRef+useEffect — zero behavior loss. CSS restyled to Faunosteo tokens (warm palette, accent vars, serif headings). DOMParser used for safe SVG loading (no innerHTML). Page noindexed via dynamic meta tag. 3 files created (SvgEditorRoute.tsx, svg-editor.css), 1 modified (App.tsx route registration), CLAUDE.md folder structure updated.

  • 155/155 tests green, typecheck clean, build OK (941KB main). No regressions.
  • BDR-017 (vanilla wrap decision), LRN-022 (DOMParser SVG loading) captured.
  • feat(editor): standalone pathology-editor.html — JSON pathology tree editor with SVG zone selection. 1390 lines vanilla JS/CSS, zero deps. Pre-wired species list + manual upload. Fuzzy zone matching ported from zoneMatch.ts. Recursive tree editor: add/edit/delete nodes, sources management, auto ID generation. SVG sanitized (scripts/foreignObject/on* stripped). Export full JSON preserving all zones. public/species/equine/pathologies.json added for HTTP access. Docs synced (CLAUDE.md + README).
  • BDR-020 (standalone HTML not React route), BDR-021 (inline port of zoneMatch.ts), LRN-025 (importNode XSS), LRN-026 (inline port pattern) captured.

2026-05-20 (session 2)

Iterated on the findings-tree branch — 11 more commits on top of B0+B1+B2.

  • 1731adf fix(editor): match findings tree to SVG zones via FR label (strict equality, dropped raw-boneId lookup).
  • 95d746b feat(editor): fuzzy zone matcher (src/lib/zoneMatch.ts) — normalize + Levenshtein, EN-first + FR fallback. 23 new tests.
  • 34acb0c feat(editor): count badges on intermediate FindingsTreePicker nodes (pathStartsWith + countSelectedUnder).
  • 93294a4 fix(pdf): buildZoneLabels per-source try/catch + parallel + warn + exported for tests. Fixes raw-boneId fallback when detail SVG fetch fails.
  • 1e12f22 fix(editor): EditorRoute eagerly preloads every species.details SVG so re-imported PDFs render their pickers immediately.
  • de40c5f feat(editor+pdf): per-zone PDF sections "CONSTATS — " + dedicated "CONSTATS LIBRES"; ObservationCard accordion (one zone picker open at a time).
  • add408e feat(pdf): single-SVG observations halved + centered; first halo glow on main-view selections.
  • 4f8ea9e fix(pdf): bumped halo with stacked feGaussianBlur (stdDeviation 18 + 8) to survive the SVG→canvas→PNG→pdf-lib alpha attenuation.
  • 700567f feat(pdf): inter-item separator rendered as accent-coloured bold "•" @14pt with per-segment layout instead of plain join (height-estimator updated).
  • 70b7f20 feat(species): auto-discover species via import.meta.glob default-export contract + pnpm scaffold:species Node script + docs refresh.
  • 70f21cc docs: PATHOLOGIES-FORMAT.md — canonical findings-JSON spec mirroring src/domain/schema/findings.ts.
  • BDR-012 (auto-discovery import.meta.glob), BDR-013 (fuzzy FR/EN label bridge), LRN-013 (glob+default plugin pattern), LRN-014 (normalize+Levenshtein cross-walk), LRN-015 (per-source try/catch), LRN-016 (pdf-lib subset-font bytes-grep caveat) captured.
  • Tests 139/139 green, lint 0, typecheck clean, vite build OK throughout. Branch feat/findings-tree-v2 = 15 commits ahead of main, no remote configured (push + PR still pending).
  • NEXT: push branch + PR; then B3 (i18n FR/EN), B4 (PDF observationPage vet-referral polish), C (full horse.json + QA + Scaleway deploy).

2026-05-27

feat(editor) 9544924 — cross-region vertebra picks spawn their spine zone.

  • New src/lib/spineZones.ts: regionFromLabel (moved from VertebraPicker, re-exported for back-compat), findSpineZoneId (region→zone via vertebral-precision + label heuristic), distributeVertebraeToZones (pure, target=replace / others=union / unmapped→target).

  • EditorRoute onConfirm now distributes instead of dumping all verts on clicked zone. +7 tests (lib.spineZones).

  • BDR-018 (replace-target/union-others), LRN-028 (drive derived UI via source-of-truth row) captured.

  • 171/171 green, lint 0, typecheck clean.

  • Iterated vertebra picker 3x same session. 9544924 additive distribute → 38888cb unified full-spine editor.

    • collectSpineVertebrae (union all spine zones, clicked first) seeds picker; syncSpineZones authoritative (replace region / prune zero / spawn new); initialRegion beats initial[0] so click opens own tab.
    • BDR-018 SUPERSEDED by BDR-019. LRN-028 still holds (drive derived UI — highlight+findings — via observation.zones lever).
    • Wart accepted: prune orphans zone findings (parity w/ ✕ button). All spine-gated (special==='vertebral-precision'). 174/174 green, lint 0, tc clean.

2026-06-01

feat(ui+pdf): footer partnership credit "Paws iin Harmony" text -> Paws_in_harmony.svg logo (moved to public/, wide 2068x454 wordmark). Site Footer.tsx h-6 mirrors ZenQuality treatment. PDF footer drawFooter gains pawsLogoPng asset; export.ts rasterizes svg via rasterizeSvg (canvg) -> embedPng, text handle "@paws.iin.harmony" kept as fallback when fetch/raster fails. 2 commits (3a67da7 ui, d9cf2fa pdf). 174/174 green, lint 0, tc clean, build OK.