chore(memory): R2 closure BDR-117, LRN-139..141, plan Rev 4, contract 19-25

This commit is contained in:
bchanot committed 2026-11-14 23:19:37 +01:00
1 parent be0f6d8beb
commit b41c24b29d
5 files changed
+94 -1

No files matched your search

+8
View File
@@ -963,3 +963,11 @@ Decision: finding + reference add/edit/detail in D13 modal dialogs, transactiona
Alternatives: URL params (rejected: leaks into links, A2), data router + useBlocker (rejected BDR-078), inline forms (owner asked modals).
Limits: delete replaces dialog entry (one dead Back); POP during pending Back can swallow a same-instant move; CloseWatcher stub-proved only; outside tap only closes « Plus »; multi-entry Back out of editor drops dirty dialog draft -> content-free sessionStorage flag, notice once on next mount (src/editor/leftDraft.ts).
Status: built, awaiting owner trial on db:trial. Commits 553a0e5..021685f on feature/v1-2-anatomical-sheets.
## BDR-117 — R2 closure after owner trial 2026-11-14: edit-only citing, session tag, leave confirm, U2 orientation (2026-11-14)
- **Status**: accepted
Context: owner R2 trial 2026-11-14 validated main journeys; asked last fixes + U2 orientation.
Decision: (1) citing/removing references only in finding edit form, part of transactional save (one undo); view = « Références citées » + « X références »; sheet read-only (no « Retirer de ce constat »); draft citations reach sibling sheet via zustand store citationDraft.ts (shortcut). (2) deletion pops dialog entry (first Back moves); first Défaire reveals restored finding (store `revealed`). (3) « Plus » pick focuses new tab panel. (4) history entries carry random 128-bit session tag, not account id; tag record in sessionStorage bound by FNV-1a fingerprint salted with tag (sync, works on http LAN); rotated on sign-out/mismatch. (5) multi-entry traversal leaving editor with dirty dialog: Navigation API navigate event preventDefault (cancelable same-document traverse, verified Chromium 156 incl. CDP history jump), cascade ask top-down, only layers a Back removes are asked; fallback no API/not cancelable = content-free left-draft flag + notice; sign-out with dirty dialog = salted flag, notice at same account's next sign-in.
U2 orientation: properties in modal dialog, geometry direct on canvas; click without move opens dialog, drag never does; point size slider stays on canvas strip; boards 02-06, 13 redraw + owner validation before U2 code. U2 not started.
Owner-accepted limits: same-instant move vs Back race, « Aller à » view mode, search kept across tabs, first outside tap closes « Plus » only. To confirm: CloseWatcher on real Android, cascade limit, browser matrix (Firefox/Safari unverified).
Status: built afc1051..f8be0ad, awaiting owner final manual checks (OWNER_TRIAL §4.12).
+3
View File
@@ -561,3 +561,6 @@ R5.4: `draft/{labels,changelog,review_report,drawing,overlay,app_review,svg_comp
## 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.
- 2026-11-13 R2 UX finish built (553a0e5..021685f): dialogs, history Back/Forward, filter chip, Plus overlay, sticky sidebar; final review fixes; gates green, shell sweep fails only admin.spec (BLK-015); awaiting owner db:trial trial
## 2026-11-14
- 2026-11-14 R2 closed after owner trial: edit-only citing, delete undo reveal, Plus focus, session tag in history, Navigation API leave confirm + cascade, sign-out notice; U2 orientation recorded (BDR-117); final sweep only admin.spec (BLK-015); awaiting owner manual checks OWNER_TRIAL 4.12
+12
View File
@@ -962,3 +962,15 @@ Apply: every dynamic key site gets unit test asserting heading text has no 'edit
## LRN-138 — Unblockable leave + no draft storage: content-free loss flag (2026-11-13)
Pattern: browser Back not interceptable (BDR-078) + owner forbids storing drafts + owner forbids silent loss. Resolution: on unmount with dirty dialog write one content-free flag (kind + element key, scoped sheetId+userId) to sessionStorage, try/catch; next mount of same sheet+user shows notice once, clears flag. Relies on React 19 parent-first cleanup on deletion.
Apply: any "cannot block leave, cannot keep data" conflict -> record the fact of loss, not the data, and tell user on return.
## LRN-139 — Navigation API cancels same-document Back traversal in Chromium (2026-11-14)
Pattern: Navigation API `navigate` event on same-document traverse is cancelable in Chromium 156 (probe: CDP Page.navigateToHistoryEntry -3, userInitiated true, preventDefault keeps entry). Gives real "confirm before leave" for SPA Back/history-menu jumps without data router (BDR-078). Then navigation.traverseTo(destination.key) after user confirms; pass-through flag for that follow-up event.
Apply: guard only when dirty + destination leaves route + event.cancelable; fallback (no API, Firefox/Safari unverified) = after-the-fact notice. e2e via CDP history jump; page.goBack with cancel times out. Probe browser behaviour with throwaway page before planning.
## LRN-140 — crypto.subtle missing on http LAN origin (2026-11-14)
Pattern: crypto.subtle absent on non-secure origin (http LAN dev/trial address); loopback 127.0.0.1 counts secure so tests miss it. Async SHA-256 binding broke reload restore on owner trial origin + added blank first frame.
Apply: for equality binding (not secret) use sync non-crypto hash (FNV-1a 64 BigInt) salted with random per-record value; test with crypto.subtle undefined. Check every crypto.subtle use against the LAN http origin.
## LRN-141 — Stacked modals: ask only removed layers; never rule silent loss into a limit (2026-11-14)
Pattern: stacked modal layers + "ask all layers" guard: question appeared in lower dialog hidden under still-open upper modal (citations sheet) -> looks frozen. Also ruling "accept as documented limit" for silent loss broke owner condition; reviewer caught it.
Apply: a guard asks only layers the move actually removes; before showing a question, close clean layers above the dirty one. Never rule a silent-loss case into "documented limit" when owner condition forbids silent loss: restore notice instead. Label limits owner did not see as "to confirm", never "accepted".
@@ -199,7 +199,7 @@ Q: Plan rev 3 and choices 1-5 / A: approved by the owner 2026-11-13 (« je valid
13. [gated 2026-11-13] A changed « Enregistrer » in the finding or reference dialog is exactly ONE undoable operation (undo length +1, one Défaire restores the prior state); a pristine « Enregistrer » and every « Annuler » / « Abandonner » add none (unit + e2e).
14. [gated 2026-11-13] The citations sheet stacked over the finding dialog is fully usable by keyboard (Tab reaches every control, Escape closes the sheet only, focus returns to « X références ») and by touch (taps on its controls at 375 with hasTouch, the dialog underneath not activated) (e2e).
15. [gated 2026-11-13] Browser history entries hold navigation state only (tab, section, open layers by element key, references filter by finding key): no typed text, no search term, no draft; an entry restores only for the same sheet and the same signed-in account, otherwise the editor opens on its default view (unit: entry state shape and mismatch rules).
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2/apps/app && f=src/editor/history/entry.ts && [ -f "$f" ] && grep -q "sheetId" "$f" && grep -q "userId" "$f" && ! grep -Eq "^\s*(query|draft|text|search)\??\s*:" src/editor/history/*.ts && echo HISTORY_SHAPE_OK
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2/apps/app && f=src/editor/history/entry.ts && [ -f "$f" ] && grep -q "sheetId" "$f" && grep -q "tag" "$f" && ! grep -Eq "^\s*(query|draft|text|search)\??\s*:" src/editor/history/*.ts && echo HISTORY_SHAPE_OK
EXPECT: HISTORY_SHAPE_OK
EVIDENCE: MET exit=0 marker-found :: HISTORY_SHAPE_OK
16. [gated 2026-11-13] With the « Plus » menu open, the platform back request (CloseWatcher where the browser offers it) closes the menu before any navigation; without CloseWatcher the limit is stated (unit with a CloseWatcher stub).
@@ -210,3 +210,21 @@ Q: Plan rev 3 and choices 1-5 / A: approved by the owner 2026-11-13 (« je valid
apps/app/src/editor/** (navigation, history adapter, references view and filter), apps/app/src/components/editor/** (findings, references, citations, tabs, workspace, layers), apps/app/src/components/ui/{ModalDialog,Dialog}.tsx (only if a shared fix is needed), apps/app/src/components/shell/{ShellChrome,AppLayout}.tsx, apps/app/src/clients/useClientList.ts, apps/app/src/animals/useAnimalList.ts and their list routes (if the app-wide review keeps them), apps/app/src/i18n/{fr,en}.ts, apps/app/src/styles/** (only if needed), apps/app/tests/**, apps/app/e2e/{support,shell,ui}/**, docs/development/{V1-2-6_U1_CORRECTIONS,V1-2-6_OWNER_TRIAL,V1-2-6_R2_LABELS,BROWSER_TESTS,V1-2_ANATOMICAL_SHEETS}.md, docs/design/README.md, this contract, the plan, .claude/tasks/TODO.md, memory.
ORACLE AMENDMENT 2026-11-13 (controller): criterion 4 key renamed to the shipped key editor.references.filter_chip (chip « Références du constat : {name} »); criterion 15 path is src/editor/history/entry.ts (folder split in Task 1) and the forbidden-field scan covers every file of src/editor/history. Same assertions, no weakening.
## Owner trial 2026-11-14 (brief « Retour de mon essai propriétaire R2 »): additional criteria
19. [gated 2026-11-14] Finding view mode shows « Références citées » and « X références » only (no cite or remove control); edit mode adds and removes citations in the form draft; one changed « Enregistrer » = one undoable operation covering names and citations; the side sheet has no « Retirer de ce constat » (unit + e2e).
20. [gated 2026-11-14] After deleting a finding, the first « Défaire » restores it at once, selected, visible and focused; the first Back after a deletion has a visible effect (unit + e2e).
21. [gated 2026-11-14] Choosing a « Plus » entry by keyboard moves the focus to the new tab's panel (e2e at 375).
22. [gated 2026-11-14] History entries hold a random session tag, never an account id; accounts stay separated (tag bound to the account by a digest, rotated on sign-out and on mismatch); left-draft flag keyed by the tag (unit).
CHECK: cd /home/bchanot/Documents/faunosteo-v1-2/apps/app && ! grep -q "userId" src/editor/history/entry.ts && ! grep -q "userId" src/editor/leftDraft.ts && grep -q "tag" src/editor/history/entry.ts && echo SESSION_TAG_OK
EXPECT: SESSION_TAG_OK
EVIDENCE: MET SESSION_TAG_OK (controller 2026-11-14, rc 0; verifier rerun)
23. [gated 2026-11-14] With a dirty dialog, a multi-entry traversal leaving the editor asks « Abandonner les modifications ? » before anything is lost where the Navigation API can cancel it (Chromium, e2e via CDP history jump); elsewhere the after-the-fact notice stays (unit).
24. [gated 2026-11-14] R2 closure docs: validated status, limits accepted and lifted, a short list of final manual checks (incl. Android Back on a real phone, the leave confirmation, the fallback browsers).
25. [gated 2026-11-14] U2 orientation recorded in the U2 plan, the UX decisions and the design README (annotation property modals with direct manipulation kept; boards to redraw and validate before U2 code); U2 not started.
ORACLE AMENDMENT 2026-11-14 (controller): criterion 15 now reads « same sheet and same session tag » (owner decision 2026-11-14 replaces the account id); its oracle checks `sheetId` and `tag` instead of `userId`.
SCOPE AMENDMENT 2026-11-14 (controller): apps/app/src/app/providers/AuthProvider.tsx joins FILE SCOPE (Task 8: the session tag rotates on sign-out for the app lifetime; an editor-local subscription would miss a sign-out while the editor is unmounted).
SCOPE AMENDMENT 2026-11-14 (controller): docs/development/V1-2-6_UX_PLAN.md and V1-2-6_UX_DECISIONS.md join FILE SCOPE (required by criterion 25); CLAUDE.md folder map lines, useLeaveGuard.ts and components/ui/afterModalsClosed.ts accepted (helpers named by the plan).
@@ -233,3 +233,55 @@ resolved targets and POP landings, scroll captured before dispatch (rob-11, cor-
creation replaced before close (cor-17); fr/en prettier exemption stated (cor-18); flip notice from the mode (rob-16);
announcer joins messages (rob-17); wrapper copied into the worktree (rob-14); skippable entry untested (rob-10);
adapter as its own hook, MemoryRouter-tolerant (rob-15); pin off under a filter (cor-9).
## Rev 4: owner trial 2026-11-14 (R2 validated; last adjustments, autonomous mandate)
Owner brief 2026-11-14: R2 main journeys validated. Accepted limits: same-instant move vs Back race, « Aller à » opens in
view mode, search kept across tabs, first outside tap only closes « Plus ». Android Back to verify on a real phone.
BLK-015 tracked separately. Probe (controller, pinned Chromium 156.0.8078.4, scratch page): a same-document `traverse`
`navigate` event is cancelable for a history-menu jump of -3 (CDP Page.navigateToHistoryEntry, userInitiated true), with
or without prior activation, and preventDefault keeps the page on its entry.
### Task 6: citing references moves to the edit mode (owner item 1)
- View mode (finding node): « Références citées » + « X références » (opens the side sheet) only; no « Citer une
référence », no remove. Family (category, no sheet per D2): label + read-only list, no « Retirer ».
- Edit mode (node and family): same label and button, plus the editable list of the DRAFT citations (each « Retirer »)
and « Citer une référence ». Citation changes live in the form draft (dirty check, « Abandonner les modifications ? »),
and « Enregistrer » writes names, descriptions, flag and citations as ONE undoable operation; pristine save none.
- The button always agrees with what the form shows: in edit mode it counts the draft and the sheet opened from the form
lists the draft's references. The side sheet becomes read-only for the finding: « Retirer de ce constat » leaves it
(removal only in the edit form); « Modifier » (the reference), « Aller à », « Tout afficher » stay.
- Creation dialog: no citations (unchanged). Tests: unit (view has no cite control; edit stages add/remove; one undo
restores names and citations together; Annuler with only a citation change asks), e2e on the finding dialog.
### Task 7: deletion, undo and Back; « Plus » keyboard focus (owner item 3, points 1 and 2)
- Deleting a finding (from its dialog or anywhere) closes its dialog by popping the dialog entry, never by replace: the
first Back after a deletion has a visible effect (limit 1 lifted). A later Forward onto the deleted element's entry
follows the existing gone rule.
- The first « Défaire » after a deletion restores the finding at once and visibly: its row exists, its branch expanded,
selected, scrolled into view and focused (Constats tab shown); no second « Défaire » needed. Same for « Refaire » of a
creation. Tests: unit + e2e (delete, one header « Défaire », row visible and selected; one Back after delete moves).
- « Plus »: choosing an entry (keyboard, also pointer) moves the focus to the new tab's panel (`role=tabpanel`,
`tabIndex=-1`, labelled by its tab) once the overlay is gone; focus ring only for keyboard (`:focus-visible`). Tests
unit + e2e at 375 (Enter on an entry: the panel of that tab is focused).
### Task 8: session tag in history; confirmation before a multi-entry leave (owner item 3, points 3 and 4)
- History entries carry `tag` (random 128-bit hex, crypto.getRandomValues) instead of `userId`; `sheetId` stays.
The tag lives in sessionStorage with the SHA-256 digest of the account id (crypto.subtle), reused only when the
digest matches the signed-in account, rotated on sign-out and on any account mismatch; storage failure → in-memory
tag (a reload then restores nothing). No tag yet → no restore (fail closed). The left-draft flag key uses the tag; flags
of a rotated tag are cleared. Entries with `userId` (older shape) read as foreign.
- Navigation API guard (`navigation` feature-detected): while a finding or reference dialog is dirty, a same-document
`traverse` whose destination leaves the editor route is cancelled when `event.cancelable`; the dialog's own
« Abandonner les modifications ? » shows; « Continuer la saisie » stays; « Abandonner » traverses to the destination
(`navigation.traverseTo(key)`) with no left-draft notice. Not cancelable or no API → the existing flag and notice.
In-editor traversals keep the existing refusal path. Tests: unit with a navigation stub; e2e with CDP
`Page.navigateToHistoryEntry` (jump of several entries out of the editor with a dirty dialog: confirm shown, URL and
draft kept; Abandonner lands on the destination).
### Task 9: R2 closure docs and the U2 orientation
- R2 validated by the owner's trial 2026-11-14: status lines (V1-2-6_U1_CORRECTIONS §R2, V1-2_ANATOMICAL_SHEETS notes),
limits (accepted list; lifted: delete dead Back, « Plus » focus to body; changed: tag, leave guard), §4.11 steps
adjusted, a §4.12 « Vérifications manuelles finales » list, labels, BROWSER_TESTS.
- U2 orientation (controller text, `u2-orientation.md` in the SDD folder) into V1-2-6_UX_PLAN §U2, V1-2-6_UX_DECISIONS
and docs/design/README.md (boards 02 to 06 and 13 to redraw at U2 planning, validated before U2 code).