chore(memory): R2 plan rev 4 after owner GO (panel from a finding only)

This commit is contained in:
bchanot committed 2026-11-12 19:55:13 +01:00
1 parent 49867bad19
commit 65a8fd37b8
3 files changed
+75 -16

No files matched your search

+1
View File
@@ -696,6 +696,7 @@ Order (BDR-071): P0 docs + decisions → V1-1 clients and animals → V1-2 sheet
- [ ] R2 fifth tab « Références », tiles, search + clear, view-only sort, panel from a finding only (34 rem, 150-200 ms slide, reduced motion). Plan APPROVED (owner 2026-11-12 « Validation du plan R2 »); GO was gated on the owner's visual confirmation of `927537b` on db:trial: confirmed 2026-11-12, GO R2 given (brief « Validation finale R1, correctif E2E et GO R2 ») AFTER anomaly B is fixed and validated (fails or needs existing data changed → stop, R2 not started). Flow `/ship-feature` (plan file, challenge, contract), one commit + push per validated sub-lot, sandbox-only automated tests, no SQL / Rust / worker / MFA / roles / trial data change, no merge, no deploy, R3 R4 U2 U2b not started, untracked review file kept. Stop at the final R2 checkpoint (commits, test results, independent reviews, known gaps, db:trial manual protocol)
- Owner decisions: (A) presentation sort + search in TypeScript, never mutating document, stored order, ids or history; exception written in `RUST_ARCHITECTURE_REVIEW.md` Part II · (B) EN labels of `REVUE.md` = working basis, not ratified: exhaustive FR/EN table of new or changed R2 labels with ambiguities, app terminology kept, shown at the checkpoint before final validation · (C) anomaly B fixed apart (below)
- Extra requirements: cited reference never deletable · « Retirer de ce constat » removes that one association only, undone by « Défaire » · no edit action in read-only · several findings citing one reference · panel only from a finding · focus back to its origin if it still exists · Vérification « Aller à » opens the right tile with focus · reader catalogue unchanged · panel ≤ 34 rem, never wider than available · no drawing shift on panel open / close · widths 375, 1 024, 1 180, 1 279, 1 280 · `prefers-reduced-motion` · closed panel (exit animation included) neither interactive nor keyboard-reachable · visual ops never mutate stored order · four sorts tested · A1 to A4 kept · references still reachable when a search returns nothing
- Owner GO on plan rev 3 (brief « GO R2 — Plan révision 3 », 2026-11-12): arbitrations 1-5 approved (permanent dvh min-height, motion/react, 3 provisional FR labels, Type sort business order stable, « Tout afficher » keeps tiles and edits); mandatory correction folded as plan rev 4: panel from a finding ONLY (the family's existing trigger removed, family keeps inline « Retirer »); data controls on full rows incl. metadata (`guard.sh`, 197 018-row baseline); editor-equine never run, never reported verified
- [ ] R2.0 internal rename of the panel place (`references` → panel name), no visible effect
- [ ] R2.1 five-tab model (`EDITOR_TABS`, « Plus » below 640 px, header button removed, reference targets → tab, focus requests)
- [ ] R2.2 Références tiles (closed / open / edit, disclosure, citation count, hint instead of « Supprimer » when cited, A2 state)
@@ -129,24 +129,45 @@ Fournir :
S'arrêter après R2 et attendre la validation utilisateur.
## CLARIFICATIONS
Q: family detail « n références » button? / A: same panel with family words (« Retirer de cette famille », badge « cette famille », « N références citées par cette famille »); new FR/EN labels in the checkpoint table. [gated 2026-11-12]
Q: family detail « n références » button? / A: same panel with family words (« Retirer de cette famille », badge « cette famille », « N références citées par cette famille »); new FR/EN labels in the checkpoint table. [gated 2026-11-12] SUPERSEDED by the owner GO below.
Q: 640-1 023 px tab row? / A: all five tabs shown; the row may wrap (fixed per width, never moves on interaction, no horizontal scroll). [gated 2026-11-12]
Q: « Retirer » marks the finding / family « À confirmer » (core rule, edit.rs)? / A: accepted; documented in docs and db:trial protocol; one « Défaire » restores both. [gated 2026-11-12]
Q: shell gate with editor-equine? / A: excluded from every run (owner §3, §4 « ne pas déclencher une suite dangereuse »); its helper calls are updated for typecheck only, never run; per-id snapshot of pre-existing anatomical_sheets before/after each shell run.
Q: where does the FR/EN table live? / A: `docs/development/V1-2-6_R2_LABELS.md` (decided in plan, shown at the gate).
Q: panel from a family? / A: NO. Owner GO 2026-11-12 (brief « GO R2 — Plan révision 3 », « Correction obligatoire de R2.1 »): the contextual panel opens only from a finding, per the earlier decision; never from a family without a new arbitration; the library stays reachable from the Références tab. The trigger a family's detail shows today (shared FindingContent) is removed; the family keeps its inline citation list with « Retirer ». [gated 2026-11-12]
Q: arbitrations of the gate? / A: owner GO 2026-11-12: (1) permanent Places min-height on the available screen height, mobile browsers and viewport changes handled, no drawing move, no horizontal overflow; (2) motion/react instead of Tailwind motion-reduce:, prefers-reduced-motion and focus return mandatory with or without animation; (3) « Ce constat ne cite plus aucune référence », « Référence introuvable », « Saisie non appliquée : … » accepted provisionally, EN not ratified one by one, full FR/EN table at R2.6; (4) Type sort in business order, deterministic and stable for equal types; (5) « Tout afficher » resets search and sort, keeps open tiles and any edit in progress, never loses a valid entry nor closes unexpectedly. Data controls must prove no unauthorised change, metadata included. [gated 2026-11-12]
## ACCEPTANCE CRITERIA
Seed (from the request); design criteria appended at STEP 3 with [gated].
1. Five editor tabs in the order Général, Annotations, Constats, Références, Vérification; below 640 px « Plus » holds Général, Constats, Références; no header « Références » button.
2. A cited reference never shows « Supprimer » (hint instead); an uncited one keeps « Supprimer » + existing dialog; the core refusal stays the authority.
3. « Retirer de ce constat / cette famille » removes only that association, one « Défaire » restores it; the reference stays in the document.
3. « Retirer de ce constat » (panel, finding only) removes only that association, one « Défaire » restores it; the reference stays in the document. [corrected 2026-11-12, owner GO: no family wording]
4. Read-only and no-right modes show no edit control in the tab or the panel.
5. Search and the four sorts are TypeScript display functions over ids; the document text, stored order, ids and history are identical before and after any search or sort (tested).
6. The panel opens only from a finding or family, width ≤ 34 rem and ≤ available width, slide 180 / 140 ms, none under reduced motion, page inert and panel unreachable while closed or exiting, focus back to the trigger if it still exists; no layout shift of the tab content on open / close.
6. The panel opens only from a finding (never from a family; corrected 2026-11-12, owner GO), width ≤ 34 rem and ≤ available width, slide 180 / 140 ms, none under reduced motion, page inert and panel unreachable while closed or exiting, focus back to the trigger if it still exists; no layout shift of the tab content on open / close.
7. A1 to A4 hold; « Aller à » from Vérification opens the right tile, open and focused; references reachable when a search returns nothing (clear button).
8. Exhaustive FR/EN table of new and changed labels with ambiguities: `docs/development/V1-2-6_R2_LABELS.md`; Rust exception rows in `RUST_ARCHITECTURE_REVIEW.md` Part II.
9. Gates per sub-lot: typecheck, lint, test:run, build; e2e:ui; e2e:shell on db:sandbox without editor-equine; pre-existing rows unchanged per id; one commit + push per sub-lot.
10. No change under supabase/, crates/, scripts/db-trial*, docker/; no db:trial / DEV access; untracked review file kept; no merge.
11. [gated 2026-11-12] A family's detail shows no « {n} références » trigger and keeps its inline citation list with « Retirer »; `open_citations` with a family key is a no-op; the panel carries no family wording.
12. [gated 2026-11-12] The header « Références » button and its id are gone.
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && ! grep -rq "REFERENCES_BUTTON_ID" apps/app/src && ! grep -rq "editor-references-panel" apps/app/src && echo NO_HEADER_BUTTON
EXPECT: NO_HEADER_BUTTON
EVIDENCE: pending
13. [gated 2026-11-12] New files exist: pure sort and safe-link modules, the two new shell specs, the labels table.
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && test -f apps/app/src/editor/references/sort.ts && test -f apps/app/src/editor/references/safeLink.ts && test -f apps/app/e2e/shell/editor-references.spec.ts && test -f apps/app/e2e/shell/editor-citations.spec.ts && test -f docs/development/V1-2-6_R2_LABELS.md && echo R2_FILES_OK
EXPECT: R2_FILES_OK
EVIDENCE: pending
14. [gated 2026-11-12] Sorts: sheet order, citation (Intl.Collator base + numeric), citation count descending, Type in REFERENCE_TYPES order; equal keys keep the stored order (deterministic, stable); inputs never mutated; unit-tested with permutations.
15. [gated 2026-11-12] Closing: every close (✕, Escape outside text fields, scrim, « Tout afficher », « Aller à », tab switch, element gone, read-only flip) records one pending move applied after the exit; focus lands on the trigger if present, else the active tab button (« Plus » below 640 px); checked by `document.activeElement` in normal and reduced motion; page inert and panel unreachable during exit; a user close with a refused draft is cancelled (field focused), a forced close drops it with the « Saisie non appliquée : … » announcement.
16. [gated 2026-11-12] « Tout afficher » resets search and sort, keeps open tiles and any tile in edit; a valid panel draft is committed before the close.
17. [gated 2026-11-12] Layout: Places min-height = dynamic viewport height minus the top bar, permanent; panel wrapper `overflow-x: clip`; document scrollWidth / scrollHeight and the drawing box unchanged before, during and after open / close at 375, 1 024, 1 180, 1 279, 1 280 px and across a viewport height change and a rotation at phone width.
18. [gated 2026-11-12] Safe links: DOI and URL rendered as links only when http(s) / a valid `10.x/…` DOI; `javascript:` never a link; dangling citation ids shown as « Référence introuvable » with « Retirer »; duplicate ids stay distinct.
19. [gated 2026-11-12] Data controls: every shell run goes through the preflight (editor-equine never listed) and the full-row guard (every column of every row of public, audit, storage tables and auth.users); no pre-existing row changed or deleted, metadata included; new rows counted per table and reported.
20. [gated 2026-11-12] No change outside scope since 49867ba.
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && [ -z "$(git diff --name-only 49867ba..HEAD -- supabase crates docker packages/supabase/src scripts)" ] && echo SCOPE_OK
EXPECT: SCOPE_OK
EVIDENCE: pending
## FILE SCOPE
apps/app/src/editor/{tabs,navigation,focusRequest,useEditorNavigation,verification,editingContext}.ts, apps/app/src/editor/annotations/deselect.ts, apps/app/src/editor/references/** (new sort.ts), apps/app/src/components/editor/{EditorWorkspace,EditorTabBody,EditorTabs,DraftHeader,HeaderActions,KeptPlace}.tsx, apps/app/src/components/editor/references/**, apps/app/src/components/editor/findings/{FindingsTab,FindingContent,FindingDetail}.tsx, apps/app/src/components/editor/tabs/** (new ReferencesTab), apps/app/src/i18n/{fr,en}.ts, apps/app/tests/unit/**, apps/app/e2e/{support,shell,ui}/**, docs/development/{V1-2-6_U1_CORRECTIONS,BROWSER_TESTS,V1-2-6_OWNER_TRIAL,RUST_ARCHITECTURE_REVIEW,V1-2-6_R2_LABELS}.md, docs/design/README.md, CLAUDE.md (tree), this contract, the plan, .claude/tasks/TODO.md, memory.
@@ -1,10 +1,12 @@
# PLAN — R2 « Références » tab (V1-2.6) — rev 2
# PLAN — R2 « Références » tab (V1-2.6) — rev 4
Contract: `.claude/tasks/contracts/2026-11-12-r2-references-tab-1730.md`. Sources: `docs/development/V1-2-6_U1_CORRECTIONS.md`
§R2 (D1-D4), `docs/design/v1-2-6-r0/{ARBITRAGES.md A1-A5, REVUE.md, maquettes.html boards 23-27}`, TODO R2 block
(a1d4084), BDR-114, BDR-107..110, BDR-113. Read-before digest: analyzer 2026-11-12.
Rev 2 = rev 1 + challenge round 1 (correctness FATAL(5), robustness FATAL(7), simplicity CONCERNS(1)); changes tagged
[Cn] / [Rn] / [Sn] with the finding number.
[Cn] / [Rn] / [Sn] with the finding number. Rev 3 = challenge round 2 (section at the end). Rev 4 = owner GO 2026-11-12
(brief « GO R2 — Plan révision 3 »): panel from a finding only, arbitrations 1-5, full-row data guard (section at the end;
in-place edits marked [O4]).
Plan form (deviation from writing-plans « full code », stated): ~30 files; each task gives files, behaviour, test cases
and verification; executors write the code under TDD. Design = owner-validated boards (BDR-110), no brainstorm.
@@ -15,7 +17,7 @@ and verification; executors write the code under TDD. Design = owner-validated b
- Never touch supabase/, crates/, scripts/db-trial*, docker/, packages/supabase/src, components/catalogue/ (reader
unchanged) [C9]. No db:trial, no DEV.
- Shell runs: `pnpm db:sandbox e2e-shell <explicit spec list>`; NEVER `editor-equine.spec.ts` (owner §3).
- Data guard [R6]: before and after each shell session, per-id snapshot of pre-existing rows of `anatomical_sheets`
- Data guard [R6] (superseded by rev 4 G3, full rows): before and after each shell session, per-id snapshot of pre-existing rows of `anatomical_sheets`
(id, status, archived_at, updated_at) AND `anatomical_sheet_versions` (id, status, the revision / updated_at columns,
md5(content::text)); compared per id (changed or missing = stop); new rows counted and their sheet ids listed per run
(owner §3 fixture tracking). Select-only through `pnpm db:sandbox sql`.
@@ -35,7 +37,11 @@ and verification; executors write the code under TDD. Design = owner-validated b
- P4 [C6] « Tout afficher dans l'onglet Références » = its own action `show_all_references`: closes the panel, then
(after exit, P9) selects the tab with a reset signal (search and sort reset, open tiles and a tile in edit kept),
focus on the tab heading. Vérification's unresolved reference path selects the tab WITHOUT reset.
- P5 [owner] family trigger → same panel, family words.
- P5 [O4] The panel opens ONLY from a finding (`finding_node`), never from a family (`finding_category`): owner GO
2026-11-12 overrides the pass-B answer « same panel with family words ». The trigger « {n} références » is rendered
only in a finding's detail; a family's detail keeps its inline citation list (« Retirer », picker) and loses the
trigger it shows today (shared `FindingContent`). `open_citations` refuses a key that is not a finding (no-op).
No family words in the panel. Families still count and appear in a tile's « Citée {n} fois, par : » list (A4).
- P6 [C2][R2] focus fallbacks, in order: the trigger (re-found by `data-citations-trigger=<element key>`) if shown →
else the active tab button via `focusActiveTab()` (« Plus » button below 640 px). Never a missing heading.
- P7 panel: no search, add, delete, reorder (board 25).
@@ -65,8 +71,8 @@ and verification; executors write the code under TDD. Design = owner-validated b
- P19 [S3] one memoised `citersOf(doc): Map<refId, CiterItem[]>` (families and nodes at any depth); tile count =
list length; `citationCounts` derived from it (or removed with its last consumer).
- P20 [C3][R2] After « Retirer … »: focus the next tile's disclosure button, else the previous, else the panel heading;
zero citations left → the panel stays open with the line « Ce constat ne cite plus aucune référence. » / « Cette
famille ne cite plus aucune référence. » (new provisional labels) + « Tout afficher »; close then follows P6 (the
zero citations left → the panel stays open with the line « Ce constat ne cite plus aucune référence. » (new
provisional label) + « Tout afficher » [O4]; close then follows P6 (the
trigger is gone when its count is 0).
- P21 [C2][R2] Selecting a tab while the panel is open closes it (pending move = the tab; focus on the new tab button).
Défaire / Refaire stay usable with the panel open; an undo that removes the element triggers P6.
@@ -104,7 +110,8 @@ shell-layout + data guard. Commit + push.
plumbing (P9) introduced here with the current (non-animated) panel so focus rules hold from R2.1.
- `verification.ts` reference issues → tab; `useEditorNavigation.ts` landing on the tab heading; fallbacks P6.
- Header button, separator and props removed (HeaderActions, DraftHeader, EditorWorkspace).
- Trigger (FindingContent): `open_citations`, `data-citations-trigger`, `aria-expanded`, `aria-controls` (P13).
- Trigger (FindingContent, finding nodes only [O4] P5): `open_citations`, `data-citations-trigger`, `aria-expanded`,
`aria-controls` (P13); removed from a family's detail (R-24 row in the commit body, e2e / unit using it remapped).
- i18n: `editor.tab.references`; removals per [R10].
- E2E [C7][R7]: tier-aware `openTab(page, dict, tab)` (opens « Plus » below 640 px); `TABS` five; each existing
`openReferences` call mapped explicitly (R-24 table in the commit body) to `openTab(…,'references')` (library) or
@@ -151,11 +158,12 @@ Gate: as R2.2. Commit + push.
## R2.4 — contextual panel — `feat(editor): …`
- `CitationsPanel.tsx` (board 25): overlay geometry P16; header book icon + « Références citées » + ✕ 44×44 « Fermer
les références »; path line; count line « {n} références citées par ce constat / cette famille » + « Tout afficher dans
l'onglet Références » (P4); tiles (meta 132 px) with « Modifier », « Retirer de ce constat / cette famille » (P15,
P20), « Aller à »; « ce constat / cette famille » badge; P7; zero state P20.
les références »; path line; count line « {n} références citées par ce constat » + « Tout afficher dans l'onglet Références »
(P4); tiles (meta 132 px) with « Modifier », « Retirer de ce constat » (P15, P20), « Aller à »; « ce constat » badge;
P7; zero state P20 [O4].
- Motion and focus P9, P6, P21, P22 (close with a tile in edit); `ReferenceLibrary` folded into `ReferencesTab` (P25).
- Unit: open only through the trigger; filtered; family words; Retirer removes only that id, reference stays, one undo
- Unit: open only through a finding's trigger; a family's detail has no trigger and `open_citations` with a family key
is a no-op [O4]; filtered; Retirer removes only that id, reference stays, one undo
restores (and the review status); P20 focus chain and zero state; P4 reset + heading focus; every close path applies
its pending move after exit and the focused element is the expected one (activeElement); P21; P6 after undo; reduced
motion (no transition) vs normal; inert page and panel during exit; `ReferencesOpenContext` until exit; read-only: no
@@ -174,8 +182,8 @@ Gate: as R2.3 + citations spec + layout spec. Commit + push.
(no assertion lost without a mapped replacement); gaps found here are fixed in this sub-lot.
## R2.6 — docs, labels, closure — `docs(…): …`
- `docs/development/V1-2-6_R2_LABELS.md`: every new / changed / removed key (key, FR, EN provisional, where, family
variants, ambiguity notes).
- `docs/development/V1-2-6_R2_LABELS.md`: every new / changed / removed key (key, FR, EN provisional, where, ambiguity
notes; among them the tile badge « famille » (A4, REVUE) while the editor still says « Catégorie » until U2b F7) [O4].
- `RUST_ARCHITECTURE_REVIEW.md` Part II §II.2 rows (class C, phase n/a) for `editor/references/{filter,citations,sort,
safeLink}.ts` + §II.3 bullet (BDR-114 A).
- `V1-2-6_U1_CORRECTIONS.md` §R2 status (incl. P15 « À confirmer », P20, P21); `BROWSER_TESTS.md` (new specs, equine
@@ -243,3 +251,32 @@ commit. Fresh verifier + security + code review on the whole of R2 at the end.
e2e/shell/editor-journey.spec.ts e2e/shell/editor-recovery.spec.ts e2e/shell/editor-drawings.spec.ts
e2e/shell/editor-signout.spec.ts e2e/shell/admin.spec.ts e2e/shell/shell.spec.ts + the new R2 specs as they land
- R2.5: every file of `ls e2e/shell/*.spec.ts` except editor-equine.spec.ts, written out in full in the command.
## Rev 4 — owner GO 2026-11-12 (brief « GO R2 — Plan révision 3 »); overrides rev 2 and rev 3 where they differ
- O4-1 Panel from a finding only: P5 rewritten in place; criteria 3 and 6 of the contract corrected; the pass-B family
answer is superseded (contract CLARIFICATIONS). The library stays reachable from the Références tab (R2.1).
- O4-2 [arbitration 1] Places keeps the PERMANENT `min-h-[calc(100dvh-<top bar>)]` (P16'): `dvh` follows the mobile
URL bar and every viewport change (rotation, resize, on-screen keyboard); `<top bar>` is the editor's real sticky
offset, verified at every tier before use (3.5rem assumed by rev 3; any other value or a tier difference uses the
same token as the sticky `top`). No drawing move, no horizontal overflow. E2E (layout spec): 375 × 667, then a
height change to 375 × 560 and a rotation to 667 × 375 with the panel open: `scrollWidth` ≤ `clientWidth`, panel
bottom = viewport bottom, drawing box unchanged across open / close. Limit stated: Chromium cannot emulate a real URL
bar collapse; the resize stands in for it.
- O4-3 [arbitration 2] `motion/react` accepted; P29 kept; every close path checks `document.activeElement` after exit
in BOTH modes (normal and `emulateMedia({ reducedMotion: 'reduce' })`), unit and e2e.
- O4-4 [arbitration 3] Provisional FR labels accepted: « Ce constat ne cite plus aucune référence. », « Référence
introuvable », « Saisie non appliquée : … »; EN not ratified one by one; full FR/EN table at the R2.6 checkpoint.
- O4-5 [arbitration 4] « Type » sort: REFERENCE_TYPES business order; equal types keep the stored order (position),
so the result is deterministic and stable; unit test: same output for every input permutation of equal-type items
restored to stored order, and inputs untouched.
- O4-6 [arbitration 5] « Tout afficher » resets search and sort only; open tiles and any tile in edit (tab or panel) are
kept. A panel tile in edit goes through P22'': a valid draft is committed before the close, a refused draft cancels
the close (field focused, message shown): never a lost valid entry, never an unexpected close. Unit + e2e.
- G3 [owner data controls] Full-row data guard replaces R6 / G2: `scratchpad/r2/guard.sh` (read-only transaction,
`pnpm db:sandbox sql`) hashes EVERY column (metadata included: updated_at, archived_at, status…) of EVERY row of every
base table of `public`, `audit`, `storage` and of `auth.users`, keyed by table + id; before / after each shell run;
any pre-existing row changed or deleted, in any table = stop and present before the commit; new rows counted per
table (fixture tracking). Baseline 2026-11-12: 197 018 rows, two consecutive snapshots identical.
- G4 Every shell run goes through `scratchpad/r2/run-shell.sh <label> <full spec paths>`: refuses a bare argument or
an editor-equine path, aborts if `--list` names editor-equine, then snapshot, run, snapshot, diff. editor-equine is
never run; its helper calls are updated for typecheck only and reported « mis à jour, non exécuté, non vérifié ».