chore(memory): V1-2.6 plan, contract, gate re-check REMAINING(2)
This commit is contained in:
1 parent
7f618d05a2
commit
4657abf1e3
4 files changed
+585
No files matched your search
@@ -515,3 +515,4 @@ R5.4: `draft/{labels,changelog,review_report,drawing,overlay,app_review,svg_comp
|
||||
## 2026-11-03
|
||||
- 2026-11-03 V1-2.5 owner checkpoint corrections (f5456f3): three permission states (creation page order loading, server refusal, failed read, editor rule; admin home notice; reloadAccess keeps held roles), Paris end-of-day expiry, species order 0..9999 in M7, labels, TOTP reuse measured (code accepted by several sessions in step N and N+1, refused N+2), lost-factor review = production prerequisite. 2 state-dependent sandbox tests fixed. Gates green on fresh stack, security PASS, verifier CONFORME. V1-2.5 VERIFIED. No DEV, no merge.
|
||||
- 2026-11-03 owner accepted V1-2.5 final checkpoint b4415a3 (V1-2.5 VERIFIED): BDR-099 decisions, LRN-113 TOTP reuse/Storage 409/sandbox order. V1-2.6 editor level 1 authorised (brief « Validation V1-2.5 et autorisation V1-2.6 »).
|
||||
- 2026-11-03 V1-2.6 owner GO conditional on six FATAL re-check. Fresh verifier: REMAINING(2): fixes 1-5 closed, I1-I5 hold; radius fix 6 opens out_of_frame on small frames; I6 broken (pending recovery copy overwritten by first commit). 2 MINOR. LRN-095 collision + BLK-013 trap in TODO. Executor not launched, STOP.
|
||||
@@ -671,6 +671,9 @@ Order (BDR-071): P0 docs + decisions → V1-1 clients and animals → V1-2 sheet
|
||||
- [x] L2 expiry end of day Europe/Paris, species order 0..9 999 in M7, labels, TOTP key test: app 696, supabase 148, pgTAP 1965 fresh + upgrade, types match
|
||||
- [x] L3 TOTP reuse measured (code accepted by several sessions in its step and the next, refused at N+2), lost-authenticator review (production prerequisite), decisions in docs; sandbox test 103 + 10 skipped x2
|
||||
- [x] L4 gates: check:all green (dcb1a94; delta = sandbox test + docs), fresh stack test-db 1965, e2e:shell 110 + 8 skipped, sandbox test 103 + 10 skipped after e2e, upgrade from M6 1965 + types match; security PASS x2; verifier ECARTS(6) -> CONFORME; two state-dependent sandbox tests fixed (0499a39, f5456f3); suites need a fresh stack in order test-db, e2e:shell, test
|
||||
- [ ] V1-2.6 editor level 1: plan APPROVED by the owner 2026-11-03 (brief « GO propriétaire V1-2.6 »: 13 lots A-M, C1-C24, 8 visible choices, M8 sandbox only, no JSON export button, recovery messages exact), gated on a targeted independent re-check of the six FATAL fixes. Re-check 2026-11-03: REMAINING(2) — fixes 1-5 closed, I1-I5 hold; fix 6 (r = 12 + 3 %) opens `out_of_frame` on frames under ~25.5 units (hitbox r in frame bounds); I6 broken: the first commit overwrites a pending recovery copy before « Restaurer » / « Ignorer »; 2 MINOR (N source when the admin read fails, two-copy cap). Executor NOT launched; STOP for the owner. Contract `.claude/tasks/contracts/2026-11-03-v1-2-6-editor-1509.md`, plan `.claude/tasks/plans/2026-11-03-v1-2-6-editor.md`; sandbox only, no DEV, no worker on DEV, no merge, no V1-2.7; STOP at the V1-2.6 owner checkpoint (trial procedure)
|
||||
- [ ] A M8 draft_last_save · [ ] B sheet asset accessors · [ ] C preview mutators, edit ops, ids · [ ] D editor store, undo, recovery · [ ] E route, modes, tabs · [ ] F Général, Références, Vertèbres · [ ] G views + upload · [ ] H Annotations · [ ] I Constats · [ ] J Vérification + submit · [ ] K e2e · [ ] L owner trial tooling · [ ] M gates, reviews, checkpoint
|
||||
- [ ] 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. No renumbering during V1-2.6 unless needed; renumber one side and patch its citers at the merge
|
||||
- [ ] V1-2.5 catalogue, admin space, rights, species, MFA · V1-2.6 editor level 1 · V1-2.7 preview, review, publication UI · V1-2.8 equine working copy and review preparation · V1-2.9 FR/EN acceptance and closure (owner checkpoints V1-2.3, V1-2.4, V1-2.6, V1-2.7, V1-2.8, V1-2.9 + each DEV operation of contract §16.11)
|
||||
|
||||
## Release readiness track (owner 2026-10-25, distinct from the functional roadmap; nothing here authorises a release or exposure)
|
||||
|
||||
@@ -0,0 +1,274 @@
|
||||
# CONTRACT — v1-2-6-editor
|
||||
- date: 2026-11-03 | flow: ship-feature | branch: feature/v1-2-anatomical-sheets
|
||||
- status: active
|
||||
- worktree: /tmp/claude-1000/-home-bchanot-Documents-faunosteo/e641af9a-743e-46d0-9804-99667836040e/scratchpad/v1-2
|
||||
(every command runs from this worktree; never from /home/bchanot/Documents/faunosteo, never against DEV:
|
||||
the `supabase_*_faunosteo` containers are DEV and are never touched; the sandbox is `faunosteo_dbsandbox_*`)
|
||||
- base: 7f618d0 (memory commit after V1-2.5 VERIFIED at b4415a3)
|
||||
- contract of the step: docs/development/V1-2_ANATOMICAL_SHEETS.md §16.7 and §8.1-§8.4, with §6.2, §6.6, §6.7,
|
||||
§9.2-§9.4, §10, §11.1-§11.2, §17.9, §17.11; design docs/design/v1-2-4 boards 04, 05, 06 A (approved, BDR-096),
|
||||
REVUE.md ratified wordings
|
||||
|
||||
## REQUEST (verbatim — IMMUTABLE)
|
||||
|
||||
# FAUNOSTEO — Validation V1-2.5 et autorisation V1-2.6
|
||||
|
||||
Décision propriétaire : **ALL**.
|
||||
|
||||
J'accepte le checkpoint final V1-2.5 au HEAD `b4415a3`.
|
||||
|
||||
**V1-2.5 VERIFIED**
|
||||
|
||||
J'autorise l'enregistrement des deux mémoires proposées, puis le démarrage de V1-2.6 conformément au contrat existant.
|
||||
|
||||
## 1. Mémoires
|
||||
|
||||
Créer les deux entrées proposées :
|
||||
|
||||
**BDR — Décisions V1-2.5**
|
||||
- Ordre des états et contrôles d'autorisation.
|
||||
- Fonctionnement du bouton Réessayer.
|
||||
- Expiration des habilitations à 23:59:59.999, heure de Paris, le jour choisi.
|
||||
- Ordre des espèces limité à 0–9 999.
|
||||
- Deux écarts UX acceptés.
|
||||
- Parcours de récupération MFA sécurisé obligatoire avant production.
|
||||
- Réserve concernant les tests mobiles et les tests sandbox supplémentaires.
|
||||
|
||||
**LRN — Retours techniques**
|
||||
- Comportement de GoTrue v2.197 sur la réutilisation des codes TOTP, en distinguant les observations de toute garantie générale.
|
||||
- Particularité de la réponse Storage HTTP 400 avec `statusCode: "409"`.
|
||||
- Nécessité d'une sandbox neuve et de l'ordre `test-db → e2e:shell → test`, en conservant l'explication du problème de partage d'état.
|
||||
|
||||
Vérifier les identifiants BDR/LRN existants avant attribution. Ne pas créer de collision.
|
||||
|
||||
Commiter et pousser ces modifications sur `feature/v1-2-anatomical-sheets`.
|
||||
|
||||
## 2. Démarrage V1-2.6 autorisé
|
||||
|
||||
Développer l'éditeur anatomique de niveau 1, en respectant strictement le contrat V1-2 §16.7 et §8.2.
|
||||
|
||||
Périmètre :
|
||||
- Onglets et formulaires structurés.
|
||||
- Import de dessin SVG avec nettoyage par le cœur Rust.
|
||||
- Gestion des vues principales et secondaires.
|
||||
- Points, zones et liens anatomiques.
|
||||
- Édition des propriétés d'annotations.
|
||||
- Catalogue et arbre des constats.
|
||||
- Indicateurs de revue et éléments `to_confirm`.
|
||||
- Enregistrement, récupération locale et gestion des conflits.
|
||||
- Consultation en lecture seule sous 1 024 px.
|
||||
- Parcours clavier et accessibilité prévus au contrat.
|
||||
|
||||
Ne pas inventer de nouvelles fonctionnalités hors périmètre.
|
||||
|
||||
Ne pas modifier le design approuvé V1-2.4 sans défaut démontré.
|
||||
|
||||
## 3. Test fonctionnel obligatoire
|
||||
|
||||
Démontrer sur une sandbox fraîche un parcours complet :
|
||||
|
||||
1. Connexion avec un compte possédant les habilitations nécessaires.
|
||||
2. Création d'une nouvelle fiche pour une espèce autre que le cheval.
|
||||
3. Import d'un SVG réel.
|
||||
4. Vérification et nettoyage du dessin par le cœur Rust.
|
||||
5. Création d'une vue secondaire.
|
||||
6. Création et modification de points, zones et liens.
|
||||
7. Création des catégories et constats prévus par le contrat.
|
||||
8. Enregistrement du brouillon.
|
||||
9. Rechargement du navigateur et récupération correcte du travail.
|
||||
10. Gestion d'un conflit de modification entre deux sessions.
|
||||
11. Soumission de la fiche.
|
||||
12. Vérification de sa progression dans le workflow, jusqu'à `verifying` conformément aux règles existantes.
|
||||
|
||||
Respecter les règles concernant les éléments `to_confirm` et les verdicts. Ne pas contourner les contrôles pour faire réussir la démonstration.
|
||||
|
||||
## 4. Tests et qualité
|
||||
|
||||
Exécuter les tests contractuels, notamment :
|
||||
- E2E A2, A3 et A4.
|
||||
- Parcours clavier et champs numériques.
|
||||
- Import SVG hostile et valide.
|
||||
- Contrôles des permissions.
|
||||
- Gestion des conflits.
|
||||
- Rechargement et récupération.
|
||||
- Affichage mobile à 320 et 375 px.
|
||||
- Lecture seule sous 1 024 px.
|
||||
- Intégration des composants Rust/Wasm.
|
||||
- Non-régression des fiches équines historiques.
|
||||
|
||||
Préserver les oracles et les protections de sécurité déjà validés.
|
||||
|
||||
Exécuter les suites sandbox dans l'ordre requis, sur une pile neuve, sans masquer les problèmes de pollution d'état.
|
||||
|
||||
Relancer `check:all` et une revue indépendante de conformité et de sécurité sur le code final.
|
||||
|
||||
## 5. Livrable testable par le propriétaire
|
||||
|
||||
Au checkpoint V1-2.6, fournir une procédure pratique pour que je puisse tester l'éditeur dans un navigateur :
|
||||
|
||||
- Commandes exactes pour démarrer les services isolés nécessaires.
|
||||
- URL locale de l'application.
|
||||
- Méthode d'accès au compte de test, sans exposer de secret dans les logs.
|
||||
- Parcours précis pour créer une fiche.
|
||||
- Opérations que je dois pouvoir tester.
|
||||
- Résultat attendu pour chaque étape.
|
||||
- Procédure d'arrêt et de nettoyage de la sandbox.
|
||||
|
||||
Ne pas affirmer que le produit a été validé par le propriétaire avant mon essai.
|
||||
|
||||
## 6. Contraintes
|
||||
|
||||
- Travail uniquement sur `feature/v1-2-anatomical-sheets`.
|
||||
- Commits et push réguliers.
|
||||
- Aucune fusion vers develop, main ou release.
|
||||
- Aucune opération sur Supabase DEV.
|
||||
- Aucun worker DEV.
|
||||
- Aucune migration DEV.
|
||||
- Aucune modification des ressources équines historiques.
|
||||
- Aucun déploiement de production.
|
||||
- Aucun début de V1-2.7.
|
||||
|
||||
La reconstruction des images et les opérations sur la sandbox jetable sont autorisées si nécessaires, après vérification des cibles et de l'absence d'exécution concurrente.
|
||||
|
||||
## 7. Checkpoint final
|
||||
|
||||
Présenter :
|
||||
- HEAD et commits.
|
||||
- Fonctionnalités réalisées.
|
||||
- Résultats des tests.
|
||||
- Résultats de l'audit indépendant.
|
||||
- Écarts et risques résiduels.
|
||||
- Démonstration complète d'une fiche non équine.
|
||||
- Procédure de test manuel par le propriétaire.
|
||||
|
||||
Ne déclarer V1-2.6 VERIFIED qu'après satisfaction des critères techniques contractuels.
|
||||
|
||||
S'arrêter avant V1-2.7 et attendre mon retour après essai de l'éditeur.
|
||||
|
||||
## CLARIFICATIONS
|
||||
|
||||
Q: Conflict dialog « author and time » (§6.2) has no data source; §16.7 says SQL none / A: [gated 2026-11-03]
|
||||
read migration M8 (sandbox only, as M7 in V1-2.5): the admin read of the draft returns the last save's actor and
|
||||
time (from the audit), no write path, no policy or rule change; the deviation from « SQL changes: none » is
|
||||
recorded in the contract. DEV untouched.
|
||||
Q: Board 06 A shows « Prévisualiser »; §8.2 lists follow the round and withdraw; §16.8 gives V1-2.7 the
|
||||
practitioner preview, the round screen and the withdrawal / A: [gated 2026-11-03] deferred to V1-2.7: V1-2.6
|
||||
submits, then shows the frozen draft with « Revue n° N · vérification en cours » and a link to the sheet's
|
||||
overview; no « Prévisualiser » and no withdrawal before V1-2.7 (visible deviation from board 06 A, recorded).
|
||||
Q: Which drawing for A2 (« un SVG réel », non-equine, exported then cleaned) / A: [gated 2026-11-03] the
|
||||
committed Inkscape 1.4.3 export (`crates/core/tests/fixtures/svg/exports/inkscape-1.4.3-*.svg`, a real export,
|
||||
cleaning offered) plus a hostile file; the owner may import a drawing of their own at the trial.
|
||||
Q: Undo / redo control (not on board 04) / A: [gated 2026-11-03] two icon buttons « Annuler » and « Rétablir »
|
||||
in the tool column under the zoom, plus Ctrl+Z and Ctrl+Shift+Z.
|
||||
|
||||
## ACCEPTANCE CRITERIA
|
||||
|
||||
Memory part (§1 of the request): done before this contract, commit 7f618d0 pushed (BDR-099, LRN-113; ids
|
||||
checked across develop, main, feature/v1-1, feature/v1-2: next free were BDR-099 and LRN-113).
|
||||
|
||||
1. Route `/app/admin/sheets/:sheetId/draft` exists under `RequireAdmin`; the page loads the sheet's draft
|
||||
(admin read for the draft version, `get_sheet_version`, drawings downloaded under RLS, an editable
|
||||
`PreviewSheet`) and shows the permission states of BDR-099 (loading, failed read with « Réessayer », not
|
||||
authorised); an active `sheet_editor` grant gives the edit mode; reviewer-only and publisher-only accounts
|
||||
get the read-only mode; a draft frozen by a `verifying`, `open` or `approved` round is read-only with a
|
||||
notice naming the round; a sheet without a draft says so with a link to the overview. The overview offers
|
||||
the editor link; A1 (new sheet) and W1 (working copy) land on the editor (§11.2).
|
||||
2. The editable preview handle replaces the document (`replace_document`) and adds drawings (`add_drawing`)
|
||||
in place, and after a runtime trap rebuilds from the CURRENT document text and the drawings held, never
|
||||
from the initial input.
|
||||
3. Tabs Général, Vues et illustrations, Annotations, Constats, Références, Vertèbres, Vérification (§11.1),
|
||||
ARIA tabs; every change is one core `sheet.edit` command run on commit (blur, confirm, pointer-up), never
|
||||
per keystroke; TypeScript keeps no document schema and no Zod copy (ts-rs types only).
|
||||
4. Général: FR/EN name, description, scope disclaimer, attribution (authors, licence, notes); annotation
|
||||
categories (name FR/EN, colour) add, edit, delete.
|
||||
5. Références: add, edit, delete; type, citation, URL (http or https only), DOI. Vertèbres: add (code typed at
|
||||
creation, read-only after), edit, reorder ↑/↓, delete. A refused removal (`has_dependents`) lists the
|
||||
dependents from `sheet.dependents`; no cascade deletion.
|
||||
6. Vues et illustrations: main view and detail views (parent; own drawing or crop entered as numeric
|
||||
`view_box` values over the parent's preview), rename, delete (dependents listed). Drawing upload: the file
|
||||
is read by the core (`clean_svg`); hard rejection and active content refused with the reason in FR/EN, no
|
||||
cleaning offered; cleanable: the cleaned drawing composed by the core and the removed names (a removed
|
||||
`<style>` named) shown, then one confirmation « Nettoyer et utiliser cette version »; clean: used. The bytes
|
||||
registered, hashed and uploaded are `SvgCleaning.stored` with the core's sha256; register, upload at
|
||||
`<sha256>.svg` (an existing object, Storage HTTP 400 with body `statusCode` "409", counts as present),
|
||||
confirm; the drawing state (ok, missing, rejected) is shown; the §9.3 closed codes have FR/EN messages.
|
||||
7. Annotations: on the core-composed view (`view.canvas`), tools select, point, zone, detail-view link, zoom;
|
||||
a point by one click with its radius in a field; a zone and a link as polygons by successive clicks,
|
||||
closed, Escape cancels a tracing; a link chooses the view it opens; selection on the drawing or in the
|
||||
list; a selected circle or polygon moves as a block (page preview during the drag, the core command on
|
||||
pointer-up); a `path` annotation is displayed, selectable, deletable and replaceable by a polygon, never
|
||||
moved or edited as path data; zoom and pan; every coordinate (cx, cy, r, each vertex x and y) in numeric
|
||||
fields, vertices added and removed in the list; a keyboard-only path creates and edits points, zones and
|
||||
links (numeric fields).
|
||||
8. Annotation properties: FR and EN name, category, laterality, finding zone, vertebral region, colour,
|
||||
review marking; « Marquer comme relu » on one element; delete with the dependents shown when refused.
|
||||
9. Constats: tree of finding zones, categories (kind) and nodes up to depth 8: add, rename FR/EN, describe
|
||||
FR/EN, vet referral flag, cite references, review marking of one element, « Marquer comme relu » on one
|
||||
category or one zone (never sheet-wide), reorder among siblings with ↑/↓, delete with a confirmation
|
||||
listing what goes; no move to another parent, no drag and drop.
|
||||
10. Vérification (board 06 A): the core report's issues with an FR and EN message per code and a link to the
|
||||
element, the completeness counts, the statuses per group, the document size (`report.document_bytes`)
|
||||
against 2 MiB, the caps exceeded; `to_confirm` elements informative, never blocking submission (C7);
|
||||
submission note required as on board 06 A (non-blank, at most 1 000 characters); « Soumettre à la revue »
|
||||
disabled while the in-page check has errors or the page has unsaved changes, with the hint; a submission
|
||||
calls `submit_sheet_review` on the saved revision and the page then shows the draft frozen with its round
|
||||
`verifying`.
|
||||
11. Save: explicit « Enregistrer » (`save_sheet_draft` with `expected_revision`, no change note: accepted
|
||||
deviation of REVUE.md); header « Révision N · modifications non enregistrées »; every server failure kind
|
||||
mapped to an FR/EN message; « Annuler les modifications » returns to the last saved document after a
|
||||
confirmation; the leave guard (`useLeaveGuard`) is armed while unsaved.
|
||||
12. Conflict (§6.2): `draft_conflict` opens a dialog with the server revision (and its author and time if the
|
||||
owner's answer provides them) and « Recharger » or « Garder ma version »; the second saves the local
|
||||
document on the new revision only after an explicit confirmation naming what it replaces; nothing is
|
||||
overwritten silently.
|
||||
13. Local recovery (§6.2): a browser copy of the unsaved document in the report editor's persistence pattern
|
||||
(sessionStorage), keyed by version and revision, written on each committed change while unsaved, its
|
||||
status bound to the real write (LRN-057), removed after a successful save or an explicit discard; offered
|
||||
back on opening when it differs from the server document, restored through the core, never sent
|
||||
automatically; proven by a restore round trip (LRN-058).
|
||||
14. Undo and redo: a stack bounded by 8 MiB of document strings (UTF-8 bytes).
|
||||
15. Ids generated by the page `<prefix>-<10 characters a-z2-7>` (crypto random), inside the stable-id grammar,
|
||||
never derived from labels, never editable, never reused within the document.
|
||||
16. Below 1 024 px (board 05): read-only, badges « Brouillon » and « Lecture seule », the notice title alone
|
||||
(L15, BDR-099 §17.11), tabs, the whole drawing at opening, zoom and pan, a properties summary, no editing
|
||||
action; unsaved work in memory survives a width change. No horizontal scroll at 320, 375 and 768 px.
|
||||
17. Security: stored drawing bytes are never inserted into the page; only core-composed trees are rendered
|
||||
(DOMParser + importNode); the cleaning preview is composed by the core under a scope unique in the page;
|
||||
the original file is never rendered; no `innerHTML` / `dangerouslySetInnerHTML` carries drawing or
|
||||
document data; the page-drawn overlay (selection, vertices, tracing) holds numbers only.
|
||||
18. Unchanged: SQL migrations (unless the owner's conflict answer adds a read migration, sandbox only), the
|
||||
core's rules and readers, the readers of user data, the equine legacy sources, seed and oracles, the
|
||||
goldens; the wasm module within its 600 000 B gzip budget; `pnpm r5:import-equine --check` without
|
||||
difference.
|
||||
19. i18n: FR and EN parity; the ratified wordings (REVUE.md, §17.9, §17.11) used verbatim; the new labels
|
||||
listed for a separate owner review, not declared approved.
|
||||
20. Tests: unit (editor state, ids, undo bound, recovery, conflict, upload steps, issue mapping); `e2e:shell`
|
||||
A2, A3, A4 with a conflict between two sessions and a local recovery after a reload; keyboard path
|
||||
through numeric fields; hostile and valid SVG imports; permissions (editor, reviewer-only read-only,
|
||||
account without capability refused); read-only at 320, 375 and a width under 1 024 px; axe on the
|
||||
editor and the read-only mode; core-wasm proofs; equine non-regression (catalogue P1, the equine working
|
||||
copy opening in the editor read path, `r5:import-equine --check`).
|
||||
21. Demonstration on a fresh sandbox of the request's §3 journey (steps 1 to 12) for a non-equine species,
|
||||
built from scratch in the UI, saved, reloaded, conflicted, submitted; the validation panel shows no error
|
||||
while elements are still `to_confirm`; the round reaches `verifying` (no verification worker started).
|
||||
22. Gates: fresh sandbox, suites in the order `test-db → e2e:shell → test`, state-dependent failures reported,
|
||||
never masked; `pnpm check:all` green; fresh independent verifier and security review on the final code.
|
||||
23. An owner test procedure (commands, local URL, test-account access without secrets in logs, journey,
|
||||
operations, expected results, teardown), and a checkpoint report; V1-2.6 not declared validated by the
|
||||
owner.
|
||||
24. Constraints: work on `feature/v1-2-anatomical-sheets` only, regular commits and pushes, no merge, no DEV
|
||||
operation, no DEV worker, no DEV migration, no production deployment, no V1-2.7 work.
|
||||
|
||||
## FILE SCOPE
|
||||
|
||||
- apps/app/src: new editor module (route, state, canvas, tabs, dialogs), App.tsx route, AdminSheetRoute and the
|
||||
creation / working-copy landing, AppLayout width for the editor page, i18n fr.ts / en.ts, core wrappers
|
||||
(editable preview, `sheet.edit`, `sheet.dependents`, `clean_svg`), lib/id.ts or an editor id module
|
||||
- apps/app/tests/unit: editor tests; apps/app/e2e/shell: editor specs and support helpers; e2e fixtures
|
||||
- packages/supabase/src: sheet asset register / upload / confirm accessors and kinds, exports, unit tests
|
||||
- packages/core-wasm/src: a TS wrapper only if the glue needs one (no Rust change planned)
|
||||
- docs: BROWSER_TESTS.md, V1-2 contract state lines (§16.7), design README / REVUE pointers, owner test
|
||||
procedure, label proposals under .claude/audits
|
||||
- .claude/tasks (plan, TODO), .claude/memory (through memory.sh)
|
||||
- NOT in scope: crates/**, supabase/migrations/** (except a read migration if the owner chooses it),
|
||||
supabase/seed/**, legacy sources, goldens, oracles
|
||||
@@ -0,0 +1,307 @@
|
||||
# Plan: V1-2.6 editor level 1 (revised after challenge, 2026-11-03)
|
||||
|
||||
Contract `.claude/tasks/contracts/2026-11-03-v1-2-6-editor-1509.md` (criteria C1 to C24, CLARIFICATIONS [gated
|
||||
2026-11-03]). Branch `feature/v1-2-anatomical-sheets`, worktree
|
||||
`/tmp/claude-1000/-home-bchanot-Documents-faunosteo/e641af9a-743e-46d0-9804-99667836040e/scratchpad/v1-2`, base
|
||||
7f618d0. Sandbox only (`pnpm db:sandbox`, containers `faunosteo_dbsandbox_*`); the `supabase_*_faunosteo`
|
||||
containers are DEV: never touched, never a target. Every command runs with the worktree as an absolute,
|
||||
verified cwd (LRN-110). One lot = one coherent change, committed and pushed by the orchestrator after its own
|
||||
checks (`pnpm typecheck && pnpm lint && pnpm test:run`, plus the lot's checks).
|
||||
|
||||
Format note: the project's lot format (precedent `.claude/tasks/plans/2026-11-02-v1-2-5.md`), every choice closed
|
||||
here; executors write the code and the tests. Reading list for every executor: the contract, this plan,
|
||||
`docs/development/V1-2_ANATOMICAL_SHEETS.md` §6.2, §6.6, §8, §9.2-§9.4, §10, §11.1, `docs/design/v1-2-4/REVUE.md`
|
||||
(ratified wordings), boards `04-editeur-desktop.png`, `05-lecture-seule-etroit.png`, `06-verification-etats.png`
|
||||
(panel A only), the ts-rs types under `packages/core-wasm/types`.
|
||||
|
||||
## Architecture (closed decisions)
|
||||
|
||||
### Core and handle
|
||||
- No Rust change (crates/** untouched): the core already offers `sheet.edit`, `sheet.dependents`, `sheet.empty`,
|
||||
`clean_svg`, `PreviewSheet` with `replace_document` / `add_drawing`, `preview.state`, `view.canvas`. The wasm
|
||||
module and its 600 000 B gzip budget are unchanged.
|
||||
- The editor reuses `CataloguePreview` (`apps/app/src/catalogue/preview.ts`), extended, never duplicated: its kept
|
||||
input (`document` text) and drawing list become mutable; `replaceDocument(text)` and `addDrawing(drawing)` call
|
||||
the glue's `replace_document` / `add_drawing`. A new text is kept only after `replace_document` AND the following
|
||||
`preview.state` both succeed; when `state` fails without a trap, `replace_document(previous)` rolls the handle
|
||||
back, so the handle, the kept input and the store never diverge. The rebuild after a trap (generation change)
|
||||
uses the kept input, so a text or file that trapped is never kept and never re-read automatically (LRN-058).
|
||||
Kept drawings are a map keyed by asset id (a re-added id replaces its entry; the builder counts entries), holding
|
||||
only drawings the core accepted (16 at most; `caps: drawings` gets its own message, a reload frees them). Every
|
||||
successful `replaceDocument` / `addDrawing` bumps a store counter `handleVersion`.
|
||||
- The draft handle is built with NO drawing (a draft builds with its drawings missing, §10; `add_drawing` works on
|
||||
a draft and `view.canvas` looks drawings up live), then each downloaded drawing is added with `addDrawing`; a
|
||||
refusal or a failed download becomes that drawing's state (`missing`, `hash mismatch`), never a load failure: one
|
||||
bad drawing never blocks authoring (§9.3). A load dropped by the session token frees the preview it built;
|
||||
`close()` frees the session's preview.
|
||||
- Wrappers `apps/app/src/editor/core/editOps.ts`: `applyEdit(text, command)` (input text built as
|
||||
`{"document":<text>,"command":<json>}`, output `{document}` serialised back with `JSON.stringify`),
|
||||
`dependentsOf(text, key)`; `cleaning.ts`: `cleanSvg(bytes)`, `composeCleaningPreview(stored)` (a throwaway
|
||||
`CataloguePreview`: `sheet.empty` → `sheet.edit insert` a detail view `view-<random>` under the main view with a
|
||||
random uuid as its own drawing, the stored bytes added under that uuid, `canvas(<that view id>)`; the scope
|
||||
`fv.view-<random>.` is unique in the page; freed when the dialog closes). The original file is never rendered.
|
||||
- Content comparisons (recovery offer, unsaved flag) compare parsed JSON deeply (`sameDocument(a, b)`), never raw
|
||||
strings: the server text is in jsonb key order, the core's in serde order.
|
||||
|
||||
### Ids
|
||||
- `<prefix>-<10 chars a-z2-7>` from `crypto.getRandomValues`, prefixes `view`, `anno`, `cat`, `ref`, `zone`,
|
||||
`fcat`, `node`; a `duplicate_key` answer regenerates once and retries; no document walk. Region codes are typed
|
||||
at creation (the core checks the grammar), read-only afterwards.
|
||||
|
||||
### Store and sessions
|
||||
- One Zustand store `editorStore`, module-level; `open(versionId, userId)` returns a session token, `close()`
|
||||
invalidates it; EVERY async continuation (load, downloads, save, upload, conflict read, submit) checks the token
|
||||
before writing and drops its result otherwise (StrictMode runs open → close → open in dev, the e2e and the
|
||||
trial). DOM handlers read `getState()` (LRN-043).
|
||||
- The page holds the document as ONE JSON text (`documentText`) and the saved pair (`savedText`, `savedRevision`)
|
||||
taken from the SAME `get_sheet_version` answer (`revision` and `document` together; the admin read is never the
|
||||
revision source). `catalogue/catalogue.ts` `readVersion` is exported and gains a draft mode that accepts
|
||||
`draft`, returns `revision` and returns per-drawing settled results (`Promise.allSettled`, a failure kind per
|
||||
asset id) instead of failing the load; the catalogue's all-or-nothing path is unchanged: no second loader.
|
||||
- Every change is one `sheet.edit` command run on commit (blur with a changed value, Enter, a confirm button,
|
||||
pointer-up), never per keystroke (BDR-050); field typing stays local; a field with a pending value commits it in
|
||||
its unmount cleanup (mode switch). The new text is stored only after `replaceDocument` and `preview.state`
|
||||
succeed; a refused command leaves everything unchanged and shows its closed kind next to the control.
|
||||
- Undo/redo: arrays of texts; each entry's UTF-8 size measured once (`TextEncoder`); oldest undo entries dropped
|
||||
while both stacks exceed 8 388 608 B; a new commit clears redo; save keeps both; a reload of the server draft
|
||||
(« Recharger », discard after an older-copy restore) and « Annuler les modifications » clear both. Controls:
|
||||
icon buttons « Annuler » / « Rétablir » in the tool column under the zoom; Ctrl+Z and Ctrl+Shift+Z outside text
|
||||
fields (no Ctrl+Y).
|
||||
|
||||
### Creation of elements (no invented labels)
|
||||
- No element is inserted with default labels. Each creation collects the fields the core requires, then one
|
||||
`insert`:
|
||||
- annotation (drawn or keyboard): the geometry is held as a pending outline in the overlay and the properties
|
||||
panel opens in a « Nouveau point / Nouvelle zone / Nouvel accès » state with Nom (FR), Nom (EN), Catégorie
|
||||
(first category preselected), Latéralité (no preselection, required), Vue ouverte (link, required), then
|
||||
« Créer » inserts; « Annuler » drops the pending element. Zone de constats and Région vertébrale optional;
|
||||
- annotation category: name FR/EN, colour optional; reference: type, citation, URL, DOI; region: code, name
|
||||
FR/EN, count; detail view: name FR/EN, parent, own drawing or crop values; finding zone: name FR/EN; finding
|
||||
category: kind, name FR/EN; node: name FR/EN.
|
||||
- A blank optional field is sent as `null` where the type is nullable and omitted where it is an optional key
|
||||
(`LocalizedOptionalText`); never "" (the core refuses empty strings).
|
||||
|
||||
### Rendering and canvas
|
||||
- Only `view.canvas` trees are rendered, inserted with `DOMParser` + `importNode` through `buildView`, exported
|
||||
from `CatalogueCanvas.tsx` and reused. Read-only modes mount `CatalogueCanvas` as is (board 05). The edit canvas
|
||||
reuses `framing.ts` and `useFraming` with one added option `canPan(event)` (false when the press starts on a
|
||||
selected marker or a drawing tool is active).
|
||||
- A page-drawn overlay `<svg>` (numbers only: selection outline dashed dark, vertex circles, the tracing in
|
||||
progress, the pending or dragged outline, the crop rectangle) sits over the drawing inside the same transformed
|
||||
container, with the composed root's `viewBox` and `preserveAspectRatio`. Pointer → drawing coordinates through
|
||||
the overlay's `getScreenCTM().inverse()`. `docs/ANNOTATION-RENDERING.md` gets an « Editor overlay (V1-2.6) »
|
||||
section first, stating it draws no annotation and holds numbers only.
|
||||
- Only the active tab panel is mounted, so one view's canvas is never twice in the DOM.
|
||||
- Canvases follow the handle: the edit canvas rebuilds on `[viewId, handleVersion, attempt]`; the read-only
|
||||
`CatalogueCanvas` is mounted with `key={handleVersion}`, so a restore, an upload or a drawing added after the
|
||||
first paint is shown (no stale tree, no stuck `no_asset` notice).
|
||||
- Pointer handling: `setPointerCapture` on press; `pointercancel` and `lostpointercapture` drop the drag with no
|
||||
command; a switch to read-only mid-drag drops it.
|
||||
|
||||
### Tools (board 04)
|
||||
- Sélectionner/déplacer, Point, Zone, Accès à une vue détaillée, separator, Zoom (−, +, Ajuster), separator,
|
||||
Annuler, Rétablir. Select: a press on a marker selects it; a drag from a selected circle or polygon moves it as
|
||||
a block (overlay preview; on pointer-up one `update` with coordinates translated by the drawing-unit delta,
|
||||
rounded to 2 decimals); a drag on empty space pans. Point: one click holds a pending circle (radius = 12 + 3 % of the
|
||||
frame's smaller side, so the visible disc `2 × max(2, r − 12)` is 6 % of it and passes the 4 px rule; frame = the
|
||||
composed root's viewBox; unit-tested on 500×380, 640×480, 200×150). Zone and link: clicks add vertices;
|
||||
Enter, a click on the first vertex or « Fermer le tracé » closes (3 vertices at least); Escape or « Annuler le
|
||||
tracé » drops it. A detail-view link opens a direct child of its own view (core rule
|
||||
`annotation.opens_view.invalid`): the link tool is enabled only while the current view has a direct detail
|
||||
child (hint otherwise), and « Vue ouverte » lists only those children, in creation and in properties; every drawing tool
|
||||
is disabled with « Créez d'abord une catégorie d'annotation (onglet Général). » while there is none.
|
||||
- Keyboard path (C7): under the canvas, « Ajouter un point », « Ajouter une zone », « Ajouter un accès » hold a
|
||||
pending element at the frame centre (zone and link: a triangle of 10 % of the smaller side) and open the
|
||||
creation panel; then every coordinate is edited in numeric fields (cx, cy, r; rows « n | x | y »; « Ajouter un
|
||||
sommet » after the selected row or the last; « Retirer » while more than 3 remain).
|
||||
- A `path` annotation: shown and selectable; « Remplacer par un polygone » starts a tracing whose result replaces
|
||||
its geometry; never moved; its path data never shown as editable.
|
||||
- Selection also from the annotation list of the view (name, kind, review badge; keyboard reachable); the tag
|
||||
« Sélection : <type> « <nom> » » over the drawing (board 04).
|
||||
|
||||
### Panels and tabs
|
||||
- Properties panel (board 04): Nom (FR), Nom (EN), Catégorie, Couleur (« de la catégorie » or a hex value),
|
||||
Latéralité, Région vertébrale, Zone de constats (point, zone), Vue ouverte (link), coordinates, review badge
|
||||
(« À confirmer », « Relu », « Hérité, non relu »), « Marquer comme relu » (`set_status reviewed`, while not
|
||||
`reviewed`), « Remettre à confirmer » (`set_status to_confirm`, while `reviewed`), « Supprimer » (confirmation;
|
||||
a refusal lists the dependents).
|
||||
- Général: names, description and scope disclaimer FR/EN, attribution (authors add/remove, licence, notes); section
|
||||
« Catégories d'annotation » (list, add, rename, colour, delete with dependents).
|
||||
- Vues et illustrations: main view (name, drawing state ok / missing / rejected with its detail, « Choisir une
|
||||
illustration »), detail views (add, parent, own drawing or crop: four numeric `view_box` fields with the parent's
|
||||
canvas beside them and the crop rectangle in the overlay; rename; delete with dependents).
|
||||
- Constats: tree zones → categories → nodes (depth ≤ 8), `role="tree"` / `treeitem`, arrow keys; categories and
|
||||
nodes carry a review badge, zones none (FindingZone has no status); actions: add zone, add category, add node
|
||||
(disabled at depth 8), ↑ / ↓ (`move`), « Marquer comme relu » (zone and category: `mark_reviewed`; node:
|
||||
`set_status reviewed`), « Remettre à confirmer » (categories and nodes only), delete with a confirmation listing
|
||||
the descendants and, on refusal, the dependents.
|
||||
- Références: list + form (type, citation, URL http/https checked by the core, DOI). Vertèbres: list (code, name,
|
||||
count, optional range), add, edit, ↑ / ↓, delete.
|
||||
- Read-only renders through shared field components that show their value as text when `readOnly` (action buttons
|
||||
hidden by the same flag): each tab stays one component.
|
||||
- Vérification (board 06 A): badges « N erreurs bloquantes » / « N éléments à confirmer »; one notice per error
|
||||
issue with its FR/EN message and « Aller à … » when the path names an element; warnings apart; the info notice on
|
||||
`to_confirm` elements; completeness; statuses per group; size « <n> o sur 2 097 152 o » from
|
||||
`report.document_bytes`, caps exceeded named; « Note de soumission (obligatoire) » (trimmed 1 to 1 000
|
||||
characters); « Soumettre à la revue » disabled with its hint while errors exist (« Corrigez les N erreurs
|
||||
bloquantes pour soumettre. »), while unsaved (« Enregistrez le brouillon avant de le soumettre. ») or while the
|
||||
note is empty. Submit → `submit_sheet_review(version_id, savedRevision, note)`; success → the admin read and the
|
||||
version are reloaded, the page shows the `frozen` read-only state. No « Prévisualiser », no withdrawal (V1-2.7).
|
||||
|
||||
### Save, conflict, recovery
|
||||
- Save: « Enregistrer » sends `sentText` with `expected_revision = savedRevision`, no change note; the answer is
|
||||
parsed as `{revision: number}` (`unavailable` otherwise). Success: `savedText = sentText`, `savedRevision =
|
||||
answer`, unsaved = `!sameDocument(current, sentText)`; the recovery copy is removed when unsaved is off, else
|
||||
rewritten on the new revision. `draft.unchanged` sets the saved pair to (`sentText`, the `expected_revision`
|
||||
sent). Other kinds → header notice, document and copy kept.
|
||||
- Conflict (`draft_conflict`): the page reads `get_official_sheet_admin` (M8 `draft_last_save`) and opens a
|
||||
dialog: « Une autre session a enregistré la révision N » + « par <nom>, le <date heure Paris> » (a neutral
|
||||
« depuis une autre session de votre compte » when `saved_by` is the caller); « Recharger » → a confirmation
|
||||
« Abandonner vos modifications et recharger la révision N ? » → reload of the server draft (text and revision
|
||||
from one `get_sheet_version`, the listed drawings the handle lacks downloaded and added), both stacks cleared,
|
||||
copy removed; « Garder ma version » → a confirmation
|
||||
« Remplacer la révision N (<nom>, <date>) par votre version ? » → save with `expected_revision = N`; a new
|
||||
conflict re-opens the dialog; « Annuler » changes nothing.
|
||||
- Local recovery: sessionStorage (the report editor's pattern), key `osteo:sheet-draft:<userId>:<versionId>`,
|
||||
value `{"v":1,"user_id","version_id","revision","written_at","document":<text>,"drawings":[{"asset_id","sha256"}]}`
|
||||
(revision = the saved revision the edits started from: the copy is identified by version and revision). Written
|
||||
SYNCHRONOUSLY by a store subscription on each committed change while unsaved, through `writeOrRemove` exported
|
||||
from `state/persistence.ts`; its boolean is kept in the store. Removed after a successful save that leaves
|
||||
nothing unsaved, after « Annuler les modifications », after « Ignorer », when undo returns to the saved content,
|
||||
and after « Recharger ». At most two copies of other versions are kept (oldest removed by `written_at`); copies
|
||||
of another account are never offered. On opening: a copy of this account and version whose document differs
|
||||
(`sameDocument`) from the server's is offered in a notice under the header (« Une copie locale non enregistrée
|
||||
de ce brouillon existe (révision N, <heure>). » with « Restaurer » / « Ignorer »); restore goes through the core
|
||||
(`replaceDocument`; a refused copy is reported and kept, never applied), downloads the copy's drawings the page
|
||||
does not hold (`downloadSheetDrawing`), sets unsaved. When the copy's revision R is older than the server's
|
||||
revision M, the offer names both (« basée sur la révision R ; le serveur est à la révision M ») and, after a
|
||||
restore, `savedRevision` stays R (the base the copy was written on) with a store flag `staleBase`: the first
|
||||
save therefore meets `draft_conflict`, whose dialog shows revision M with its author and time (M8) and requires
|
||||
the « Garder ma version » confirmation before anything is replaced; « Annuler les modifications » with
|
||||
`staleBase` takes the « Recharger » path (server text and revision M). Nothing is overwritten silently. The offer
|
||||
shows only in edit mode or `narrow` (a mode that can save); never sent automatically.
|
||||
- Header status: only the failure variant « Copie locale impossible (stockage plein) » is shown (board 04 keeps
|
||||
« Révision N · modifications non enregistrées »). Every message that promises kept work reads the real write
|
||||
flag: session or MFA lost (`session_expired`, `rights.mfa`) and an unsaveable draft (`draft.frozen`,
|
||||
`sheet.inactive`, `rights.capability`) say « une copie locale existe dans cet onglet » only when the last write
|
||||
succeeded, otherwise that the unsaved changes cannot be kept.
|
||||
- Leave guard (`useLeaveGuard`) armed while unsaved.
|
||||
|
||||
### Upload (§9.2-§9.3)
|
||||
- File input (`.svg`, `image/svg+xml`), size ≤ 2 MiB checked before reading; bytes → `clean_svg`. `rejected` →
|
||||
message per reason, nothing else. `cleanable` → dialog with the core-composed cleaned drawing, the removed names
|
||||
(the `<style>` element named when `style_removed`), « Nettoyer et utiliser cette version » / « Annuler ».
|
||||
`clean` → no dialog.
|
||||
- Then: `register_sheet_asset(sheet_id, sha256, byte_size, file_name)` with the core's sha256 and size of
|
||||
`stored`; read the row (`listSheetAssets(sheetId)`: id, sha256, byte_size, uploaded_at); if `uploaded_at` is set,
|
||||
nothing is uploaded or confirmed (§9.3 step 2); if pending, upload `stored` at `<sha256>.svg` (`image/svg+xml`,
|
||||
no upsert): ok → confirm; already present (HTTP 409, or 400 with `statusCode` "409") → confirm; refused by the
|
||||
policy (403, or 400 with `statusCode` "403": a pending row registered by another account) → `confirm` once (the
|
||||
other account's object may already be there); `upload_missing` then → closed code `upload.pending_other`; then `confirm_sheet_asset_upload(asset_id)` (`upload_missing`, `size_mismatch`). Then the
|
||||
stored object is downloaded and added with `addDrawing`: `drawing_hash_mismatch` → `object_conflict`; `caps` →
|
||||
its message. Then the view the upload started from gets the drawing (`update` view with `svg_asset_id`).
|
||||
- Codes with FR/EN messages: `size_mismatch`, `hash_mismatch`, `svg_rejected` with the reason, `svg_active_content`,
|
||||
`svg_not_canonical`, `too_large`, `upload_missing`, `object_conflict`, `upload.pending_other`, `caps`, and the
|
||||
server kinds through `failureMessage` (allowlist extended).
|
||||
|
||||
### Modes, permissions, layout
|
||||
- Edit mode needs, as a display rule only: an active `sheet_editor` own grant AND the admin or owner platform role
|
||||
(`grant_active` needs both), a viewport ≥ 1 024 px, no freezing round, not the historical sheet, an active sheet.
|
||||
Otherwise read-only with the reason's notice: `narrow` (board 05: badge « Lecture seule » with the lock icon,
|
||||
notice title alone « L'édition nécessite une largeur d'écran d'au moins 1 024 px. », L15), `rights`, `frozen`
|
||||
(« Revue n° N · vérification en cours » for `verifying`, the round status label otherwise, link to the
|
||||
overview), `historical`, `inactive`. Unsaved work in memory survives a switch to narrow and back.
|
||||
- Permission states on the route (BDR-099 order): own grants `loading` → waiting; a `rights.*` answer from the admin
|
||||
read → « Accès non autorisé »; own grants `failed` → `PermissionsUnavailable` with « Réessayer »; `not_found` →
|
||||
`SheetNotFound` (exported from `AdminSheetRoute.tsx`); no draft → notice + link to the overview.
|
||||
- Tabs: wide, all seven (board 04); narrow (board 05), static lists: 640 to 1 023 px « Général, Annotations,
|
||||
Constats, Vérification » + « Plus »; below 640 px « Annotations, Vérification » + « Plus »; « Plus » is a
|
||||
disclosure (`aria-expanded`) listing the others; no width measurement.
|
||||
- Layout: `AppLayout` drops `max-w-4xl` for `/app/admin/sheets/:sheetId/draft` (`matchPath`). From 1 280 px board
|
||||
04's three columns; from 1 024 to 1 279 px the properties card goes under the canvas (tools + canvas columns),
|
||||
the tab row scrolls within itself and the header wraps; no page horizontal scroll at 1 024 px.
|
||||
- Links: the overview shows « Ouvrir le brouillon » (edit possible) or « Consulter le brouillon » when a draft
|
||||
exists; A1 creation and W1 working copy navigate to `/app/admin/sheets/<id>/draft`.
|
||||
|
||||
### i18n
|
||||
- Keys `editor.*` in fr.ts and en.ts (parity tests); ratified wordings verbatim (REVUE.md, contract §17.9, §17.11,
|
||||
L15); every new label listed in `.claude/audits/2026-11-03-v1-2-6-label-proposals.md` for the owner's separate
|
||||
review, none declared approved.
|
||||
|
||||
## Lots
|
||||
|
||||
| Lot | Content | Criteria | Checks |
|
||||
|---|---|---|---|
|
||||
| A | M8 `supabase/migrations/20261103100000_sheet_draft_last_save.sql`: redefines `public.get_official_sheet_admin` only (the list and the summary helper untouched) adding `draft_last_save` = `{revision, saved_at, saved_by: private.sheet_admin_person(actor)}` from the newest `audit.audit_logs` row with `resource_type = 'anatomical_sheet_version'`, `resource_id` = the draft, `action = 'anatomical_sheet_version.saved'`, `metadata->>'revision'` = the draft's revision, else null; body otherwise identical to M7; privileges restated as M7 has them. pgTAP `supabase/tests/023_sheet_draft_last_save.sql`: null on a fresh draft, actor and time after a save, the second editor after a second save, null after a non-save content write, same refusals as M7, no new privilege. `packages/supabase` schema `draft_last_save` (nullable). Sandbox fresh + upgrade from M7; `db:types --check`. Contract §12.3 and §16.7 amended (read migration, owner 2026-11-03) | C12, C18 | PGlite, `db:sandbox test-db`, types |
|
||||
| B | `packages/supabase/src/sheets.ts`: `registerSheetAsset`, `listSheetAssets(sheetId)`, `uploadSheetDrawing` (→ `'uploaded' \| 'present'`, `upload.pending_other` on a policy refusal, Storage errors read on HTTP status and body `statusCode`, checked against the installed storage-js error type), `confirmSheetAssetUpload`, `parseSaveAnswer`; new kind `upload.pending_other`; exports; unit tests; sandbox test `packages/supabase/tests/sandbox/sheet-editor-assets.sandbox.ts` with bytes unique per run (pattern of `sheet-fixtures.ts`): register, upload, confirm, row read, second register of a confirmed hash (no upload), second editor on a pending row (`upload.pending_other` with its own statusCode) | C6 | unit, sandbox |
|
||||
| C | `CataloguePreview` extension (mutators, kept input on ok only, accepted drawings only); `editor/core/editOps.ts`, `cleaning.ts`, `editor/ids.ts`, `sameDocument`; `CatalogueCanvas` exports `buildView`; `useFraming` option `canPan`; unit tests on the Node core: rebuild after a forced generation change keeps the replaced text and the added drawing, a refused text is not kept, a bad drawing refused alone, the cleaning preview's scope | C2, C3, C15, C17 | unit |
|
||||
| D | `editor/state/editorStore.ts`, `undo.ts`, `recovery.ts`, `editor/issues.ts`; `persistence.ts` exports `writeOrRemove`; unit tests: session token drops late answers, commit, refusal unchanged, undo bound, redo cleared, save with commits in flight (sent text kept), save unchanged, conflict paths (reload clears stacks, keep mine with confirmation), recovery write flag, removal cases, restore round trip through the core, older-revision restore, other account ignored, other versions capped at two | C11-C14 | unit |
|
||||
| E | Route `AdminSheetDraftRoute.tsx`, App.tsx, AppLayout width, header, tabs (wide and narrow), modes and permission states, recovery offer, conflict dialog, leave guard, overview links, A1/W1 landing, shared read-only field components; `readVersion` draft flag + revision; `failureMessage` allowlist; i18n | C1, C11-C13, C16 | unit |
|
||||
| F | Général (+ annotation categories), Références, Vertèbres; shared delete-with-dependents dialog | C4, C5 | unit |
|
||||
| G | Vues et illustrations + upload flow | C6, C17 | unit |
|
||||
| H | `docs/ANNOTATION-RENDERING.md` overlay section first; Annotations: canvas, overlay, tools, list, creation panel, properties panel, keyboard creation, undo/redo controls | C7, C8, C14, C17 | unit |
|
||||
| I | Constats tree | C9 | unit |
|
||||
| J | Vérification panel + submission | C10 | unit |
|
||||
| K | e2e `apps/app/e2e/shell/editor-*.spec.ts` reusing `createAccount`, `assignRole`, `seedGrant`, `enrolVerifiedFactor`, `stepUpAdmin`, `seedOfficialSheet`, `expectAccessible`, `expectNoHorizontalOverflow`, `dropLateReplays`; adds editor-only helpers. A2 (hostile refused, Inkscape export cleaned, attach, detail view by crop; both upload outcomes accepted), A3 (points, zones, links by clicks and by keyboard, move, numeric edits), A4 (zones, categories, nodes, refs, regions, reorder, mark reviewed, delete with dependents), journey (the brief's §3 steps 1-12 with two editor accounts: creation, upload, detail view, points/zones/links, categories and findings, save, reload with the beforeunload dialog accepted and the recovery offer, conflict, submit, round `verifying` read back in SQL, no error shown while elements are `to_confirm`), access (reviewer-only read-only, editor grant without admin role read-only, account without capability refused), narrow (320, 375, 800 px read-only, no horizontal scroll; 1 024 px edit without horizontal scroll), axe on editor and read-only, the equine working copy opening (sets aside an active copy first, as `sheets-concurrency.sandbox.ts` does); commit latency measured on the equine copy and on a synthetic document near 2 MiB (reported; budget 500 ms per commit on the equine copy); `docs/development/BROWSER_TESTS.md` | C16, C20, C21 | `e2e:shell` on a fresh sandbox |
|
||||
| L | Owner trial: `scripts/db-sandbox.sh` subcommands `trial` (its own gateway container `faunosteo_dbsandbox_trial_gateway` on its own loopback port, refusing to start when that container exists, + Vite dev server on 127.0.0.1:5193 whose proxy forwards `/auth/v1`, `/rest/v1` and `/storage/v1` to that gateway so the browser stays same-origin (no CORS change), proven by the manual run; foreground, Ctrl+C stops both), `trial-account <email>` (password at a hidden prompt, confirmed account, nothing secret printed), `trial-grant <email> <kind>` (email and kind checked against fixed patterns and passed as psql variables; for `sheet_editor` / `sheet_publisher` also `private.assign_platform_role(null, <id>, 'admin')`, the same SQL as the e2e helpers); `docs/development/V1-2-6_OWNER_TRIAL.md` (commands, URL, account, TOTP enrolment, journey, operations, expected results, the freeze after a submission with no worker and no withdrawal, teardown); label proposals file | C23 | script review, manual run on the sandbox |
|
||||
| M | Gates: fresh sandbox → `test-db` → `e2e:shell` → `test`; `check:all`; `r5:import-equine --check`; fresh verifier + security; docs (contract §16.7 state, TODO, design README pointer); memory; checkpoint report | C18, C22, C24 | all |
|
||||
|
||||
Dependencies: A, B, C independent; D needs A, C; E needs A, B, D; F-J need E; K needs A-J; L needs E; M last.
|
||||
|
||||
## Edge cases (all lots)
|
||||
|
||||
- Core trap mid-edit: the store keeps `documentText`; the handle rebuilds from its kept input; the canvas shows the
|
||||
engine notice with retry (BDR-054); a command or file that trapped is not retried automatically.
|
||||
- A drawing missing or refused: that view shows its state and the canvas notice; edits continue.
|
||||
- Two tabs on the same draft: each its own copy; the server revision decides (conflict dialog).
|
||||
- A save answer lost (`network`): the next save meets the conflict dialog with the neutral own-account wording.
|
||||
- Escape in a native dialog closes it (LRN-082); e2e waits for a closed dialog before typing (LRN-111) and accepts
|
||||
the beforeunload dialog before a reload.
|
||||
|
||||
## Disposition of memory (in force)
|
||||
|
||||
Honors BDR-043 (no rule in TS: translation and defaults are UI arithmetic, every check is the core's), BDR-050,
|
||||
BDR-054/055/056 (failure states, honest unsaved wording, restore through the core), BDR-076, BDR-078, BDR-082,
|
||||
BDR-084 (M8 reads through the RPC, no grant widening), BDR-085, BDR-086, BDR-087 (stored form; unique scope for
|
||||
the cleaning preview; one canvas per view in the DOM), BDR-088/090 (Inkscape 1.4.3 fixture), BDR-091/092,
|
||||
BDR-094, BDR-096 (boards followed; deviations listed), BDR-097, BDR-099; LRN-010, -017, -043, -055, -057, -058,
|
||||
-060, -082, -085, -087, -088, -089, -094, -097, -101, -103, -104, -110, -111, -112, -113.
|
||||
|
||||
## Visible choices taken in this plan (for the owner at the validation gate)
|
||||
|
||||
1. Annotation categories edited in the Général tab.
|
||||
2. Creation panels collect the required fields (names FR/EN, laterality with no preselection, category, opened
|
||||
view) before the element exists; no default labels.
|
||||
3. Keyboard creation buttons under the canvas, then numeric fields.
|
||||
4. Read-only notices per reason (rights, frozen, historical, archived) besides board 05's narrow notice.
|
||||
5. From 1 024 to 1 279 px the properties card goes under the canvas.
|
||||
6. Overview links « Ouvrir le brouillon » / « Consulter le brouillon »; A1 and W1 land on the editor (§11.2).
|
||||
7. Owner trial commands `pnpm db:sandbox trial`, `trial-account`, `trial-grant` and the doc
|
||||
`docs/development/V1-2-6_OWNER_TRIAL.md`.
|
||||
8. New closed code `upload.pending_other` (another account's unfinished upload of the same drawing).
|
||||
|
||||
Recorded deviations from board 06 A (owner answer): no « Prévisualiser », no withdrawal before V1-2.7.
|
||||
|
||||
## Challenge record (2026-11-03, three lenses, each CONCERNS(4), no BLOCKER tag)
|
||||
|
||||
Accepted and integrated: simplicity 1-11 (CataloguePreview extended, canvas and framing reused, static narrow
|
||||
tabs, synchronous copy writes, one key per account and version, id retry on `duplicate_key`, recovery drawings in
|
||||
the copy, loader and failure map reused, failure-only copy status, no Ctrl+Y, shared read-only fields, e2e
|
||||
helpers reused); robustness 1-3 and 5-17 (sent text kept on save, session token, drawings added one by one and
|
||||
the stored object re-read, removal cases, no pending write, account in the key, trapping input not kept, edit mode
|
||||
needs the admin role, 16-drawing cap, two-step reload and neutral own-account wording, pointer capture, unique
|
||||
test bytes and working-copy slot, trial gateway and SQL variables, admin role in trial-grant, M8 in
|
||||
`get_official_sheet_admin` only with `resource_type`, 2 MiB latency); correctness 1-14 (confirmed row skips the
|
||||
upload and a policy refusal is named, creation fields, discard removes the copy, deep comparison, saved revision
|
||||
from the version answer, save answer parsed, zones without status, A before D and E, 1 024 px layout, older-copy
|
||||
restore, stacks cleared on reload, one canvas per view, beforeunload in e2e).
|
||||
|
||||
Confirmation pass (one fresh correctness challenger on the revision): FATAL(6) → all 12 integrated: [BLOCKER] an
|
||||
older restored copy saved over a newer revision → `savedRevision` stays the copy's base with `staleBase`, the
|
||||
first save meets the conflict dialog; state failure after replace → rollback, kept input only after `state`;
|
||||
draft `readVersion` per-drawing settled results; `handleVersion` drives canvas rebuilds and the read-only `key`;
|
||||
link tool and « Vue ouverte » limited to direct detail children; default radius 12 + 3 %; drawings keyed by
|
||||
asset id; `draft.unchanged` sets the saved pair; policy refusal tries `confirm` once; trial through a Vite proxy
|
||||
(same origin); dropped loads and `close()` free the preview; recovery offer only where saving is possible. The
|
||||
procedure allows one confirmation pass: these fixes go to the gate unchallenged again. Robustness 4: messages read the
|
||||
write flag (integrated); a downloadable rescue copy (BDR-055 pattern) is a visible choice asked at the gate.
|
||||
Reference in new issue
Block a user