chore(memory): R2 corrections, BDR-115, LRN-133..135, BLK-015

Plan rev 5/5b and contract criteria 21-29 (25 amended to the two-part touch proof), TODO line, journal.
This commit is contained in:
bchanot committed 2026-11-13 15:35:31 +01:00
1 parent 538ce275ce
commit 36c6eb3fea
7 files changed
+207 -3

No files matched your search

+8
View File
@@ -116,3 +116,11 @@ Friction: `apps/app/e2e/shell/admin.spec.ts` « admin screens: axe and no sidewa
Root cause: working copy exists only for historical sheet (`private.historical_sheet_id()` fixed `503dc301-…`; `create_sheet_working_copy` refuses other source `working_copy.source_invalid`) and ONE active copy per database. Test required slot free in shared persistent sandbox. (a) slot taken by `8c315a12-…` leaked by `packages/supabase/tests/sandbox/sheets-admin.sandbox.ts` (`kindOf` discarded created id; afterAll deleted accounts, not sheets). (b) `editor-equine.spec.ts` set-aside (archive active copies, create own, restore) flips slot while admin.spec runs in parallel (fullyParallel, 8 workers).
Solution: 2cdee42 (owner option 1). Dialog checks → e2e:ui harness `e2e/harness/working-copy.*` + `e2e/ui/working-copy.spec.ts` on real `WorkingCopyAction` (StrictMode, MemoryRouter, free + taken): axe, overflow, panel in viewport, name, description, prefilled slug, explicit Tab/Shift+Tab order with one 'browser' step, Escape + focus return, taken disabled + reason. Shell: historical page kept in axe/overflow loop + state-consistent button check (disabled iff reason shown and linked). Sandbox suite: every created copy id captured, archived only those, `returning id` asserted equal, 3 independent cleanup steps, first error rethrown. Before 4 failed → after 4 passed ×2; full admin.spec 16/8 skipped/0; e2e:ui 251 ×2; sandbox sheets-admin 5/5; 637 pre-existing anatomical_sheets rows identical per id. Verifier CONFORME 6/6, security PASS (1 LOW: optional uuid check before interpolation).
Scope of resolution: THESE 4 failures only. NOT all concurrency risks of e2e suites: editor-equine set-aside still writes pre-existing copies (8c315a12 updated_at already changed 2026-11-12 13:40 UTC by R1 follow-up run) → TODO, separate fix, suite not run on persistent data meanwhile. Open: cleanup creation branch and shell free-slot branch not run on a fresh stack. Limit (documented): dialog no longer a11y-checked in real server context by this test. Test fixtures accumulate (A1 sheets never archived) → tracked.
## BLK-015 — admin.spec rights screen crashes under axe on accumulated e2e grants (sandbox) (2026-11-13)
- **Status**: open
Friction: `apps/app/e2e/shell/admin.spec.ts` A0 « the rights screen with grants » (:373, sometimes :369 grant row not visible) and « admin screens » (:750 loop, fr/en, desktop + 375) fail with « Target crashed » inside axe (`e2e/support/browser.ts:219`) on persistent sandbox; locale varies run to run.
Real cause: accumulation of e2e grants in persistent sandbox. Rights screen (/app/admin/access) renders EVERY grant (`list_catalog_grants` no argument, `GrantList` shows all) → renderer dies under axe. Grants 753 → 1 282 (R2.3) → 2 269 (C0 start 2026-11-13) → 3 515 (C6 end); each admin.spec run adds 25 grants + 25 accounts, full sweep +149.
Evidence: interleaved A/B admin.spec alone, pre-R2 worktree 65a8fd3 vs HEAD 52aac41, 4 runs all 13p/8s/3f same crashes → not an R2 regression. Dose-response quiet window (temp spec copy routing list_catalog_grants to 753 newest rows, deleted after): capped 16p/0f (2 526 grants), full 11p/5f 4 crashes (2 551), capped 16p/0f (2 570). Final sweep c6sweep2 221p/119s/5f all admin.spec; isolated 12p/8s/4f. Guard OK every run.
Solution: none applied (owner: no reset, no deletion of pre-existing data, pagination stays in RR-13). Rerun admin.spec alone only as diagnosis, never as gate. Close when RR-13 paginates grant list (or run-scoped fixture cleanup approved) and admin.spec green on sandbox.
Refs: `docs/development/BROWSER_TESTS.md` §6, `V1-2-6_U1_CORRECTIONS.md` §R2, BDR-115, LRN-133.
+15
View File
@@ -940,3 +940,18 @@ Owner brief « R0 — Autorisation des trois dernières corrections graphiques
**Constraints**: sandbox-only automated tests; no SQL migration, Rust/worker, roles, MFA, secrets, trial data, historical sheet or manual working copy change; no merge/deploy; R3/R4/U2/U2b not started.
**Alternatives rejected**: sort/search in Rust core (no gain, ICU weight, no document impact); EN labels ratified en bloc (owner wants per-label check); set-aside/restore of existing copies like editor-equine (modifies existing data).
**Refs**: `.claude/tasks/TODO.md` R2 block (a1d4084), `docs/development/V1-2-6_U1_CORRECTIONS.md` §R2, `docs/design/v1-2-6-r0/{ARBITRAGES,REVUE}.md`, BDR-110.
## BDR-115 — R2 Références tab: owner-validated choices and 2026-11-13 corrections, pending manual validation (2026-11-13)
- **Status**: implemented, pending owner manual validation on db:trial
**Context**: R2 « Références » tab (V1-2.6) built 2026-11-12 (52aac41), owner brief 2026-11-13 (reviewed with ChatGPT) validated functional choices WITHOUT final validation, asked corrections before db:trial trial. Status: R2 implemented + corrected, PENDING owner manual validation on db:trial; nothing merged, nothing deployed.
**Decisions**:
- Read-only flip (width < 1024) keeps citations panel open (not a close, criterion 15 amended). Refused draft never dropped silently: tile in edit pinned (editingKey) through flip whatever search/sort; drop said once in polite live region + visible note in tile; forced close names every refused field once; flip adds no history entry (C1 3303530, 1e19479).
- « Annuler l'ajout » on draft tile + Escape (non-text target, or pristine text field; never during IME composition): document + undo/redo untouched, focus back to « Ajouter une référence » (C2 d177992, c8109af).
- Pinned tile outside search shows « Ne correspond pas à la recherche » (aria-describedby); « Aucun résultat » only when no tile shown, add draft excluded (C3 b1fd896).
- 667×375: trigger reachable by touch, proof only, no app code (C4 969a5f3..78fb2d0). Rotation-at-scroll-0 cramped exception kept, auto-scroll offered as option.
- User leave with several refused fields focuses first refused field WITH its own error (final review I1, 94f8a8b).
- Draft dropped with its tile (header « Défaire »/« Refaire » removes the reference in edit) announced once from the drop callback via surviving AnnounceContext; panel tiles silent during panel's own forced close (hostLeaving, relies on React 19 parent-first layout cleanup, guarded by forced-close count test) (verifier gap, cb1ad47).
- New keys provisional EN: add_cancel fr « Annuler l'ajout » en « Cancel adding »; outside_search fr « Ne correspond pas à la recherche » en « Does not match the search ».
**Stated limits** (owner to ratify): undo/redo replacing pending draft in still-mounted view overwrites typed text silently; two drops in one flip speak only last (visible notes remain); full page reload out of scope (recovery copy rules); rotation cramped exception; admin.spec red on accumulated sandbox (BLK-015).
**Alternatives rejected**: close panel on read-only flip (loses context); drop slot in a store (StrictMode, scope) → tile-local; rotation auto-scroll (scope, offered); per-field error map in useEditCommand (every panel uses it).
**Refs**: plan `.claude/tasks/plans/2026-11-12-r2-references-tab-1730.md` rev 5/5b, contract criteria 15, 21-29, `docs/development/V1-2-6_U1_CORRECTIONS.md` §R2, BDR-114, BLK-015.
+3
View File
@@ -557,3 +557,6 @@ R5.4: `draft/{labels,changelog,review_report,drawing,overlay,app_review,svg_comp
- 2026-11-12 R1 last owner feedback: « Sélection » tag above drawing made sr-only (927537b), drawing stable on select/deselect (desktop + 375 twin e2e); docs 00936c8 (board 04/26 deviation). BLK-013, LRN-131. Owner: R1 accepted technically, visual fix to confirm on db:trial; ToolNotes shift + SR selection announce + iOS open; RR-14 secrets rule added. R2 not started.
- 2026-11-12 R1 VALIDATED functionally by owner (10/10 manual checks + 927537b visual confirmation). BDR-114 R2 decisions recorded. Next: anomaly B e2e fix (isolated fixture), then R2 GO.
- 2026-11-12 Anomaly B fixed 2cdee42 (owner accepted): BLK-014, LRN-132. editor-equine set-aside risk + fixture accumulation tracked in TODO (separate fix). Owner GO R2.0-R2.6.
## 2026-11-13
- R2 corrections 2026-11-13: C0 admin.spec diagnosis (A/B + dose-response, accumulation, BLK-015 open), C1-C5 + final review I1 + verifier gap fixed (3303530..538ce27), sweep 221p/5f admin.spec only, guard OK, verifier CONFORME; stopped at R2 checkpoint for db:trial trial.
+19
View File
@@ -931,3 +931,22 @@ Limit: wording of this client version only.
- Avoid concurrent suites mutating the same singleton (set-aside/restore patterns race with readers under fullyParallel and alter pre-existing metadata such as updated_at).
- Prove non-interference: per-id snapshot (id, status, archived_at, updated_at) of pre-existing rows before/after; counts alone lie (fixtures add rows).
**Refs**: BLK-014, `e2e/ui/working-copy.spec.ts`, `sheets-admin.sandbox.ts` afterAll, `editor-equine.spec.ts` set-aside (open), LRN-076, LRN-082.
## LRN-133 — Guarded e2e on persistent sandbox: preflight wrapper, full-row guard, A/B then dose-response (2026-11-13)
**Context**: R2 shell e2e on persistent sandbox (editor-equine must never run there; pre-existing rows must stay identical).
**Rules**:
- Wrap every shell e2e run in a script: refuse bare args, refuse any spec named editor-equine, run `--list` first and abort if editor-equine appears (preflight), then run.
- Guard = full-row md5 per id of pre-existing rows in every touched table, snapshot before/after; report new rows per table + « pre-existing rows changed or deleted: none ». Counts alone lie; metadata (updated_at) included in the hash.
- Diagnose suite failures with interleaved A/B (pre-change worktree vs HEAD, same lockfile, same data) then a dose-response probe (cap the suspect input, same code/data) in a quiet window; loaded runs confound.
**Refs**: scratchpad wrappers run-shell.sh / guard.sh (R2), BLK-015, LRN-132.
## LRN-134 — Blur-commit plus explicit commit: stale value duplicates history; one error slot vs several refused fields (2026-11-13)
**Context**: R2 reference tiles: field blur commits value to history; « Terminer » / panel close also commit.
**Pattern**: blur-commit + explicit commit on the same gesture read a stale value → duplicate history entry (two undos for one edit). Fix: one commit path per edit, compare against document value at commit time, test « one history entry per edit » for blur, « Terminer », panel close (criterion 26, 1bf2701).
**Also**: a guard that tries several pending fields with one shared error slot leaves the LAST field's message; focus first refused field then re-assert its refusal (94f8a8b). Test focused field's aria-invalid, not just that an error exists.
**Apply**: any form with commit-on-blur plus a submit-like button.
## LRN-135 — Refusal layout shift loses the click (mousedown preventDefault); happy-dom observer and touch-slop test traps (2026-11-13)
**Context**: R2 « Terminer » below a field whose blur-commit is refused.
**Pattern**: mouse down blurs field → refusal line inserted → layout shifts → mouseup lands elsewhere → click lost (« Terminer » looks dead). Fix: `mousedown` preventDefault on the button (focus stays, button then runs the leave guard). Editor-wide general cure not done.
**Also (tests)**: happy-dom 20.10.6 holds MutationObserver callback in WeakRef → GC under load silently stops observation; count live-region announcements by wrapping textContent/nodeValue setters, restore in afterEach (c8109af, b1fd896). Touch e2e: CDP synthesizeScrollGesture touch scrolls nothing in Chromium 1248; dispatchTouchEvent swipes do, but slop floor ~60 px + load-dependent gain → pixel-exact touch landing not reproducible; prove reachability by touch, place worst case by programmatic scroll (78fb2d0).
+1
View File
@@ -705,6 +705,7 @@ Order (BDR-071): P0 docs + decisions → V1-1 clients and animals → V1-2 sheet
- [x] R2.5 tests and non-regressions (unit, e2e:ui, e2e:shell on db:sandbox, axe, keyboard walk, layout widths)
- [x] R2.6 docs, FR/EN label table, Rust exception (Part II), db:trial manual protocol, closure
- R2 BUILT 2026-11-13, awaiting owner validation: fc3fec7 R2.0, 4499bc7 R2.1, c21995b R2.2, 3baac4d R2.3, 8db6f42 R2.4, 4b7d254 R2.5, 2182307 R2.6 docs, 1bf2701 final-review fixes (all pushed). Verifier 18/20 (NOT-MET 9 admin.spec renderer crash from accumulated grants, 15 read-only flip keeps panel open), security PASS, final review ready-with-fixes → fixed, re-review ready. Owner decisions pending: read-only flip ratification, admin.spec closure before merge (fresh-run authorisation or separate fix: paginated grants / run-scoped cleanup), add-draft cancel control, V1-2_ANATOMICAL_SHEETS.md D1-D4 supersede note wording. editor-equine updated, never run. Parked: N1 silent draft loss on read-only flip of an unmatched tile, N2 pinned non-matching tile beside no-result, first-click loss below a refused field, landscape 667×375 panel 13 px, M10 locals over 5 in R2 hooks (/refactor)
- [x] R2 corrections (owner brief 2026-11-13, plan rev 5/5b): C0 admin.spec diagnosis (A/B 65a8fd3 vs 52aac41 identical, dose-response proves grant accumulation, BLK-015 open, pagination = RR-13), C1 read-only flip never drops a refused draft silently (3303530, 1e19479), C2 « Annuler l'ajout » + Escape (d177992, c8109af), C3 « Ne correspond pas à la recherche » (b1fd896), C4 667×375 touch proof, test only (969a5f3..78fb2d0), C5 docs (b919cf8, c0da36d, 58228ab), final review I1 (94f8a8b, 346a8fd), verifier gap undo drop announced (cb1ad47, 538ce27). Sweep 221p/119s/5f (admin.spec only), guard OK, verifier CONFORME, security PASS. BDR-115, LRN-133..135. Awaiting owner db:trial trial; residuals: two drops one flip speak last, undo/redo overwriting a pending draft in a mounted view, rotation cramped exception (auto-scroll offered), prettier drift editor-shell-layout.spec.ts:297-302
- [x] Anomaly B FIXED `2cdee42` (owner 2026-11-12 « Décision sur l'anomalie E2E », option 1): dialog checks moved to e2e:ui on the real WorkingCopyAction (`e2e/harness/working-copy.*`, `e2e/ui/working-copy.spec.ts`), shell keeps the historical page + state-consistent button check, sandbox suite archives only its own copies (`returning id` checked). Before 4 failed; after 4 passed ×2; full admin.spec 16 passed / 8 skipped; e2e:ui 251 ×2; sandbox sheets-admin 5/5; pre-existing anatomical_sheets rows identical per id (637 → 643, 6 added by A1). Verifier CONFORME, security PASS (1 LOW: optional uuid check before interpolation). Open: cleanup creation branch not run on a fresh stack; free branch of the shell check not run on this sandbox; `editor-equine.spec.ts` set-aside still archives and restores pre-existing copies (8c315a12 included, updated_at 2026-11-12 13:40 from the R1 follow-up run): owner decision. R2.0 waits for the owner's green light on this result
- [ ] editor-equine risk (owner 2026-11-12 « Validation du correctif E2E et GO R2 » §3; separate fix, NOT part of R2): `editor-equine.spec.ts` beforeAll archives every active historical working copy (`update public.anatomical_sheets … private.is_historical_working_copy(id)`), afterAll restores them, and `confirmHistoricalDrawing` may upload / confirm the historical sheet's drawing; it already changed 8c315a12's `updated_at` (2026-11-12 13:40 UTC). NOT to be run on a persistent database holding data to preserve until fixed. Before any rerun: list its writes exactly, propose a reproducible non-destructive isolation of pre-existing resources, check interactions with admin.spec and parallel suites; keep 8c315a12 and its current metadata (no artificial date restore); no sandbox reset or deletion
- [ ] e2e fixture accumulation (owner 2026-11-12 §3): sheets created by the suites persist on the sandbox (admin.spec A1 `fiche-e2e-<tag>` never archived, seedDraft / seedOfficialSheet sheets, editor copies); track them (count per run, owner per fixture) and propose run-scoped cleanup limited to ids each run created
@@ -139,6 +139,12 @@ Q: arbitrations of the gate? / A: owner GO 2026-11-12: (1) permanent Places min-
Q: read-only flip while the panel is open? / A: PENDING OWNER. Implemented: the panel stays open in read view (no edit control; existing crossing spec expects it visible); plan P22'' and criterion 15 listed it as a forced close. Verifier 2026-11-13: criterion 15 NOT-MET on this point only. Shown at the R2 checkpoint.
Q: admin.spec red at the end of R2? / A: PENDING OWNER. A0 (fr, en) and « admin screens » crash the renderer during axe on screens rendering every accumulated grant (1 282+); not proven by a base-commit run. Verifier 2026-11-13: criterion 9 NOT-MET on this point only. Separate fix proposed at the checkpoint.
Q: read-only flip, owner answer? / A: owner 2026-11-13: panel kept open in read view (ratified; criterion 15 amended). A draft abandoned by the flip must be said clearly (accessible and perceptible), nothing shown as saved, no extra history entry. [gated 2026-11-13]
Q: admin.spec, owner answer? / A: owner 2026-11-13: no sandbox reset, no deletion or change of pre-existing data; non-destructive diagnosis first (accumulation or regression, evidence required, not assumed); grant pagination stays in RR-13, not here; results and still-failing tests documented. [gated 2026-11-13]
Q: add tile cancel? / A: owner 2026-11-13: « Annuler l'ajout » approved; abandons an unfinished creation without leaving an incomplete reference; tests for document, Défaire / Refaire, focus, Escape. [gated 2026-11-13]
Q: V1-2 contract note? / A: owner 2026-11-13: dated note authorised (four tabs and references dispositions superseded by D1 to D4 of R2). [gated 2026-11-13]
Q: three UX fixes before the trial? / A: owner 2026-11-13: landscape 667 × 375 trigger reachable without a physical keyboard; a refused draft never lost silently when its tile leaves the results; no pinned non-matching tile shown incoherently next to the no-result notice. Targeted; stop and present before any architecture or model change. Behaviours chosen by the controller under that delegation (plan rev 5 C1-C4), reported. [gated 2026-11-13]
## 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.
@@ -161,7 +167,7 @@ Seed (from the request); design criteria appended at STEP 3 with [gated].
EXPECT: R2_FILES_OK
EVIDENCE: MET exit=0 marker-found :: R2_FILES_OK
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.
15. [gated 2026-11-12; amended 2026-11-13, owner: the read-only flip keeps the panel open in read view, it is not a close] Closing: every close (✕, Escape outside text fields, scrim, « Tout afficher », « Aller à », tab switch, element gone) 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.
@@ -171,5 +177,27 @@ Seed (from the request); design criteria appended at STEP 3 with [gated].
EXPECT: SCOPE_OK
EVIDENCE: MET exit=0 marker-found :: SCOPE_OK
21. [gated 2026-11-13] Read-only flip: no history entry from the flip itself (unit: undo and redo lengths unchanged with nothing pending and with a refused draft; +1 exactly with a valid focused draft, the typed change only; +0 on the flip back); a dropped draft leaves the document unchanged, is said once in the polite live region and shown as visible text in its tile; the read view shows the document values.
22. [gated 2026-11-13] A tile in edit never leaves the shown list on a read-only flip (pin kept whatever the search or sort); an edit view unmounted with pending drafts outside an explicit leave is always announced (all pending fields named), visibly noted when its tile is shown; a panel forced close is announced exactly once.
23. [gated 2026-11-13] « Annuler l'ajout » and Escape (not during IME composition) abandon the draft tile: document references identical, undo and redo stacks unchanged (a pending redo kept), focus on « Ajouter une référence », a new add starts empty; unit + e2e.
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2/apps/app && grep -q "editor.references.add_cancel" src/i18n/fr.ts && grep -q "editor.references.add_cancel" src/i18n/en.ts && grep -rq "Annuler l'ajout" e2e/shell/editor-references.spec.ts tests/unit && echo ADD_CANCEL_OK
EXPECT: ADD_CANCEL_OK
EVIDENCE: MET exit=0 marker-found :: ADD_CANCEL_OK
24. [gated 2026-11-13] A shown tile outside the search carries « Ne correspond pas à la recherche »; the no-result notice shows only when no tile is shown; unit + e2e.
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2/apps/app && grep -q "editor.references.outside_search" src/i18n/fr.ts && grep -q "editor.references.outside_search" src/i18n/en.ts && echo OUTSIDE_OK
EXPECT: OUTSIDE_OK
EVIDENCE: MET exit=0 marker-found :: OUTSIDE_OK
25. [gated 2026-11-13, amended rev 5b and C4 round 4] At 667 × 375: (A) with touch only (CDP touch swipes, no keyboard, no programmatic scroll) the trigger is brought wholly on screen and hit-testable, a tap opens the panel, heading and ✕ in the viewport and hit-testable, scrollY unchanged; (B) worst case, trigger bottom placed on the viewport bottom by an instant programmatic scroll (a touch landing cannot be pixel-exact: slop floor ~60 px), a tap opens the panel with heading and ✕ in view and hit-testable, scrollY unchanged (e2e, phone project). The rotation to 667 × 375 with the panel open at scroll 0 keeps its documented cramped exception (not built, offered to the owner at the checkpoint).
26. [gated 2026-11-13] One history entry per reference edit (field blur, « Terminer », panel close), re-proved on the final code (unit + e2e green).
27. [gated 2026-11-13] admin.spec diagnosis recorded: grant counts, interleaved A/B runs at pre-R2 65a8fd3 and HEAD with results and memory, conclusion with its evidence, still-failing tests listed in docs and BLK-015; no grant pagination, no reset, no deletion.
28. [gated 2026-11-13] V1-2 contract notes dated 2026-11-13 at the four-tab bullet and at « Validated UX ».
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && [ "$(grep -c 'Note 2026-11-13' docs/development/V1-2_ANATOMICAL_SHEETS.md)" -ge 2 ] && echo V12_NOTE_OK
EXPECT: V12_NOTE_OK
EVIDENCE: MET exit=0 marker-found :: V12_NOTE_OK
29. [gated 2026-11-13] No change outside scope since 52aac41 (no SQL, Rust, worker, scripts, docker, Supabase package, admin sources).
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2 && [ -z "$(git diff --name-only 52aac41..HEAD -- supabase crates docker packages/supabase/src scripts apps/app/src/admin apps/app/src/components/admin apps/app/src/app/routes/app/admin)" ] && echo SCOPE2_OK
EXPECT: SCOPE2_OK
EVIDENCE: MET exit=0 marker-found :: SCOPE2_OK
## 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.
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/tests/helpers/editorRoute.tsx (StrictMode wrap, rev 5b), apps/app/src/editor/useViewport.ts (C1, rev 5b), apps/app/src/editor/useEditCommand.ts (only if the final-review I1 fix requires it), apps/app/e2e/{support,shell,ui}/**, docs/development/V1-2_ANATOMICAL_SHEETS.md (dated notes, criterion 28), 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,4 +1,4 @@
# PLAN — R2 « Références » tab (V1-2.6) — rev 4
# PLAN — R2 « Références » tab (V1-2.6) — rev 5
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
@@ -280,3 +280,133 @@ commit. Fresh verifier + security + code review on the whole of R2 at the end.
- 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é ».
## Rev 5 — owner corrections 2026-11-13 (brief « décisions sur le bilan R2 »); overrides earlier revs where they differ
Owner decisions: read-only flip keeps the panel open (ratified; criterion 15 amended); « Annuler l'ajout » approved;
V1-2 contract note authorised; three UX fixes before the db:trial trial; admin.spec: non-destructive diagnosis only,
no grant pagination here (RR-13), no reset, no deletion; BDR-115, LRN-133..135, BLK-015 authorised (BDR-115: R2 built,
manual validation pending; BLK-015 open). Visible behaviours below are the controller's choices under the owner's
delegation (« Prévois un comportement cohérent et vérifiable »), reported at the checkpoint; new labels provisional.
Stop and present before any change of architecture or of the document model. Commits: one per task, pushed.
### C0 — admin.spec diagnosis (controller, no code)
Read-only counts (grants per day, accounts); `git diff 65a8fd3..HEAD` on admin sources and shared files; interleaved
A/B runs of `admin.spec.ts` alone through the guarded wrapper (`run-shell-wt.sh`): HEAD, pre-R2 worktree 65a8fd3
(scratchpad, same lockfile, wasm module copied: no crates change), HEAD, base; duration and free memory per run.
Conclusion rule: same failures at base and HEAD on the same data = not R2; base green and HEAD red = R2 regression
(stop, fix). Results and the tests still failing documented (C5) and in BLK-015.
### C1 — dropped drafts never silent, read-only flip without history (owner 1, 5b) — `fix(editor): …`
- The drop slot moves from the tile (`useRef` in `ReferenceTile`, `useDropNote`) to the tile state owner
(`useTileState`, shared by the tab library and the panel): `dropped: { key, fields } | null`. An edit view unmounted
with pending drafts outside an explicit leave (read-only flip; its reference removed by an undo or a reload) records
ALL pending fields in `FIELDS` order (no longer only the first). The owner announces once in the polite live region
« Saisie non appliquée : {field} » (fields joined by « , »), even when the tile is no longer shown.
- Visible note: the tile whose key holds the drop shows the same text in its body (warning style + icon, plain
paragraph, not a second live region), in read view and, after a flip back, in the edit view above « Terminer ». The
note ends with the next tile action of that owner (toggle, « Modifier », « Terminer », « Ajouter une référence »)
or a newer drop.
- Pin (P23' amended): no longer suspended while read-only; the tile that entered edit stays shown at its index across
the flip whatever the search or the sort (so its note is seen). It still ends at the next search or sort change
unless it is the tile in edit, at `reset` and « Tout afficher ». The M3 test is rewritten (R-24 mapping).
- Unchanged: the flip commits the focused field first (`useTabTier`), one history entry for that typed change only;
the flip itself writes nothing; the panel stays open; a panel forced close (P22'') keeps its own note and is never
announced twice.
- Tests (unit): (a) refused URL + flip: note visible in the tile, one announcement, `references` deep-equal, undo and
redo lengths unchanged, read view shows the document URL; (b) valid focused draft + flip: undo +1 exactly, no note;
flip back: +0; (c) nothing pending: +0, no note, silence; (d) search not matching the tile in edit + refused draft +
flip: tile still shown with the note (N1 probe); (e) two refused fields: both named; (f) note kept across flip back,
cleared by « Terminer », toggle, « Modifier »; (g) panel: flip with a refused draft → note in the panel tile, one
announcement; forced close (finding gone) with a refused draft → exactly one announcement; (h) undo removing the
reference of a tile in edit with a refused draft → one announcement. E2E (editor-references): search, edit out of
the search, refused URL, resize 1 280 → 800: tile and note visible, live region text; back to 1 280: note still
there, URL field shows the document value; « Terminer » removes the note.
### C2 — « Annuler l'ajout » (owner 3) — `feat(editor): …`
- Draft tile: secondary button « Annuler l'ajout » (`editor.references.add_cancel`, EN « Cancel adding »,
provisional) after « Ajouter la référence ». Escape anywhere inside the draft tile, not during IME composition and
not already handled, does the same and marks the event handled.
- Cancel: the draft tile unmounts, nothing reaches the document, the « form » error goes with it, undo and redo stacks
untouched (a redo available before stays available), focus on the toolbar's « Ajouter une référence »; the search
and sort reset by the add (P24) are not restored. A new add starts from an empty form. Read-only: unchanged (hidden).
- Tests (unit): button and Escape (citation field, type select, a button): tile gone, `references` identical, undo and
redo lengths unchanged incl. a pending redo, focus on the add button, fresh form after a new add; Escape while
composing: nothing; cancel after a refusal message; « Défaire » after a cancel undoes the previous real change.
E2E (editor-references): add, type, « Annuler l'ajout »: count unchanged, focus on « Ajouter une référence »,
Défaire / Refaire states unchanged; same with Escape.
### C3 — tile outside the search after « Terminer » (owner 5c) — `fix(editor): …`
- A shown tile that does not match the search (only a pinned one can) carries a muted line right under its header:
« Ne correspond pas à la recherche » (`editor.references.outside_search`, EN « Does not match the search »,
provisional), in edit, after « Terminer » and in read-only.
- The no-result notice (board 24 B) shows only when no tile at all is shown; while a pinned tile shows outside the
search it is not shown (the count « 0 référence sur N » and the tile's line say it; the search field keeps its ✕).
- Tests (unit): « Terminer » on a tile edited out of the search: tile shown with the line, no notice, count 0 sur N,
focus on its header; next search change: tile gone, notice shown; tile in edit not matching: line; matching pinned
tile: no line. E2E: the same journey in editor-references.
### C4 — landscape 667 × 375 by touch (owner 5a) — `fix(editor): …`
- First a failing-or-passing proof (layout spec, phone project, `hasTouch`): 667 × 375 read-only, « Constat A »
selected by tap, the trigger brought into view by a touch scroll (CDP `Input.synthesizeScrollGesture`,
`gestureSourceType: 'touch'`), hit-testable (`elementFromPoint`), opened by `tap()`; then the panel heading and ✕
inside the viewport and hit-testable without a user scroll. Second case: panel open at 375 × 667 scroll 0, rotation
to 667 × 375: heading and ✕ visible and hit-testable without a user scroll.
- Fix where the proof fails: `CitationsLayer` re-fits on entry and on a viewport WIDTH change while open (never on a
height-only change: on-screen keyboard): if the panel's visible height is below min(240 px, viewport − top bar), the
window scrolls at once (no smooth scroll) so the Places container's top sits under the top bar (clamped to the
page's scroll range). The document size never changes. The user's own scroll back to 0 stays allowed (cramped
exception of `expectPanelWithin` kept, comment updated).
- If touch cannot reach the trigger at all (covered, inert, layout), stop and present: no layout redesign here.
### C5 — docs (owner 4) — `docs(docs): …`
`V1-2_ANATOMICAL_SHEETS.md`: « **Note 2026-11-13:** … superseded by D1 to D4 of R2 … » before the ~1 361 bullet and
before the ~2 804 « Validated UX » paragraph (style of the 2026-11-12 note). `V1-2-6_R2_LABELS.md`: new keys, changed
uses, totals; `V1-2-6_OWNER_TRIAL.md` §4.10: steps for cancel add (button, Échap), read-only flip with a refused
draft, the outside-search line, landscape by touch; `V1-2-6_U1_CORRECTIONS.md` §R2: corrections wave, admin.spec
diagnosis and the tests still failing; `BROWSER_TESTS.md`: new tests, admin.spec status.
### C6 — closure (controller)
Static gates, e2e:ui, e2e:shell every spec but editor-equine through the wrapper (admin.spec in its own run), guard OK
each run; fresh verifier on criteria 15 (amended) and 21-29; security gate on 52aac41..HEAD; opus review of the
corrections diff; memory entries; contract evidence; checkpoint. editor-equine: never run.
### Rev 5b — challenge of rev 5 (correctness CONCERNS(2), robustness CONCERNS(2), simplicity CONCERNS(1)); overrides rev 5
- C0 [rob-1, cor-9] Done: 4 interleaved runs, identical 3 failures at base and HEAD (ledger). Added: grant count logged
before each run, and a POSITIVE dose-response probe with no data change: a temporary, never-committed copy of
admin.spec whose `list_catalog_grants` answer is capped by `page.route` to its 753 newest rows (the list is
`granted_at desc`, so the test's own grants stay); capped runs vs a full control run. Rule: capped green + full red
= accumulation proven; anything else (mixed, both green, both red) = inconclusive, presented as such, never assumed.
- C1 [simp-3, cor-1, cor-2, rob-3..7, cor-3..7] The drop slot STAYS in the tile (no lift): a tile-local `useState`
replaces the `useRef`; the edit view's unmount cleanup writes it ONLY when fields are pending (never clears it:
StrictMode remount in e2e), naming ALL pending fields in `FIELDS` order. With the pin kept in read-only the tab tile
stays mounted across the flip, panel tiles are never filtered: the note is always seen on its tile.
- `LeaveGuard` returns the list of refused fields (it tries every pending field, focuses the first refused); a user
close still refuses; the panel FORCED close note names every refused field (same « , » join). Test with two
refused fields (blank citation + schemeless URL) on the forced path.
- Pin follows `editingKey` through read-only; `reset` / « Tout afficher » re-pin `editingKey` (if any) at its index
in the reset view instead of null; the read-only branch of `pinAfterChange` and the `readOnly` parameter of
`useReferenceView` are removed. R-24: rewrite the M3 test and « is suspended in read-only: the tile renders its read
view » (editor-references-view.test.tsx ~370-379).
- Read-only toggle on the tile still in edit state: ends the edit state AND collapses (openKeys), clears the note;
tested with aria-expanded.
- Focus on a flip: the field that held the focus inside a tile (tab or panel) gives it to that tile's header (not
the tab row); `activeElement` asserted in the flip tests.
- Note ends on that tile's toggle, « Modifier », « Terminer », « Ajouter une référence » (tab), or a newer drop.
- Unit flips go through `mountDraft` + `setWidth` + resize (`cross()`, editor-no-loss.test.tsx), inside
`<StrictMode>`, so the `useTabTier` commit is exercised; announcements counted with a spy / observer.
- Stated limits (checkpoint, not built): the reference removed by an undo / reload while its tile holds a refused
draft (tile gone, draft gone with its reference); an undo / redo of the same field replacing a pending draft in a
mounted view; two drops in the same flip (tab tile + panel tile) share one live-region update, only the last is
spoken (both notes stay visible).
- C2 [rob-2] Escape cancels from a non-text target of the draft tile (select, buttons, the tile), and from a text field
only while the form is pristine (type unset, every field empty); with typed text Escape stays the field's. Composing
= `isComposing` or `keyCode === 229`. Unit: typed citation + Escape in the field → draft kept.
- C3 [simp-7, rob-10] Notice condition: `shown.positions.length === 0` with references present (the draft tile does not
count). The header button carries `aria-describedby` to the outside-search line.
- C4 [simp-1, simp-2, rob-8, rob-9, cor-8] Proof only: case 1 (touch scroll of the WORST distance: the trigger's bottom
brought just to the viewport bottom, then `tap()`; heading and ✕ in the viewport and hit-testable). If it passes:
test + docs, no code. If it fails: the fix scrolls only on the proof's own condition (heading or ✕ outside the
viewport), after the commit, on panel entry only; stop and present if more is needed. The rotation-at-scroll-0 case
and an auto-scroll are NOT built: offered at the checkpoint as an option, the documented limit kept.
- C6 [rob-11] The final sweep includes admin.spec with the other specs (reported as is) AND an isolated admin.spec run;
the isolated result never stands for the gate.