Files
faunosteo/.claude/tasks/contracts/2026-11-03-v1-2-6-editor-1509.md

485 lines
39 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# CONTRACT — v1-2-6-editor
- date: 2026-11-03 | flow: ship-feature | branch: feature/v1-2-anatomical-sheets
- status: active
- worktree: /home/bchanot/Documents/faunosteo-v1-2 (durable since 2026-11-04, LRN-114; was a session scratchpad)
(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
- [amended 2026-11-05, V1-2.6 UX U0] level 1 as built here is NOT declared validated as a whole (owner T11); the
redesign (sub-steps U1 to U8 of `docs/development/V1-2-6_UX_PLAN.md`) follows the 16 boards of
`docs/design/v1-2-6` (validated 2026-11-05), which replace v1-2-4 boards 04 and 05 for editing (board 05's
narrow-screen read-only mode stays the reference under O14 A, C16); the criteria it changes carry an amendment
note below. Precedence for the redesign: where a criterion of this contract, with or without a note, differs
from the validated v1-2-6 boards or from the V1-2 contract as amended (§8.2-§8.4, §17.12), the amended contract
prevails first, then the boards. Two exceptions: a difference listed in `docs/development/V1-2-6_UX_DECISIONS.md`
(« Points from the boards for U1 and later ») is an open owner question, and until the owner answers it the
criterion stays as written; a point owned by another step (V1-2.7: preview, withdrawal) stays with that step. The
other criteria stay in force
## 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. [amended 2026-11-05, U0, §17.12: the two buttons
move to the editor header on every tab (ARBITRAGES choice 2, built at U1); the history command is named « Annuler la dernière
modification » (T15); the shortcuts are unchanged.]
Q: Plan approval (8 visible choices, rescue copy) / A: [gated 2026-11-03] owner brief « GO propriétaire V1-2.6 »:
plan, lots A-M, C1-C24 and the 8 choices approved; M8 on the throwaway sandbox only; no JSON export button for the
recovery copy; local recovery kept with exact messages on its state and limits; a local restore never silently
overwrites a newer server revision; execution gated on a targeted independent re-check of the six FATAL fixes.
Q: Re-check REMAINING(2) (default radius out of frame; pending copy overwritten) / A: [gated 2026-11-03] owner
brief « arbitrages propriétaire sur REMAINING(2) »: radius `min(12 + 0.03 × max(w, h), min(w, h) / 2)` in the
drawing's frame, the clicked position kept when a valid radius exists, a position correction shown and confirmed,
never silent, never below the core's minimums, never `out_of_frame`, the core keeps the authority; editing blocked
while a recovery offer is unanswered (« Restaurer la copie » / « Ignorer la copie », consultation allowed); conflict
N from `draft_version.revision`, author and date from `draft_last_save`, failed read → « Recharger » / « Réessayer »,
« Garder ma version » disabled; two-copy cap kept with no automatic eviction of an unresolved copy; AAL2 residual
risk recorded, not fixed; second targeted re-check, then execution without a new authorisation if conforming.
Q: Re-check REMAINING(1) (F1 unmeasured views; C26 refinement for annotations already out; minor effects) / A:
[gated 2026-11-04] owner brief « GO propriétaire après REMAINING(1) »: F1 fix approved; C26 refined by seven
repair rules (new annotation valid before integration; a valid annotation never made invalid; an annotation
already out repairable; intermediate values kept in the form; geometry applied only when the whole satisfies the
core; no diagnostic hidden; a frame change never silently invalidates); 4 px drag threshold, unreadable copy kept
with « Ignorer la copie » naming the loss, leave guard while a decision is pending and not after; execution of
lots A-M authorised without a third plan review; stop on a blocking defect or a contractual impossibility.
## 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).
[amended 2026-11-05, V1-2.6 UX U0, V1-2 contract §17.12; built at U1] Four tabs: Général, Annotations,
Constats, Vérification. Views, drawings, annotation categories and vertebral regions move into Annotations;
Références becomes a side panel opened from the header or from a finding; Annuler and Rétablir sit in the
header on every tab. The commit rule and the ts-rs-only rule above are unchanged.
4. Général: FR/EN name, description, scope disclaimer, attribution (authors, licence, notes); annotation
categories (name FR/EN, colour) add, edit, delete.
[amended 2026-11-05, U0, §17.12] Categories leave Général for the category panel of Annotations (U3: swatch
and name, palette and hex, staged « Appliquer », delete when unused, « Réaffecter à… »). From U6 the three fixed
categories Os, Articulations, Vertèbres keep their names and roles (no delete, name read-only), their colour and
fill opacity stay adjustable; other categories stay free.
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.
[amended 2026-11-05, U0, §17.12] References move to a side panel (C3). Vertebral regions open from the
vertebra-role category at U6 (board 09): reorder by grip handle or Alt+arrows, staged « Appliquer »; the
↑/↓ buttons stay until then; whether a region code stays read-only after creation is settled at U6.
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.
[amended 2026-11-05, U0, §17.12] Views and drawings sit in Annotations. A crop is drawn as a rectangle over
the parent's drawing, its handles resizable by keyboard (U4); the numeric `view_box` editor leaves the normal
journey; the view's name is proposed from the annotations inside and stays editable (U5); replacing a crop
view's drawing opens the three-action dialog of decision T9 before any upload (U5). Upload, cleaning, register,
upload and confirm are unchanged.
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).
[amended 2026-11-05, U0, §17.12; built at U2 and U4] Direct manipulation replaces the numeric fields in the
normal journey: point move and a size slider snapped to the sizes of the view, with the core's minimum mark;
vertex drag, « + » on a segment, « − » on the chosen vertex (disabled at 3 vertices with its reason, board 12 B); zone move, directly
with the mouse once selected, in an explicit « Déplacer la zone » mode by touch; redraw keeping the old shape
until the new one is accepted. The keyboard alternative goes through the handles (Tab, arrows, Shift ×10,
Insert or Backspace or Delete, Enter, Escape); no coordinate field. The detail-view link tool leaves the
toolbar: an access is placed from the view's menu (« Ajouter un accès »), and created with the view from U6
when no annotation overlaps it. Paths are unchanged (C45, T16): displayed, selectable, deletable, never moved
or edited; « Remplacer par un polygone » stays their one explicit exit, validated by the core, the old path kept
until the polygon is accepted, one undo entry.
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.
[amended 2026-11-05, U0, §17.12; built at U3] The annotation's own colour is shown only when set, with
« Revenir à la couleur de la catégorie » (one `update` with `color: null`); a new annotation carries no own
colour and inherits its category's. The other properties are unchanged.
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.
[amended 2026-11-05, U0, §17.12; built at U1] The header states follow the validated boards (07, 08, 09,
12 A, 13): « n modifications non enregistrées » while unsaved, « Enregistré à hh:mm · révision n » after a
save; the exact labels go to the U1 label review.
[amended 2026-11-05, U0, owner decision T15, §17.12; built at U1] The command that returns to the last saved
document is labelled « Abandonner les modifications » (today `editor.draft.discard` « Annuler les
modifications », `apps/app/src/i18n/fr.ts:1238`), so no discard of unsaved changes is called « Annuler »;
dialogs that close without effect keep « Annuler » (outside T15, DECISIONS T15); its confirmation and behaviour
are unchanged.
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).
[amended 2026-11-05, U0, wording matched to the code] The copy is keyed by account and version
(`apps/app/src/editor/state/recovery.ts:47-49`); the revision is a field of the copy (`recovery.ts:25`), used
as the expected revision at restore (C27). Behaviour unchanged.
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.
[amended 2026-11-05, U0] Board 05 is v1-2-4's and stays the reference of this read-only mode under O14 A.
Board 15 C of v1-2-6 shows the same rule only as an illustration: its two-sentence notice and the absence of
tabs and summary there are not adopted; the notice title alone, the tabs and the summary stay.
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.
[amended 2026-11-05, U0, §17.12] This list describes level 1. The redesign changes, each on its own
authorisation: one read-only core value (U2), two core queries (U5), and at U6 the category model (core rules
and edit refusals, a bounded widening of the snapshot reader, one SQL migration with the declared checks of
contract §12.2), under `docs/development/V1-2-6_UX_COMPATIBILITY.md`. The seed, the legacy sources, the
oracles, the goldens, the wasm budget rule and `r5:import-equine --check` stay unchanged.
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`).
[amended 2026-11-05, U0, §17.12] With the redesign the keyboard path goes through the handles and the
rectangle (C7 and C6 as amended), not through numeric fields; the redesign's tests are in
`docs/development/V1-2-6_UX_TESTS.md` (U1 to U8). The other tests are unchanged.
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.
25. [gated 2026-11-03] The plan's eight visible choices are built as approved; no JSON export or import of the
recovery copy; every message about the copy says it is temporary, limited to this tab and not saved on the
server, and reads the real write flag.
[amended 2026-11-05, U0, §17.12] Of the plan's eight choices, the redesign replaces three: categories edited in
Général (now in Annotations, C4), keyboard creation through numeric fields (now through handles, C7), the
properties card under the canvas from 1 024 to 1 279 px (now beside it, board 13).
Plan choice 2 (creation panels ask names and laterality before the element exists, no preselection, no default
labels): for detail views it gives way to the validated name proposal (ARBITRAGES choice 6, contract §8.2 as
amended, C6); for points and zones it differs from boards 02 and 04 (laterality and other properties set after
creation), an open owner question listed in DECISIONS, plan choice 2 in force until it is answered. The other
four stay.
26. [gated 2026-11-03] Default point: radius `r0 = min(12 + 0.03 × max(w, h), min(w, h) / 2)` in the view's frame
as composed by the core (composed root `viewBox`, origin kept); the clicked position is kept with r0 when the
circle fits, else with a smaller radius when the core accepts it; otherwise a corrected position is shown
beside the original click and used only after an explicit confirmation, with a cancel; no point is ever
created `out_of_frame` or `too_small` by the page's defaults, and no geometry commit leaves the changed
annotation `out_of_frame` (rolled back before anything is kept); the decision is the core's report, TypeScript
holds no copy of the frame or size rules; Node-core unit tests cover 40×30, 20×20, 100×300, very elongated
frames, non-zero origins, clicks on edges and corners, equality at the edge, 0.01 rounding and large
coordinates. (Refined by 33: the commit rule covers every geometry error, not only `out_of_frame`.)
27. [gated 2026-11-03] A recovery offer left unanswered blocks every document change: the store refuses commit,
undo, redo, save and submit, and the copy is neither written nor removed; consultation stays; « Restaurer la
copie » goes through the core and keeps the copy's base revision as the expected revision (`staleBase` when
older, never converted to the server's); « Ignorer la copie » is confirmed, removes the copy and resumes from
the server version; a copy the core refuses is reported, kept, never applied, and editing stays blocked until
it is ignored.
28. [gated 2026-11-03] A copy is removed only by a successful save leaving nothing unsaved, or a confirmed
« Annuler les modifications » ([amended 2026-11-05, U0] « Abandonner les modifications » from U1, C11 as amended), « Ignorer la copie »,
« Recharger » or « Abandonner cette copie »; never on
undo, never by automatic eviction; at most two copies of other versions of the account; when the cap or the
storage quota prevents keeping the current copy, the page says so and lists the other copies for an explicit,
confirmed abandonment; unit tests for the cap, the quota and pending copies.
29. [gated 2026-11-03] Conflict dialog: N from `draft_version.revision`, author and date from `draft_last_save`
only when its revision is N, never invented; a failed read offers « Recharger » and « Réessayer » only, with
« Garder ma version » disabled; a confirmed replacement saves with `expected_revision = N` under the server's
atomic check, and a new concurrent save re-opens the dialog instead of writing.
30. [gated 2026-11-03] Tests named by the owner, in e2e on a fresh sandbox: concurrent save between two sessions,
older-copy restore, a pending offer blocking edits, permission changes during an open session (grant revoked,
grant expired, admin role removed), drawing import (hostile and valid), keyboard-only paths, a point near the
edge of a detail crop (correction confirmed and cancelled); the full non-equine journey (C21).
31. [gated 2026-11-03] Records: the AAL2 residual risk (catalogue RPCs check the token's `aal2` claim, not the live
session, until the token expires after a factor removal) written in the V1-2 contract §13 as a production
prerequisite, not declared fixed, no authentication change in V1-2.6; the LRN-095 and BLK-013 id collisions
with develop recorded for the reconciliation before the merge, registries not renumbered.
32. [gated 2026-11-04] Unmeasured views (no accepted drawing, or `view.frame.unknown` for the view): drawing tools,
keyboard « Ajouter … » buttons and numeric geometry fields disabled with the hint naming « Vues et
illustrations »; existing annotations shown and selectable with read-only geometry, no drag; `accept` refuses
every creation and geometry commit there (checked on the post-commit state); the fallback frame `0 0 100 100`
is never used as a frame; the core stays the authority, no TypeScript frame or size rule.
[amended 2026-11-05, U0, §17.12] With direct manipulation the same views disable the handles, the size slider,
the keyboard handle moves, the creation tools and the detail-view rectangle, with the same hint naming where the
drawing is attached (Annotations after U1); there is no numeric geometry field left to disable.
33. [gated 2026-11-04] Geometry commits: accepted only when the changed annotation carries no Error at
`annotations[i].geometry` after the commit (new, valid or already invalid before), refused otherwise with the
handle rolled back and nothing kept; a typed radius the core reports `too_small` is refused; the geometry
fields form one group held in the form and applied whole, refused values stay shown as not applied with the
core's message and a way back to the stored values; an annotation already invalid is repaired that way and
its error stays visible until the fix is applied; a frame change (`view_box`, drawing) is refused when an
annotation without a geometry error gets one, or a measured view holding annotations becomes unmeasured; the
save path and the server verdict unchanged; Node-core unit tests for repair, `too_small`, drag rollback and
frame changes.
[amended 2026-11-05, U0, §17.12] The acceptance rule applies to every handle gesture, slider release and
keyboard move: a geometry commit is kept only when the changed annotation carries no Error at
`annotations[i].geometry` afterwards; a refused gesture restores the previous shape exactly, with the core's
message. The numeric form group leaves the normal journey: an annotation already invalid is repaired through its
handles, its error shown until the fix is accepted. The frame-change rule is unchanged.
34. [gated 2026-11-04] A drag starts after 4 CSS px (click, keyboard and touch kept); an unreadable copy is kept
until « Ignorer la copie » confirmed, its notice names the loss, editing blocked meanwhile; the leave guard is
armed only while unsaved or a recovery decision is pending, and its mobile-browser limits are documented; the
owner trial guide `docs/development/V1-2-6_OWNER_TRIAL.md` covers non-equine creation, SVG import, points,
zones and links, geometry correction, save and restore, two-tab concurrency and submission; the checkpoint
gives HEAD, commits, test and audit results.
35. [gated 2026-11-04 checkpoint] The uncommitted Prettier changes under `apps/app/src/editor/state/` are restored
only after a kept copy of their diff and a per-file proof that nothing but formatting differs from HEAD.
36. [gated 2026-11-04 checkpoint] Counts agree in number in FR and EN (« 1 erreur bloquante », « 2 erreurs
bloquantes »), through one plural mechanism, every editor count string included.
37. [gated 2026-11-04 checkpoint] Leading and trailing spaces are removed from names and simple single-line labels
before they are committed; descriptions, notes, citations, URLs, SVG content and secrets are never altered.
38. [gated 2026-11-04 checkpoint] Mode precedence: rights, then the sheet's state (inactive, historical, frozen),
then the screen width; server checks keep the last word.
39. [gated 2026-11-04 checkpoint] « Utiliser l'illustration de la vue parente » is kept, explicit (a confirmation
naming its effect) and non-destructive (undoable; the stored drawing is not deleted).
40. [gated 2026-11-04 checkpoint] Default tab at opening: Général for a new, empty sheet; Annotations for an
existing sheet with at least one measurable view; read-only modes kept.
[amended 2026-11-05, U0, §17.12] Same rule on the four tabs of C3: Annotations now also holds the views and
drawings, so a sheet without a measurable view still opens on Général and reaches the drawing upload from
Annotations.
41. [gated 2026-11-04 checkpoint] Attaching a drawing to an unmeasured view whose annotations would fall out of the
new frame no longer forces their deletion: the attachment and the repairs are prepared in a temporary state
and validated atomically by the Rust core (one commit, nothing kept on refusal). A new Rust operation, if one
is indispensable, is presented (design and impact) to the owner before it is built.
42. [gated 2026-11-04 checkpoint] « Ajouter une catégorie » creates at the root of the findings tree whatever the
selection; inserting under an element has its own explicit action.
43. [gated 2026-11-04 checkpoint] A voluntary sign-out with unsaved changes or local copies warns of the loss and
asks for confirmation; once confirmed, that account's local copies are purged. After an involuntary session
end, a copy is never exposed to another account; only the same user may recover it.
44. [gated 2026-11-04 checkpoint] New FR/EN labels stay proposals for a separate review; the verifier's 33/34 is
reconciled with the contract-order run, and 34/34 is stated only if a fresh verification confirms it; the
owner trial guide's commands are run from `/home/bchanot/Documents/faunosteo-v1-2` (local URL
`http://127.0.0.1:5193`, SSH tunnel documented), no DEV, no DEV worker, no merge, no V1-2.7.
45. [gated 2026-11-04 final] Free paths in the repair dialog: never replaced by a triangle or any automatic
shape; every original vertex kept; out-of-frame vertices identified and corrected explicitly only when the core
allows it; attach and corrections validated atomically; cancel loses nothing; an invalid geometry is never saved
or submitted. Without a core operation for it, no TypeScript path parser or rival validation: the attach is
refused cleanly with the document unchanged, and the minimal core evolution is presented to the owner before it
is built. Non-regression test with a complex free path and several vertices outside the frame.
46. [gated 2026-11-04 final] « Ajouter une catégorie » never depends on the selected node: it creates a category on
the first level directly under a zone of the business model, the zone chosen explicitly; adding child findings
stays a separate explicit action. (Owner confirms « root » = that first level.)
47. [gated 2026-11-04 final] The owner trial is reachable from the trusted LAN at http://192.168.1.100:5193 without a
tunnel: the app server bound to 192.168.1.100 only (never 0.0.0.0), the browser's Supabase URL is that origin
(Auth, REST, Storage proxied to the loopback trial gateway, no other port opened), Vite host check limited to
that address, Supabase DEV and its ports 54321-54324 untouched, no production configuration changed, no
Internet exposure; authentication, MFA and RLS unchanged; the journey (sign-in, MFA, catalogue, SVG import,
save) checked through that address; the guide gives the address and exact start/stop commands.
48. [gated 2026-11-04 final] Final controls: affected tests, restore/conflict/non-destruction of annotations,
historical documents unchanged, an independent verification of criteria 23 and 34 on a written final report, a
security review of the final changes; « 34/34 » stated only when established.
## 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) and §13 residual risks (AAL2 line, [gated 2026-11-03]),
ANNOTATION-RENDERING.md editor overlay section, design README / REVUE pointers, owner test
procedure, label proposals under .claude/audits
- .claude/tasks (plan, TODO), .claude/memory (through memory.sh)
- [amended 2026-11-04, each file required by a gated criterion or the approved plan; to confirm at the owner
checkpoint] apps/app/src/components/shell/{SignOutButton,SignOutLossDialog}.tsx and
apps/app/src/app/usePurgeForeignCopies.ts (C43); apps/app/src/catalogue/{catalogue,useFraming}.ts,
apps/app/src/components/catalogue/CatalogueCanvas.tsx, apps/app/src/components/admin/WorkingCopyAction.tsx,
apps/app/src/components/ui/Icon.tsx, apps/app/src/state/persistence.ts, apps/app/src/admin/labels.ts (C1, C7,
C11, C13, C16, C17 reuse); apps/app/vite/trial.config.ts, scripts/db-sandbox.sh, docs/development/SUPABASE.md
(plan choice 7, C25); supabase/tests/023_sheet_draft_last_save.sql (M8 pgTAP); packages/supabase/tests/sandbox/**
and apps/app/e2e/playwright.shell.config.ts (C20, C22); [amended 2026-11-04 after the owner's approval of a09e24d] apps/app/e2e/playwright.lan.config.ts and
apps/app/e2e/lan/** (C47: the LAN trial check); apps/app/tests/helpers/** (the unit tests' editor harness, C20)
- NOT in scope: crates/**, supabase/migrations/** (except a read migration if the owner chooses it),
supabase/seed/**, legacy sources, goldens, oracles