191 lines
13 KiB
Markdown
191 lines
13 KiB
Markdown
# CONTRACT — r4-card-integrity
|
||
|
||
Plan: `.claude/tasks/plans/2026-11-16-r4-card-integrity-2337.md` (rev 3, validated 2026-11-17). Base: `b895ecf`.
|
||
|
||
## REQUEST (verbatim — IMMUTABLE)
|
||
|
||
### Owner brief 2026-11-16 (R3 closed, R4 start)
|
||
|
||
Je confirme avoir testé le volet repliable des filtres sur téléphone.
|
||
|
||
Tout fonctionne correctement et l'ergonomie me convient.
|
||
|
||
Je valide officiellement R3, y compris sa dernière amélioration mobile.
|
||
|
||
Je confirme également que « Réinitialiser les filtres » doit rester uniquement à l'intérieur du volet. Aucun bouton supplémentaire n'est nécessaire.
|
||
|
||
Tu peux enregistrer cette validation propriétaire dans la documentation, le suivi et la mémoire, puis committer et pousser les éventuelles mises à jour.
|
||
|
||
R3 est terminé.
|
||
|
||
Nous pouvons maintenant passer à R4 : affichage des erreurs d'intégrité sur les cartes du catalogue.
|
||
|
||
Reprends les décisions déjà validées, notamment D9 C, les maquettes R0 et le plan V1-2.6.
|
||
|
||
Je te laisse autonome pour auditer l'existant, préparer le plan technique et organiser les relectures habituelles.
|
||
|
||
Présente-moi les éventuelles décisions qui nécessitent mon accord avant l'implémentation.
|
||
|
||
Conserve BLK-015 et RR-13 comme chantiers séparés.
|
||
|
||
Aucune fusion ni intervention sur DEV.
|
||
|
||
### Owner validation 2026-11-17 (plan R4, decisions D1 to D4)
|
||
|
||
Je valide le plan R4 avec les décisions suivantes.
|
||
|
||
D1 : ALTERNATIVE.
|
||
|
||
Une version trop volumineuse doit afficher le message spécifique existant :
|
||
|
||
« Cette version dépasse les limites de taille d'une fiche. »
|
||
|
||
Je préfère distinguer un dépassement de limite d'un véritable problème d'intégrité.
|
||
|
||
Le bouton « Réessayer » n'est pas nécessaire dans ce cas, puisqu'un nouvel essai sans modification de la version ne changera rien.
|
||
|
||
D2 : RECOMMANDATION VALIDÉE.
|
||
|
||
Lorsqu'une illustration ne peut pas être dessinée alors que la version a passé le contrôle d'intégrité, affiche le message neutre existant.
|
||
|
||
Si le problème provient du moteur, utilise le traitement d'erreur et le bouton « Réessayer » prévus.
|
||
|
||
Je ne souhaite plus que ce type d'erreur soit ignoré silencieusement.
|
||
|
||
D3 : RECOMMANDATION VALIDÉE.
|
||
|
||
Utilise pnpm db:sandbox trial pour mon essai manuel de R4.
|
||
|
||
Je préfère ne pas créer de nouvelles fiches publiées de test dans db:trial.
|
||
|
||
Précise dans la procédure comment distinguer les anomalies déjà présentes dans la sandbox des comportements propres à R4.
|
||
|
||
D4 : RECOMMANDATION VALIDÉE.
|
||
|
||
Le nouveau test navigateur doit nettoyer uniquement les fiches et les droits qu'il a lui-même créés.
|
||
|
||
La suppression logique des fiches de test et le retrait du droit créé sont autorisés, avec les contrôles d'identité prévus.
|
||
|
||
Aucune donnée préexistante ne doit être modifiée.
|
||
|
||
Je valide également les autres choix retenus dans le plan :
|
||
- Gestion du bouton « Réessayer ».
|
||
- Gestion du focus et des annonces accessibles.
|
||
- Affichage des refus d'accès.
|
||
- Gestion des dates absentes.
|
||
- Signalement des erreurs propres à chaque carte.
|
||
|
||
Tu peux maintenant implémenter R4 selon ton processus habituel, avec tes tests et relectures indépendantes.
|
||
|
||
Conserve BLK-015, RR-13 et l'anomalie A dans leurs chantiers respectifs.
|
||
|
||
À la fin, présente-moi :
|
||
- Le bilan des modifications.
|
||
- Les résultats exacts des tests.
|
||
- Les éventuelles limites.
|
||
- La procédure d'essai manuel sur la sandbox.
|
||
|
||
Aucune fusion ni intervention sur DEV.
|
||
|
||
### Owner validation 2026-11-17 (R4 closed, U2 design start)
|
||
|
||
Je confirme avoir terminé mes tests manuels de R4 sur la sandbox.
|
||
|
||
Tous les tests fonctionnent correctement et le résultat me convient.
|
||
|
||
Je valide officiellement R4.
|
||
|
||
Je confirme également les deux décisions restantes :
|
||
|
||
1. Nettoyage des fiches de test :
|
||
Je valide leur archivage plutôt que leur suppression.
|
||
|
||
Les règles métier concernant les fiches ayant eu une version publiée doivent rester inchangées.
|
||
|
||
2. Fichiers supplémentaires :
|
||
J'accepte les modifications de Card.tsx et de l'utilitaire de validation des identifiants SQL.
|
||
|
||
Tu peux maintenant procéder à la clôture documentaire de R4 :
|
||
- Enregistrer ma validation propriétaire.
|
||
- Mettre à jour les contrats, le TODO et le suivi.
|
||
- Enregistrer les décisions et apprentissages pertinents.
|
||
- Conserver les résultats exacts des tests.
|
||
- Committer et pousser les modifications documentaires.
|
||
|
||
BLK-015, RR-13 et l'anomalie A restent des chantiers séparés.
|
||
|
||
R4 est terminé.
|
||
|
||
Nous pouvons maintenant préparer U2 : la refonte de la manipulation graphique des annotations.
|
||
|
||
Je souhaite commencer par la conception graphique, conformément à notre méthode habituelle.
|
||
|
||
Reprends les maquettes validées et les nouvelles décisions UX concernant les modales de propriétés des annotations.
|
||
|
||
Les objectifs restent :
|
||
- Création d'un point directement sur le schéma.
|
||
- Création d'une zone en traçant son polygone.
|
||
- Déplacement des sommets avec la souris ou le doigt.
|
||
- Ajout d'un sommet avec « + » sur un segment.
|
||
- Suppression d'un sommet avec « − ».
|
||
- Déplacement et redessin d'une zone.
|
||
- Modification de la taille d'un point.
|
||
- Consultation et modification des propriétés dans une modale.
|
||
- Ouverture de la modale de création après le placement du point ou la fin du tracé.
|
||
|
||
Les interactions graphiques doivent rester possibles sans que les modales gênent les gestes.
|
||
|
||
Prépare les nouvelles maquettes U2, notamment les planches 02 à 06 et 13, ainsi que les éventuels écrans supplémentaires nécessaires.
|
||
|
||
Je te laisse autonome pour auditer l'existant, proposer les meilleures interactions et organiser les relectures.
|
||
|
||
Présente-moi les maquettes pour validation visuelle avant toute implémentation de U2.
|
||
|
||
Aucune fusion ni intervention sur DEV.
|
||
|
||
## CLARIFICATIONS
|
||
- Graphic reference: board 30 `docs/design/v1-2-6-r0/30-catalogue-carte-integrite.png` (approved as is, 2026-11-09). Wording: A10 (`docs/design/v1-2-6-r0/ARBITRAGES.md`), REVUE.md:85.
|
||
- Criterion 9: the CHECK greps each dictionary's own quote convention (double quotes in fr.ts for a text holding an apostrophe, single quotes in en.ts); the text is what binds.
|
||
- File scope extended by controller rulings (2026-11-17): `apps/app/src/components/ui/Card.tsx` (optional `aria-busy` prop, required by criterion 5), `apps/app/e2e/support/records.ts` (the `capturedId` UUID guard shared by the cleanup of criterion 11 and by `seedGrant`, security LOW). Both additive; flagged to the owner.
|
||
- D4 ruling: the spec archives its own published sheets (reachable state, out of the catalogue) rather than soft-deleting them, because the application never deletes a sheet that had a published version (§6.9); the owner's authorisation of soft deletion covers it. Its own grant is revoked by id.
|
||
|
||
## ACCEPTANCE CRITERIA
|
||
1. Integrity class: for `fingerprint_mismatch`, `drawing_hash_mismatch`, `drawing_missing`, `invalid_document`, the card shows « Contrôle d'intégrité échoué : cette version ne peut pas être affichée. » (EN « Integrity check failed: this version cannot be displayed. »), error tone, no « Réessayer »; name, « Publiée », « Version n » and « Consulter » (enabled, same href) kept. Unit-tested per kind through the real core.
|
||
2. D1: `caps` shows « Cette version dépasse les limites de taille d'une fiche. » (existing key `catalogue.failure.caps`), never the integrity text, no « Réessayer ». Unit-tested.
|
||
3. Other failures: warning tone, existing text (`catalogue.failure.<kind>`, `access_denied.title` for `denied`, the core's text for `core_unavailable`), « Réessayer » for that card only; `network` with the `wifi-off` glyph, others `alert`; no retry once the engine stopped for good. Unit-tested.
|
||
4. D2: a version that passes but whose main view cannot be composed shows the existing `catalogue.failure.view` text in a neutral line with its counts; an engine failure there shows the core line with its retry. Never silent. Unit-tested.
|
||
5. Retry: for `core_unavailable` it calls `coreRuntime().retry()` first; during an attempt the line and button stay mounted (`aria-disabled`, card `aria-busy`), clicks ignored; a repeated failure keeps the focus on « Réessayer » and is said again by a polite region cleared at each attempt; on success the focus moves to « Consulter » only if it was on that card's « Réessayer » or on `body`. Unit-tested, including unmount during an attempt (deferred answer, balanced blob URLs, one `free()` per preview).
|
||
6. The card lines are not live regions; `Notice` keeps today's role and glyph at every existing call site (defaults tested).
|
||
7. The check is never bypassed or changed: nothing under `crates/`, `packages/core-wasm/`, `apps/app/src/catalogue/catalogue.ts`, `apps/app/src/catalogue/preview.ts`.
|
||
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && [ -z "$(git diff --name-only b895ecf..HEAD -- crates packages/core-wasm apps/app/src/catalogue/catalogue.ts apps/app/src/catalogue/preview.ts)" ] && echo CHECK_UNTOUCHED
|
||
EXPECT: CHECK_UNTOUCHED
|
||
EVIDENCE: MET exit=0 marker-found :: CHECK_UNTOUCHED
|
||
8. The sheet page is unchanged.
|
||
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && [ -z "$(git diff --name-only b895ecf..HEAD -- apps/app/src/app/routes/app/anatomy/SheetRoute.tsx apps/app/src/components/catalogue/CatalogueFailureNotice.tsx apps/app/src/catalogue/useSheetVersion.ts)" ] && echo PAGE_UNCHANGED
|
||
EXPECT: PAGE_UNCHANGED
|
||
EVIDENCE: MET exit=0 marker-found :: PAGE_UNCHANGED
|
||
9. One new key with the exact A10 texts, fr / en parity.
|
||
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2/apps/app && grep -q "'catalogue.card.integrity_failed': \"Contrôle d'intégrité échoué : cette version ne peut pas être affichée.\"" src/i18n/fr.ts && grep -q "'catalogue.card.integrity_failed': 'Integrity check failed: this version cannot be displayed.'" src/i18n/en.ts && echo A10_OK
|
||
EXPECT: A10_OK
|
||
EVIDENCE: MET exit=0 marker-found :: A10_OK
|
||
10. Browser proof on the sandbox (`apps/app/e2e/shell/catalogue-integrity.spec.ts`): integrity in fr and en at desktop and 375 px (line, « Consulter » opening the unchanged sheet page notice, axe, no sideways scroll, 44 px); network in fr on both projects (abort one version with `route.fallback()` for the rest, remount by search, « Réessayer », focus). Exact counts recorded.
|
||
11. D4 / P2: the spec cleans only what it created, by captured id: each own sheet archived through `private.set_sheet_status` and read back, its own grant revoked by id and read back; no statement matches by pattern; a guard before / after shows no pre-existing row changed.
|
||
12. P1: `V1-2-6_OWNER_TRIAL.md` §4.16 in French on `pnpm db:sandbox trial` names the sandbox's pre-existing failing entries (anomaly A, by name, from a read-only query) and tells them apart from R4's own behaviour; the offline step names the remount and the wait.
|
||
13. Exact test results kept in `.claude/tasks/TODO.md` and the documents; no failed suite called green; BLK-015, RR-13 and anomaly A stay separate open tracks.
|
||
14. Documents as built: `V1-2-6_U1_CORRECTIONS.md` §R4 and §5 row C, the review's Part II row, `CHANGELOG.md`, `BROWSER_TESTS.md`, `.claude/tasks/TODO.md`.
|
||
15. Gates: typecheck, lint, app unit suite, build; `pnpm check:all` exit 0 at the final head.
|
||
16. No merge, no deploy, DEV unchanged, no write on the trial stack.
|
||
|
||
## FILE SCOPE
|
||
apps/app/src/{catalogue/failure.ts,catalogue/useCardDetails.ts,components/catalogue/CardFailure.tsx,components/catalogue/CatalogueCard.tsx,components/ui/Notice.tsx,components/ui/Icon.tsx,i18n/fr.ts,i18n/en.ts}, apps/app/tests/**, apps/app/e2e/{support/catalogue.ts,support/admin.ts,shell/catalogue-integrity.spec.ts}, docs/**, CHANGELOG.md, .claude/tasks/**.
|
||
|
||
## Verification 2026-11-17 (fresh verifiers)
|
||
- Pass 1 at `04b723c`: ECARTS(5): criteria 3 and 5 lacked a test (glyph per kind; focus rule on `body` / elsewhere), criterion 15 pending (check:all not yet run), two files outside FILE SCOPE. Fixed: tests `83f2d8b`; criterion 9 oracle and scope rulings `2c9d837`; `pnpm check:all` at `2c9d837` exit 0.
|
||
- Pass 2 at `8224eda`: ECARTS(2). Criteria 1 to 16 all MET. The two écarts are `apps/app/src/components/ui/Card.tsx` (optional `aria-busy`, +4 lines, default undefined at the 33 other call sites) and `apps/app/e2e/support/records.ts` (`capturedId`, +8 lines, beside `literal`), judged justified and additive by the verifier; they wait for the owner's ruling.
|
||
|
||
## Owner validation 2026-11-17 (R4 closed)
|
||
- The owner ran the manual trial on `pnpm db:sandbox trial` (OWNER_TRIAL §4.16) with a sandbox account created for it (`trial-account`, `catalog_reader` only) and validated R4 officially: every step works, the result suits them.
|
||
- D4 ruled by the owner: the spec's own test sheets are archived, not deleted. The business rules on sheets that had a published version stay unchanged (`delete_anatomical_sheet` still refuses them; nothing in R4 touched them).
|
||
- The two files outside FILE SCOPE are accepted by the owner: `apps/app/src/components/ui/Card.tsx` (optional `aria-busy`) and `apps/app/e2e/support/records.ts` (`capturedId`). The verifier's ECARTS(2) is closed by that ruling; criteria 1 to 16 MET.
|
||
- Final state `b6408f1` plus this record. Exact results as kept in `V1-2-6_U1_CORRECTIONS.md` §R4: app unit suite 1780 tests in 138 files; `pnpm check:all` at `2c9d837` exit 0 (core-wasm 66, supabase 182, app 1780, e2e:ui 253; e2e:shell not run by check:all); `catalogue-integrity.spec.ts` alone 6 passed, 0 failed, 0 skipped, 0 flaky at each of its four runs; `catalogue.spec.ts` alone 8 passed; data guard 0 removed, 0 changed, 81 added (the runs' own rows). BLK-015, RR-13 and anomaly A stay open in their own tracking. No merge, no deploy, DEV unchanged, no write on the trial stack.
|