diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index abf85aa9..3d0bdb01 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -567,3 +567,4 @@ R5.4: `draft/{labels,changelog,review_report,drawing,overlay,app_review,svg_comp ## 2026-11-15 - 2026-11-15 R2 owner follow-up built (Tasks 10-13 + fixes, b41c24b..ebd1d6d): references dialog with own edit mode, one tab order, vertical Plus. Gates 0, sweep 264 passed, fails = admin.spec BLK-015 + Target crashed (rerun green), GUARD OK. Waiting owner db:trial check. +- R2 Rev 6 built: Citer button, draft-owned creation (commitBatch), family labels, 44px dialog close. Sweep final7 273 pass, 6 fail admin.spec BLK-015. Await owner db:trial then R2 closure. diff --git a/.claude/tasks/contracts/2026-11-13-r2-ux-finish-1624.md b/.claude/tasks/contracts/2026-11-13-r2-ux-finish-1624.md index 4743d512..dc2bee46 100644 --- a/.claude/tasks/contracts/2026-11-13-r2-ux-finish-1624.md +++ b/.claude/tasks/contracts/2026-11-13-r2-ux-finish-1624.md @@ -241,3 +241,25 @@ SCOPE AMENDMENT 2026-11-14 (controller): docs/development/V1-2-6_UX_PLAN.md and EVIDENCE: MET FOLLOWUP_DOCS_OK (controller 2026-11-15, rc 0; verifier rerun) CLARIFICATIONS 2026-11-15 (controller, owner brief 2026-11-15): the tests removed or reduced in b41c24b..HEAD (editor-shell-layout.spec.ts sheet edge geometry, editor-finding-dialog / editor-findings citation controls in the finding form, editor-initial-tab tier parameter, editor-reference-dialog reference over the side sheet, editor-references-panel sheet scrim and header) cover behaviour the owner asked to remove (side sheet, citing in the finding form, phone split); their replacements live in editor-citations-edit.test.tsx, editor-citations-guards.test.tsx and the updated e2e specs. These assertion drops are authorized. + +## Owner pre-closure brief 2026-11-15 (« Avant la clôture définitive de R2 »): additional criteria +32. [gated 2026-11-15] In the references dialog's edit mode, the select only browses: arrow keys or a pick never change the draft; a « Citer » button adds the chosen reference (unit + e2e keyboard). + CHECK: cd /home/bchanot/Documents/faunosteo-v1-2/apps/app && grep -q "'editor.citations.cite'" src/i18n/fr.ts && grep -q "'editor.citations.cite'" src/i18n/en.ts && echo CITE_KEY_OK + EXPECT: CITE_KEY_OK + EVIDENCE: MET CITE_KEY_OK (controller 2026-11-15 rc 0; verifier rerun) +33. [gated 2026-11-15] A reference created from the references dialog's edit mode is written only by its « Enregistrer », together with the citations, as ONE undoable operation; abandoning the draft leaves the library unchanged; « Ajouter une référence » in the Références tab still creates an independent reference at once (unit + e2e). +34. [gated 2026-11-15] Labels follow the cited element's kind: « Références du constat » / « Ce constat ne cite aucune référence. » for a finding, « Références de la famille » / « Cette famille ne cite aucune référence. » for a family, same logic in EN and in the filtered Références tab (unit). + CHECK: cd /home/bchanot/Documents/faunosteo-v1-2/apps/app && grep -q "Références de la famille" src/i18n/fr.ts && grep -q "Cette famille ne cite aucune référence." src/i18n/fr.ts && grep -q "'editor.references.panel_empty_family'" src/i18n/en.ts && echo FAMILY_LABELS_OK + EXPECT: FAMILY_LABELS_OK + EVIDENCE: MET FAMILY_LABELS_OK (controller 2026-11-15 rc 0; verifier rerun) +35. [gated 2026-11-15] The shared Dialog ✕ has a touch area of at least 44 × 44 px (e2e bounding box at 375 and 1280, axe). + CHECK: cd /home/bchanot/Documents/faunosteo-v1-2/apps/app && grep -q "h-11 w-11" src/components/ui/Dialog.tsx && echo CLOSE_44_OK + EXPECT: CLOSE_44_OK + EVIDENCE: MET CLOSE_44_OK (controller 2026-11-15 rc 0; verifier rerun) +36. [gated 2026-11-15] Docs: limits lifted, labels table, short manual checks for db:trial; the full sweep reported with its failures (never as all green). + +CLARIFICATIONS 2026-11-15 b (controller, owner pre-closure brief): the Rev 5 unit tests in apps/app/tests/unit/editor-citations-edit.test.tsx asserting that a reference created from the edit mode is in the library before « Enregistrer » (two undo steps) and stays uncited after an abandon are inverted by Task 15 (owner item 2 asks the opposite behaviour); the inversion is authorized, the new assertions are stricter (library unchanged, one undo step). + +SCOPE AMENDMENT 2026-11-15 (controller): apps/app/e2e/harness/dialog.tsx joins FILE SCOPE (the ui Dialog harness gains the long-title case for criterion 35; dev-server only, never built). + +CLARIFICATIONS 2026-11-15 c (controller, owner pre-closure brief: « Le balayage complet présente toujours des échecs et ne doit pas être annoncé comme entièrement vert »): for criterion 10, full-sweep failures that are browser crashes (« Target crashed ») or navigation timeouts under the accumulated sandbox load, and that pass when their spec runs alone, are reported to the owner with their counts and names, as the BLK-015 family; they are not counted as fixed and the sweep is never announced green. diff --git a/.claude/tasks/plans/2026-11-13-r2-ux-finish-1624.md b/.claude/tasks/plans/2026-11-13-r2-ux-finish-1624.md index 27026f6b..53bd4e75 100644 --- a/.claude/tasks/plans/2026-11-13-r2-ux-finish-1624.md +++ b/.claude/tasks/plans/2026-11-13-r2-ux-finish-1624.md @@ -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 + `_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 `_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.