diff --git a/.claude/memory/decisions.md b/.claude/memory/decisions.md index ce4c8749..3f222f4d 100644 --- a/.claude/memory/decisions.md +++ b/.claude/memory/decisions.md @@ -143,3 +143,21 @@ Status: closed. editor.html = ~1630-line standalone SVG annotation tool (DOM manipulation, drag/drop, polygon editing, zoom, categories, export). Integrated into React app via `useRef` + `useEffect` mounting all vanilla JS logic into container refs. Only CSS restyled to Zoosteo tokens. Alt rejected: full React rewrite (convert all state to Zustand/useState, all DOM ops to React) — massive effort ~10x, high risk of subtle behavior differences in drag/polygon/zoom interactions. Status: closed. + +--- + +## BDR-020 | 2026-05-22 | Pathology editor: standalone HTML, not React route + +pathology-editor.html = standalone tool at project root, same pattern as SVG editor integration. Vanilla JS/CSS, no build step, no deps. Decoupled from React app entirely — zero imports from src/. +**Why:** tool for domain experts editing JSON, not practitioners using main app. No shared state needed. Standalone = deployable anywhere, no Vite required. +Alt rejected: React route with Zustand store — unnecessary coupling, heavier DX for a JSON editing tool. +Status: closed. + +--- + +## BDR-021 | 2026-05-22 | Port zoneMatch.ts inline into pathology editor + +Fuzzy matching logic (normalizeLabel, levenshtein, scorePair, matchZone) duplicated inline in pathology-editor.html rather than imported from src/lib/zoneMatch.ts. +**Why:** standalone HTML cannot import TS modules. Keeping identical algorithm ensures matching consistency between main app and editor. +Alt rejected: extract to shared .js file — adds dependency management for a tool that should be zero-dep. +Status: closed. diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index 8bb95c88..f8a6ec11 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -92,6 +92,8 @@ User dropped catalog v1.2→v2.0 in place. pathologies.json now schema_version " 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 Zoosteo 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. --- diff --git a/.claude/memory/learnings.md b/.claude/memory/learnings.md index c5e06c4c..39ad26f2 100644 --- a/.claude/memory/learnings.md +++ b/.claude/memory/learnings.md @@ -192,3 +192,19 @@ Fix paths: - Never `corepack prepare pnpm@latest` — re-resolves at every cold build, silently bumps toolchain across deploys with no commit. **Why:** Floating tag = drift bomb between cached dev + fresh prod resolve. Same risk for unpinned `node:lts`, `:alpine`, GitHub Actions `uses: foo@v1` (prefer SHA). Lockfile pins app deps; Dockerfile must pin toolchain. **How to apply:** Before first prod deploy, audit every Dockerfile, docker-compose, and CI workflow for floating upstream refs. For pnpm specifically, check Node version against pnpm minimum (pnpm 11 ↔ Node 22.13, pnpm 10 ↔ Node 18+, pnpm 9 ↔ Node 18+). + +--- + +## LRN-025 | 2026-05-22 | SVG importNode executes inline scripts — sanitize before append + +`DOMParser.parseFromString(text, 'image/svg+xml')` is safe — doesn't execute scripts during parse. But `document.importNode(svg, true)` into a live document DOES allow `