From cac66f6e764ae3486cf86db024b99a188fd556d4 Mon Sep 17 00:00:00 2001 From: Alexander Kucera Date: Mon, 23 Nov 2026 22:38:43 +0100 Subject: [PATCH] docs(brief-28 r1): evidence classes, r1 verify line, changelog/index to 717 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit N-2: "Identity checks — evidence classes" — pinned (card hop-back, rescan hoist, #179 guard) vs correct by construction (the Micropub stamp) vs invariant-equivalent defensive depth (the synchronous sweep and openPostID's gate: never independently observable under the gate-first invariant — belt to the gate's suspenders, not "every site test-verified"). Verify line for r1 at 92344e2: full rail 717/717, filtered 19/19, MF-1 mutation 9/8/1 restored byte-exact, lint 0/0. Gotchas: the partial patch regeneration, the status/current race. N-3 is the regenerated owner-apply patch beside the handoff. --- CHANGELOG.md | 2 +- ...e-repoint-retains-old-editor-target_log.md | 73 ++++++++++++++----- docs/devlog/INDEX.md | 2 +- 3 files changed, 56 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ed51e9..7f25ce7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ All notable changes to this project will be documented in this file. The format ### Fixed -- **editor:** A Home repoint is a guarded document departure (finding `museion/home-repoint-retains-old-editor-target`, argus cycle-5; unticketed fix, brief-28) — Settings → Choose… committed the new Home and flipped `watchedHome` without departing the open session: the session's immutable target kept the OLD Home, so a same-slug piece in the new library made the ID-only reselect return it (autosave/Save/quit wrote the old library while structural operations resolved against the new one), the new library's rescan raised a spurious reload conflict on it, a no-collision piece was torn down by the vanish path with its dirty buffer dropped, and a card scan from the old library could land on the new library's same-slug piece. #198's departure gate never saw this seam. Now `PostsModel.repoint(to:)` runs the SAME gate (`sessionMayDepart`'s three legs — unanswered conflict, failed flush, never-loaded retype; no parallel gate) BEFORE anything commits: a refusal changes nothing (preference, binding, the session's target and buffer stay; the #198 reason spoken once, the #200 quit-refusal posture, since no Posts strip is in sight from Settings), an acceptance lands the edits on the old library first and clears the departed piece's state — nothing auto-reopens. Document identity is (Home, ID) everywhere (`EditorSession.targets`, `PostsModel.openSessionTargets`): every bare `session.postID ==` comparison is retired across select, the structural rail, conversion, the pass guard, Micropub and the card refresh, and async continuations re-validate identity at COMPLETION (the card-scan hop-back; `rescan`'s stale-Home verdict is hoisted to cover the list, the revision and the #67 text, not just the vanish check). The in-memory draft survives a repoint (no Home until first save). +7 tests over a two-Home same-slug rig (the three refusal legs with ordering pinned, same-slug open + save on flush AND quit, no-collision cleanup, stale card scan via the per-model `scanPieceCards` seam — mutation-checked, pass after repoint), RED-first 6/6 at the pin. Suite 715 (unticketed fix, brief-28) +- **editor:** A Home repoint is a guarded document departure (finding `museion/home-repoint-retains-old-editor-target`, argus cycle-5; unticketed fix, brief-28) — Settings → Choose… committed the new Home and flipped `watchedHome` without departing the open session: the session's immutable target kept the OLD Home, so a same-slug piece in the new library made the ID-only reselect return it (autosave/Save/quit wrote the old library while structural operations resolved against the new one), the new library's rescan raised a spurious reload conflict on it, a no-collision piece was torn down by the vanish path with its dirty buffer dropped, and a card scan from the old library could land on the new library's same-slug piece. #198's departure gate never saw this seam. Now `PostsModel.repoint(to:)` runs the SAME gate (`sessionMayDepart`'s three legs — unanswered conflict, failed flush, never-loaded retype; no parallel gate) BEFORE anything commits: a refusal changes nothing (preference, binding, the session's target and buffer stay; the #198 reason spoken once, the #200 quit-refusal posture, since no Posts strip is in sight from Settings), an acceptance lands the edits on the old library first and clears the departed piece's state — nothing auto-reopens. Document identity is (Home, ID) everywhere (`EditorSession.targets`, `PostsModel.openSessionTargets`): every bare `session.postID ==` comparison is retired across select, the structural rail, conversion, the pass guard, Micropub and the card refresh, and async continuations re-validate identity at COMPLETION (the card-scan hop-back; `rescan`'s stale-Home verdict is hoisted to cover the list, the revision and the #67 text, not just the vanish check). The in-memory draft survives a repoint (no Home until first save). +9 tests over a two-Home same-slug rig (the three refusal legs with ordering pinned, same-slug open + save on flush AND quit, no-collision cleanup, stale card scan via the per-model `scanPieceCards` seam — mutation-checked, pass after repoint; review r1: the hoisted `rescan` stale-Home verdict via the `scanLibrary` seam — mutation-checked — and the draft-survives repoint), RED-first 6/6 at the pin. Suite 717 (unticketed fix, brief-28) - **editor:** Quit no longer bypasses the document departure gate (#200, follow-up to the #198 audit) — `PostsModel.shutdown()` flushed both sessions best-effort and ignored the results, so quitting with an unanswered reload-conflict alert wrote the local text over the foreign disk body (`flush()` holds for conflicts only in the debounce, never itself), and a failed quit-time flush silently dropped the only copy of the edits. Quit now routes through the same departure gate as navigation (`documentsMayDepart` → `sessionMayDepart`): an unanswered conflict never writes over the foreign body, and the failed-flush-at-quit posture is BLOCK QUIT — `WritingLockAppDelegate.applicationShouldTerminate` refuses termination with one spoken reason (running before the Cold Turkey ask, so a refusal never strands a walked-away block), pinned at the pure `quitReply(posts:)` seam. Finish-audit additions: a never-loaded session's retyped words refuse too (their flush is a vacuous success — the same gap closed for navigation), and the external guest's quit-time flush is pinned. +5 tests, all flip-verified. Suite 708 diff --git a/docs/devlog/20261123-home-repoint-retains-old-editor-target_log.md b/docs/devlog/20261123-home-repoint-retains-old-editor-target_log.md index 2b56fd9..71e5053 100644 --- a/docs/devlog/20261123-home-repoint-retains-old-editor-target_log.md +++ b/docs/devlog/20261123-home-repoint-retains-old-editor-target_log.md @@ -90,10 +90,22 @@ async COMPLETION. re-validating against the live session would skip a correct write after a mid-send repoint. Disclosed, left as is. -**Tests:** `PostsModelRepointTests` (7, new file) over a two-Home same-slug +**Tests:** `PostsModelRepointTests` (9, new file) over a two-Home same-slug rig (`projects/posts/shared/post.md` in both, differing bodies); the #179 mid-pass repoint pin (`PostsModelWriteRailTests`) now drives the real Settings -path (`repoint(to:)` then `bind`). +path (`repoint(to:)` then `bind`). r1 (athena) added the two the review +asked for: the hoisted `rescan` verdict (MF-1, via the `scanLibrary` seam) +and the draft-survives decision (N-1). + +## Identity checks — evidence classes (r1, athena N-2) + +"Identity everywhere" is NOT "every site test-verified". Three classes: + +| Class | Sites | Proof | +|-------|-------|-------| +| **Pinned** (failing-test / mutation proof) | `refreshCards` hop-back (the seeded site); `rescan`'s hoisted stale-Home verdict; the #179 mid-pass advance guard (pre-existing, its `lastError ==` line) | Mutation checks: ID-only card guard → `openPieceCards → ["Hedging"]`; hoist removed → `posts → ["alpha"]` + `contentRevision → 3` vs `2`. Both restored byte-exact. | +| **Correct by construction** | Micropub's completion stamp — the captured (Home, ID) of the piece actually sent | Not independently pinnable: a re-validate against the live session would SKIP a correct write after a mid-send repoint. Disclosed, left as is. | +| **Invariant-equivalent defensive depth** — never independently observable under the gate-first invariant | The whole synchronous sweep: `select` reselect, `openUnguarded`×2, `stageConversion`, `convertToPost`, `flushOrAbort`, the six structural ops, `guardOpenPieceRun`, Micropub launch, `refreshCards` launch, `canArmWritingLock`/`editorBodyText`, the vanish teardown, AND `rescan`'s `openPostID` identity gate (the #67 read) | None possible while the gate holds: a live session always targets `watchedHome`, so the id-only and identity forms agree on every reachable state (athena's run removed `openPostID`'s gate and reverted `select` to ID-only — the rail stayed green). They are belt to the gate's suspenders: any future path that bypasses `repoint` (a direct `bind` under a live session — what the mid-pass pin used to do) falls through to a departure instead of matching across libraries. Correct as design; not test-verified; say so. | ## Decisions & Rationale @@ -119,6 +131,8 @@ path (`repoint(to:)` then `bind`). | Vanish-path rewrite first tore down the CAPTURED session | `openSessionTargets(id)` reads `session` now while `openSession?.teardown` hit the pre-scan object — a same-id reopen mid-scan would leave the live session armed | `if let open = session, open.targets(postID: id, home: home)` — the original shape (current session), identity-matched | | `swiftlint:disable:next large_tuple` flagged superfluous | The return type sat on the `) ->` line, not the `func` line the `:next` covers | Signature on one line so the tuple starts on the covered line (PostStore.swift:259 precedent) | | A context-fuzzy patch duplicated "The refusal" in a doc comment | The edit span started mid-line | Re-read and re-patched the two lines | +| Regenerating the owner-apply patch from FRESH scratch copies kept only the r1 edits (9 changed lines vs the reviewed 19) | The regeneration script carries the full edit set; a partial re-run silently drops the earlier anchors | Re-ran the FULL pair set from fresh `a/` copies and compared hunk count/line count against the reviewed patch (69 lines / 5 hunks) before trusting it | +| `full-test.sh status` reported the MUTATION run's `9 / 8 / 1` while the full rail was in flight | `status` reads `current`, which a newer launch repoints; the loop broke on a finished-but-stale verdict | Read each run's OWN `summary.json` by run dir — the per-dir numbers are the record (full: Passed / 717) | ## Files Changed @@ -129,13 +143,13 @@ path (`repoint(to:)` then `bind`). | `Museion/EditorSession.swift` | `targets(postID:home:)` / `targets(home:)` | | `Museion/HomeResolution.swift` | `AppGateState.repointMuseionHome(to:)` | | `Museion/WorkspaceView.swift` | `homeRepointBinding` (gate in the setter) + hosted-guarded refusal alert; `import AppKit`; dead `@Bindable` removed | -| `Museion/PostsModel.swift` | `select` reselect by identity; `canArmWritingLock`/`editorBodyText` by identity; `scanPieceCards` seam | +| `Museion/PostsModel.swift` | `select` reselect by identity; `canArmWritingLock`/`editorBodyText` by identity; `scanPieceCards` + `scanLibrary` (r1) seams | | `Museion/PostsModelWrites.swift` | `flushOrAbort` + the six structural ops by identity | | `Museion/PostsModelOutline.swift` | `openUnguarded`, `stageConversion`, `convertToPost` by identity | | `Museion/PostsModelCards.swift` | identity at launch AND completion; scanner through the seam | | `Museion/PostsModelPasses.swift` | `guardOpenPieceRun` identity + returns the validated Home; callers consume it | | `Museion/Micropub.swift` | identity at launch | -| `MuseionTests/PostsModelRepointTests.swift` (new) | 7 pins | +| `MuseionTests/PostsModelRepointTests.swift` (new) | 9 pins (7 + r1's two) | | `MuseionTests/PostsModelTests.swift` | mid-pass pin drives `repoint(to:)` + `bind` | | `CHANGELOG.md`, `docs/devlog/INDEX.md`, this log | docs | | `AGENTS.md`, `Museion/AGENTS.md`, `MuseionTests/AGENTS.md` | OWNER-APPLY patch only (see Open Items) — never written by this session | @@ -144,10 +158,11 @@ path (`repoint(to:)` then `bind`). - [ ] AGENTS.md DOX pass ships as an owner-apply patch: `~/daedalus-builds/museion/brief-28-agents-owner-apply.patch` — `git - apply --check` clean against `8b0d43a` (3 files, 25 changed lines: the + apply --check` clean at the r1 head (3 files, 5 hunks: the PostsModel/Watcher/Writes/Editor-core/Settings/WorkspaceView bullets, the - `AppGateState.museionHome` bullet, the MuseionTests suite map row, and the - root 10-most-recent window row). Apply from the branch head with + `AppGateState.museionHome` bullet, the MuseionTests suite map row with the + r1 pins and the `scanLibrary` seam, and the root 10-most-recent window + row). Apply from the branch head with `git apply ~/daedalus-builds/museion/brief-28-agents-owner-apply.patch`. - [ ] GitNexus `impact`/`detect_changes` were NOT run: `.gitnexus/run.cjs` is absent at base and no GitNexus capability is exposed (the argus cycle-5 @@ -171,8 +186,28 @@ path (`repoint(to:)` then `bind`). - **Base / pin:** `ca265d3bd359e663216aa91d4778e2bdef8a36eb` = live `main` tip at claim (`tea api repos/AlexKucera/museion/branches/main`, 20:05 CET) and - still at handoff (`git ls-remote`, 20:26 CET; re-checked again before the - final report). Zero drift. + still at r1 handoff (`git ls-remote`, 22:36 CET). Zero drift. Round 1 + (athena) reviewed `97712fb`; this round appends `92344e2` (code) and the + docs commit on top — 4 linear commits kept, no force-push. +- **r1 (athena MF-1/N-1), full rail at `92344e2`** (tree pristine vs the + commit, watcher blob sha256 prefix `d86ce09d6b7e6bd2`): run dir + `_build/full-test/20261123T213424Z-Museion` → `717 executed / 717 passed / + 0 failed / 0 skipped (xcodebuild exit 0)`, `summary.json` `Passed / 717`, + `** TEST SUCCEEDED **`; 717 = 715 + the two r1 pins; `PostsModelRepointTests` + 9/9 (both r1 pins named passed), `PostsModelDepartureTests` 10/10, + `PostsModelWriteRailTests` 5/5. Filtered GREEN (repoint + departure) → + run dir `…T213313Z` `19 / 19`. +- **r1 mutation check (MF-1):** hoisted `guard watchedHome == home` removed + → run dir `…T213345Z` `9 executed / 8 passed / 1 failed (exit 65)`, ONLY + `a library scan from the old Home lands nothing under the new binding`, + `posts.map(\.id) → ["alpha"]` and `contentRevision → 3` vs `revision → 2`; + restored byte-exact (prefix `d86ce09d6b7e6bd2` before and after), zero + `MUTATION-CHECK` tokens repo-wide. Lint at `92344e2`: `swiftformat --lint .` + 0/152, `swiftlint` 0. +- **r1 owner-apply patch regenerated** for the seam + the two pins (N-3): + 69 lines / 5 hunks — the reviewed patch's shape — `git apply --check` CLEAN + at the new head (re-checked after the docs commit). +- **Round 0 (first report) follows.** - **RED first** at the pin (commit `bce6abb`), rail-filtered `./scripts/full-test.sh start -- -only-testing:MuseionTests/PostsModelRepointTests`: `6 executed / 0 passed / 6 failed / 0 skipped (xcodebuild exit 65)`, zero @@ -199,16 +234,16 @@ path (`repoint(to:)` then `bind`). - **Lint:** `swiftformat --lint .` → `0/152 files require formatting`; `swiftlint lint --quiet` → zero violations (both at `8b0d43a`; the pre-push hook's scoped gate passed on both pushes). -- **Evidence types:** failing-test proof (RED → GREEN on the rail) for the - gate, the ordering, the same-slug save sinks, the no-collision cleanup, the - pass-after-repoint; mutation-check proof for the completion re-check; - structural proof for the view wiring (`homeRepointBinding` → - `repointMuseionHome` → `posts.repoint` precedes `museionHome = newHome`) — - the preference leg is NOT unit-pinned: `AppGateState`'s `didSet` writes the - REAL `UserDefaults.standard` (MuseionTests/AGENTS.md: never touch the - machine), so driving a repoint through `AppGateState` in a hosted test - would point the owner's next launch at a temp dir. Unverified by design; - disclosed. +- **Evidence types:** see "Identity checks — evidence classes" above — + pinned (card hop-back, rescan hoist, #179 guard) vs by-construction + (Micropub stamp) vs invariant-equivalent defensive depth (the synchronous + sweep and `openPostID`'s gate). The preference leg is NOT unit-pinned: + `AppGateState`'s `didSet` writes the REAL `UserDefaults.standard` + (MuseionTests/AGENTS.md: never touch the machine), so driving a repoint + through `AppGateState` in a hosted test would point the owner's next launch + at a temp dir. The view wiring is structural proof only + (`homeRepointBinding` → `repointMuseionHome` → `posts.repoint` precedes + `museionHome = newHome`). Unverified by design; disclosed. - **Not run:** the MuseionUITests smoke (outside the rail by design); no GUI reproduction of the Settings flow (same posture as the scan — static trace + model-level pins). diff --git a/docs/devlog/INDEX.md b/docs/devlog/INDEX.md index f424ff0..bd4ce5e 100644 --- a/docs/devlog/INDEX.md +++ b/docs/devlog/INDEX.md @@ -5,7 +5,7 @@ Complete history of session logs in this directory, newest first. One-line summa | Date | Type | File | Summary | |------|------|------|---------| -| 2026-11-23 | fix | [20261123-home-repoint-retains-old-editor-target_log.md](20261123-home-repoint-retains-old-editor-target_log.md) | Unticketed fix (brief-28, argus cycle-5): a Home repoint is a guarded document departure — the gate runs before the preference/binding commit, the refusal keeps Home A and the buffers; document identity is (Home, ID) across the model and re-checked at async completion (card scan, rescan); RED-first 6/6 at ca265d3b, stale-scan pin mutation-checked; rail 715/715 | +| 2026-11-23 | fix | [20261123-home-repoint-retains-old-editor-target_log.md](20261123-home-repoint-retains-old-editor-target_log.md) | Unticketed fix (brief-28, argus cycle-5): a Home repoint is a guarded document departure — the gate runs before the preference/binding commit, the refusal keeps Home A and the buffers; document identity is (Home, ID) across the model and re-checked at async completion (card scan, rescan — both mutation-checked); RED-first 6/6 at ca265d3b, review r1 +2 pins (rescan hoist, draft survives); rail 717/717 | | 2026-11-19 | fix | [20261119-issue200-gate-quit-time-flushes-through-departure-gate_log.md](20261119-issue200-gate-quit-time-flushes-through-departure-gate_log.md) | Quit routes through the departure gate (#200): conflict-held shutdown, BLOCK-QUIT at applicationShouldTerminate, never-loaded-retype guard; finish-audit fixes; rail 708/708 | | 2026-11-17 | fix | [20261117-acp-backpressure-defeats-timeout-and-shutdown_log.md](20261117-acp-backpressure-defeats-timeout-and-shutdown_log.md) | Unticketed fix (brief-27, argus cycle-4): stdin writes move to a dedicated writer queue — engine backpressure can no longer defeat the request deadline, Stop, or a bounded reaping close; neverRead/serverPing fake modes, 3 RED-first smokes + healthy-contract pin, suite 697/697 | | 2026-11-17 | issue | [20261117-issue193-split-fat-files-along-postsmodel-pattern_log.md](20261117-issue193-split-fat-files-along-postsmodel-pattern_log.md) | Three most-re-read files split into 8 domain-extension files, move-only (three audits concur); 693/693 |