Files
faunosteo/.claude/tasks/contracts/2026-11-12-r2-references-tab-1730.md
bchanot 36c6eb3fea chore(memory): R2 corrections, BDR-115, LRN-133..135, BLK-015
Plan rev 5/5b and contract criteria 21-29 (25 amended to the two-part touch proof), TODO line, journal.
2026-11-13 15:35:31 +01:00

204 lines
19 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# CONTRACT — r2-references-tab
- date: 2026-11-12 | flow: ship-feature | branch: feature/v1-2-anatomical-sheets (commit in place, no finish)
- status: active
- plan: .claude/tasks/plans/2026-11-12-r2-references-tab-1730.md
## REQUEST (verbatim — IMMUTABLE)
# FAUNOSTEO V1-2.6 — Validation du correctif E2E et GO R2
Le propriétaire valide le checkpoint du correctif E2E.
## 1. Correctif E2E accepté
Le commit 2cdee42 est accepté.
Résultats retenus :
- Les quatre échecs historiques ont disparu.
- Deux passages successifs réussis.
- Le véritable composant WorkingCopyAction est couvert dans e2e:ui.
- Les contrôles de la fiche historique restent présents dans e2e:shell.
- Les refus serveur restent couverts.
- Les 637 fiches préexistantes sont restées inchangées pendant cette intervention.
Conserver la limite documentaire : le dialogue n'est plus testé dans son contexte serveur réel par ce contrôle d'accessibilité.
## 2. Mémoire — VALIDÉE
Enregistrer :
BLK-014 — admin.spec dialog check depended on shared singleton working-copy state — resolved 2cdee42.
Préciser que la résolution concerne les quatre échecs de ce contrôle, pas tous les risques de concurrence des suites E2E.
LRN-132 — E2E tests and database-wide singleton state.
Documenter :
- Ne pas exiger qu'une ressource unique soit disponible dans une base persistante partagée.
- Tester le véritable composant UI indépendamment lorsque nécessaire.
- Vérifier dans les tests serveur la cohérence de l'état réellement présent.
- Nettoyer ou archiver exclusivement les ressources créées et identifiées par la suite concernée.
- Vérifier les identifiants effectivement modifiés par les opérations de nettoyage.
- Éviter les interactions concurrentes entre suites manipulant une ressource singleton.
Effectuer les contrôles documentaires et commit/push.
## 3. Risque editor-equine — À encadrer
La suite editor-equine archive temporairement les copies actives de la fiche historique puis les restaure.
Ce comportement a déjà modifié la date de modification de 8c315a12.
Il ne doit plus être exécuté sur une base persistante contenant des données préexistantes à préserver.
Avant de relancer une suite qui inclut editor-equine :
- Identifier précisément ses écritures.
- Proposer une isolation reproductible et non destructive pour les ressources préexistantes.
- Vérifier les interactions possibles avec admin.spec et les autres suites parallèles.
- Préserver la copie 8c315a12 et ses métadonnées actuelles.
- Ne pas chercher à rétablir artificiellement une ancienne date.
- Ne pas supprimer ou réinitialiser la sandbox.
Présenter une correction séparée si nécessaire. Ne pas élargir silencieusement le périmètre R2.
Suivre également les fiches créées par les tests pour éviter l'accumulation de fixtures persistantes.
## 4. GO — Implémentation de R2
J'autorise R2.0 à R2.6 conformément au plan technique approuvé et aux maquettes R0.
R2.0 — Renommage interne du volet de références.
R2.1 — Cinquième onglet Références et navigation.
R2.2 — Tuiles de références dépliables.
R2.3 — Recherche, tri et actions.
R2.4 — Volet contextuel des références citées par un constat.
R2.5 — Tests et non-régressions.
R2.6 — Documentation, traductions et clôture.
Respecter les décisions A1 à A4 et D1 à D4, ainsi que les exigences enregistrées dans la TODO par a1d4084.
Chaque sous-lot doit être vérifié, commité et poussé avant le suivant.
Ne pas déclencher une suite dangereuse pour les données préexistantes au prétexte qu'elle fait partie des contrôles habituels. Si cela bloque une validation obligatoire, s'arrêter au checkpoint correspondant et proposer une solution.
## 5. Exigences R2
- Une référence citée ne peut pas être supprimée.
- « Retirer de ce constat » retire seulement l'association concernée et reste annulable.
- Aucune modification en lecture seule.
- Recherche et tri en TypeScript, exclusivement pour l'affichage.
- Aucune mutation de l'ordre enregistré ou du document.
- Volet contextuel sans déplacement du schéma.
- Navigation clavier et gestion du focus conformes aux maquettes.
- Accessibilité, mobile et prefers-reduced-motion respectés.
- Tableau exhaustif des nouveaux libellés FR/EN à présenter avant leur validation définitive.
- Documenter l'exception TypeScript dans la revue d'architecture Rust.
## 6. Restrictions
Aucune intervention sur db:trial ou DEV.
Les tests automatisés utilisent uniquement les environnements autorisés et ne doivent jamais modifier des données préexistantes à préserver.
Ne pas toucher à la fiche équine historique ni à la copie d'essai manuelle.
Aucune migration SQL, modification Rust ou worker hors périmètre.
Aucune suppression de données, aucune fusion et aucun déploiement.
Préserver le fichier de revue ChatGPT non suivi.
Ne pas commencer R3, R4, U2 ou U2b.
## 7. Checkpoint final
Fournir :
- La liste des sous-lots R2 réalisés.
- Les commits et leur état de push.
- Les résultats exacts des tests exécutés et ceux volontairement non exécutés.
- Les revues indépendantes et les éventuelles réserves.
- Le statut du risque editor-equine.
- Le tableau FR/EN des nouveaux libellés.
- Le protocole de test manuel sur db:trial.
S'arrêter après R2 et attendre la validation utilisateur.
## CLARIFICATIONS
Q: family detail « n références » button? / A: same panel with family words (« Retirer de cette famille », badge « cette famille », « N références citées par cette famille »); new FR/EN labels in the checkpoint table. [gated 2026-11-12] SUPERSEDED by the owner GO below.
Q: 640-1 023 px tab row? / A: all five tabs shown; the row may wrap (fixed per width, never moves on interaction, no horizontal scroll). [gated 2026-11-12]
Q: « Retirer » marks the finding / family « À confirmer » (core rule, edit.rs)? / A: accepted; documented in docs and db:trial protocol; one « Défaire » restores both. [gated 2026-11-12]
Q: shell gate with editor-equine? / A: excluded from every run (owner §3, §4 « ne pas déclencher une suite dangereuse »); its helper calls are updated for typecheck only, never run; per-id snapshot of pre-existing anatomical_sheets before/after each shell run.
Q: where does the FR/EN table live? / A: `docs/development/V1-2-6_R2_LABELS.md` (decided in plan, shown at the gate).
Q: panel from a family? / A: NO. Owner GO 2026-11-12 (brief « GO R2 — Plan révision 3 », « Correction obligatoire de R2.1 »): the contextual panel opens only from a finding, per the earlier decision; never from a family without a new arbitration; the library stays reachable from the Références tab. The trigger a family's detail shows today (shared FindingContent) is removed; the family keeps its inline citation list with « Retirer ». [gated 2026-11-12]
Q: arbitrations of the gate? / A: owner GO 2026-11-12: (1) permanent Places min-height on the available screen height, mobile browsers and viewport changes handled, no drawing move, no horizontal overflow; (2) motion/react instead of Tailwind motion-reduce:, prefers-reduced-motion and focus return mandatory with or without animation; (3) « Ce constat ne cite plus aucune référence », « Référence introuvable », « Saisie non appliquée : … » accepted provisionally, EN not ratified one by one, full FR/EN table at R2.6; (4) Type sort in business order, deterministic and stable for equal types; (5) « Tout afficher » resets search and sort, keeps open tiles and any edit in progress, never loses a valid entry nor closes unexpectedly. Data controls must prove no unauthorised change, metadata included. [gated 2026-11-12]
Q: read-only flip while the panel is open? / A: PENDING OWNER. Implemented: the panel stays open in read view (no edit control; existing crossing spec expects it visible); plan P22'' and criterion 15 listed it as a forced close. Verifier 2026-11-13: criterion 15 NOT-MET on this point only. Shown at the R2 checkpoint.
Q: admin.spec red at the end of R2? / A: PENDING OWNER. A0 (fr, en) and « admin screens » crash the renderer during axe on screens rendering every accumulated grant (1 282+); not proven by a base-commit run. Verifier 2026-11-13: criterion 9 NOT-MET on this point only. Separate fix proposed at the checkpoint.
Q: read-only flip, owner answer? / A: owner 2026-11-13: panel kept open in read view (ratified; criterion 15 amended). A draft abandoned by the flip must be said clearly (accessible and perceptible), nothing shown as saved, no extra history entry. [gated 2026-11-13]
Q: admin.spec, owner answer? / A: owner 2026-11-13: no sandbox reset, no deletion or change of pre-existing data; non-destructive diagnosis first (accumulation or regression, evidence required, not assumed); grant pagination stays in RR-13, not here; results and still-failing tests documented. [gated 2026-11-13]
Q: add tile cancel? / A: owner 2026-11-13: « Annuler l'ajout » approved; abandons an unfinished creation without leaving an incomplete reference; tests for document, Défaire / Refaire, focus, Escape. [gated 2026-11-13]
Q: V1-2 contract note? / A: owner 2026-11-13: dated note authorised (four tabs and references dispositions superseded by D1 to D4 of R2). [gated 2026-11-13]
Q: three UX fixes before the trial? / A: owner 2026-11-13: landscape 667 × 375 trigger reachable without a physical keyboard; a refused draft never lost silently when its tile leaves the results; no pinned non-matching tile shown incoherently next to the no-result notice. Targeted; stop and present before any architecture or model change. Behaviours chosen by the controller under that delegation (plan rev 5 C1-C4), reported. [gated 2026-11-13]
## ACCEPTANCE CRITERIA
Seed (from the request); design criteria appended at STEP 3 with [gated].
1. Five editor tabs in the order Général, Annotations, Constats, Références, Vérification; below 640 px « Plus » holds Général, Constats, Références; no header « Références » button.
2. A cited reference never shows « Supprimer » (hint instead); an uncited one keeps « Supprimer » + existing dialog; the core refusal stays the authority.
3. « Retirer de ce constat » (panel, finding only) removes only that association, one « Défaire » restores it; the reference stays in the document. [corrected 2026-11-12, owner GO: no family wording]
4. Read-only and no-right modes show no edit control in the tab or the panel.
5. Search and the four sorts are TypeScript display functions over ids; the document text, stored order, ids and history are identical before and after any search or sort (tested).
6. The panel opens only from a finding (never from a family; corrected 2026-11-12, owner GO), width ≤ 34 rem and ≤ available width, slide 180 / 140 ms, none under reduced motion, page inert and panel unreachable while closed or exiting, focus back to the trigger if it still exists; no layout shift of the tab content on open / close.
7. A1 to A4 hold; « Aller à » from Vérification opens the right tile, open and focused; references reachable when a search returns nothing (clear button).
8. Exhaustive FR/EN table of new and changed labels with ambiguities: `docs/development/V1-2-6_R2_LABELS.md`; Rust exception rows in `RUST_ARCHITECTURE_REVIEW.md` Part II.
9. Gates per sub-lot: typecheck, lint, test:run, build; e2e:ui; e2e:shell on db:sandbox without editor-equine; pre-existing rows unchanged per id; one commit + push per sub-lot.
10. No change under supabase/, crates/, scripts/db-trial*, docker/; no db:trial / DEV access; untracked review file kept; no merge.
11. [gated 2026-11-12] A family's detail shows no « {n} références » trigger and keeps its inline citation list with « Retirer »; `open_citations` with a family key is a no-op; the panel carries no family wording.
12. [gated 2026-11-12] The header « Références » button and its id are gone.
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && ! grep -rq "REFERENCES_BUTTON_ID" apps/app/src && ! grep -rq "editor-references-panel" apps/app/src && echo NO_HEADER_BUTTON
EXPECT: NO_HEADER_BUTTON
EVIDENCE: MET exit=0 marker-found :: NO_HEADER_BUTTON
13. [gated 2026-11-12] New files exist: pure sort and safe-link modules, the two new shell specs, the labels table.
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && test -f apps/app/src/editor/references/sort.ts && test -f apps/app/src/editor/references/safeLink.ts && test -f apps/app/e2e/shell/editor-references.spec.ts && test -f apps/app/e2e/shell/editor-citations.spec.ts && test -f docs/development/V1-2-6_R2_LABELS.md && echo R2_FILES_OK
EXPECT: R2_FILES_OK
EVIDENCE: MET exit=0 marker-found :: R2_FILES_OK
14. [gated 2026-11-12] Sorts: sheet order, citation (Intl.Collator base + numeric), citation count descending, Type in REFERENCE_TYPES order; equal keys keep the stored order (deterministic, stable); inputs never mutated; unit-tested with permutations.
15. [gated 2026-11-12; amended 2026-11-13, owner: the read-only flip keeps the panel open in read view, it is not a close] Closing: every close (✕, Escape outside text fields, scrim, « Tout afficher », « Aller à », tab switch, element gone) records one pending move applied after the exit; focus lands on the trigger if present, else the active tab button (« Plus » below 640 px); checked by `document.activeElement` in normal and reduced motion; page inert and panel unreachable during exit; a user close with a refused draft is cancelled (field focused), a forced close drops it with the « Saisie non appliquée : … » announcement.
16. [gated 2026-11-12] « Tout afficher » resets search and sort, keeps open tiles and any tile in edit; a valid panel draft is committed before the close.
17. [gated 2026-11-12] Layout: Places min-height = dynamic viewport height minus the top bar, permanent; panel wrapper `overflow-x: clip`; document scrollWidth / scrollHeight and the drawing box unchanged before, during and after open / close at 375, 1 024, 1 180, 1 279, 1 280 px and across a viewport height change and a rotation at phone width.
18. [gated 2026-11-12] Safe links: DOI and URL rendered as links only when http(s) / a valid `10.x/…` DOI; `javascript:` never a link; dangling citation ids shown as « Référence introuvable » with « Retirer »; duplicate ids stay distinct.
19. [gated 2026-11-12] Data controls: every shell run goes through the preflight (editor-equine never listed) and the full-row guard (every column of every row of public, audit, storage tables and auth.users); no pre-existing row changed or deleted, metadata included; new rows counted per table and reported.
20. [gated 2026-11-12] No change outside scope since 49867ba.
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && [ -z "$(git diff --name-only 49867ba..HEAD -- supabase crates docker packages/supabase/src scripts)" ] && echo SCOPE_OK
EXPECT: SCOPE_OK
EVIDENCE: MET exit=0 marker-found :: SCOPE_OK
21. [gated 2026-11-13] Read-only flip: no history entry from the flip itself (unit: undo and redo lengths unchanged with nothing pending and with a refused draft; +1 exactly with a valid focused draft, the typed change only; +0 on the flip back); a dropped draft leaves the document unchanged, is said once in the polite live region and shown as visible text in its tile; the read view shows the document values.
22. [gated 2026-11-13] A tile in edit never leaves the shown list on a read-only flip (pin kept whatever the search or sort); an edit view unmounted with pending drafts outside an explicit leave is always announced (all pending fields named), visibly noted when its tile is shown; a panel forced close is announced exactly once.
23. [gated 2026-11-13] « Annuler l'ajout » and Escape (not during IME composition) abandon the draft tile: document references identical, undo and redo stacks unchanged (a pending redo kept), focus on « Ajouter une référence », a new add starts empty; unit + e2e.
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2/apps/app && grep -q "editor.references.add_cancel" src/i18n/fr.ts && grep -q "editor.references.add_cancel" src/i18n/en.ts && grep -rq "Annuler l'ajout" e2e/shell/editor-references.spec.ts tests/unit && echo ADD_CANCEL_OK
EXPECT: ADD_CANCEL_OK
EVIDENCE: MET exit=0 marker-found :: ADD_CANCEL_OK
24. [gated 2026-11-13] A shown tile outside the search carries « Ne correspond pas à la recherche »; the no-result notice shows only when no tile is shown; unit + e2e.
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2/apps/app && grep -q "editor.references.outside_search" src/i18n/fr.ts && grep -q "editor.references.outside_search" src/i18n/en.ts && echo OUTSIDE_OK
EXPECT: OUTSIDE_OK
EVIDENCE: MET exit=0 marker-found :: OUTSIDE_OK
25. [gated 2026-11-13, amended rev 5b and C4 round 4] At 667 × 375: (A) with touch only (CDP touch swipes, no keyboard, no programmatic scroll) the trigger is brought wholly on screen and hit-testable, a tap opens the panel, heading and ✕ in the viewport and hit-testable, scrollY unchanged; (B) worst case, trigger bottom placed on the viewport bottom by an instant programmatic scroll (a touch landing cannot be pixel-exact: slop floor ~60 px), a tap opens the panel with heading and ✕ in view and hit-testable, scrollY unchanged (e2e, phone project). The rotation to 667 × 375 with the panel open at scroll 0 keeps its documented cramped exception (not built, offered to the owner at the checkpoint).
26. [gated 2026-11-13] One history entry per reference edit (field blur, « Terminer », panel close), re-proved on the final code (unit + e2e green).
27. [gated 2026-11-13] admin.spec diagnosis recorded: grant counts, interleaved A/B runs at pre-R2 65a8fd3 and HEAD with results and memory, conclusion with its evidence, still-failing tests listed in docs and BLK-015; no grant pagination, no reset, no deletion.
28. [gated 2026-11-13] V1-2 contract notes dated 2026-11-13 at the four-tab bullet and at « Validated UX ».
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && [ "$(grep -c 'Note 2026-11-13' docs/development/V1-2_ANATOMICAL_SHEETS.md)" -ge 2 ] && echo V12_NOTE_OK
EXPECT: V12_NOTE_OK
EVIDENCE: MET exit=0 marker-found :: V12_NOTE_OK
29. [gated 2026-11-13] No change outside scope since 52aac41 (no SQL, Rust, worker, scripts, docker, Supabase package, admin sources).
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && [ -z "$(git diff --name-only 52aac41..HEAD -- supabase crates docker packages/supabase/src scripts apps/app/src/admin apps/app/src/components/admin apps/app/src/app/routes/app/admin)" ] && echo SCOPE2_OK
EXPECT: SCOPE2_OK
EVIDENCE: MET exit=0 marker-found :: SCOPE2_OK
## FILE SCOPE
apps/app/src/editor/{tabs,navigation,focusRequest,useEditorNavigation,verification,editingContext}.ts, apps/app/src/editor/annotations/deselect.ts, apps/app/src/editor/references/** (new sort.ts), apps/app/src/components/editor/{EditorWorkspace,EditorTabBody,EditorTabs,DraftHeader,HeaderActions,KeptPlace}.tsx, apps/app/src/components/editor/references/**, apps/app/src/components/editor/findings/{FindingsTab,FindingContent,FindingDetail}.tsx, apps/app/src/components/editor/tabs/** (new ReferencesTab), apps/app/src/i18n/{fr,en}.ts, apps/app/tests/unit/**, apps/app/tests/helpers/editorRoute.tsx (StrictMode wrap, rev 5b), apps/app/src/editor/useViewport.ts (C1, rev 5b), apps/app/src/editor/useEditCommand.ts (only if the final-review I1 fix requires it), apps/app/e2e/{support,shell,ui}/**, docs/development/V1-2_ANATOMICAL_SHEETS.md (dated notes, criterion 28), docs/development/{V1-2-6_U1_CORRECTIONS,BROWSER_TESTS,V1-2-6_OWNER_TRIAL,RUST_ARCHITECTURE_REVIEW,V1-2-6_R2_LABELS}.md, docs/design/README.md, CLAUDE.md (tree), this contract, the plan, .claude/tasks/TODO.md, memory.