diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index ce79d7ce..62639089 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -679,7 +679,8 @@ Order (BDR-071): P0 docs + decisions → V1-1 clients and animals → V1-2 sheet - [ ] separate tracks kept apart: TOTP asked at sign-in; missing illustrations blocking the copy of the historical equine sheet; phone editing (full touch editing below 1 024 px) = distinct future lot after V1-2 (owner 2026-11-05, choice 9; boards 14-16 kept as its reference) - [ ] V1-2.6 UX redesign technical preparation (owner brief 2026-11-05 « V1-2.6 — Validation UX définitive et préparation technique »: 16 boards + 11 choices validated; docs and static audits only, no app/Rust/SQL/worker code, no DEV, no merge, no V1-2.7; STOP at the technical checkpoint) - [x] static audits (core model, rendering/PDF/N-1, geometry/wasm, SQL/worker, editor/tests) · [x] docs/development V1-2-6_UX_{PLAN,COMPATIBILITY,TESTS,RISKS,DECISIONS}.md (sub-steps U0-U9, decisions T1-T19) · [x] independent review (3 lenses: CONCERNS 5/9/6, no BLOCKER) + fixes integrated (plan §6) · [x] commit + push branch · [x] owner answers 2026-11-05 (brief « V1-2.6 UX — Ratification des décisions techniques », BDR-100): T11 approved, T16 conditional deferral (curves lot), T2/T3 conditional on proofs, T4 no residual gap, T5 history preserved, T9 three actions, T10 navigation type, T12 principle · [x] five docs updated (decisions, compatibility §0/§7/§8, tests, risks + blocking criteria, plan §7) · [x] LRN-118 (wasm measuring rule) · [x] independent reviews: correctness challenger CONCERNS(5 MAJOR, 7 MINOR) integrated; verifier ECARTS(2) fixed; targeted re-check ECARTS(2) (one U6 test assumed permissive save, deploy order said all rounds) fixed · [x] third independent check before commit (2026-11-05): ECARTS(2) on K10/K11 (R-3 mitigation, U6 objective on older T4 scope, write-lock test assumed stripping save, T16 count scope in two forms) fixed · [x] fresh targeted re-check: CONFORME 12/12 (G1-G4 closed; 7 observations kept for U0) · [x] commit + push · [x] owner answers 2026-11-05 (brief « Autorisation U0 uniquement », BDR-101): T4 both SQL checks approved (O22 amended), T5 defaults, T10 option B, T15, T16 count before activation, « Remplacer par un polygone » explicit · [x] T17 answered 2026-11-06 (BDR-102) · [ ] still open: T12 text (before U7), T6 (V1-2.8), T14 follow-up; T1 only if a measure exceeds · [x] owner authorisation to start U0 (2026-11-05) - - [ ] V1-2.6 UX U0, contract and decisions, docs only (contract `.claude/tasks/contracts/2026-11-05-v1-2-6-ux-u0.md`; no code, no SQL, no DEV, no U1): [x] V1-2 contract §6.2, §6.4, §6.7, §7.4, §8.2-§8.4, §12.2 + §17.1 (O22), §16.7, §16.12, §17.12 · [x] level-1 contract C3, C4, C5, C6, C7, C8, C11, C13, C16, C18, C20, C25, C28, C32, C33, C40, with the precedence rule of its header · [x] docs/design/README.md · [x] rules sheet-model.md, schemas.md · [x] five UX docs · [x] BDR-101 · [x] preconditions (r5:import-equine --check clean, seed 22/6/0 paths, wasm 592 143 B) · [x] independent verification: ECARTS x6 fixed, then CONFORME 12/12 (2026-11-06); open points for U2/U6 not in docs: point edge-size handle (boards 02/03), default laterality of the automatic access (U6), §15 replay text vs the category.fixed.* filter · [x] commit + push · [ ] owner U0 checkpoint (then U1 on a new authorisation) + - [ ] V1-2.6 UX U0, contract and decisions, docs only (contract `.claude/tasks/contracts/2026-11-05-v1-2-6-ux-u0.md`; no code, no SQL, no DEV, no U1): [x] V1-2 contract §6.2, §6.4, §6.7, §7.4, §8.2-§8.4, §12.2 + §17.1 (O22), §16.7, §16.12, §17.12 · [x] level-1 contract C3, C4, C5, C6, C7, C8, C11, C13, C16, C18, C20, C25, C28, C32, C33, C40, with the precedence rule of its header · [x] docs/design/README.md · [x] rules sheet-model.md, schemas.md · [x] five UX docs · [x] BDR-101 · [x] preconditions (r5:import-equine --check clean, seed 22/6/0 paths, wasm 592 143 B) · [x] independent verification: ECARTS x6 fixed, then CONFORME 12/12 (2026-11-06); open points for U2/U6 not in docs: point edge-size handle (boards 02/03), default laterality of the automatic access (U6), §15 replay text vs the category.fixed.* filter · [x] commit + push · [x] owner U0 checkpoint (approved for good in the brief « Autorisation de U1 uniquement », 2026-11-06) + - [ ] V1-2.6 UX U1, editor shell (brief « Autorisation de U1 uniquement » + « U1 — Validation de la conception interne », approach A; contract `.claude/tasks/contracts/2026-11-06-v1-2-6-ux-u1-1123.md`; plan `.claude/tasks/plans/2026-11-06-v1-2-6-ux-u1.md`, lots A, B1, B2, C-I; no Rust/SQL/worker/scripts, no DEV, no merge, no U2): [x] design approach A validated by the owner with 10 precisions · [x] owner choices 2026-11-06 (server save time, non-modal references panel, citation button in the finding's detail, board 01 annotation card) · [x] plan written + three-lens challenge (correctness CONCERNS 6, robustness CONCERNS 5, simplicity CONCERNS 2, no BLOCKER) integrated · [ ] owner plan checkpoint · [ ] lots A-I · [ ] gates, verifier, security · [ ] owner U1 checkpoint - [ ] follow-up candidates (owner T14): multi-tab notice; RR item for the rollback limit of the category model (new id, reconcile with develop) - [ ] curves lot (ex-U9, owner T16 2026-11-05): curve handle editing, curved zone move, path remap, path point correction; spec `V1-2-6_UX_PLAN.md` §2 D, tests `V1-2-6_UX_TESTS.md` « Curves lot ». Rule: no feature that lets a path enter a document (package import, zones from the drawing's shapes, a curve drawing tool) ships before or without it. Before the new model is activated on an environment, and before U6 or U8 reaches any environment beyond the throwaway sandbox: read-only count of path geometries in its drafts and published versions (sandbox by U6 itself; DEV and shared environments by the owner or under explicit authorisation; non-zero reopens T16) - [ ] MANDATORY before merging V1-2 into develop (owner 2026-11-03): registry id reconciliation. LRN-095 collides: develop 09655b2 « Port a safe runner verbatim… » (2026-11-02) vs V1-2 « pgTAP across PGlite and the real Supabase image… » (2026-10-28, cited by BDR-084 and the V1-2.1 TODO lines). BLK-013 exists on develop only (« e2e:avatar on develop reached DEV »): `memory.sh` on V1-2 would hand out BLK-013 again, so a V1-2 blocker needs its id checked against develop first. Same for the TODO release-readiness ids: RR-11 is develop's (« sandbox-only e2e follow-ups »), V1-2 uses RR-12. No renumbering during V1-2.6 unless needed; renumber one side and patch its citers at the merge diff --git a/.claude/tasks/contracts/2026-11-06-v1-2-6-ux-u1-1123.md b/.claude/tasks/contracts/2026-11-06-v1-2-6-ux-u1-1123.md new file mode 100644 index 00000000..480cc707 --- /dev/null +++ b/.claude/tasks/contracts/2026-11-06-v1-2-6-ux-u1-1123.md @@ -0,0 +1,267 @@ +# CONTRACT — v1-2-6-ux-u1 +- date: 2026-11-06 | flow: ship-feature | branch: feature/v1-2-anatomical-sheets +- status: active +- worktree: /home/bchanot/Documents/faunosteo-v1-2 (every command runs from this absolute path; never from + /home/bchanot/Documents/faunosteo; never against DEV: the `supabase_*_faunosteo` containers are DEV; the throwaway + sandbox is `faunosteo_dbsandbox_*`, reached only through `pnpm db:sandbox …`) +- base: 846994b (T17 recorded, BDR-102). Commit in place, push each commit; no merge, no `gitflow.sh finish` + (T13), no sub-branch. +- spec: `docs/development/V1-2-6_UX_PLAN.md` §3 U1 and §2 G (undo rules), `docs/development/V1-2-6_UX_TESTS.md` U1, + `docs/development/V1-2_ANATOMICAL_SHEETS.md` §8.2-§8.4 and §17.12 as amended, the level-1 contract + `.claude/tasks/contracts/2026-11-03-v1-2-6-editor-1509.md` with its U0 notes and header precedence rule, + `docs/development/V1-2-6_UX_DECISIONS.md` (T15, T17, « Points from the boards for U1 and later »), boards + `docs/design/v1-2-6` (`maquettes.html` is their source). + +## REQUEST (verbatim — IMMUTABLE) + +# FAUNOSTEO — V1-2.6 UX — Autorisation de U1 uniquement + +Le propriétaire approuve définitivement le checkpoint U0. + +U0 est terminé, vérifié CONFORME 12/12, commité et poussé au HEAD 452a346. + +J'autorise maintenant l'implémentation de U1 uniquement, conformément à V1-2-6_UX_PLAN.md, aux contrats amendés et aux 16 maquettes V2 validées. + +## 1. Périmètre U1 + +Implémenter la nouvelle structure générale de l'éditeur anatomique. + +Navigation principale à quatre onglets : +- Général +- Annotations +- Constats +- Vérification + +Les références doivent rester accessibles depuis un panneau secondaire, sans imposer un onglet principal supplémentaire. + +Les vues détaillées et les régions vertébrales seront intégrées progressivement à Annotations dans les étapes prévues. U1 ne doit pas anticiper les opérations U2 à U6. + +## 2. Annuler / Rétablir + +Déplacer les commandes globales dans l'en-tête conformément aux maquettes corrigées. + +Contraintes : +- Historique global de la fiche. +- Conservation du comportement existant et de la pile d'historique. +- États activé/désactivé correctement synchronisés. +- Raccourcis clavier appropriés. +- Noms accessibles explicites, notamment « Annuler la dernière modification ». +- Aucun bouton flottant redondant sur le dessin. + +Ne pas confondre Annuler/Rétablir avec l'abandon d'un formulaire. + +## 3. Navigation et compatibilité + +Préserver toutes les fonctions métier de l'ancien éditeur pendant leur réorganisation. + +En particulier : +- Aucune perte de brouillon lors d'un changement d'onglet. +- Aucun changement non prévu du mécanisme de sauvegarde explicite. +- Préservation de la récupération locale. +- Préservation des contrôles d'autorisation et du MFA. +- Aucune modification des règles de soumission et de publication. +- Aucun changement du format des documents anatomiques. +- Conservation des chemins et des états nécessaires aux étapes suivantes. + +Ne pas implémenter prématurément des fonctions de V1-2.7 simplement parce qu'elles figurent dans certaines maquettes. + +## 4. Responsive et accessibilité + +Appliquer les règles UX validées : +- Barre latérale repliée sous 1 280 px dans l'éditeur. +- Navigation accessible au clavier. +- Focus visible et cohérent après changement d'onglet. +- Annonces et libellés accessibles. +- Préservation de la règle O14 A : téléphone en lecture seule sous 1 024 px. +- Ne pas supprimer les capacités tactiles déjà présentes sur les largeurs autorisées. + +La manipulation avancée des points et des polygones relève de U2, pas de U1. + +## 5. Décision T17 + +Le propriétaire valide la solution suivante pour U6 : + +Lorsqu'aucune catégorie ne porte le rôle `vertebra`, proposer une entrée de secours « Régions vertébrales » depuis Annotations. + +Lorsqu'une catégorie Vertèbres existe, sa configuration doit se faire depuis cette catégorie, sans doublon. + +Enregistrer cette décision selon la convention du registre et actualiser ses dépendances. Ne pas implémenter maintenant le nouveau modèle de catégories. + +## 6. Vérifications + +Avant toute exécution de tests : +- Vérifier le répertoire et la branche. +- Examiner le statut Git. +- Préserver le fichier de revue non suivi. +- Inspecter les commandes pour confirmer qu'elles ne visent pas DEV. + +Exécuter les vérifications applicables à U1 : +- TypeScript et lint. +- Tests unitaires de navigation et d'historique. +- Tests de non-régression. +- Tests clavier/accessibilité pertinents. +- Tests d'intégration et E2E en sandbox jetable strictement isolée, si nécessaires. + +Ne jamais exécuter une commande susceptible de joindre ou modifier Supabase DEV. + +Faire une revue indépendante de la conformité U1 et corriger les écarts justifiés. + +## 7. Git et traçabilité + +Travailler dans : + +`/home/bchanot/Documents/faunosteo-v1-2` + +Sur : + +`feature/v1-2-anatomical-sheets` + +Utiliser les conventions Git du projet, avec commits réguliers et push. + +Ne pas ajouter les fichiers non suivis préexistants sans nécessité et autorisation. + +Ne pas modifier le checkout V1-1. + +## 8. Interdictions + +Aucune modification Rust, SQL, worker ou schéma documentaire. + +Aucune migration, aucune opération sur DEV et aucun déploiement. + +Aucune fusion. + +Ne pas commencer U2, U3, U4, U5, U6, U7, U8 ou V1-2.7. + +## 9. Checkpoint U1 + +Fournir : +- Liste des modifications réalisées. +- Correspondance entre l'interface et les maquettes V2. +- Tests réellement exécutés et leurs résultats. +- Revue indépendante et verdict exact. +- Éventuelles limitations restantes. +- Démonstration testable dans la sandbox. +- Commits et état Git. +- Critères de sortie U1. + +S'arrêter au checkpoint U1. + +Ne pas commencer U2 sans nouvelle autorisation explicite. + +## CLARIFICATIONS +Q: The plan's U1 tooling (worker image commit label in `crates/worker/Dockerfile`, `verify-e2e` image check against +HEAD, demo sheet provisioned by the trial command in `scripts/db-sandbox.sh`) — the brief forbids worker changes / +A: [gated 2026-11-06] defer all of it to U6 (owner). No change under `crates/` or `scripts/` in U1. The U1 demo runs +on the existing trial stack: the owner creates a non-equine sheet in the UI as in `docs/development/V1-2-6_OWNER_TRIAL.md`. +The PLAN U1 acceptance line « a stale worker image is refused » and the TESTS U1 « Tooling » row move to U6. +Q: Where does « Abandonner les modifications » (C11, return to the last saved revision) sit, since the boards show no +discard control / A: [gated 2026-11-06] in the header, a secondary button beside the save state and « Enregistrer », +edit mode only, disabled when nothing is unsaved; same confirmation and behaviour as today (owner). +Q: Internal design (brief « U1 — Validation de la conception interne », 2026-11-06) / A: [gated 2026-11-06] approach +A: the Annotations panel keeps board 01's cards; « Gérer les vues », « Modifier les catégories » and « Régions +vertébrales » open the existing level-1 editors in full-width sections with « Retour au dessin », until U3, U4 and U6 +replace them; four tabs, references in a side panel, history in the header, sidebar hidden below 1 280 px, keyboard +navigation, focus management, read-only below 1 024 px. Ten mandatory precisions: no silent loss of changes, history +or editing state on a section, tab or panel change; « Retour au dessin » restores a coherent context and an +accessible focus; history tests on typed text, shortcuts and section transitions; a save shown only after effective +confirmation, never the browser clock as proof of persistence; read-only below 1 024 px on every editing entry, +moved forms and shortcuts included; reference counters from the current document, no network, no costly recount per +render; no « Prévisualiser » nor withdrawal, no existing function removed; the regions entry respects T17 without +anticipating U6; « Abandonner les modifications » only for unsaved changes, confirmed when data can be lost, never +removing the local copy silently; no provisional code hard to remove, sections replaceable without rebuilding the +navigation. Plan: `.claude/tasks/plans/2026-11-06-v1-2-6-ux-u1.md`. +Q: Save time source / A: [gated 2026-11-06] server time: after a confirmed save, one read of the existing admin +endpoint; « Enregistré à hh:mm · révision n » only when `draft_last_save` names the same revision, else « Enregistré · +révision n »; never the browser clock. +Q: References panel behaviour / A: [gated 2026-11-06] non-modal: scrim over the content below the tabs (board 11), +content inert, header, tabs and Annuler/Rétablir usable, Escape or scrim click closes, content kept across closes. +Q: Control opening the filtered panel from a finding / A: [gated 2026-11-06] a « n référence(s) » button in the +Citations block of the selected finding's detail; no control inside the ARIA tree. +Q: Annotation list layout / A: [gated 2026-11-06] board 01 card « Annotations de la vue » (grouped by category, +« Filtrer par nom »), shown when nothing is selected; the properties panel gains « Toutes les annotations » to return +to it. + +## ACCEPTANCE CRITERIA +1. Four tabs from 1 024 px: Général, Annotations, Constats, Vérification, as an ARIA tablist (arrows, Home/End not + required beyond today's pattern); no « Vues et illustrations », « Références » or « Vertèbres » tab remains; the + initial-tab rule of C40 as amended holds (Général for a sheet without a measurable view, else Annotations). +2. Annotations holds, with their level-1 operations unchanged: the views and their drawings (main view, detail views, + upload, cleaning, attach, the numeric crop editor kept until U4), the annotation categories (level-1 editor kept + until U3) and the « Régions vertébrales » fallback entry with the level-1 regions editor (T17, BDR-102; no role + exists before U6), laid out after board 01's overview panel; no U2-U6 operation is added (no handle, slider, + rectangle, remap, role, opacity). +3. References open in a side panel after board 11, from a « Références » button in the header and from a finding + (its citation badge), filtered to that finding's citations with « Tout afficher », with search, the citation count + per reference, and the level-1 add / edit / delete; read-only (no edit control) in every read-only mode; a modal + panel uses `ModalDialog` (D13, BDR-076); closing returns focus to the opener. +4. Undo and redo sit at the right of the tab row on every tab (board `hist()`): icon and visible « Annuler » / + « Rétablir »; « Annuler » has the accessible name and tooltip « Annuler la dernière modification » (T15); redo's + long name is a label proposal; enabled exactly when the store can undo or redo AND the editor is in edit mode with + no recovery pending; disabled in every read-only mode (narrow, frozen, rights, inactive, historical, recovery + pending, saving); the same `undo()`/`redo()` store actions as today, history and its 8 MiB bound unchanged; + Ctrl+Z and Ctrl+Shift+Z unchanged; the undo and redo buttons of the tool column are removed (no pair on the + drawing). +5. Undo from any tab reverts the last accepted commit, whichever tab made it; a field holding typed text is committed + before the header undo, and that commit is what the undo reverts (behaviour pinned by a test). +6. « Abandonner les modifications » replaces « Annuler les modifications » in the header beside « Enregistrer » + (clarification), with the same confirmation and `discardChanges` behaviour; C28's list names it. +7. The header save line follows the boards: « n modification(s) non enregistrée(s) » while unsaved (count through the + existing plural mechanism), « Enregistrement… » while saving, « Enregistré à hh:mm · révision n » after a save in + this page session; « Révision n » when nothing was saved yet in the session; the save mechanism itself unchanged. +8. The Vérification tab shows the boards' text badge « n erreur(s) » (plural mechanism) when the in-page check has + errors. +9. In the editor, the application sidebar is hidden below 1 280 px and shown from 1 280 px; below 1 280 px the top bar + shows the menu button, which opens the existing drawer (D11, BDR-079) one tap away; the drawer does not close by + itself while the sidebar stays hidden; every menu link stays under the leave guard (BDR-078); other pages keep + today's 1 024 px rule. +10. From 1 024 to 1 279 px the editor follows board 13: properties beside the canvas (C25 as amended), header actions + in reach; no horizontal scroll at 1 024, 1 180, 1 279 and 1 280 px on any tab and with the references panel open. +11. Below 1 024 px (O14 A, C16 as amended): read-only as today, notice title alone, badges, tabs, whole drawing, zoom + and pan, properties summary, no editing action and no enabled undo or redo; unsaved work survives a width change; + no horizontal scroll at 320, 375 and 768 px; touch abilities already present from 1 024 px kept. +12. Focus and announcements: clicking or arrowing a tab keeps focus on that tab; a tab change started from inside a + panel (a hint link, « Aller à ») moves focus to its target element, or to the new tab when there is none, never to + `body`; a polite live region (distinct from the save status) announces a tab or section reached that way; focus + is visible on every new control. +13. « Aller à » reaches every issue kind in its new place: views, categories and regions in Annotations (the section + shown and its row focused), references in the side panel (opened, the reference focused), annotations, findings + and general fields as today. +14. Unchanged: the explicit save, the local recovery (C13, C27, C28), conflicts, rights and MFA checks, the mode + precedence (C38), submission and publication rules, the document format, Rust, SQL, the worker, the core and its + wasm build; level-1 criteria C13, C14, C16, C34 and C41 re-run green. +15. No V1-2.7 control: no « Prévisualiser », no withdrawal (DECISIONS « Points from the boards »). +16. i18n: every string through `useT`, FR/EN parity; prose that names an old tab is reworded to the new place; the new + labels are listed as proposals in `.claude/audits/2026-11-06-v1-2-6-u1-label-proposals.md` for the owner's label + review (C19, C44). +17. Tests: unit tests for the tab model and tiers, header undo/redo states (edit and every read-only mode), cross-tab + undo, the typed-field flush, the references panel (open from header and finding, filter, close, focus return), + « Aller à » targets, the sidebar rule, the save line; e2e helpers (`e2e/support/editor.ts`, `warm-up.ts`) and + specs rewritten for the new shell; every removed or rewritten assertion mapped to its replacement in the commit + message (R-24); axe with no serious or critical violation on the four tabs, the open references panel and the + narrow read-only mode; a keyboard test of the order header → tabs → panel → canvas. +18. Gates, in this order, all green: `pnpm typecheck`, `pnpm lint`, `pnpm test:run`, `pnpm build`, `pnpm e2e:ui`, + a fresh sandbox `pnpm db:sandbox up fresh` then `test-db → e2e-shell → test` (LRN-113), `pnpm check:all`, + `pnpm r5:import-equine --check`; a fresh verifier and a fresh security review. +19. Scope: no change under `crates/`, `supabase/`, `scripts/`, `packages/core-wasm/src/`, `packages/supabase/src/`, + `docs/design/v1-2-6/`; nothing staged from the untracked review file. + CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && git diff --quiet 846994b..HEAD -- crates supabase scripts packages/core-wasm/src packages/supabase/src docs/design/v1-2-6 && git diff --quiet -- crates supabase scripts packages/core-wasm/src packages/supabase/src docs/design/v1-2-6 && ! git ls-files --error-unmatch faunosteo-v1-2-6-revue-ux-chatgpt.md >/dev/null 2>&1 && echo U1_SCOPE_OK + EXPECT: U1_SCOPE_OK + EVIDENCE: pending +20. FR/EN dictionaries hold the same keys. + CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && node -e "const fs=require('fs');const k=f=>new Set([...fs.readFileSync(f,'utf8').matchAll(/^\s*'([a-z0-9_.]+)':/gm)].map(m=>m[1]));const a=k('apps/app/src/i18n/fr.ts'),b=k('apps/app/src/i18n/en.ts');const d=[...a].filter(x=>!b.has(x)).concat([...b].filter(x=>!a.has(x)));if(d.length||a.size<100){console.error(d);process.exit(1)}console.log('I18N_PARITY_OK',a.size)" + EXPECT: I18N_PARITY_OK + EVIDENCE: pending + +## FILE SCOPE +- apps/app/src: editor tabs model (`editor/tabs.ts`, `editor/useViewport.ts`, `editor/verification.ts`, + `editor/focusRequest.ts`, `editor/annotations/focusTarget.ts`), editor state selectors needed for the header + (`editor/state/*`, read-only additions only: save count, save time), `components/editor/**` (EditorTabs, + EditorTabBody, DraftHeader, tab bodies, annotations panels, references panel, verification), `components/shell/ + {AppLayout,MobileDrawer,SidebarNav}.tsx`, `app/routes/app/admin/AdminSheetDraftRoute.tsx`, `i18n/{fr,en}.ts` +- apps/app/tests/unit/**, apps/app/tests/helpers/**, apps/app/e2e/** (support helpers, shell and ui specs) +- docs: `docs/development/V1-2-6_OWNER_TRIAL.md` (U1 demo steps), `docs/development/BROWSER_TESTS.md` if a suite + changes, `docs/development/V1-2-6_UX_{PLAN,TESTS}.md` (tooling moved to U6), `.claude/audits/2026-11-06-v1-2-6-u1- + label-proposals.md` +- .claude/tasks (this contract, plan, TODO), .claude/memory (through memory.sh) +- NOT in scope: crates/**, supabase/**, scripts/**, packages/core-wasm/src/**, packages/supabase/src/**, + docs/design/v1-2-6/**, the V1-1 checkout diff --git a/.claude/tasks/plans/2026-11-06-v1-2-6-ux-u1.md b/.claude/tasks/plans/2026-11-06-v1-2-6-ux-u1.md new file mode 100644 index 00000000..32b06b92 --- /dev/null +++ b/.claude/tasks/plans/2026-11-06-v1-2-6-ux-u1.md @@ -0,0 +1,685 @@ +# Plan: V1-2.6 UX U1, editor shell (four tabs, sections, references panel, header history) + +> For agentic workers: executed lot by lot under `subagent-driven-development` (ship-feature STEP 4); each lot is +> one coherent change, committed and pushed by the orchestrator after its own checks. + +Status: REVISED after the three-lens challenge (2026-11-06, record at the end), for the owner's plan checkpoint. No +application code is written before the owner approves this plan (brief « U1 — Validation de la conception +interne »). + +- Goal: replace the seven-tab level-1 shell of the draft editor by the four-tab shell of the validated v1-2-6 + boards, with approach A (owner, 2026-11-06): the level-1 editors of views, categories and vertebral regions open in + full-width sections of Annotations with « Retour au dessin », References in a side panel, history in the header. +- Architecture: a pure navigation model (tab, Annotations section, references panel, focus request) held by the + editor workspace; every visited place stays mounted and is hidden with the `hidden` attribute, so no switch loses + state and no effect re-runs on a switch; the unsaved count is derived from the history the store already holds; the + store gains one display field (`lastSave`, the server's save time). +- Stack: React 19.2.6, Zustand 5, Tailwind 4 (`lg` 64rem, `xl` 80rem; preflight hides `[hidden]` with `!important`), + vitest + happy-dom, Playwright 1.64.1 + axe on the throwaway sandbox. +- Spec: contract `.claude/tasks/contracts/2026-11-06-v1-2-6-ux-u1-1123.md` (AC1-AC20, CLARIFICATIONS + [gated 2026-11-06]); `docs/development/V1-2-6_UX_PLAN.md` §3 U1 and §2 G; `docs/development/V1-2-6_UX_TESTS.md` + U1; `docs/development/V1-2-6_UX_DECISIONS.md` (T11, T15, T17, « Points from the boards for U1 and later »); level-1 + contract `.claude/tasks/contracts/2026-11-03-v1-2-6-editor-1509.md` (header precedence rule, C3, C4, C5, C6, C11, + C13, C14, C16, C27, C28, C32, C34, C36, C38, C40, C41, C44, C47 as amended); boards `docs/design/v1-2-6` 01, 11, + 12 A, 13 (source `maquettes.html`: `hist()` :287, `save()` :292, `overviewPanel()` :325, board 11 :615-628); board + 05 of v1-2-4 for the narrow read-only mode. +- Reading list for every executor: the contract, this plan, the files named in its lot, `.claude/rules/i18n.md`, + `.claude/rules/stores.md`. +- Format: the project's lot format (precedent `.claude/tasks/plans/2026-11-03-v1-2-6-editor.md`): every choice is + closed here, executors write the code and the tests named per lot. + +## Global constraints + +- Worktree `/home/bchanot/Documents/faunosteo-v1-2`, branch `feature/v1-2-anatomical-sheets`, base 846994b; every + shell command starts with `cd /home/bchanot/Documents/faunosteo-v1-2 &&` (LRN-110). Commit in place, push each + commit, no sub-branch, no merge, no `gitflow.sh finish` (T13). +- Never DEV: no `pnpm db:start`, `db:reset`, `db:test`, `db:types`, `pnpm supabase …`, `e2e:avatar`, + `e2e:sheet-assets`; database work only through `pnpm db:sandbox …` (containers `faunosteo_dbsandbox_*`). +- The sandbox is shared with the level-1 owner trial stack: Lot B1 runs `pnpm db:sandbox up fresh`, which wipes the + trial accounts and data (`scripts/db-sandbox.sh:47-60`). Approving this plan authorises that wipe; no other + checkout runs the sandbox during U1. +- No change under `crates/`, `supabase/`, `scripts/`, `packages/core-wasm/src/`, `packages/supabase/src/`, + `docs/design/v1-2-6/` (AC19 CHECK); `faunosteo-v1-2-6-revue-ux-chatgpt.md` never staged. +- No U2-U6 operation (no handle, slider, rectangle, remap, role, opacity, own-colour revert, category fold, view + menu), no V1-2.7 control (no « Prévisualiser », no withdrawal), no existing function removed (owner precision 7). +- Store rules unchanged: `undoStep()` / `redoStep()`, `HISTORY_LIMIT_BYTES` 8 388 608, one commit per change on + blur, confirm or pointer-up (BDR-050), the save request, the recovery copy (C13, C27, C28), conflicts (C12, C29), + mode precedence (C38). Store addition: `lastSave` only (Lot E); the count is a selector. +- Every string through `useT`, FR/EN key parity (AC20), counts through `usePlural` (`editor/plural.ts`, C36); new + labels are proposals (C44) listed in `.claude/audits/2026-11-06-v1-2-6-u1-label-proposals.md`. Prose naming a + place is reworded in the lot that moves that place. +- Focus moves only through the navigation hook or a one-shot focus request; no kept-mounted component focuses or + scrolls in a mount effect. +- Our code: functions at most 25 logic lines, 5 params, 5 locals, 100 columns in TypeScript (project exception). + `DraftEditor`, `DraftHeader`, `EditorTabs`, `FindingsTab` and `AppLayout` already exceed 25 lines: each one this + plan touches is split along the lines below, never grown. +- Browser suites stay green at every lot: each lot from B1 rewrites the e2e assertions its change breaks (mapped in + its commit message, R-24) and runs every `apps/app/e2e/shell/editor-*.spec.ts` on the sandbox started in Lot B1 + (`pnpm db:sandbox e2e-shell ` per spec); a spec that breaks and is not in the lot's list is added to the + lot, never skipped. The full suites run in Lot H and in the gate order of Lot I on a new fresh sandbox. +- Queries: tests never query labels or text page-wide; they scope to the visible place (`data-place` hook, below) + or use role queries, which ignore hidden content. + +## Review focus (failure modes no single lot owns; each pinned by a test in the named lot) + +1. A hidden place answers instead of the visible one: a focus request consumed by a hidden body, a label or text + locator matching a hidden copy (« Nom (FR) » labels the sheet, a region and an annotation), a static `id` + repeated. Pinned in Lot B2 (requests routed to their owner, unique ids once every place is visited, Chromium spec + of the keep-alive and focus rules) and every lot's e2e scoping. +2. Undo from another place removes what a kept place still shows: the canvas's current view (with a pending + creation or a tracing on it), the selected annotation, the finding the references filter names. Pinned in Lot B1 + (full canvas reset to the main view) and Lot D (filter falls back to « Tout afficher »). +3. The save line says something false: a count after undoing past the save point, after a trim by a commit, an undo + or a redo, after a restored copy, after commits or undos during a save; a time from another revision or an old + save. Pinned in Lot E (`savedDistance` table, including the sequences the challengers found; `saveLineState` + table; `readSaveTime` drops late answers and is skipped on `draft.unchanged`). +4. A width change across 1 024 px with a section or the panel open: every place turns read-only in place, unsaved + document changes kept, edit mode back on widening, no crash. Creation forms (canvas pending creation and every + `!readOnly` form) unmount as today: documented limit, section 2. Pinned in Lot H. +5. The references panel over the header: Enregistrer, Annuler and Rétablir must stay clickable with the panel open. + Pinned in Lot D (Chromium check at 1 024 and 1 280 px). + +--- + +## Architecture (closed decisions) + +### 1. Navigation model (owner precisions 1, 2, 10) + +- New pure module `apps/app/src/editor/navigation.ts`: + - `ANNOTATION_SECTIONS = ['drawing', 'views', 'categories', 'regions'] as const`, `AnnotationSection`. + - `EditorTarget = { place: 'tab'; tab: EditorTabId; section: AnnotationSection | null; key: ElementKey | null } + | { place: 'references'; key: ElementKey | null; citedBy: ElementKey | null }`. One encoding: a target on + Annotations always names its section (`'drawing'` for the canvas); `section` is null on the other tabs. + - `targetOfKey(key: ElementKey): EditorTarget`: `sheet` → general; `zone`, `finding` → findings; `annotation` → + annotations/drawing; `view` → annotations/views; `category` → annotations/categories; `region` → + annotations/regions; `reference` → references (citedBy null). The only place a key meets a place. + - `FocusRequest = { target: EditorTarget; serial: number }` is defined here (Lot A) and re-exported by + `editor/focusRequest.ts` from Lot B1. + - `NavigationState = { tab; section; references: { open: boolean; citedBy: ElementKey | null }; visitedTabs: + readonly EditorTabId[]; visitedSections: readonly AnnotationSection[]; referencesMounted: boolean; focus: + FocusRequest | undefined }`; `initialNavigation(tab)`. + - `navigationReducer(state, action)`, actions `select_tab` (manual; keeps the Annotations section; no focus + request), `open_section`, `back_to_drawing`, `open_references` (citedBy) and `close_references` (both keep tab and + section: the panel opens over whatever is shown), `go_to` (target: sets tab, section or panel; `focus = { target, + serial: previous + 1 }`), `focus_consumed` (serial). Visited lists grow, never shrink. +- `useFocusRequest(focus, apply: (target) => 'found' | 'kept' | 'none')` reports `consumed(serial, outcome)` + through `FocusConsumedContext` (`kept`: the place kept a creation or tracing in progress instead of jumping, + section 4); `useRowFocus` returns `found` or `none`. A request is passed only to the body, + section or panel its target names; `FindingsTab`'s `focusId` becomes one-shot (cleared once applied, + `findings/FindingTree.tsx:31-33`, `tabs/FindingsTab.tsx:47,73,90`), so a later visit never re-focuses the tree and a + second « Aller à » to the same finding focuses it again. +- New hook `apps/app/src/editor/useEditorNavigation.ts`, called in the new `EditorWorkspace` (rendered only once the + version is ready, so `initialTab(previewState, tier)` is known at mount: lazy `useReducer` initialiser, no + render-phase `setTab`, no reset action; reloads keep `status: 'ready'`, `editorLoad.ts:136-152`). It owns the DOM + side: + - stable callbacks (`useCallback` over `dispatch`): `navigate(target, opener?)`, `selectTab(tab)`, + `openSection(section, opener)`, `backToDrawing()`, `openReferences(citedBy, opener)`, `closeReferences()`; + - before every move (tab click or key, « Plus » item, section entry, « Retour au dessin », panel open, panel close + by ✕, Escape or scrim, « Aller à », hint link), `commitFocusedField()` (new in `editor/focusRequest.ts`): when + `document.activeElement` is an `input`, `textarea` or `select` inside the editor, `blur()` it, so its + `TextField` commits on blur (`TextField.tsx:75-79`) before the place is hidden. Today an unmount commits that + text (`TextField.tsx:61-68`); kept-mounted places never unmount, and Safari and iPadOS do not move focus to a + tapped button, so the blur is forced rather than assumed (confirmation challenge); + - openers kept in a ref (`section`, `references`), never in state; + - after each programmatic move, in an effect keyed on the move: focus the request's element, else the section + heading, the panel heading, the active tab button `#editor-tab-`, or « Plus » when the active tab sits in + the closed « Plus » list (< 640 px); never `body`; + - one polite live region text `{ text, serial }` on programmatic moves only (go to, hint links, section open and + back, panel open and close): « Annotations · Vues », « Références »; rendered as `

`, distinct from the save status (AC12); a repeated text alternates a trailing no-break + space. +- `EditorTabProps` becomes `EditorPlaceProps = { readOnly: boolean; navigate: (target: EditorTarget, opener?: + HTMLElement | null) => void; focus?: FocusRequest; reloadSheet: () => void }`. The route computes `readOnly` once + and passes `!readOnly` to `useUndoShortcuts` and to the history buttons (no third spelling of the predicate). + +### 2. Kept-mounted places (precision 1: no silent loss on a tab, section or panel change) + +- Each visited tab panel, each visited Annotations section and the references panel once opened stay mounted inside + a plain wrapper `