chore(memory): R2 finish BDR-116, LRN-136..138, BLK-015 note, plan and contract
This commit is contained in:
1 parent
3a7ffa2f8b
commit
afc1051313
6 files changed
+469
No files matched your search
@@ -124,3 +124,4 @@ Real cause: accumulation of e2e grants in persistent sandbox. Rights screen (/ap
|
||||
Evidence: interleaved A/B admin.spec alone, pre-R2 worktree 65a8fd3 vs HEAD 52aac41, 4 runs all 13p/8s/3f same crashes → not an R2 regression. Dose-response quiet window (temp spec copy routing list_catalog_grants to 753 newest rows, deleted after): capped 16p/0f (2 526 grants), full 11p/5f 4 crashes (2 551), capped 16p/0f (2 570). Final sweep c6sweep2 221p/119s/5f all admin.spec; isolated 12p/8s/4f. Guard OK every run.
|
||||
Solution: none applied (owner: no reset, no deletion of pre-existing data, pagination stays in RR-13). Rerun admin.spec alone only as diagnosis, never as gate. Close when RR-13 paginates grant list (or run-scoped fixture cleanup approved) and admin.spec green on sandbox.
|
||||
Refs: `docs/development/BROWSER_TESTS.md` §6, `V1-2-6_U1_CORRECTIONS.md` §R2, BDR-115, LRN-133.
|
||||
- **Status (2026-11-13)**: open: R2 finish 2026-11-13 sweep, admin.spec A0 + admin screens still Target crashed, same signature; shell chrome changed, no A/B cap rerun on this branch; pagination stays RR-13
|
||||
@@ -955,3 +955,11 @@ Owner brief « R0 — Autorisation des trois dernières corrections graphiques
|
||||
**Stated limits** (owner to ratify): undo/redo replacing pending draft in still-mounted view overwrites typed text silently; two drops in one flip speak only last (visible notes remain); full page reload out of scope (recovery copy rules); rotation cramped exception; admin.spec red on accumulated sandbox (BLK-015).
|
||||
**Alternatives rejected**: close panel on read-only flip (loses context); drop slot in a store (StrictMode, scope) → tile-local; rotation auto-scroll (scope, offered); per-field error map in useEditCommand (every panel uses it).
|
||||
**Refs**: plan `.claude/tasks/plans/2026-11-12-r2-references-tab-1730.md` rev 5/5b, contract criteria 15, 21-29, `docs/development/V1-2-6_U1_CORRECTIONS.md` §R2, BDR-114, BLK-015.
|
||||
|
||||
## BDR-116 — R2 finish: editor dialogs, view state in browser history, filter by finding (2026-11-13)
|
||||
- **Status**: accepted
|
||||
Context: owner R2 trial 2026-11-13, UX finish of sheet editor (plan .claude/tasks/plans/2026-11-13-r2-ux-finish-1624.md R2F-1..9, gate approved).
|
||||
Decision: finding + reference add/edit/detail in D13 modal dialogs, transactional forms (one undo entry per changed save, BDR-050 amended for dialogs). Citations panel = modal side sheet over finding dialog (D2 kept: from finding only). Editor view layers (tab, section, dialog by element key, sheet, references filter by finding key) live in history.state via react-router navigate state (src/editor/history/{entry,useEditorHistory}.ts); never typed text, search, draft. Entry owned by sheetId+userId, foreign entry -> default view; reload drops forms; read-back allowlisted + length capped. « Tout afficher » filters by finding with removable chip (A3 amended). « Plus » = overlay dropdown, CloseWatcher closes it first (board 27 A amended). Sidebar sticky top-0 h-dvh. No new mockups: owner brief + gate = validation (docs/design/README.md addendum 2026-11-13). Clients/animals list searches NOT in history (BDR-078 stands).
|
||||
Alternatives: URL params (rejected: leaks into links, A2), data router + useBlocker (rejected BDR-078), inline forms (owner asked modals).
|
||||
Limits: delete replaces dialog entry (one dead Back); POP during pending Back can swallow a same-instant move; CloseWatcher stub-proved only; outside tap only closes « Plus »; multi-entry Back out of editor drops dirty dialog draft -> content-free sessionStorage flag, notice once on next mount (src/editor/leftDraft.ts).
|
||||
Status: built, awaiting owner trial on db:trial. Commits 553a0e5..021685f on feature/v1-2-anatomical-sheets.
|
||||
@@ -560,3 +560,4 @@ R5.4: `draft/{labels,changelog,review_report,drawing,overlay,app_review,svg_comp
|
||||
|
||||
## 2026-11-13
|
||||
- R2 corrections 2026-11-13: C0 admin.spec diagnosis (A/B + dose-response, accumulation, BLK-015 open), C1-C5 + final review I1 + verifier gap fixed (3303530..538ce27), sweep 221p/5f admin.spec only, guard OK, verifier CONFORME; stopped at R2 checkpoint for db:trial trial.
|
||||
- 2026-11-13 R2 UX finish built (553a0e5..021685f): dialogs, history Back/Forward, filter chip, Plus overlay, sticky sidebar; final review fixes; gates green, shell sweep fails only admin.spec (BLK-015); awaiting owner db:trial trial
|
||||
@@ -950,3 +950,15 @@ Limit: wording of this client version only.
|
||||
**Context**: R2 « Terminer » below a field whose blur-commit is refused.
|
||||
**Pattern**: mouse down blurs field → refusal line inserted → layout shifts → mouseup lands elsewhere → click lost (« Terminer » looks dead). Fix: `mousedown` preventDefault on the button (focus stays, button then runs the leave guard). Editor-wide general cure not done.
|
||||
**Also (tests)**: happy-dom 20.10.6 holds MutationObserver callback in WeakRef → GC under load silently stops observation; count live-region announcements by wrapping textContent/nodeValue setters, restore in afterEach (c8109af, b1fd896). Touch e2e: CDP synthesizeScrollGesture touch scrolls nothing in Chromium 1248; dispatchTouchEvent swipes do, but slop floor ~60 px + load-dependent gain → pixel-exact touch landing not reproducible; prove reachability by touch, place worst case by programmatic scroll (78fb2d0).
|
||||
|
||||
## LRN-136 — Implementer gate claims need exit codes, controller reruns (2026-11-13)
|
||||
Pattern: subagent implementer claimed typecheck/lint green while red (Task 2, 18085ce: missing import, readonly fixtures). Caught only when controller reran gates rounds later.
|
||||
Apply: briefs demand real exit codes per gate; controller reruns typecheck + lint itself on every report before review. Never accept "green" without rc.
|
||||
|
||||
## LRN-137 — Template-built i18n keys escape typecheck (2026-11-13)
|
||||
Pattern: i18n key built by template literal (t(`editor.findings.new.${kind}`)) escapes typecheck: Dict typed as string map, missing key renders raw. Found in final round: editor.findings.new.category absent in fr+en, title showed raw key.
|
||||
Apply: every dynamic key site gets unit test asserting heading text has no 'editor.' prefix, or enumerate union kinds against both dicts in a test. Audit dynamic key sites in touched files at review.
|
||||
|
||||
## LRN-138 — Unblockable leave + no draft storage: content-free loss flag (2026-11-13)
|
||||
Pattern: browser Back not interceptable (BDR-078) + owner forbids storing drafts + owner forbids silent loss. Resolution: on unmount with dirty dialog write one content-free flag (kind + element key, scoped sheetId+userId) to sessionStorage, try/catch; next mount of same sheet+user shows notice once, clears flag. Relies on React 19 parent-first cleanup on deletion.
|
||||
Apply: any "cannot block leave, cannot keep data" conflict -> record the fact of loss, not the data, and tell user on return.
|
||||
@@ -0,0 +1,212 @@
|
||||
# CONTRACT — r2-ux-finish
|
||||
- date: 2026-11-13 | flow: ship-feature | branch: feature/v1-2-anatomical-sheets (worktree /home/bchanot/Documents/faunosteo-v1-2)
|
||||
- status: active
|
||||
|
||||
## REQUEST (verbatim — IMMUTABLE)
|
||||
J'ai terminé mon essai manuel de R2 sur db:trial.
|
||||
|
||||
Globalement, tout fonctionne et je suis satisfait du résultat. J'ai néanmoins plusieurs améliorations UX à apporter avant de clôturer R2.
|
||||
|
||||
Je te laisse autonome sur l'analyse, la conception technique, le découpage, les tests et l'implémentation. Tu connais le projet, ses contrats et son architecture. Utilise ton processus habituel de développement, de relecture et de validation.
|
||||
|
||||
L'objectif général est de rendre l'éditeur plus fluide, en évitant les déplacements inutiles dans la page et en conservant le contexte de navigation.
|
||||
|
||||
### 1. Constats : utiliser des modales
|
||||
|
||||
Actuellement, lorsqu'on clique sur un constat pour le consulter ou le modifier, son contenu s'affiche plus bas dans la page.
|
||||
|
||||
Quand il existe beaucoup de constats, c'est contraignant : il faut descendre, effectuer la modification, puis retrouver sa position précédente.
|
||||
|
||||
Je souhaite que le clic sur un constat ouvre une modale contenant son détail.
|
||||
|
||||
De même, l'ajout et la modification d'un constat devraient utiliser une modale.
|
||||
|
||||
Comportement attendu :
|
||||
- Ouverture du constat directement devant l'utilisateur.
|
||||
- Consultation et modification dans la modale.
|
||||
- Enregistrement, annulation ou fermeture.
|
||||
- Retour à l'endroit exact où l'utilisateur se trouvait, avec la même position de défilement et les mêmes filtres.
|
||||
- Conservation du contexte de sélection.
|
||||
|
||||
L'utilisateur ne doit pas devoir rechercher à nouveau son constat après avoir fermé la modale.
|
||||
|
||||
### 2. Références : modales pour l'ajout et la modification
|
||||
|
||||
Dans l'onglet Références, les tuiles dépliables fonctionnent bien pour consulter les informations.
|
||||
|
||||
En revanche, je préfère que les formulaires d'ajout et de modification s'ouvrent dans des modales.
|
||||
|
||||
Les tuiles restent utilisées pour la consultation.
|
||||
|
||||
L'utilisateur doit retrouver exactement sa position dans la liste lorsqu'il enregistre, annule ou ferme une modale.
|
||||
|
||||
### 3. Simplifier les références affichées dans un constat
|
||||
|
||||
Actuellement, lorsqu'un constat possède des références, leurs informations apparaissent directement dans son détail.
|
||||
|
||||
Or il existe déjà un bouton « X références » qui ouvre le volet latéral.
|
||||
|
||||
Cela fait doublon.
|
||||
|
||||
Je souhaite conserver uniquement :
|
||||
- Un libellé « Références citées ».
|
||||
- Le bouton « X références », qui ouvre le volet existant.
|
||||
- La possibilité de lier une référence existante au constat, comme actuellement.
|
||||
|
||||
La liste détaillée des références n'a plus besoin d'apparaître directement dans le constat.
|
||||
|
||||
### 4. « Tout afficher dans l'onglet Références » : filtrer automatiquement
|
||||
|
||||
Actuellement, ce bouton ouvre correctement l'onglet Références, mais affiche toutes les références.
|
||||
|
||||
Je voudrais qu'il affiche uniquement les références citées par le constat depuis lequel on vient.
|
||||
|
||||
Exemple :
|
||||
|
||||
Je consulte le constat A, qui cite les références 12 et 25.
|
||||
|
||||
Je clique sur « Tout afficher dans l'onglet Références ».
|
||||
|
||||
L'application ouvre l'onglet Références et n'affiche que les références 12 et 25.
|
||||
|
||||
Le filtre doit être clairement visible, par exemple :
|
||||
|
||||
« Références du constat : [Nom du constat] × »
|
||||
|
||||
L'utilisateur doit pouvoir retirer ce filtre pour retrouver toutes les références.
|
||||
|
||||
La recherche et le tri existants doivent rester utilisables avec ce filtre.
|
||||
|
||||
### 5. Navigation Précédent et historique du navigateur
|
||||
|
||||
C'est un point important.
|
||||
|
||||
Je veux que la navigation interne fonctionne naturellement avec le bouton Précédent du navigateur, y compris sur téléphone.
|
||||
|
||||
Exemple de parcours :
|
||||
|
||||
1. Je suis dans l'onglet Constats.
|
||||
2. J'ouvre le constat A.
|
||||
3. Je clique sur « 2 références ».
|
||||
4. Le volet des références citées s'ouvre.
|
||||
5. Je clique sur « Tout afficher dans l'onglet Références ».
|
||||
6. J'arrive dans l'onglet Références, filtré sur les deux références du constat A.
|
||||
7. J'appuie sur Précédent dans mon navigateur ou sur mon téléphone.
|
||||
8. Je reviens au constat A, avec son volet de références ouvert, dans l'état où je l'avais quitté.
|
||||
|
||||
Je souhaite aussi que les changements d'onglet et les autres navigations significatives soient cohérents avec l'historique du navigateur.
|
||||
|
||||
Tu peux prévoir un bouton de retour visible lorsque cela améliore l'expérience.
|
||||
|
||||
Choisis une solution adaptée au routeur et à l'architecture existante, sans accumuler d'entrées d'historique inutiles.
|
||||
|
||||
### 6. Menu « Plus » sur téléphone
|
||||
|
||||
Le menu « Plus » des onglets devrait fonctionner comme un véritable menu déroulant.
|
||||
|
||||
Je souhaite une ouverture et une fermeture fluides, avec une animation légère et naturelle.
|
||||
|
||||
L'objectif est que la navigation mobile paraisse moins rigide et soit plus agréable.
|
||||
|
||||
### 7. Menu principal latéral gauche
|
||||
|
||||
Actuellement, le menu principal latéral gauche défile avec le contenu de la page.
|
||||
|
||||
Je souhaite qu'il reste fixe à l'écran pendant que l'utilisateur fait défiler le contenu.
|
||||
|
||||
Le menu principal ne doit pas disparaître lorsqu'on descend dans une longue page.
|
||||
|
||||
Adapte naturellement le comportement aux différentes tailles d'écran. Si son contenu dépasse la hauteur disponible, il peut disposer de son propre défilement.
|
||||
|
||||
### 8. Principe général pour les formulaires
|
||||
|
||||
Plus généralement, je souhaite privilégier les modales pour les opérations d'ajout et de modification lorsque c'est pertinent.
|
||||
|
||||
Cela concerne notamment les écrans présentant de longues listes, où les formulaires intégrés au milieu ou au bas de la page rendent la navigation pénible.
|
||||
|
||||
Il ne s'agit pas de transformer aveuglément tous les formulaires en modales.
|
||||
|
||||
Analyse les composants existants et applique ce principe là où il améliore réellement l'expérience.
|
||||
|
||||
L'objectif est d'avoir un comportement cohérent dans l'ensemble de l'application :
|
||||
- Consulter facilement.
|
||||
- Ajouter ou modifier sans perdre sa position.
|
||||
- Enregistrer ou annuler.
|
||||
- Retrouver immédiatement son contexte précédent.
|
||||
- Utiliser naturellement Précédent et Suivant dans le navigateur.
|
||||
|
||||
Pense également au focus clavier, à l'accessibilité, aux erreurs de validation et aux modifications non enregistrées.
|
||||
|
||||
### 9. Finition de R2
|
||||
|
||||
Tu peux intégrer à ce travail les limites résiduelles déjà relevées au checkpoint R2, notamment :
|
||||
- Les saisies remplacées silencieusement pendant Défaire/Refaire.
|
||||
- Les annonces accessibles lorsque plusieurs brouillons sont abandonnés.
|
||||
- Les derniers petits problèmes de formatage.
|
||||
|
||||
Pour BLK-015, conserve le diagnostic établi sur l'accumulation des droits dans la sandbox et le suivi du chantier séparé de pagination.
|
||||
|
||||
### Organisation
|
||||
|
||||
Je te laisse choisir le découpage le plus pertinent, mutualiser les composants et prendre les décisions techniques nécessaires.
|
||||
|
||||
Tu peux apporter des améliorations complémentaires si elles servent directement les objectifs UX décrits.
|
||||
|
||||
Évite de multiplier les checkpoints intermédiaires pour des détails que tu peux résoudre par ton analyse et tes relectures habituelles.
|
||||
|
||||
Si une décision modifie réellement le fonctionnement métier, les droits, les données ou une règle importante déjà ratifiée, présente-moi le choix.
|
||||
|
||||
Sinon, avance de manière autonome.
|
||||
|
||||
À la fin, fournis-moi :
|
||||
- Le résumé des changements.
|
||||
- Les principaux choix UX et techniques.
|
||||
- Les tests et les résultats.
|
||||
- Les éventuelles limites restantes.
|
||||
- Une courte procédure pour tester les changements sur db:trial.
|
||||
|
||||
Je veux pouvoir essayer cette nouvelle navigation avant de considérer R2 définitivement terminé.
|
||||
|
||||
## CLARIFICATIONS
|
||||
Q: Standing restrictions from the earlier R2 briefs still bind? / A: yes (owner briefs 2026-11-12 and 2026-11-13): no SQL migration, Rust, worker, roles, MFA or secrets change; no db:trial or DEV access (the owner's trial app is left running, untouched); automated tests only on db:sandbox through the guarded wrapper (preflight, full-row guard), editor-equine never run; no merge, no deploy; the untracked faunosteo-v1-2-6-revue-ux-chatgpt.md kept; R3, R4, U2, U2b not started; BLK-015 diagnosis kept, grant pagination stays in RR-13.
|
||||
Q: Pass B open choices (visible wording, placement, animation timings, dialog layouts, URL parameter names `q`, `species`, `archived`, the « Revenir au constat » button, the post-create notice) / A: delegated — defaults of plan rev 1 (R2F-1 to R2F-9), reported in the final French report with the FR/EN table [gated 2026-11-13]
|
||||
Q: Pass A gaps? / A: none. The owner delegated analysis, design, split, tests and implementation; choices touching business behaviour, rights, data or an important ratified rule are presented once, at the plan validation gate.
|
||||
|
||||
Q: Plan rev 3 and choices 1-5 / A: approved by the owner 2026-11-13 (« je valide le plan et les choix 1 à 5 »), choice 6 = default (no list search kept, BDR-078); precisions 1-5 folded as criteria 13-17 [gated 2026-11-13]
|
||||
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. Constats: activating a tree item opens a modal dialog with its detail in front of the user; add and edit of a finding happen in a modal dialog; save, cancel and close are available; after any of them the page scroll position, the tree's expanded branches and the selection are those before the dialog opened, and focus returns to the opener (no re-search).
|
||||
2. Références: tiles stay the reading surface; adding and editing a reference happen in a modal dialog; after save, cancel or close the list scroll position, search, sort, filter and open tiles are those before the dialog opened.
|
||||
3. A finding's detail no longer lists its cited references inline: it shows the label « Références citées », the « X références » button opening the citations panel, and the control linking an existing reference.
|
||||
4. « Tout afficher dans l'onglet Références » opens the Références tab filtered to the references cited by the source finding, with a visible removable chip « Références du constat : [name] × »; search and sort keep working with the filter; removing the chip shows every reference.
|
||||
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2/apps/app && grep -q "editor.references.filter_chip" src/i18n/fr.ts && grep -q "editor.references.filter_chip" src/i18n/en.ts && echo FILTER_KEY_OK
|
||||
EXPECT: FILTER_KEY_OK
|
||||
EVIDENCE: MET exit=0 marker-found :: FILTER_KEY_OK
|
||||
5. Browser Back and Forward follow the editor's internal navigation (tab changes, the finding dialog, the citations panel, the filtered Références tab), desktop and phone, with no duplicate or orphan entries; the owner's 8-step journey ends, after Back, on finding A with its panel open as left (e2e).
|
||||
6. The phone « Plus » tab menu opens and closes as a dropdown with a light animation (none under reduced motion), closes on outside click and Escape, keyboard and screen-reader usable.
|
||||
7. The main left sidebar stays in view while the page scrolls (sizes where it is shown), with its own scroll when taller than the viewport; no sideways scroll introduced.
|
||||
8. App-wide review of add/edit forms recorded (each candidate with its decision and reason); modals applied where the review says they help; focus, accessibility, validation errors and unsaved changes handled in every new dialog (no silent loss).
|
||||
9. R2 residuals: no typed text is replaced or dropped silently by Défaire/Refaire or by a read-only flip; announcements of several abandoned drafts are all heard (or the cause removed); `prettier --check` passes on the e2e and source files this run touches (fr.ts and en.ts exempt: pre-existing long lines, one line per new key; owner gate 2026-11-13).
|
||||
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2/apps/app && pnpm -s exec prettier --check e2e/shell/editor-shell-layout.spec.ts >/dev/null && echo PRETTIER_LAYOUT_OK
|
||||
EXPECT: PRETTIER_LAYOUT_OK
|
||||
EVIDENCE: MET exit=0 marker-found :: PRETTIER_LAYOUT_OK
|
||||
10. Gates: typecheck, lint, test:run, build, e2e:ui green; e2e:shell on db:sandbox through the guarded wrapper without editor-equine, every failure other than admin.spec (BLK-015) fixed; no pre-existing sandbox row changed, metadata included.
|
||||
11. No change under supabase/, crates/, docker/, scripts/, packages/supabase/src; no db:trial or DEV access; no merge.
|
||||
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && [ -z "$(git diff --name-only 36c6eb3..HEAD -- supabase crates docker scripts packages/supabase/src)" ] && echo SCOPE3_OK
|
||||
EXPECT: SCOPE3_OK
|
||||
EVIDENCE: MET exit=0 marker-found :: SCOPE3_OK
|
||||
12. Final French report: summary of changes, main UX and technical choices, tests and results, remaining limits, short db:trial test procedure.
|
||||
13. [gated 2026-11-13] A changed « Enregistrer » in the finding or reference dialog is exactly ONE undoable operation (undo length +1, one Défaire restores the prior state); a pristine « Enregistrer » and every « Annuler » / « Abandonner » add none (unit + e2e).
|
||||
14. [gated 2026-11-13] The citations sheet stacked over the finding dialog is fully usable by keyboard (Tab reaches every control, Escape closes the sheet only, focus returns to « X références ») and by touch (taps on its controls at 375 with hasTouch, the dialog underneath not activated) (e2e).
|
||||
15. [gated 2026-11-13] Browser history entries hold navigation state only (tab, section, open layers by element key, references filter by finding key): no typed text, no search term, no draft; an entry restores only for the same sheet and the same signed-in account, otherwise the editor opens on its default view (unit: entry state shape and mismatch rules).
|
||||
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2/apps/app && f=src/editor/history/entry.ts && [ -f "$f" ] && grep -q "sheetId" "$f" && grep -q "userId" "$f" && ! grep -Eq "^\s*(query|draft|text|search)\??\s*:" src/editor/history/*.ts && echo HISTORY_SHAPE_OK
|
||||
EXPECT: HISTORY_SHAPE_OK
|
||||
EVIDENCE: MET exit=0 marker-found :: HISTORY_SHAPE_OK
|
||||
16. [gated 2026-11-13] With the « Plus » menu open, the platform back request (CloseWatcher where the browser offers it) closes the menu before any navigation; without CloseWatcher the limit is stated (unit with a CloseWatcher stub).
|
||||
17. [gated 2026-11-13] No user modification is lost silently in any documented limit (owner condition on the stated limits).
|
||||
18. [gated 2026-11-13] Clients and Animaux lists keep no search term in browser history (BDR-078; choice 6 = default).
|
||||
|
||||
## FILE SCOPE
|
||||
apps/app/src/editor/** (navigation, history adapter, references view and filter), apps/app/src/components/editor/** (findings, references, citations, tabs, workspace, layers), apps/app/src/components/ui/{ModalDialog,Dialog}.tsx (only if a shared fix is needed), apps/app/src/components/shell/{ShellChrome,AppLayout}.tsx, apps/app/src/clients/useClientList.ts, apps/app/src/animals/useAnimalList.ts and their list routes (if the app-wide review keeps them), apps/app/src/i18n/{fr,en}.ts, apps/app/src/styles/** (only if needed), apps/app/tests/**, apps/app/e2e/{support,shell,ui}/**, docs/development/{V1-2-6_U1_CORRECTIONS,V1-2-6_OWNER_TRIAL,V1-2-6_R2_LABELS,BROWSER_TESTS,V1-2_ANATOMICAL_SHEETS}.md, docs/design/README.md, this contract, the plan, .claude/tasks/TODO.md, memory.
|
||||
|
||||
ORACLE AMENDMENT 2026-11-13 (controller): criterion 4 key renamed to the shipped key editor.references.filter_chip (chip « Références du constat : {name} »); criterion 15 path is src/editor/history/entry.ts (folder split in Task 1) and the forbidden-field scan covers every file of src/editor/history. Same assertions, no weakening.
|
||||
@@ -0,0 +1,235 @@
|
||||
# R2 UX finish — design and plan (rev 3a: rev 3 approved by the owner 2026-11-13, precisions folded)
|
||||
|
||||
Contract: `.claude/tasks/contracts/2026-11-13-r2-ux-finish-1624.md` (verbatim owner brief 2026-11-13, criteria 1-12).
|
||||
Worktree `/home/bchanot/Documents/faunosteo-v1-2`, branch `feature/v1-2-anatomical-sheets`, base `36c6eb3`. Commit in place,
|
||||
push by hook, never merge. Analysis: `.superpowers/sdd/r2-ux-finish/analysis.md`. Rev 1 challenged (FATAL 10 / FATAL 13 /
|
||||
CONCERNS 3), rev 2 re-challenged (CONCERNS 10 / 8 / 3, no BLOCKER); rev 3 folds every rev 2 MAJOR (record at the end).
|
||||
|
||||
## Global rules (bind every task)
|
||||
- No change under supabase/, crates/, docker/, scripts/, packages/supabase/src. No db:trial or DEV access. No merge, no deploy.
|
||||
- Shell tests only on db:sandbox through the guarded wrapper (preflight refuses editor-equine, full-row guard):
|
||||
`bash /home/bchanot/Documents/faunosteo-v1-2/.superpowers/sdd/r2-ux-finish/gate/run-shell.sh <label> e2e/shell/<spec>.spec.ts …`
|
||||
(untracked copy; the brief checks it exists and stops if not). Never playwright directly, never editor-equine (its
|
||||
helper edits are typecheck-only, said so). admin.spec red under BLK-015, never a gate. Each task's gate runs EVERY shell
|
||||
spec that uses a helper, an i18n key, a test id or a component the task changes (grep, listed in the report), and
|
||||
reports the grants its runs added.
|
||||
- One modal primitive: ModalDialog / Dialog (D13). No hand-written trap, no new dependency. e2e waits for the open dialog
|
||||
count to reach 0 before typing after a close (LRN-111/116). happy-dom 20.10.6 has no `:modal`, no inert, no popover API:
|
||||
code detects open modals with `dialog[open]`, and behaviours needing real top-layer semantics are proved in e2e.
|
||||
- No native modal inside a hidden KeptPlace. One ModalDialog instance per layer, kept across its modes and flips.
|
||||
- Transactional forms on local draft state only (never TextField / blur-commit fields, never the change-commit checkbox):
|
||||
« Abandonner », a move or a flip never commits.
|
||||
- Document history (Défaire/Refaire) and browser history stay separate.
|
||||
- i18n: fr.ts and en.ts, one line per key, no formatter on them (they are exempt from `prettier --check`: 188 pre-existing
|
||||
lines over the print width; stated deviation); new EN labels provisional, rows in V1-2-6_R2_LABELS.md.
|
||||
- Limits 25 logic lines / function, 100 chars / line, 5 params, 5 locals; `prettier --check` on every other touched file.
|
||||
Every removed or rewritten assertion mapped (R-24). Motion: motion/react, reduced motion honoured, no permanent will-change.
|
||||
|
||||
## Design
|
||||
|
||||
### R2F-1 Browser history for the editor (item 5)
|
||||
- History records only the editor VIEW, held by the navigation reducer (single holder): `EditorView = { tab, section,
|
||||
finding: { key, citations: boolean } | { create: { kind, parent } } | null, reference: { edit: id } | { create: true } |
|
||||
null, referenceFilter: ElementKey | null }`. Selection, expansion, search, sort, open tiles and a dialog's edit mode never
|
||||
touch history.
|
||||
- Moves dispatch at once (as today, through `go`); history follows from ONE reconcile effect, mounted as its own hook in
|
||||
EditorWorkspace (no dependency of useEditorNavigation on a router; tolerant of MemoryRouter and a missing `idx`). It
|
||||
compares the new view with the last written entry, read from a ref holding what it wrote (never `useLocation()`, which
|
||||
lags one transition):
|
||||
- a layer, tab or section ADDED by a user move → push `{ view, below }` (`below` = previous view);
|
||||
- a layer REMOVED by a user move → `navigate(-1)` when the top entry's `below` equals the new view, else replace;
|
||||
- replace hints: an arrow-key tab move, the chip removal, a creation turned into its element after « Créer » / save.
|
||||
A second close finds no layer and does nothing; a held Escape is ignored by `event.repeat`; the exiting surface is inert
|
||||
through motion `useIsPresent` (the CitationsLayer pattern). While a `back()` is pending the effect writes nothing; the
|
||||
pending flag clears on the next POP of any kind or after 1 s.
|
||||
- Pushes: a tab chosen by click / Enter / « Plus », an Annotations section, the finding dialog, a finding creation, the
|
||||
citations sheet, the reference dialog (edit or create), « Tout afficher », « Aller à ». The move captures `scrollY`
|
||||
synchronously before its dispatch into a map keyed by the leaving entry; a POP stores the leaving entry's scroll too.
|
||||
- POP (Back / Forward): `restore_view(sanitize(view))` (vanished keys drop their layer; a node creation whose parent vanished
|
||||
dropped), scroll from the map, then focus: a reopened layer → its dialog's first control; a closed layer → its return
|
||||
target; a tab change with no layer → the active tab button. All POP focus uses `preventScroll`; announcements and
|
||||
landings go through `afterModalsClosed` (R2F-2).
|
||||
- Guards (a stack keyed by layer, replacing the single CanLeave slot): a UI close of a dirty form shows the inline
|
||||
confirmation and never moves; « Abandonner » / « Enregistrer » pop their guard before closing; a push that would close a
|
||||
dirty layer (« Tout afficher », « Aller à ») asks first; ANY POP that would remove a dirty layer, or that happens while a
|
||||
non-layer modal (DeleteDialog, ConfirmDialog, ConflictDialog, views dialogs) is open, re-pushes the full pre-POP view
|
||||
(below = the landed view) and keeps everything mounted, then the dirty layer shows its confirmation.
|
||||
- Ownership (owner precision 3): every entry also stores `sheetId` and `userId`; an entry restores only when both match the
|
||||
current sheet and signed-in account, otherwise the default view (a POP or mount onto a foreign entry replaces it).
|
||||
Entries hold navigation only: never typed text, a search term or a draft.
|
||||
- Mount: an entry carrying editor state is restored through sanitize WITHOUT form layers (creation, reference dialog,
|
||||
finding edit mode is local anyway); an entry without one is replaced by the default view.
|
||||
- Write failures: react-router's push turns a refused pushState into a page load; the adapter keeps a write budget
|
||||
(sliding window, well under WebKit's 100 / 10 s) and, past it, keeps the view in memory without writing; replaces are
|
||||
wrapped in try/catch. Stated: a refused push would reload (out of reach at one push per user move).
|
||||
- Limits stated: leaving the editor by Back past its first entry is unguarded (BDR-078; recovery copy); a sheet reopened by
|
||||
Back shows its tiles closed; Chromium's skippable-entry intervention after a script re-push and Android's close-watcher
|
||||
grouping of two restored dialogs are untested (Playwright's goBack bypasses them), checked in the owner's phone trial.
|
||||
|
||||
### R2F-2 Shared dialog primitives
|
||||
- ModalDialog re-shows (`showModal()`) only when its consumer REFUSED a close (`onClose` returns `'kept'`) and the
|
||||
`<dialog>` was closed natively; never during an AnimatePresence exit (useIsPresent) or a history close. Unit: a Dialog
|
||||
set closed then natively closed stays closed.
|
||||
- `returnFocus?: (() => HTMLElement | null) | null`: a function resolves the target (focused with `preventScroll`, falling
|
||||
back to the captured opener then its ancestors when it returns null); `null` skips the restore (the move owns focus).
|
||||
- `afterModalsClosed(fn)`: runs `fn` once no `dialog[open]` remains (flushed from ModalDialog's cleanup / `close` event);
|
||||
used by the announcer (queued messages joined into ONE announcement) and every focus landing that follows a close.
|
||||
`focusRow` reports `found` only when the row actually holds focus.
|
||||
- Escape with `event.repeat` ignored; Dialog's fade honours reduced motion.
|
||||
- Return targets: tree rows get a `data-finding-key` attribute (no tabindex change); « X références » through the existing
|
||||
`triggerOf` + `visibleElement`; tile headers by key; the add buttons by id.
|
||||
- `useBeforeUnload(dirty)` extracted from useLeaveGuard's effect, used by dirty dialogs; leaveGuardStore untouched.
|
||||
- Place-scoped dialogs (DeleteDialog …) stay valid: a POP while one is open is refused by re-push (R2F-1).
|
||||
|
||||
### R2F-3 Finding dialog (items 1, 3)
|
||||
- Rendered by FindingsTab (owns selection, expansion, creation, deletion), gated by the place being visible, driven by
|
||||
`nav.finding`. Row activation (click, Enter, Space) selects the row and opens the dialog. Tree, expansion and scroll never
|
||||
change; on close focus returns to the row (`data-finding-key`, preventScroll). The detail below the tree and the inline
|
||||
creation form are removed.
|
||||
- View mode: type and status, names, descriptions, vet referral (read); « Références citées », « X références » (finding
|
||||
nodes with citations; opens the sheet), « Aucune référence citée », « Citer une référence » (edit tier, immediate, one
|
||||
history entry). No inline citation list for a finding node; a family keeps its list with « Retirer ». Actions (edit tier):
|
||||
« Modifier », mark reviewed / reset, move up / down, « Supprimer » (DeleteDialog stacked, returnFocus null; the deletion
|
||||
closes the finding layer in the same move by replace — no POP — and the nearest-row focus runs via afterModalsClosed).
|
||||
- Edit mode local (no history entry), local draft state: names (required), descriptions, vet referral. « Enregistrer »:
|
||||
pristine → view mode, no command; changed → ONE `update` command (one history entry), refusal on its field (focus
|
||||
there), success → view mode with « Modifications enregistrées » in the dialog's status line. « Annuler » → view mode
|
||||
(dirty: confirmation first).
|
||||
- Creation (AddBar): `{ create: { kind, parent } }`, FindingCreateForm fields on local state; « Créer » → command, entry
|
||||
replaced by `{ key }`, view mode of the new element (the `created` flow expands and selects behind).
|
||||
- Dirty close request (✕, Annuler, Escape, scrim, Back, platform): footer confirmation « Abandonner les modifications ? »,
|
||||
« Continuer la saisie » (focused), « Abandonner ». The confirmation is never inert.
|
||||
- Read-only: view mode without actions. When the mode leaves edit while a form is open, the dialog keeps the draft, fields
|
||||
`readOnly` + `aria-readonly`, « Enregistrer » disabled, and a notice worded from the mode (ModeNotice's wording: width
|
||||
→ « Élargissez la fenêtre … », back on widening; frozen / inactive / rights → only « Abandonner »).
|
||||
releaseEditFocus / refocusIfHidden return early when focus is inside an open dialog.
|
||||
- Gone: if the element vanishes under the dialog (a reload after a conflict), the layer closes by replace with a queued
|
||||
announcement « Ce constat n'existe plus ». « Aller à » (Vérification) opens view mode.
|
||||
- While a dialog is open, Défaire/Refaire and the header save are unreachable (page inert): stated.
|
||||
|
||||
### R2F-4 Citations sheet (items 3, 4, 5)
|
||||
Side sheet on MobileDrawer's pattern at the right edge (min(34 rem, 100 vw), full height, 0.18 s in / 0.14 s out),
|
||||
rendered by the layer host placed AFTER the tab body in tree order (so it calls showModal after the finding dialog; e2e
|
||||
asserts the top dialog after Back and Forward), stacked over the finding dialog; return focus « X références ». Content
|
||||
kept (read tiles, « Modifier », « Retirer de ce constat », « Aller à », « Tout afficher »). « Tout afficher » pushes
|
||||
`{ tab: references, referenceFilter: finding, no layer }` (search cleared, sort kept); « Aller à » pushes the references
|
||||
tab with the tile focused through afterModalsClosed. Gone rule as R2F-3. Deleted with the section (tests mapped):
|
||||
CitationsLayer and its geometry and cramped exception, the tab panels' `inert={open}`, useCitationsExit / PendingClose /
|
||||
`afterExit`, useRequestClose, useCloseMoves, the panel branch of useTabSelect, focusAfterClose and focusIsFree (triggerOf
|
||||
and visibleElement kept), the panel-only parts of useBodyEscape and the workspace Escape handler, the citationsOf gate of
|
||||
useDecisionsOpen, useCloseWhenGone / dropCitations (replaced by the gone rule).
|
||||
Interim until Task 3 (tiles still edit inline in the sheet): the sheet ignores Escape coming from a tile text field (A5 /
|
||||
P27 kept), and every move that unmounts the sheet (✕, scrim, Back, « Tout afficher », « Aller à ») consults the tiles'
|
||||
guard; a refusal cancels the move.
|
||||
|
||||
### R2F-5 Reference dialog and reading tiles (items 2, 9)
|
||||
- Tiles: disclosure, « Modifier », « Supprimer » or the cited hint. Deleted (tests mapped): the inline edit view in tiles,
|
||||
useReferenceEdit drafts and leave guard, DroppedNote / useDroppedDrafts / hostLeaving / `draft_dropped`, NewReferenceTile
|
||||
and the « Annuler l'ajout » tile, useLeaveCheck, the interim sheet rules of R2F-4.
|
||||
- ReferenceDialog (layer host, above the sheet): type, DOI, citation (required), URL (http/https), local draft, same
|
||||
validation. « Enregistrer »: pristine → close, no command; changed → ONE add / update command, refusal on its field;
|
||||
a creation's entry is replaced by `{ edit: id }` before closing. Dirty close and mode change: as R2F-3.
|
||||
- After close: scroll, search, sort, filter, open tiles unchanged; focus to the opener. Edited tile pinned when it no
|
||||
longer matches the search (C3 line kept). After a create: queued announcement and a visible notice « Référence ajoutée :
|
||||
<citation> » with « Afficher » (useReferenceFocus); the list does not move.
|
||||
- Residuals: no inline draft outside a dialog, Défaire/Refaire unreachable during a dialog: residual 9a and 9b cannot occur
|
||||
(tests: an undo shortcut and a mode flip leave an open dialog's draft untouched).
|
||||
|
||||
### R2F-6 References filtered by a finding (item 4)
|
||||
`referenceFilter` passed to shownPositions and the count. `isSheetView` requires no filter (reorder arrows off) and the pin
|
||||
is applied only when there is no filter (a pinned tile outside the filter never shows). Toolbar chip « Références du
|
||||
constat : <name> » with « × » (« Retirer le filtre du constat <name> », replace) and « Revenir au constat » while the filter
|
||||
is set (pops when the entry below shows that finding, else pushes its dialog). Count within the filter; the no-result
|
||||
notice keeps its clear actions; a vanished finding clears the filter with a queued announcement. BDR-114 A row updated in
|
||||
RUST_ARCHITECTURE_REVIEW Part II.
|
||||
|
||||
### R2F-7 « Plus » dropdown (item 6) and sticky sidebar (item 7)
|
||||
- The menu list renders as an overlay `absolute inset-x-0 top-full z-20` in the tab row made `relative` (full width: never
|
||||
off-screen, no measuring, no layout shift), AnimatePresence: opacity + translateY(-4 px) in 0.15 s, out 0.12 s, instant
|
||||
under reduced motion; closing entries are inert and never focused. Closes on selection, outside pointerdown (the closing
|
||||
tap is stopped from reaching the page: no deselection), Escape (useMoreEscape, A5), any tab change, and the platform back request through a `CloseWatcher` created when the menu
|
||||
opens, where the browser offers it (owner precision 4; feature-detected, unit-tested with a stub); without CloseWatcher
|
||||
the Android back gesture goes back in history (stated limit).
|
||||
- Sidebar aside `sticky top-0 h-dvh self-start overflow-y-auto` where shown (lg default, xl editor); drawer unchanged.
|
||||
|
||||
### R2F-8 App-wide review (item 8)
|
||||
| Screen | Decision | Reason |
|
||||
|---|---|---|
|
||||
| Editor Constats, Références | modals | long lists, form far from its item |
|
||||
| Editor categories, views, regions, Vertèbres | kept inline | short lists, form by its list |
|
||||
| Admin species | already a modal | — |
|
||||
| Admin access (grants) | kept: form above the list | nothing to lose; size is RR-13 |
|
||||
| Clients, Animaux lists | pages kept; list context on Back not done | BDR-078 refused keeping the search term (personal data) to survive Back: owner choice |
|
||||
| Relations | kept in-page | §11.4 ratified |
|
||||
| Mon compte | kept inline | sections, no list |
|
||||
|
||||
### R2F-9 Ratified rules this design changes (owner, at the gate)
|
||||
1. BDR-050: transactional forms in the finding and reference dialogs (one entry per changed save); U2b F9 to re-plan.
|
||||
2. D2 / boards 24-25 / P16-P17: the citations panel becomes a modal side sheet over the finding dialog (still from a
|
||||
finding only); its section geometry and the rotation cramped exception disappear.
|
||||
3. A2: the editor's view layers live in the browser's session history; a reload keeps the tab, section, filter and
|
||||
reading layers, never a form.
|
||||
4. A3: « Tout afficher » filters by the finding (owner request). 5. Board 27 A: « Plus » becomes an overlay (owner request).
|
||||
6. Design-reference rule: no new mockups; owner brief + this gate = validation, dated addendum in docs/design/README.md.
|
||||
7. Open: clients/animals list context on Back would keep the search term (personal data) in browser history (BDR-078
|
||||
refused it). Default: not done.
|
||||
|
||||
## Tasks (5)
|
||||
|
||||
### Task 1 — Shared dialog primitives and history foundations (tabs, sections, « Aller à »)
|
||||
ModalDialog / Dialog (R2F-2: kept-refusal re-show, returnFocus, afterModalsClosed, repeat Escape, reduced motion),
|
||||
announcer queue, focusRow check, useBeforeUnload extraction; history reconcile hook (R2F-1) wired to tab, section and
|
||||
« Aller à » moves only (the citations panel and new layers are not in history yet), mount rule, scroll map, guard stack
|
||||
(with the POP-refusal while a non-layer modal is open), write budget; residual 9c formatting. Unit (incl. the 6
|
||||
editor-focus-request tests without a Router and the 14 MemoryRouter suites green) + new e2e/shell/editor-history.spec.ts
|
||||
(tabs and sections back/forward, landing focus, arrow replace, reload, a DeleteDialog open + Back keeps it). Gate: grep-found
|
||||
specs (EditorTabs, sections, dialogs app-wide incl. e2e/ui dialog, shell, clients, animals).
|
||||
|
||||
### Task 2 — Finding dialog and citations sheet (items 1, 3, 4 partly, 5)
|
||||
Owner precision 2: the sheet over the finding dialog is proved by keyboard (Tab through every control, Escape closes the
|
||||
sheet only, focus back on « X références ») and by touch (hasTouch taps at 375, the dialog underneath never activated).
|
||||
R2F-3 and R2F-4 with the interim rules; history for the finding layer, creation, the sheet, « Tout afficher » (tab +
|
||||
search cleared until Task 3 adds the filter) and « Aller à » from the sheet; deletions named; helpers (open a finding =
|
||||
activate its row and wait for its dialog; openCitations / closeCitations on the sheet) and every spec using them. Unit +
|
||||
e2e per R2F-3/R2F-4 (scroll and expansion identical after close at 1280; pristine save no entry, changed save one;
|
||||
Abandonner and a flip commit nothing; dirty Escape and Back ask; flip 1280 → 900 → 1280 keeps draft and focus; delete from
|
||||
the dialog lands on the nearest row; gone rule; sheet at 1280 and 375 read-only; top dialog after Back / Forward; owner
|
||||
steps 1-4 with Back and Forward).
|
||||
|
||||
### Task 3 — Reference dialog, reading tiles, filter by finding, owner journey (items 2, 4, 5, 9)
|
||||
R2F-5 and R2F-6, deletions named (interim sheet rules removed), history for the reference dialog and the filter. Unit +
|
||||
e2e per R2F-5/R2F-6, then the owner's 8 steps at 1280 and on the phone project at 375 (Back → finding A with its sheet
|
||||
open and on top; Forward → filtered tab), Back presses to leave = pushes made (no orphan), double clicks on ✕ and
|
||||
« Enregistrer » and a held Escape pop at most one entry, a real `dialog.close()` on a dirty dialog keeps it with its
|
||||
confirmation, a dirty dialog + Back (one step and a cross-tab jump) keeps the draft, reload then Back.
|
||||
|
||||
### Task 4 — « Plus » dropdown and sticky sidebar (items 6, 7)
|
||||
R2F-7. Unit (open / close, outside pointerdown not reaching the page, Escape order) + e2e at 375 and 320 (boxes identical
|
||||
open vs closed, axe menu open) and at 1280 / 1024 (sidebar first link in view after scrolling; own scroll at 1280 × 500;
|
||||
no sideways scroll; axe from the top).
|
||||
|
||||
### Task 5 — Documentation and closure
|
||||
docs/design/README.md (dated addendum = R2F-9), V1-2-6_U1_CORRECTIONS (§R2 « Finition 2026-11-13 »), V1-2-6_OWNER_TRIAL
|
||||
(§4.11 short db:trial procedure, French, incl. the phone checks of the stated limits), V1-2-6_R2_LABELS, BROWSER_TESTS,
|
||||
CLAUDE.md tree lines.
|
||||
|
||||
## Verification (controller)
|
||||
Static gates, unit, e2e:ui, full shell sweep (all specs but editor-equine; admin.spec reported; grants added reported),
|
||||
gates.sh, fresh verifier, security gate, opus xhigh review, memory, French final report with the db:trial procedure.
|
||||
|
||||
## Challenge record
|
||||
Rev 1 → 2: latch and repeat Escape; below in entries; guard disarm; native-close re-show; return targets; queued
|
||||
announcer; creation kind; finding dialog + sheet in one task; isSheetView; sections; scroll map; writes on view change
|
||||
only; arrow replace; readOnly on flip; pristine save; own beforeunload; lists task dropped (BDR-078); local edit mode;
|
||||
« Aller à » view mode; single filter holder; MobileDrawer and useReferenceFocus reuse; named deletions.
|
||||
Rev 2 → 3: close-first + reconcile effect, no UI latch (sim-1, cor-1, rob-9); one re-push rule, no idx (sim-2, cor-6,
|
||||
rob-5); mount id dropped, landed entry restored (sim-3, cor-3, rob-12); afterModalsClosed for focus and announcements,
|
||||
focusRow checked (sim-4, cor-7, rob-8); push refusal reloads → write budget (sim-6, rob-2, cor-11); finding.citations
|
||||
(sim-7); triggerOf / visibleElement and useBeforeUnload reused (sim-8); 5 tasks, journey in Task 3 (sim-9); plain overlay
|
||||
for « Plus » (sim-5, cor-15, rob-13); re-show only on a kept refusal (rob-1); gone rule kept (rob-3, cor-8); host after
|
||||
the tab body + top-dialog assertion (rob-4, cor-2); interim A5 / guard rules (rob-6, rob-7, cor-13); preventScroll on
|
||||
resolved targets and POP landings, scroll captured before dispatch (rob-11, cor-4); non-layer modal open → POP refused
|
||||
(cor-5); entry read from a ref (cor-10); guard stack (cor-12); happy-dom limits (cor-14); data-finding-key (cor-16);
|
||||
creation replaced before close (cor-17); fr/en prettier exemption stated (cor-18); flip notice from the mode (rob-16);
|
||||
announcer joins messages (rob-17); wrapper copied into the worktree (rob-14); skippable entry untested (rob-10);
|
||||
adapter as its own hook, MemoryRouter-tolerant (rob-15); pin off under a filter (cor-9).
|
||||
Reference in new issue
Block a user