114 lines
7.6 KiB
Markdown
114 lines
7.6 KiB
Markdown
# CONTRACT — anomaly-b-working-copy-dialog
|
||
- date: 2026-11-12 | flow: bugfix | branch: feature/v1-2-anatomical-sheets
|
||
- status: active
|
||
- plan: .claude/tasks/plans/2026-11-12-anomaly-b-working-copy-dialog-1530.md (rev 2)
|
||
|
||
## REQUEST (verbatim — IMMUTABLE)
|
||
# FAUNOSTEO V1-2.6 — Décision sur l'anomalie E2E
|
||
|
||
Je valide l'OPTION 1 : déplacer les contrôles d'accessibilité et de mise en page du dialogue « Créer une copie de travail » dans e2e:ui.
|
||
|
||
Le diagnostic est accepté : seule la fiche historique peut servir de source à une copie de travail, et une seule copie active est autorisée. Nous ne devons pas modifier cette règle métier pour les tests.
|
||
|
||
## 1. Correctif autorisé
|
||
|
||
- Utiliser le véritable composant WorkingCopyAction dans e2e:ui, avec une situation simulant une place disponible.
|
||
- Vérifier le dialogue dans les deux langues et les deux largeurs prévues.
|
||
- Conserver les assertions axe, focus, navigation clavier et absence de défilement horizontal.
|
||
- Vérifier que le comportement testé correspond au composant réellement utilisé dans l'application.
|
||
- Conserver dans e2e:shell les contrôles de la page historique et son accessibilité, sans dépendre de la disponibilité de sa copie de travail.
|
||
- Ne pas affaiblir les assertions existantes : les déplacer vers la couche appropriée et documenter le changement de couverture.
|
||
|
||
## 2. Nettoyage des fixtures
|
||
|
||
La suite sandbox peut archiver exclusivement les copies qu'elle crée elle-même.
|
||
|
||
Le nettoyage doit être limité aux ressources identifiées comme appartenant à l'exécution courante, avec gestion des échecs lorsque c'est possible.
|
||
|
||
Ne jamais archiver ou modifier la copie préexistante 8c315a12-… ni une autre ressource préexistante.
|
||
|
||
Ne pas réinitialiser la sandbox.
|
||
|
||
## 3. Vérifications
|
||
|
||
- Les quatre variantes précédemment défaillantes doivent réussir.
|
||
- Exécuter au moins deux passages pour démontrer la reproductibilité.
|
||
- Vérifier les contrôles du vrai composant dans e2e:ui.
|
||
- Vérifier que la page historique reste couverte dans e2e:shell.
|
||
- Vérifier que les refus et contraintes serveur restent couverts par les tests sandbox.
|
||
- Documenter explicitement la limite : le dialogue n'est plus testé dans son contexte serveur réel par ce test d'accessibilité.
|
||
- Effectuer une revue fonctionnelle et une revue indépendante du code.
|
||
|
||
Si une assertion essentielle ne peut pas être préservée, s'arrêter et présenter le problème.
|
||
|
||
## 4. Restrictions
|
||
|
||
Aucune migration SQL.
|
||
|
||
Aucune modification des règles de copie de travail.
|
||
|
||
Aucune modification de données existantes, y compris 8c315a12-….
|
||
|
||
Aucun test automatisé sur db:trial ou DEV.
|
||
|
||
Aucune fusion ni aucun déploiement.
|
||
|
||
Préserver le fichier de revue ChatGPT non suivi.
|
||
|
||
Isoler le correctif dans un commit indépendant, puis pousser.
|
||
|
||
## 5. Checkpoint
|
||
|
||
Fournir :
|
||
- Le détail des assertions déplacées.
|
||
- Les résultats avant/après.
|
||
- Les résultats des deux passages.
|
||
- Les contrôles d'accessibilité conservés.
|
||
- La preuve que les ressources préexistantes sont intactes.
|
||
- Les éventuelles limites de couverture.
|
||
- Les commits et l'état Git.
|
||
|
||
S'arrêter après ce correctif.
|
||
|
||
R1 est définitivement validé par le propriétaire.
|
||
|
||
Le plan R2 est approuvé, mais ne commencer R2.0 qu'après mon nouveau feu vert sur le résultat du correctif.
|
||
|
||
## CLARIFICATIONS
|
||
Q: tests environment? / A: e2e:ui local (no backend); e2e:shell and sandbox suite only through `pnpm db:sandbox` (faunosteo_dbsandbox_*, already up); never db:trial, DEV, `up`/`down`/`reset`/`trial*`.
|
||
Q: run editor-equine? / A: no (its set-aside archives and restores pre-existing copies); reported to the owner.
|
||
Q: data proof? / A: per-id snapshot (id, status, archived_at, updated_at) of every pre-existing anatomical_sheets row before and after; new rows allowed.
|
||
Q: Tab walk vs Dialog contract? / A: explicit order with one 'browser' step (LRN-082), like dialog.spec.ts; not "stays inside".
|
||
|
||
## ACCEPTANCE CRITERIA
|
||
1. Harness renders the real WorkingCopyAction (free + taken, StrictMode, MemoryRouter, ?lang) and a new e2e:ui spec covers fr/en on both projects: axe, overflow, panel in viewport, keyboard open, prefilled slug, explicit Tab/Shift+Tab walk, Escape + focus return, taken button disabled with its reason.
|
||
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2/apps/app && test -f e2e/harness/working-copy.html && grep -q "WorkingCopyAction" e2e/harness/working-copy.tsx && grep -q "StrictMode" e2e/harness/working-copy.tsx && grep -q "MemoryRouter" e2e/harness/working-copy.tsx && grep -q "faunosteo-cheval-copie-de-travail" e2e/ui/working-copy.spec.ts && grep -q "expectAccessible" e2e/ui/working-copy.spec.ts && grep -q "expectNoHorizontalOverflow" e2e/ui/working-copy.spec.ts && grep -q "Shift+Tab" e2e/ui/working-copy.spec.ts && grep -q "Escape" e2e/ui/working-copy.spec.ts && grep -q "toBeDisabled" e2e/ui/working-copy.spec.ts && echo UI_SPEC_OK
|
||
EXPECT: UI_SPEC_OK
|
||
EVIDENCE: MET exit=0 marker-found :: UI_SPEC_OK
|
||
2. admin.spec.ts no longer opens the working-copy dialog (other dialogs of the file untouched; oracle corrected 2026-11-12, the first form matched them); it keeps the historical page in the axe/overflow loop and asserts the button state is consistent with its linked reason.
|
||
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2/apps/app && ! grep -A1 "getByRole('dialog', {$" e2e/shell/admin.spec.ts | grep -q "admin.working_copy.create" && grep -q "historical}" e2e/shell/admin.spec.ts && grep -q "admin.working_copy.active" e2e/shell/admin.spec.ts && grep -q "working-copy.spec" e2e/shell/admin.spec.ts && echo SHELL_OK
|
||
EXPECT: SHELL_OK
|
||
EVIDENCE: MET exit=0 marker-found :: SHELL_OK
|
||
3. Sandbox suite captures every created copy, archives only those with `returning id` checked, cleanup steps independent, first error rethrown.
|
||
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && grep -q "returning id" packages/supabase/tests/sandbox/sheets-admin.sandbox.ts && grep -q "status = 'archived'" packages/supabase/tests/sandbox/sheets-admin.sandbox.ts && echo CLEANUP_OK
|
||
EXPECT: CLEANUP_OK
|
||
EVIDENCE: MET exit=0 marker-found :: CLEANUP_OK
|
||
4. Static gates green; no SQL, Rust, worker, app src change.
|
||
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && [ -z "$(git diff --name-only HEAD -- supabase crates apps/app/src packages/supabase/src scripts docker)" ] && pnpm -s typecheck >/dev/null 2>&1 && pnpm -s lint >/dev/null 2>&1 && pnpm -s test:run >/dev/null 2>&1 && echo STATIC_OK
|
||
EXPECT: STATIC_OK
|
||
EVIDENCE: MET exit=0 marker-found :: STATIC_OK
|
||
5. Runs (manual, logs in scratchpad): BEFORE grep « admin screens » 4 failed; AFTER passes 1 and 2: 4 passed each; full admin.spec once; e2e:ui full ×2 green; sandbox suite sheets-admin green; pre-existing anatomical_sheets rows identical per id before/after.
|
||
6. Docs updated in the same commit: BROWSER_TESTS.md (e2e:ui row, harness paragraph, coverage change + limit), V1-2-6_U1_CORRECTIONS.md §5 row B and four-failure lines, playwright.ui.config.ts header, CLAUDE.md e2e:ui line and harness list.
|
||
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && grep -q "working-copy" docs/development/BROWSER_TESTS.md && grep -q "working-copy" apps/app/e2e/playwright.ui.config.ts && grep -q "working-copy" CLAUDE.md && echo DOCS_OK
|
||
EXPECT: DOCS_OK
|
||
EVIDENCE: MET exit=0 marker-found :: DOCS_OK
|
||
|
||
## FILE SCOPE
|
||
- apps/app/e2e/harness/working-copy.html (new), apps/app/e2e/harness/working-copy.tsx (new)
|
||
- apps/app/e2e/ui/working-copy.spec.ts (new)
|
||
- apps/app/e2e/shell/admin.spec.ts
|
||
- packages/supabase/tests/sandbox/sheets-admin.sandbox.ts
|
||
- apps/app/e2e/playwright.ui.config.ts (header comment only)
|
||
- docs/development/BROWSER_TESTS.md, docs/development/V1-2-6_U1_CORRECTIONS.md, CLAUDE.md
|
||
- this contract, the plan, .claude/tasks/TODO.md and memory (memory commit)
|