From 7bf1404946cdf0cf0a80db9cb1839c26ccba98c8 Mon Sep 17 00:00:00 2001 From: bchanot Date: Wed, 4 Nov 2026 13:26:04 +0100 Subject: [PATCH] chore(memory): LRN-114 worktree loss, durable worktree, V1-2.6 execution ledger --- .claude/memory/journal.md | 1 + .claude/memory/learnings.md | 6 ++ .claude/tasks/TODO.md | 4 +- .../2026-11-03-v1-2-6-editor-1509.md | 2 +- .../tasks/plans/2026-11-03-v1-2-6-editor.md | 3 +- .../plans/2026-11-03-v1-2-6-execution.md | 92 +++++++++++++++++++ 6 files changed, 104 insertions(+), 4 deletions(-) create mode 100644 .claude/tasks/plans/2026-11-03-v1-2-6-execution.md diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index 3702b60d..079952f6 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -520,3 +520,4 @@ R5.4: `draft/{labels,changelog,review_report,drawing,overlay,app_review,svg_comp ## 2026-11-04 - V1-2.6 owner GO after REMAINING(1): F1 approved, C26 refined (7 repair rules: commit only when changed annotation error-free after; form group applied whole; frame change never invalidates silently), C32-C34 gated. Execution lots A-M starts. +- V1-2.6: scratchpad worktree removed by harness cleanup 13:08 (LRN-114); lots A-F + G committed safe at 8343528; uncommitted H + G fix lost. Worktree recreated at /home/bchanot/Documents/faunosteo-v1-2 (prune of 5 missing entries only). Tracked execution ledger added. diff --git a/.claude/memory/learnings.md b/.claude/memory/learnings.md index 1a5bf600..21026e86 100644 --- a/.claude/memory/learnings.md +++ b/.claude/memory/learnings.md @@ -785,3 +785,9 @@ Supersedes [[LRN-102]]. 2. Storage duplicate upload: answers HTTP 400 with body `statusCode: "409"` (KeyAlreadyExists), not HTTP 409. Delete of missing object likewise HTTP 400 + `statusCode` 404. Test/client must read body `statusCode`; any other 400 still fails. 3. Sandbox suites share one stack: e2e:shell seeds content-addressed drawings + working copies that later `test` cases meet (duplicate upload, `working_copy.exists`), so a case green only from 2nd run or only after another suite hides defects. Gate run = fresh stack (`db:sandbox down` + `up fresh`), order `test-db → e2e:shell → test`, each case robust to state the earlier suites leave; never re-run until green. **Apply**: never cite TOTP span as a guarantee (measured fact + version); Storage error handling reads body `statusCode`; V1-2.6+ gates start from fresh sandbox in that order, report state-dependent failures instead of masking them. + +## LRN-114 — Worktree in session scratchpad dies with harness cleanup; durable path + tracked ledger (2026-11-04) +- **Context**: V1-2 worktree lived in a past session's scratchpad (`/tmp/claude-1000///scratchpad/v1-2`). 2026-11-04 13:08 harness cleanup of ended sessions removed it (and other old session dirs) mid V1-2.6 execution. +- **Lost**: uncommitted lot H work, uncommitted lot G review fix, git-ignored SDD workspace (briefs, reports, rulings ledger). **Kept**: every commit — pushed by gitflow hooks (origin at 8343528). +- **Pattern**: long-running worktree → durable path outside `/tmp` and outside session dirs (now `/home/bchanot/Documents/faunosteo-v1-2`). Rulings, contract changes, findings and resume checkpoints → git-tracked file, committed + pushed after each validated lot. Scratch (SDD briefs/reports) may stay ignored; nothing needed to resume lives only there or in an agent's context. +- **Recovery recipe**: `git worktree list --porcelain` → `git worktree prune --dry-run --verbose` (only entries whose dir is gone; check their commits reachable from a branch) → `git worktree prune` → `git worktree add ` → HEAD = origin, tree clean → `pnpm install --offline`, `pnpm wasm:build` (ignored build outputs). diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index d6b839fd..e346d2f6 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -671,8 +671,8 @@ Order (BDR-071): P0 docs + decisions → V1-1 clients and animals → V1-2 sheet - [x] L2 expiry end of day Europe/Paris, species order 0..9 999 in M7, labels, TOTP key test: app 696, supabase 148, pgTAP 1965 fresh + upgrade, types match - [x] L3 TOTP reuse measured (code accepted by several sessions in its step and the next, refused at N+2), lost-authenticator review (production prerequisite), decisions in docs; sandbox test 103 + 10 skipped x2 - [x] L4 gates: check:all green (dcb1a94; delta = sandbox test + docs), fresh stack test-db 1965, e2e:shell 110 + 8 skipped, sandbox test 103 + 10 skipped after e2e, upgrade from M6 1965 + types match; security PASS x2; verifier ECARTS(6) -> CONFORME; two state-dependent sandbox tests fixed (0499a39, f5456f3); suites need a fresh stack in order test-db, e2e:shell, test - - [ ] V1-2.6 editor level 1: plan APPROVED by the owner 2026-11-03 (brief « GO propriétaire V1-2.6 »: 13 lots A-M, C1-C24, 8 visible choices, M8 sandbox only, no JSON export button, recovery messages exact), gated on a targeted independent re-check of the six FATAL fixes. Re-check 2026-11-03: REMAINING(2) — fixes 1-5 closed, I1-I5 hold; fix 6 (r = 12 + 3 %) opens `out_of_frame` on frames under ~25.5 units (hitbox r in frame bounds); I6 broken: the first commit overwrites a pending recovery copy before « Restaurer » / « Ignorer »; 2 MINOR (N source when the admin read fails, two-copy cap). Executor NOT launched; STOP for the owner. Owner arbitrations 2026-11-03 (« arbitrages propriétaire sur REMAINING(2) »): C25-C31 gated, plan revised; second targeted re-check: REMAINING(1), no BLOCKER, F1 MAJOR (accept trusted the core's silence on unmeasured views) + 7 MINOR, all integrated in the plan. Owner GO 2026-11-04 (« GO propriétaire après REMAINING(1) »): F1 fix approved, C26 refined by seven repair rules, minor effects approved; C32-C34 gated; execution of lots A-M authorised, no third plan review. Contract `.claude/tasks/contracts/2026-11-03-v1-2-6-editor-1509.md`, plan `.claude/tasks/plans/2026-11-03-v1-2-6-editor.md`; sandbox only, no DEV, no worker on DEV, no merge, no V1-2.7; STOP at the V1-2.6 owner checkpoint (trial procedure) - - [ ] A M8 draft_last_save · [ ] B sheet asset accessors · [ ] C preview mutators, edit ops, ids · [ ] D editor store, undo, recovery · [ ] E route, modes, tabs · [ ] F Général, Références, Vertèbres · [ ] G views + upload · [ ] H Annotations · [ ] I Constats · [ ] J Vérification + submit · [ ] K e2e · [ ] L owner trial tooling · [ ] M gates, reviews, checkpoint + - [ ] V1-2.6 editor level 1: plan APPROVED by the owner 2026-11-03 (brief « GO propriétaire V1-2.6 »: 13 lots A-M, C1-C24, 8 visible choices, M8 sandbox only, no JSON export button, recovery messages exact), gated on a targeted independent re-check of the six FATAL fixes. Re-check 2026-11-03: REMAINING(2) — fixes 1-5 closed, I1-I5 hold; fix 6 (r = 12 + 3 %) opens `out_of_frame` on frames under ~25.5 units (hitbox r in frame bounds); I6 broken: the first commit overwrites a pending recovery copy before « Restaurer » / « Ignorer »; 2 MINOR (N source when the admin read fails, two-copy cap). Executor NOT launched; STOP for the owner. Owner arbitrations 2026-11-03 (« arbitrages propriétaire sur REMAINING(2) »): C25-C31 gated, plan revised; second targeted re-check: REMAINING(1), no BLOCKER, F1 MAJOR (accept trusted the core's silence on unmeasured views) + 7 MINOR, all integrated in the plan. Owner GO 2026-11-04 (« GO propriétaire après REMAINING(1) »): F1 fix approved, C26 refined by seven repair rules, minor effects approved; C32-C34 gated; execution of lots A-M authorised, no third plan review. 2026-11-04 13:08 the scratchpad worktree was removed by the harness cleanup (LRN-114): commits safe on origin (8343528), uncommitted lot H + lot G fix lost; worktree recreated at /home/bchanot/Documents/faunosteo-v1-2 (owner authorisation); resume ledger `.claude/tasks/plans/2026-11-03-v1-2-6-execution.md`. Contract `.claude/tasks/contracts/2026-11-03-v1-2-6-editor-1509.md`, plan `.claude/tasks/plans/2026-11-03-v1-2-6-editor.md`; sandbox only, no DEV, no worker on DEV, no merge, no V1-2.7; STOP at the V1-2.6 owner checkpoint (trial procedure) + - [x] A M8 draft_last_save (2f824a9) · [x] B sheet asset accessors (f7e7bf4) · [x] C preview mutators, edit ops, ids (173be59..cfd49c7) · [x] D editor store, undo, recovery (7f1d440..b14509f) · [x] E route, modes, tabs (6aba971) · [x] F Général, Références, Vertèbres (d163b2c) · [ ] G views + upload (8343528, review fix to redo) · [ ] H Annotations · [ ] I Constats · [ ] J Vérification + submit · [ ] K e2e · [ ] L owner trial tooling · [ ] M gates, reviews, checkpoint - [ ] MANDATORY before merging V1-2 into develop (owner 2026-11-03): registry id reconciliation. LRN-095 collides: develop 09655b2 « Port a safe runner verbatim… » (2026-11-02) vs V1-2 « pgTAP across PGlite and the real Supabase image… » (2026-10-28, cited by BDR-084 and the V1-2.1 TODO lines). BLK-013 exists on develop only (« e2e:avatar on develop reached DEV »): `memory.sh` on V1-2 would hand out BLK-013 again, so a V1-2 blocker needs its id checked against develop first. Same for the TODO release-readiness ids: RR-11 is develop's (« sandbox-only e2e follow-ups »), V1-2 uses RR-12. No renumbering during V1-2.6 unless needed; renumber one side and patch its citers at the merge - [ ] V1-2.5 catalogue, admin space, rights, species, MFA · V1-2.6 editor level 1 · V1-2.7 preview, review, publication UI · V1-2.8 equine working copy and review preparation · V1-2.9 FR/EN acceptance and closure (owner checkpoints V1-2.3, V1-2.4, V1-2.6, V1-2.7, V1-2.8, V1-2.9 + each DEV operation of contract §16.11) diff --git a/.claude/tasks/contracts/2026-11-03-v1-2-6-editor-1509.md b/.claude/tasks/contracts/2026-11-03-v1-2-6-editor-1509.md index d3655749..222b008c 100644 --- a/.claude/tasks/contracts/2026-11-03-v1-2-6-editor-1509.md +++ b/.claude/tasks/contracts/2026-11-03-v1-2-6-editor-1509.md @@ -1,7 +1,7 @@ # CONTRACT — v1-2-6-editor - date: 2026-11-03 | flow: ship-feature | branch: feature/v1-2-anatomical-sheets - status: active -- worktree: /tmp/claude-1000/-home-bchanot-Documents-faunosteo/e641af9a-743e-46d0-9804-99667836040e/scratchpad/v1-2 +- worktree: /home/bchanot/Documents/faunosteo-v1-2 (durable since 2026-11-04, LRN-114; was a session scratchpad) (every command runs from this worktree; never from /home/bchanot/Documents/faunosteo, never against DEV: the `supabase_*_faunosteo` containers are DEV and are never touched; the sandbox is `faunosteo_dbsandbox_*`) - base: 7f618d0 (memory commit after V1-2.5 VERIFIED at b4415a3) diff --git a/.claude/tasks/plans/2026-11-03-v1-2-6-editor.md b/.claude/tasks/plans/2026-11-03-v1-2-6-editor.md index 36a83993..b8e20e9a 100644 --- a/.claude/tasks/plans/2026-11-03-v1-2-6-editor.md +++ b/.claude/tasks/plans/2026-11-03-v1-2-6-editor.md @@ -2,7 +2,8 @@ Contract `.claude/tasks/contracts/2026-11-03-v1-2-6-editor-1509.md` (criteria C1 to C34, CLARIFICATIONS [gated 2026-11-03] and [gated 2026-11-04]). Branch `feature/v1-2-anatomical-sheets`, worktree -`/tmp/claude-1000/-home-bchanot-Documents-faunosteo/e641af9a-743e-46d0-9804-99667836040e/scratchpad/v1-2`, base +`/home/bchanot/Documents/faunosteo-v1-2` (durable since 2026-11-04, LRN-114; execution ledger +`.claude/tasks/plans/2026-11-03-v1-2-6-execution.md`), base 7f618d0. Sandbox only (`pnpm db:sandbox`, containers `faunosteo_dbsandbox_*`); the `supabase_*_faunosteo` containers are DEV: never touched, never a target. Every command runs with the worktree as an absolute, verified cwd (LRN-110). One lot = one coherent change, committed and pushed by the orchestrator after its own diff --git a/.claude/tasks/plans/2026-11-03-v1-2-6-execution.md b/.claude/tasks/plans/2026-11-03-v1-2-6-execution.md new file mode 100644 index 00000000..5ba5a904 --- /dev/null +++ b/.claude/tasks/plans/2026-11-03-v1-2-6-execution.md @@ -0,0 +1,92 @@ +# 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 | 2 Important open (fix lost with the old worktree) | fix round to redo | +| H Annotations | — | — | to redo from scratch (lost, uncommitted, never tested) | +| I Constats · J Vérification · K e2e · L owner trial · M gates | — | — | pending | + +## 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. +- 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 fix (Important, from its review; V1-2 contract §9.3 item 6): `hash_mismatch` and `svg_not_canonical` must + show as closed codes with FR/EN messages. Design kept from the lost round: `drawingStatus.ts` + `rejectionReason(detail)` maps the core's rejection details (`not_canonical`, `processing_instruction`, reader + reasons, `removed …` → `removal`, else `other`; raw detail never shown); a `rejected` `not_canonical` drawing + reads « Illustration refusée : elle n'est pas sous la forme enregistrée… »; `updateView` refuses through + `accept` a new `svg_asset_id` the core holds as `rejected` (`drawing_rejected`), which `attachToView` reports as + `svg_not_canonical` (or `svg_rejected` with the reason); `object_conflict` unchanged; keys + `editor.upload.err.svg_not_canonical`, `editor.views.drawing.not_canonical`, `editor.views.drawing.hash_mismatch`, + `editor.upload.reason.processing_instruction`, `editor.upload.reason.removal` (proposals, section « Lot G »). +- Lot G fix (Important, code limits): `EditableCrop` (~8 locals, nested `apply`) and `ViewDrawing` over the limits. + Design kept: `useCropGroup(viewId, box)`; `CropEditor` → `EditableCrop`, `CropFields`, `CropRefusal`; `ViewDrawing` + → `DrawingLines`, `DrawingActions`, `FilePicker`, `UploadNotices`. +- Store gap found during that round (owner 2026-11-04: must be checked): a hash mismatch at load shows + « Illustration introuvable » instead of the hash message; `state/editorLoad.ts` apparently does not record that + failure in `drawingFailures`. Not confirmed; the G fix round owns it (store files allowed for this point). +- 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: 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). + +## Questions for the owner at the checkpoint (not decided) + +- 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). +- Every new label stays a proposal (`.claude/audits/2026-11-03-v1-2-6-label-proposals.md`).