Files
faunosteo/.claude/tasks/plans/2026-11-03-v1-2-6-execution.md

254 lines
24 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# V1-2.6 execution ledger (tracked, resume source)
Plan `.claude/tasks/plans/2026-11-03-v1-2-6-editor.md`, contract `.claude/tasks/contracts/2026-11-03-v1-2-6-editor-1509.md`
(C1-C34). Worktree `/home/bchanot/Documents/faunosteo-v1-2` (durable, owner 2026-11-04; the former one under a session
scratchpad was removed by the harness cleanup at 13:08, LRN-114). Branch `feature/v1-2-anatomical-sheets`. Sandbox
only. This file holds every ruling, finding and checkpoint needed to resume; the git-ignored SDD workspace
(`.superpowers/sdd/2026-11-03-v1-2-6-editor/`) holds drafts only. Updated and pushed after each validated lot.
## Lots
| Lot | Commits | Review | State |
|---|---|---|---|
| A M8 `draft_last_save` | 2f824a9 | clean | done (sandbox fresh 1992 + upgrade from M7, types --check) |
| B sheet asset accessors | f7e7bf4 | clean | done (sandbox 2/2 twice; refusal observed HTTP 400 + statusCode "403") |
| C preview mutators, edit ops, ids | 173be59, bc43a1b, cfd49c7 | clean after 2 fix rounds | done |
| D store, undo, recovery, issues | 7f1d440, b14509f | clean after 1 fix round | done |
| E route, modes, offer, conflict | 6aba971 | clean | done |
| F Général, Références, Vertèbres | d163b2c | clean | done |
| G views + upload | 8343528, 1bbf97e, 7ea9619 | clean after the redone fix rounds (G1 closed codes, G3 hash at load, G2 split) | done |
| H Annotations | 2609785, 3f15762 | clean after 1 fix round (owner rules O1-O6 hold, H1-H8 addressed) | done |
| I Constats | 92c595c, 91d06c9 | clean after 1 fix round (C9 description, vet referral, citations; keyboard focus) | done |
| J Vérification + submit | 447d0a4, 4f223e0, 3d589e1 | clean after 2 fix rounds (« Aller à » selects the element, consumed once) | done |
| L owner trial tooling + guide | ac5fbfb | clean (security checks all hold); 3 minors for the guide fix with K's findings | done |
| K e2e (fresh sandbox: test-db 1992; e2e-shell final 147 passed / 45 skipped 375 px / 0 failed) | 5097fd7, bb99edd, 4cc27a8 | clean after 2 fix rounds (I1-I4, M1/M3/M4/M5/M8; species loss = spec resolving the list filter « Espèce », not a product defect) | done |
| M gates | 071b58a..7a4ce9e | 3 fresh verifier passes (last: 33/34 MET, C22 order fixed and re-run); final opus review With fixes (I1, I2, m1, m2, m5 fixed, re-review Approved); security PASS on 7a4ce9e | done: on 7a4ce9e, one fresh sandbox test-db 1992 → e2e-shell 148 passed / 46 skipped / 0 failed → db:sandbox test 105 passed / 10 skipped → down; check:all green (unit 66/159/1033, e2e:ui); r5:import-equine --check 0 differences |
## Rulings (orchestrator, each with its cost if wrong)
- R1 `readVersion` draft mode moved from Lot E to Lot D (D's `open()` consumes it). Cost: one lot boundary moved.
- R2 the `accept` hook lives in `CataloguePreview.replaceDocument(text, accept?)` so the rollback is in one place.
Cost: one signature to move.
- R3 a lot's review may run in parallel with the next lot's implementation when their files are disjoint. Cost: a
fix round sees a partial tree in typecheck; commits use explicit paths.
- R4 the store refuses `submit` while unsaved (closed kind `unsaved`) besides `stale_base`; the UI mirrors it.
Cost: one extra refusal kind.
- R5 Lot E dispatched while Lot D's re-review ran (E never edits store files). Cost: E adapts to a later store fix.
- R6 mode precedence rights > inactive > historical > frozen > narrow (strongest server-side reason first, display
reason last). Cost: notice order only; listed at the checkpoint.
- R7 a detail view's parent change goes through the geometry `accept` (it changes the inherited drawing, owner
rule 7); the button « Utiliser l'illustration de la vue parente » (drop an own drawing back to a crop) kept as a
label proposal and a visible choice for the checkpoint. Cost: a refused parent change; one button removed.
- R8 locals limit: one destructuring declaration (`const [x, setX] = useState()`, `const {a, b} = form`) counts as
one local, the reading every earlier lot was reviewed under; `useCropGroup` (5) and `useCropDraft` (4) pass.
Cost if wrong: a cosmetic split of two hooks.
- R9 Constats: a finding category's kind is creation-only (C9 lists no kind edit). Cost: one select added later.
- R10 undo/redo shortcuts editor-wide (plan « Store and sessions »), writable mode only, ignored under an open modal
dialog. Cost: shortcut scope only.
- R11 « Aller à … » selects the element through a focus request on `EditorTabProps` (`{key, serial}`), each tab
seeding its own selection. Cost: one prop on every tab.
- R12 the 10 store files reformatted by a subagent's Prettier run (format only, uncommitted) are neither committed
nor reverted by the orchestrator: the subagent's `git checkout` was refused by the permission classifier and the
orchestrator does not run a refused action on its behalf; the owner decides (revert or keep). Every commit uses
explicit paths meanwhile.
- R13 an editor grant without the admin role sees « Fiche introuvable », not a read-only draft: the route sits
under `RequireAdmin` (contract C1); the K brief's read-only expectation was wrong. Cost: none (contract text).
- R14 Lot K touch fix: `touch-action: none` while a movable annotation is selected (the browser reads it at
touchstart; a touch drag was cancelled as a pan). Visible side effect: no touch scroll of the canvas while a
movable annotation is selected; listed at the checkpoint. Cost: one CSS condition.
- R15 the findings-tree crash on the equine copy (stored nodes omit serde-defaulted fields) is fixed at the root:
the loader keeps the core's defaults-filled `PreviewState.document` as `documentText`/`savedText`; K's
TypeScript mirror of the defaults in `tree.ts` (BDR-043 breach) is removed. `editorLoad.ts` hunks are staged on
the committed version, the R12 format changes stay uncommitted. Cost: one load path.
- R16 `docs/design/v1-2-4/REVUE.md` (approved dossier, holds SHA-256 of the boards) is not edited; the V1-2.6
pointer lives in `docs/design/README.md`. Cost: one extra pointer line.
- R17 contract C25 binds over the plan's quoted copy wordings (« … Elle est conservée. », copy_kept): every copy
message names « temporary, this tab, not saved on the server »; the refused-copy notice keeps the offer text and
adds the refusal; new wordings are proposals. Cost: wording only.
- R18 the 375 px `test.skip` of editing specs stands (C16: editing ≥ 1 024 px; read-only phone coverage in
editor-access); the verifier's floor flags them, no CLARIFICATION needed. Cost: none.
- Promoted minors (same invariant as an Important finding): C non-trap `internal` taken as a trap (now detected by
runtime generation/status); D `discardChanges` busy guard and late `readConflict` write after dismiss.
## Open findings to carry
- Lot G fixes DONE (1bbf97e, 7ea9619): G3 root cause — the store already recorded `drawing_hash_mismatch` in
`drawingFailures`; `drawingStatusOf` read the core's `missing` entry first. `issues.ts` gained the refusal reason
`drawing_rejected` (+ optional `drawingDetail`) for attaching a drawing the core holds as rejected; `geometryAccept`
unchanged. `svg_not_canonical` is unreachable through the page's own upload (it uploads its cleaned form); covered by
attaching a held non-canonical drawing.
- Lot H design notes from the lost attempt (NOT implemented, NOT tested; to be rebuilt): proposal arithmetic in
`editor/annotations/frame.ts` (F from the `viewBox` text with `Number`, r0 floored to 0.01, candidates A/B/C, C by
an inward-rounded per-axis clamp with the exact clamp on an empty interval); every geometry commit through
`commit(cmd, { accept: geometryAccept({ before: previewState, changedIds: [id] }) })`; `correctionFor` offers C on
an `out_of_frame` refusal or a refused radius under r0; one geometry-group component for the pending creation and
the properties panel; read-only reuses `CatalogueCanvas` with `key={handleVersion}`; select and place on `click`,
drag move after 4 CSS px; `canPan` false on a selected marker or while a drawing tool is active. Implementer's own
additions to judge: zone and link clicks outside F get the same hint as points; « Remplacer par un polygone »
commits on close under `accept`, a refusal drops the tracing.
## Deferred minors (for the final review's triage)
- A: M8 header comment « Null when the draft has no draft »; 023 lacks a save with a null actor; 023 non-save write
relies on the revision trigger (asserted).
- B: doc line 101 chars in sheets.ts; test lines > 100 chars; `classifyUploadError` duplicates 3 branches of
`classifyDrawingError`; `storageCode()` "undefined" fallback.
- C: `canPan` ref set during render; unrelated Prettier re-wrap in useFraming.ts; tests lack re-add-replaces-bytes
after rebuild and a 16-entry map assertion; cleaning test IIFE builder; private `handle` cast in a test; local
`document` shadows the DOM global.
- D: `keepMine` checks conflict before the recovery block (unreachable); `finishRestore` drops a failed copy
drawing from the held list; `geometryErrorsById` superset of the four codes (accepted); `setCanEdit` without a
`restoring` guard (no loss); true→false→true with unsaved work untested.
- E: `otherCopies.ts` re-parses copies on render (add `sheetId` to `StoredCopyInfo`); leave guard under recovery
alone untested at page level; conflict `reading` state has no Annuler (Escape to confirm in e2e).
- F: digits-only count check overlaps the core's unsigned rule (shape check); `duplicate_key` retry and
DeleteDialog failure branch untested; RangeEditor `setState` during render; repeated row labels; long citation
titles.
- G: `issues.ts` Prettier noise on Lot D lines; frame-refusal test lacks the `other` / `removal` fallbacks; no session check between register/list/upload/confirm (idempotent); UI state set after an await without the
session check; `parseBox` accepts `1e3` / `0x10` (the core decides).
- I: no tree type-ahead; expansion seeded once (a restore bringing new zones leaves them collapsed); add-category
with a node selected lands at zone level without a hint; `Citations` long JSX; `currentItems()` swallows a parse
error.
- H: `pendingForClick` (creation.ts:161) 7 locals; ToolColumn, CreationFields, CreationPanel, ToolButton long JSX
(markup); per-click 1000×30 / 4000×200 tests assert invariants, not each verdict; 1000×30 keyboard case skips
silently; `useUndoShortcuts` uses `dialog[open]` (not `:modal`), ignores neither `defaultPrevented` nor `repeat`;
stale `built.failure` notice for one build after a view switch; `proposedRadius` kept on a cx/cy-only edit.
- E (found at H re-review): `DraftEditor` 13 locals and `AdminSheetDraftRoute` 10 locals (limits breach).
- J: focus serial restarts at 1 after a clear (latent: a same-instance self « go to » would be skipped; a
monotonic route counter removes it); `focusRow` global querySelectorAll by JSON key; issue codes a hand-kept
mirror of the core's 26 codes (complete today).
- K: M2 accepted (a recovery copy written before R15 holds raw text: one extra recovery offer, answered once; no
editor in use outside this branch); M6 pointer capture not exercised in a real browser; M7 journey test body
~140 lines and 6 lines > 100 chars; M9 French literals in the journey spec; e2e support `browser.ts` untouched
(a stray Prettier reformat was verified format-only and restored).
- L (folded into bb99edd except the two script items below): trial.config.ts checks hostname only (add `protocol === 'http:'`);
guide hard-codes the worktree path (say « racine du dépôt »); step 4.3.1 paraphrases the no-category hint (quote
« Créez d'abord une catégorie d'annotation (onglet Général). » and name « Nouvelle catégorie » / « Ajouter la
catégorie »); unknown email gives a raw `\gset` error; `trial-account` not idempotent.
- K: latency (headless Chromium, n=16, median/p95/max ms, handler end): equine rename 38/42/55, add category
45/49/49, geometry edit 46/54/61; synthetic 1 803 038 B rename 100/117/222, add category 105/111/112; second
animation frame up to 133 (equine) and 331 (synthetic). Budget 500 ms met. Expect timeout raised to 10 s (8
workers on one stack); `e2e/support/warm-up.ts` global setup absorbs Vite's first dependency reload.
- Final review (opus, 2571978..0764eb1): no Critical; I1 (undo shortcuts active in narrow read-only), I2
(`downloadAndHold` store write without the session check), m1 (post-submit edit window), m2 (restore keeps raw
copy text, R15), m5 (staleBase with nothing unsaved is a dead end) taken in Lot M fix round 3. Kept for before
the V1-2 merge: m4 per-commit copy bookkeeping cost (each other copy parsed twice), m6 conflict dialog after a
`rights.*` refusal of « Garder ma version », m7 `issues.ts` `drawingAssetOf` mirrors the core's
`asset_id_of_view` (BDR-043: needs a core op, crates out of scope in V1-2.6), m8 React component locals
(DraftEditor 13, AdminSheetDraftRoute 10, DraftHeader ~11, `pendingForClick` 7), m10 M8 header comment
« Null when the draft has no draft » (migrations frozen in this step). Every ledger deferred minor triaged
« keep » except L trial.config / path / 4.3.1 (done). Second verifier pass: C19 marker wordings, C25 two header
copy strings, C22 final-HEAD check:all + security, floor waivers on the 375 px skips: fix round 3.
- Final gates. My first two chains ran `pnpm test:run` as the third step; the contract's `test` is
`pnpm db:sandbox test` on the same fresh stack after `e2e:shell` (LRN-113), caught by the third fresh verifier
(C22 NOT MET, 32/34 MET otherwise). Re-run in the exact order on 697cefa. Security gate on 5bd1226: PASS, LOWs:
trial dev server not pinned to loopback in its own config (fixed 697cefa), Vite inherits PGPASSWORD in
`cmd_trial` (kept: never exposed to the browser; `env -u PGPASSWORD` before the merge), template SQL in e2e
helpers against the throwaway sandbox (kept, same idiom as the existing sandbox suites). Verifier note fixed:
EN hints named the tab « Views and illustrations » (3831a49).
- Security gate on 7a4ce9e: PASS; new LOWs kept for before the merge: the trial nginx gateway answers any Host
(DNS rebinding could reach the throwaway sandbox during a trial; `server_name` + default 444), `secondSession`
aborts refused requests without failing the test, the recovery copy survives an explicit sign-out (owner
question below). One e2e setup failure (`editor fixture: no aal2`, TOTP verify) seen once on 697cefa, not
reproduced; step guard added to the shared helper (2b10471), failure messages now carry status + GoTrue code.
## Questions for the owner at the checkpoint (not decided)
- The 10 format-only uncommitted changes under `apps/app/src/editor/state/` (R12): revert (`git checkout -- apps/app/src/editor/state`) or keep.
- « 1 erreurs bloquantes »: ratified wording kept; a singular form needs the owner.
- Trim leading/trailing spaces of typed values before sending (Lot F review: visible choice).
- R6 mode precedence, R7 « Utiliser l'illustration de la vue parente », default tab Annotations (boards 04/05).
- m3: attaching a drawing to an unmeasured view that already holds annotations is refused as « newly invalid »
when they fall outside the new frame, and geometry on an unmeasured view is locked (C32): the only way out is
deleting those annotations. Keep the rule, or allow repair after attach?
- Findings: adding a category with a node selected lands at zone level without a hint (visible behaviour).
- The local copy survives an explicit sign-out in the same tab (sessionStorage): drop the account's copies at
sign-out, or keep them (current design: a copy is removed only on an explicit outcome)?
- Every new label stays a proposal (`.claude/audits/2026-11-03-v1-2-6-label-proposals.md`).
## Lot N — owner checkpoint decisions (brief « Checkpoint V1-2.6 : décisions finales du propriétaire », 2026-11-04)
Contract criteria 35-44. Arbitration 1 done by the orchestrator (diff kept in the git-ignored SDD workspace
`r12/r12-format.diff`, sha256 3593183c…, plus the session scratchpad; 10/10 files equal to HEAD after Prettier on
both sides; restored with `git restore`). Memories LRN-115, LRN-116, LRN-117 (observation, strict control only),
EVAL-042 (67480b2). Arbitration 4 already holds (mode.ts:57-69 rights > inactive > historical > frozen > narrow;
server refusals demote only from `edit`): no change. Arbitration 10: proposals file only.
| Lot | Scope | State |
|---|---|---|
| N1 | plurals (36), trimming (37), parent illustration confirmation (39), default tab (40), category destination hint (42) | be4f468; review spec ✅ Approved; Important (stale category fallback key) carried to N3; `editor.draft_rebased` is the local tool, out of the editor scope; core `reconfirm_redrawn_views` (edit.rs:842) backs the dialog text |
| N2 | sign-out confirmation and copy purge; purge of other accounts' copies on a different-account sign-in (43) | bd4ba33; review spec ✅ Approved (store cannot hold another account at click: route closes it; purge before sign-out, after confirmation); minor: confirm button not `variant="danger"` unlike the leave dialog (align in N4); the implementer's chained `pkill` + `db:sandbox down` was refused by the permission system: not re-run by the orchestrator, surfaced to the owner, 5 sandbox containers left up |
| N3 | repair on attach to an unmeasured view: temporary repair dialog, one atomic commit validated by the core (41) | 3776a33, 9c21fd3, 46fd861; opus review Changes requested (locals, pending drafts, dialog wording) then re-reviews Approved; no Rust op (R23); owner question: a free path is only replaceable by a small triangle at the frame centre (shape lost) |
| N4 | guide (086d6e9, c5fd3c3), trial commands run from the worktree, gates | done: on 5e0aa62 fresh sandbox test-db 1992 → e2e-shell 150 passed / 48 skipped / 0 failed → db:sandbox test 105/10 → down; check:all green (66/159/1083, e2e:ui); r5 check 0 diff. Verifier on 6471b25: 43/44 (C37: submission note trimmed since lot J) → fixed 5e0aa62 with the sign-out purge race (second purge after sign-out); security PASS full range + scoped |
- R19 default tab: Annotations when at least one view is measurable (`unmeasuredViews` complement), Général
otherwise; this also covers an existing sheet with no measurable view (the brief names two cases only; Général
keeps one rule for « nothing to annotate yet »). No « new » flag exists. Cost: one condition.
- R20 findings « root »: the core accepts a finding category only under a zone (`insert_top` refuses it), so the
root a category can have is the zone level; « Ajouter une catégorie » already inserts there whatever the
selection; N1 adds the destination zone to the form, « Ajouter un constat » stays the explicit child insert.
Cost: wording only.
- R21 plurals: one editor helper on `Intl.PluralRules(locale)` with `_one` / `_other` keys (French 0 and 1 are
singular); V1-1 call sites keep their ternaries (not reopened). Cost: a helper.
- R22 trimming: opt-in on the fields that commit names and simple labels (sheet, categories, views, annotations,
regions, finding zones/categories/nodes, authors, licence) and their creation forms; never on descriptions,
notes, citations, URL, DOI, colours, SVG. Cost: one prop.
- R23 arbitration 7 without a Rust op: `sheet.edit` is pure text→text; the attach and the repairs are chained on a
scratch text and committed once through `preview.replaceDocument(text, accept)` (one undo entry); the core
judges the end state. Cost: one store action.
- Trial commands verified 2026-11-04 from the durable worktree: account, grants, rerun, unknown e-mail, `trial`
(/login 200, proxied /auth/v1/health 200, password sign-in through the proxy 200), sockets on 127.0.0.1 only.
One `up fresh` right after a `down` failed on « 127.0.0.1:57432 address already in use » (rootless Docker port
release lag): `down` + `up fresh` recovered; guide §5 says so.
- Residual LOW (security, unproven): an upload resolving after the second purge and before the editor store
closes could rewrite the departing account's own copy in its own tab (purged at the next other-account sign-in
or tab close). Before the merge: gate `syncCopy` on the auth user matching `state.userId`.
- R24 involuntary session end: copies stay keyed to their user (offered again only to that user); when a
different account signs in within the tab, the other accounts' copies are purged (never exposed). Cost: a lost
copy if another person signs in on that tab.
## Verification state at the owner-trial checkpoint (2026-11-04)
Fresh verifiers, combined: 6471b25 pass → 1-36 and 38-44 MET in code, 37 NOT MET (fixed 5e0aa62); 6f0fa41 pass →
37 and 43 MET, 1-19, 24-29, 31-33, 35-44 hold, 20/21/22/30 not observable to it; raw-log pass on the 5e0aa62 run →
20, 21, 22 (sandbox + check:all), 30 CONFORME. Security: full range PASS (6471b25), scoped PASS (5e0aa62). Open:
23 and 34 only for the checkpoint report itself. Verifier notes kept: 8 of the 48 e2e skips are pre-existing
admin.spec 375 px journeys; the keyboard spec focuses programmatically (no Tab walk); the journey's restore checks
the unsaved status (editor-recovery:134 proves the value in SQL); FILE SCOPE amended (a09e24d) awaits the owner.
## Lot O — last owner decisions before the trial (brief « V1-2.6 : derniers arbitrages avant essai propriétaire »)
Contract criteria 45-48. Owner confirmed R19 (default tab), R20 (category root = first level under a zone, but the
action must not depend on the selection: C46), and the FILE SCOPE amendment a09e24d (only files the criteria need).
| Lot | Scope | State |
|---|---|---|
| O1 | C45 free paths: drop the triangle conversion, clean refusal, regression test; C46 explicit zone choice | a69eba5 (+2057b0e quotes); review Approved; i18n rebuilt from HEAD by the orchestrator (the agent had reformatted the dictionaries) |
| O2 | C47 LAN trial on http://192.168.1.100:5193 (bind, Supabase URL, host check), guide | d74c54e, fb95255 (fs.allow to app sources, no PGPASSWORD); review Approved; LAN journey passed twice by the orchestrator; two agent commands refused by the permission system (probe chain, `rm -rf` in a chain): not re-run by the orchestrator |
| O3 | gates, checkpoint report, fresh verifiers, security | done: gates green on 2057b0e; LAN journey re-run after each trial-server change; host filter 5207f87, cors/ws/open-in-editor 8531dd3, upgrade closing 72b742f; security PASS on every range to fe724b2; fresh verifiers: final pass on 70c34bf CONFORME, 0 NOT MET, all 48 criteria hold with the earlier verdicts (security verdicts and raw-log runs as recorded); 9b86f54 fixes the last guide/comment wording after that pass (docs/comment only, not re-verified) |
- R25 C45: the core stores a free path as an SVG `d` string and exposes no operation that lists or moves its
points (`sheet.check`, `sheet.empty`, `sheet.edit`, `sheet.dependents` only). Parsing `d` in TypeScript would be
a rival parser (BDR-043, owner clause): O1 refuses the attach cleanly when a free path falls out of the new frame
(document unchanged, no triangle) and the minimal core evolution is presented at the checkpoint, not built.
- R26 O1 and O2 run in parallel: disjoint files (O1: editor repair/findings/i18n/unit and e2e editor specs; O2:
apps/app/vite/trial.config.ts, scripts/db-sandbox.sh, guide). Cost: one conflict if a file overlaps.
- R27 C47: only Vite is exposed, on 192.168.1.100:5193; it proxies /auth/v1, /rest/v1, /storage/v1 to the trial
gateway kept on 127.0.0.1:57801; the sandbox ports stay on loopback; secrets live in ~/.cache (outside Vite's
served root); the LAN browser runs in a non-secure context (plain HTTP), already handled by lib/id.ts as on DEV.
## Owner-trial checkpoint (2026-11-04, after lot O)
Report `.claude/tasks/plans/2026-11-04-v1-2-6-checkpoint.md` (verified at 70c34bf). Pending owner decisions: the
core proposal for free-path point correction (`2026-11-04-v1-2-6-path-repair-core-proposal.md`, reopens crates/**);
the single-zone preselection in the category form (C46 says « chosen explicitly »: one zone is preselected); the
FILE SCOPE line adding apps/app/tests/helpers/** (5a3ed97). Owner-side checks: a real second LAN device, the host
firewall rule if needed, removing the trial TOTP entry afterwards. Not validated functionally until the owner's trial.