chore(memory): R2 Rev 6 decision, plan and contract 32-36

This commit is contained in:
bchanot committed 2026-11-15 21:14:34 +01:00
1 parent 8681e66ec9
commit 6de88bbb7c
3 files changed
+132

No files matched your search

@@ -380,3 +380,112 @@ of the order (Général, Annotations), the rest under « Plus » in order.
citations dialog with a draft asks; topDirtyLayer order; citations under a clean reference dialog in POP and cascade;
jump-out cascade e2e (editor-leave-confirm) with dirty citations; sign-out flag for a citations draft.
- T13: also the CLAUDE.md folder-map line for the citations sheet.
## Rev 6: owner pre-closure adjustments 2026-11-15 (four items, autonomous mandate on the technique)
Owner brief 2026-11-15 « Avant la clôture définitive de R2 »: (1) a « Citer » button: the arrow keys only browse the
references, a citation joins the draft only on an explicit action; (2) a reference created from the references
dialog's edit mode is abandoned with the draft; an independent creation from the Références tab stays; (3) labels
follow the context (constat / famille), FR and EN; (4) the modal ✕ gets a 44 × 44 px touch area, harmonised in the
shared component. BLK-015 stays separate; the full sweep still fails and is never announced green.
Controller rulings (autonomous mandate, reported to the owner):
- A pending choice in the select is not part of the draft (no « Abandonner ? » for a choice never cited).
- Creation from the edit mode is deferred: the new reference lives in the draft and is written with the citations
by « Enregistrer », as ONE undoable operation (`commitBatch`: the inserts, then the element's update; no Rust
change). Abandon, Annuler, close, Back or leave drop it with the rest of the draft (asked first when dirty).
- « Modifier la référence » on an EXISTING reference keeps saving by its own dialog (a library change seen by every
citer, own undo step): stated to the owner as a choice, with the alternative (fold it into the draft).
- A reference still pending in the draft can be modified (same dialog, prefilled, nothing written) or removed
(« Retirer » drops it entirely).
### Task 14: « Citer » button, context labels, 44 px close (owner items 1, 3, 4)
- CitationsDraftList AddRow: the select (label « Citer une référence existante ») holds a local choice only (not in
the draft, not dirty); a « Citer » button (new key `editor.citations.cite`, fr « Citer », en « Cite ») beside it,
disabled while nothing is chosen; its click cites the choice, resets the select to the placeholder and puts the
focus back on the select. A choice no longer offered (cited, gone after an undo) resets to the placeholder. Arrow
keys and a pick on the select never change the draft. Read-only: select and « Citer » hidden (as the select today).
- Context labels: every label of the references dialog and of the filtered Références tab that names the cited
element gets a family variant chosen from the element's kind (`buildItems` kind / CiterItem.isFamily rule, one
helper): `editor.references.dialog_title`, `editor.citations.edit_title`, `editor.references.panel_count_one/other`,
`editor.references.panel_empty`, `editor.references.this_finding`, `editor.references.filter_chip`,
`editor.references.filter_remove`, `editor.references.filter_back`, `editor.references.filter_gone`. New keys
`<key>_family` (fr « Références de la famille », « Modifier les références de la famille », « … citée(s) par cette
famille », « Cette famille ne cite aucune référence. », « cette famille », « Références de la famille : {name} »,
« Retirer le filtre de la famille {name} », « Revenir à la famille », « La famille n'existe plus : le filtre est
retiré »; en the same with « family »). Finding wording unchanged.
- Dialog (components/ui/Dialog.tsx) close button: 44 × 44 px box (`grid h-11 w-11 place-items-center rounded-lg`,
visible focus ring), the same as MobileDrawer's close; header padding adjusted so the header does not grow more
than needed. Every Dialog of the app inherits it.
- Tests: unit (arrow/change on the select leaves the draft clean; « Citer » adds once and resets; disabled with no
choice; family vs finding titles, empty text, chip; ✕ box classes); e2e (keyboard: ArrowDown on the select then
close asks nothing, « Citer » then « Enregistrer » = one Défaire; ✕ bounding box ≥ 44 × 44 at 375 and 1280 in an
editor dialog and in the ui Dialog harness; axe).
### Task 15: a creation from the edit mode belongs to the draft (owner item 2)
- `citationEdits.ts`: the draft gains `created: readonly Reference[]` (references made in this draft, absent from the
document). Removing a created id drops it from `created` and `added`. `sameEdits` covers it.
- Reference dialog over the citations edit mode: a « draft » creation. `ReferenceMoves.start(opener, cite, initial?)`;
`cite` now receives the reference VALUE. In that mode ReferenceForm writes nothing: its save validates as today,
builds the value under a fresh id (`newElementId('ref')`, or the pending id when modifying a pending one), hands it
back, and the layer closes (forced, no replace, no library « added » notice, `held.cite` cleared). Submit label:
« Ajouter la référence » for a new one, « Valider » (new key `editor.reference.apply`, en « Apply ») when modifying a
pending one; title « Nouvelle référence » in both. An announcement says the reference is cited in the draft and
will be written with the citations (new key `editor.citations.created_draft`, `{citation}`).
- Draft list: a created reference shows its citation with a « Nouvelle » badge (new key `editor.citations.pending`),
« Modifier la référence » (draft mode, prefilled) and « Retirer ».
- Save: one `commitBatch` = an `insert` per created reference still cited, then the element's `update` with the
applied ids. `useEditCommand` gains `runBatch(field, build)` that regenerates the created ids once on
`duplicate_key` (as `runNew`), remapping them in the update. One Défaire undoes both the citations and the new
references; Refaire restores both.
- Everything else of the Rev 5 rules holds (guard layer `citations`, read-only flip keeps the draft, `{create}` over
citations never read back from history, focus).
- Tests: unit (create in draft → nothing in the document; save → references and citations in one undo step; abandon →
document unchanged; modify pending; remove pending; duplicate id retried; References tab « Ajouter » still writes at
once); e2e (owner path: « Nouvelle référence », « Abandonner » → library unchanged; « Nouvelle référence »,
« Enregistrer », one « Défaire » removes both).
### Task 16: docs
- V1-2-6_U1_CORRECTIONS §R2 (« Pre-closure adjustments 2026-11-15 »), V1-2-6_OWNER_TRIAL (limit 10 lifted, ✕ and arrow
limits lifted, §4.14 short manual checks), V1-2-6_R2_LABELS (new keys, totals), BROWSER_TESTS clauses.
### Rev 6 challenge rulings (binding on Tasks 14-16; 3 lenses, 2026-11-15)
- Family rule: one key helper `isFamilyKey(key) = key.kind === 'finding' && key.path.length === 1`, beside `isCitable`
(works for a vanished element). Sites: CitationsDialog titles (view, edit), CitationsPanel summary and empty line,
NoResult (new prop for the filtered element), CitersList (the current family row shows « cette famille » only, no
second « famille » badge), ReferenceToolbar chip / remove / back, useReferenceLibrary `filter_gone`, and
`editor.findings.gone` (family variant when a family's dialog closes because it vanished). Plural keys
`editor.references.panel_count_family_one/_other` through the unchanged plural helper; other keys `<key>_family`.
Unit: a filtered family removed by an undo announces the family variant.
- T14 ✕: `shrink-0` on the button, `min-w-0 break-words` and a gap on the h2; e2e measures the ✕ (≥ 44 × 44) at 320,
375 and 1280 with a long title (ui harness long-title case and one editor dialog with a long finding name).
- T14 select: the shown value is derived at render (`options.some(o => o.value === choice) ? choice : ''`), driving
the select and « Citer » (no effect). The choice state lives in the edit form (needed at save). « Citer » is
`type="button"`; its unit asserts the dialog stays in edit mode. « Enregistrer » with a chosen-but-not-cited
reference refuses: stays in edit mode, a line at the select (new key `editor.citations.pending_choice`, fr « Référence
choisie mais pas encore citée : choisissez « Citer » ou revenez au choix vide. »), focus on « Citer ». Closing with
only a choice asks nothing (no draft change).
- T15 channel: `ReferenceMoves`/`ReferenceLayer` get `drafting(): { initial: Reference | null, cite } | null` read
from `held` (never NavigationState, never history; `initial` cleared at every site that clears `cite`; draft mode
decided by `cite !== null` alone). ReferenceForm gets one optional `onValue(value)` that replaces `useWrite`, behind
the same once-only latch (double submit = one pending row, tested). Pending edit: ReferenceForm `reference` = the
pending value (prefill, id kept), title `editor.reference.new`, submit `common.confirm` (« Valider »); a new one keeps
`editor.reference.add`. No `editor.reference.apply` key.
- T15 validation: the draft-mode submit dry-runs the insert on the current document text with the pure `applyEdit`
(core/editOps.ts, nothing stored) and shows any refusal in the reference form as today. If the batch is refused at
« Enregistrer » anyway, the line names the pending reference.
- T15 notices: the draft-creation notice (`editor.citations.created_draft`) and a removed pending reference
(`editor.citations.pending_removed`, « Nouvelle référence retirée : {citation} ») go to the citations dialog's own
`role="status"` line, never `layer.announce`. Test: after an abandon and closing both dialogs, the live region holds
no « sera enregistrée ».
- T15 draft: one pure helper in citationEdits.ts adds or replaces a created value and its id together (one `set`).
`useEditCommand.runBatch(field, build: () => readonly EditCommand[])` calls `build()` once more on `duplicate_key`;
the citations save's `build` mints the created ids and maps them; no « still cited » filter (removeId keeps the
invariant). Save with the element unreadable (`!item`) is a refusal on the save line that keeps the draft, never the
pristine path. Dead Rev 5 write-and-cite path removed (`useCreated` citing branch, `CiteCreated` retyped to the
value, comments): `created()` is library-only again.
- Tests to update, named: e2e editor-citations.spec.ts:274-282 (`panel_empty` on « Dysfonction A », a family → family
text), :441-443 (cite through selectOption → choose + « Citer »); unit editor-citations-edit.test.tsx:185-189 (`cite`
helper), :416-440 and :442-459 inverted (CLARIFICATIONS 2026-11-15 b); editor-citations-guards.test.tsx:158-203
(cite through `created()` → the draft path).
- T16: document the durability change (a pending reference lives only in the open form until « Enregistrer »,
protected by the leave guards and beforeunload, no recovery copy), next to the other draft limits.