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

@@ -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.