docs(brief-28): session log, INDEX row, changelog entry
CI / ci (push) Canceled after 0s
CI / ci (push) Canceled after 0s
Home repoint rides the departure gate — devlog with the pattern- exhaustive identity table, the decisions (gate placement, nothing auto-reopens, draft survives, refusal posture, the disclosed not- converted sites), the gotchas (pollUntil's consuming probe, the free-function filter trap, the current-session teardown shape), and the Verify line: RED 6/6 atca265d3b, full rail 715/715 at8b0d43a, stale-scan pin mutation-checked, lint 0/0. The AGENTS.md DOX pass ships as an owner-apply patch beside the handoff (~/daedalus-builds/museion/brief-28-agents-owner-apply.patch, git apply --check clean against the branch head) — never written by this session, per the brief's standing rule.
This commit is contained in:
1 parent
8b0d43aed8
commit
108075239d
3 files changed
+223
No files matched your search
@@ -0,0 +1,220 @@
|
||||
# brief-28 — Home repoint rides the departure gate (document identity is (Home, ID))
|
||||
|
||||
> **Date:** 2026-11-23
|
||||
> **Type:** fix (unticketed)
|
||||
> **Reference:** finding `museion/home-repoint-retains-old-editor-target` (argus cycle-5 bugs pass, `museion-bugs.md` finding 1; HIGH, certain) — branch `fix/home-repoint-retains-old-editor-target` off `main` at `ca265d3bd359e663216aa91d4778e2bdef8a36eb`
|
||||
|
||||
## Goal
|
||||
|
||||
Settings → Content → Choose… committed the new Home (preference + UserDefaults
|
||||
through `AppGateState.museionHome.didSet`) and the root `.task(id:)` → `bind` →
|
||||
`startWatching` flipped `watchedHome` WITHOUT departing the open session. The
|
||||
session's immutable `SessionTarget` kept the OLD Home, so under the new UI:
|
||||
|
||||
- a same-slug piece in the new library made `select`'s ID-only reselect return
|
||||
the retained A session — autosave/Save/quit wrote A while structural
|
||||
operations resolved against B;
|
||||
- the new library's rescan read B's same-slug `post.md` for the A session and
|
||||
raised a spurious #67 on it (differing bodies);
|
||||
- a no-collision piece was torn down by the vanish path with its dirty buffer
|
||||
dropped (data loss);
|
||||
- a card scan started under A landed its cards on B's same-slug piece when it
|
||||
completed after a reselect (the ID-only hop-back guard).
|
||||
|
||||
#198's departure gate never saw this seam (it guards navigations, not the
|
||||
Home binding). Fix direction (argus, binding): repoint = a GUARDED DOCUMENT
|
||||
DEPARTURE before any commit; identity (Home, ID) everywhere, re-checked at
|
||||
async COMPLETION.
|
||||
|
||||
## What Was Done
|
||||
|
||||
**The gate (gate-first, commit-after):**
|
||||
|
||||
- `PostsModel.repoint(to:) -> Bool` (PostsModelWatcher.swift, beside `bind`):
|
||||
`guard newHome != watchedHome` (first bind / same folder: nothing departs)
|
||||
→ `departOpenDocuments()` (the brief-25 gate — `sessionMayDepart`'s three
|
||||
legs: unanswered #67, failed flush, never-loaded retype; NO parallel gate)
|
||||
→ on true, the departed piece's state dies with it (`selectedPostID`,
|
||||
`openPieceCards`, `openPieceHasSnapshot`, `outlineGuardPieceID`,
|
||||
`proseOverridePostID`, `pendingConversion`, `lastDraftWasOutline`,
|
||||
`pendingProject`). On false NOTHING changed: `lastError` says why (#198's
|
||||
strings), the preference/binding/target/buffer are untouched.
|
||||
- `AppGateState.repointMuseionHome(to:)` (HomeResolution.swift): `guard
|
||||
posts.repoint(to:)` FIRST, `museionHome = newHome` (its `didSet` persists)
|
||||
only after. The ONE runtime repoint entry.
|
||||
- WorkspaceView: the Settings Home control binds through `homeRepointBinding`
|
||||
— the binding's setter IS the gate (`repointMuseionHome`, then nothing
|
||||
else: the root `.task(id: museionHome)` binds the model after the commit).
|
||||
`$gate.museionHome` and the now-dead `@Bindable var gate` are gone from
|
||||
`paneContent`. A refusal presents one hosted-guarded `NSAlert` carrying
|
||||
`posts.lastError` (#200's quit-refusal posture — the Posts strip that shows
|
||||
it is not in sight from Settings).
|
||||
- `bind` stays the dumb binder by design (see Decisions).
|
||||
|
||||
**Document identity is (Home, ID) — the pattern-exhaustive sweep:**
|
||||
|
||||
- `EditorSession.targets(postID:home:)` / `targets(home:)` — the pair; the
|
||||
target is immutable, so a session born under another Home is a foreign
|
||||
document to a model whose `watchedHome` moved past it.
|
||||
- `PostsModelIdentity.swift` (new): `openSessionTargets(_:)` — the model's ONE
|
||||
"is this piece open" question (`session.targets(postID: watchedHome, id)`).
|
||||
- Every model-side ID-only session comparison converted:
|
||||
|
||||
| Site | Was | Now |
|
||||
|------|-----|-----|
|
||||
| `PostsModel.select` reselect no-op | `session.postID == id` | `session.targets(postID: id, home: watchedHome)` — a foreign session departs below |
|
||||
| `PostsModel.canArmWritingLock` / `editorBodyText` | `session.postID == selectedPostID` | `openSessionTargets(id)` |
|
||||
| `PostsModelOutline.openUnguarded` (depart test + reuse test) | `postID != id` / `id == postID` | `!targets(postID:home:)` / `targets(postID:home:)` |
|
||||
| `PostsModelOutline.stageConversion` / `convertToPost` | `session.postID == post.id` | `openSessionTargets` |
|
||||
| `PostsModelWrites.flushOrAbort` | `session.postID == postID` | `openSessionTargets(postID)` |
|
||||
| `PostsModelWrites` rename / trash / moveToProject / archivePost / restorePost / `unarchiveProject`'s `openPieceInArchivedProject` | `session?.postID == post.id` | `openSessionTargets(post.id)` |
|
||||
| `PostsModelPasses.guardOpenPieceRun` | `id == selectedPostID` (+ callers re-read `watchedHome`) | `session.targets(postID: id, home: watchedHome)`; the answer carries the validated `home` (3-tuple, callers stop re-reading) |
|
||||
| `Micropub.micropubSendDraft` launch | `id == selectedPostID`, then `watchedHome` + `folder(of:)` | identity at launch; the wire reads the session's OWN library |
|
||||
| `PostsModelCards.refreshCards` launch | `session?.postID` + `watchedHome` | `session.targets(postID:home:)` |
|
||||
|
||||
**Async continuations re-validate at COMPLETION:**
|
||||
|
||||
- `refreshCards` hop-back: `self.session?.targets(postID: id, home: home)` —
|
||||
the seeded site (PostsModelCards:24-42). The scanner is now the per-model
|
||||
injectable `scanPieceCards` (never static — the hosted suite runs in
|
||||
parallel) so the deterministic stale-result pin can HOLD an old-library scan
|
||||
past a repoint.
|
||||
- `rescan` (PostsModelWatcher): the stale-Home verdict is HOISTED — `guard
|
||||
watchedHome == home` right after the detached scan, so a scan that outlived
|
||||
a repoint applies NOTHING (list, revision, vanish check, #67 text), not
|
||||
just the vanish check as before; the #67 disk read runs only for a session
|
||||
targeting the scan's own Home (`openPostID` is identity-gated); the vanish
|
||||
teardown matches identity and still tears down the CURRENT session.
|
||||
- `Micropub`'s completion stamp (`stampMicropubURL(id:home:)` after the
|
||||
awaits) keeps the CAPTURED pair — the piece actually sent — by construction;
|
||||
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
|
||||
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`).
|
||||
|
||||
## Decisions & Rationale
|
||||
|
||||
| Decision | Rationale |
|
||||
|----------|-----------|
|
||||
| Gate in the Settings binding's setter + `repointMuseionHome`, NOT in `bind` | The gate must precede the preference commit (`museionHome.didSet` persists immediately). A gate inside `bind` would leave `museionHome` = B while `watchedHome` = A — the UI showing a Home the model isn't watching. `bind` is reached only after a passed gate (or the same Home / first frame), so it stays unconditional. |
|
||||
| `sessionMayDepart` via `departOpenDocuments` — no parallel gate | The brief's acceptance (1) and brief-25's contract: one gate, three legs, #198's strings. The refusal tests prove the composition (PostsModelDepartureTests 10/10 stay green beside the new suite). |
|
||||
| Nothing auto-reopens after an accepted repoint | The brief left it to the implementer within existing machinery. Auto-reopening B's same-slug piece would be a NEW UX (the writer never chose it) and cannot even be decided at gate time — B isn't scanned until `bind` + rescan land. `selectedPostID = nil` is the #198 departure semantics (newPost/openExternal do the same); the writer picks from the new list. |
|
||||
| The in-memory draft survives a repoint | A draft has no Home until first save (#62); it lands in the new library. The only alternatives — dropping it (the only copy) or refusing the repoint (new UX) — are worse. Disclosed; `pendingProject` (a stale A project name) IS cleared. |
|
||||
| A running pass / Blind Read is not cancelled by the repoint | `sessionMayDepart` flushes; the session departs; the engine turn keeps its own completion guard (#179: the advance refuses once `watchedHome` moved) — pinned by the mid-pass test. Cancelling would desync the pass bar's Cancel ↔ Run state. |
|
||||
| `pendingImportURLs` / `askNewProject` left alone | Both are sheet-modal (OriginAsk / NewProject) — a repoint cannot be requested while either is up, and neither is piece-specific. An import batch landing in B after a repoint is the writer's chosen library. |
|
||||
| Refusal = one `NSAlert` (the #200 posture), not a Settings strip | Settings shows no `lastError` strip (PostsPaneView owns it); a silent Choose… is the dishonest outcome. The alert carries the exact #198 `lastError` string; hosted-guarded like the quit refusal. |
|
||||
| `openSessionTargets` on the model + `targets` on the session (two helpers) | The session owns the pair (it knows its target); the model owns "which Home is current". `rescan` needs the scan's captured `home`, not `watchedHome`, so the session-level predicate is public within the module. |
|
||||
| Rescan hoist of `watchedHome == home` | The old inline guard covered only the vanish check; a stale list could still land under the new binding (and bump `contentRevision`). One verdict at the top covers everything the continuation writes. |
|
||||
| View-layer `session.postID == selectedPostID` (PostsPaneView:125) NOT converted | A render gate on the same pair; with the model invariant (the open session always targets `watchedHome`) it is correct by construction, and the view has no Home-identity vocabulary. Other view reads are nil-checks (`session?.postID != nil`) or title lookups, not comparisons. Disclosed, not exposed. |
|
||||
|
||||
## Gotchas & Fixes
|
||||
|
||||
| Problem | Root Cause | Fix |
|
||||
|---------|------------|-----|
|
||||
| Stale-scan pin's park probe never passed (5 s poll timeout) | `pollUntil` re-evaluates its `where !condition()` per iteration WITHOUT sleeping when true, and `DispatchSemaphore.wait` consumes — two parked scans drained the count in two iterations, the final `#expect(condition())` saw zero | A non-consuming `ParkedFlag` (NSLock box, `@unchecked Sendable`); the park itself is a bounded `release.wait(timeout: .now() + 30)` so a failed test never leaks a parked cooperative thread |
|
||||
| `-only-testing:MuseionTests/PostsModelTests` matched ZERO tests in a filtered run (17 executed, not more) | Those `@Test`s are free functions; MuseionTests/AGENTS.md: "Suite-name filters do not run free functions" — the rail passed only because the sibling filters matched | The mid-pass pin is a `PostsModelWriteRailTests` member and ran in the FULL rail (715); no verification claim was taken from the filtered run for it |
|
||||
| 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 |
|
||||
|
||||
## Files Changed
|
||||
|
||||
| File | Change Summary |
|
||||
|------|---------------|
|
||||
| `Museion/PostsModelWatcher.swift` | `repoint(to:)` (the gate); `bind` documented as the dumb binder; rescan: identity-gated #67 read, hoisted stale-Home verdict, identity vanish teardown |
|
||||
| `Museion/PostsModelIdentity.swift` (new) | `openSessionTargets(_:)` |
|
||||
| `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/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/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 |
|
||||
|
||||
## Open Items & Next Steps
|
||||
|
||||
- [ ] 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
|
||||
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
|
||||
`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
|
||||
audit hit the same wall). The blast radius was traced by hand instead — the
|
||||
table above IS the caller trace. The root AGENTS.md index-count line
|
||||
(`7133 symbols …`) is therefore NOT refreshed in the patch.
|
||||
- [ ] Coupled (HELD behind this PR's merge, per the brief):
|
||||
`museion/external-watch-compares-unnormalized-text` dispatches from the
|
||||
merged state. This diff touched `rescan`'s :94-98 (identity-gated read) and
|
||||
the vanish block (:135-146 → hoisted verdict), NOT the normalization seam
|
||||
itself (`readBody`'s representation at the former :107 and
|
||||
PostsModelImports.swift:69-70 are untouched) — the two changes are
|
||||
disjoint in mechanism.
|
||||
- [ ] Not in scope, observed while tracing: `newProjectPending(named:)` sets
|
||||
`pendingProject` BEFORE `newPost()` and leaves it set when the departure
|
||||
gate refuses the new post (a stale pending target with no draft). Reported
|
||||
to @aegis as an observation; `repoint` clears `pendingProject` on its own
|
||||
path regardless.
|
||||
|
||||
## Verification
|
||||
|
||||
- **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.
|
||||
- **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
|
||||
compile errors — each on the finding's signature: `session.text → "A body,
|
||||
typed in A"` under the B binding, `targets(postID: "shared", home: homeB)
|
||||
→ false`, B's edits landing on A's disk, `watchedHome → …/B` despite a
|
||||
refused flush / unanswered conflict / never-loaded retype, and the
|
||||
no-collision vanish path dropping the dirty buffer (`readBody(A) → "# Unique
|
||||
\n\nA body\n"`).
|
||||
- **GREEN, full rail** at `8b0d43a` (the fix commit; tree clean at start):
|
||||
`./scripts/full-test.sh start` → `./scripts/full-test.sh status` →
|
||||
`715 executed / 715 passed / 0 failed / 0 skipped (xcodebuild exit 0)`;
|
||||
`summary.json` → `result: Passed, totalTestCount: 715`; `** TEST SUCCEEDED **`;
|
||||
715 = the cycle-5 baseline 708 + the 7 new pins, all 7 named passed in the
|
||||
log; `PostsModelDepartureTests` 10/10 (#198 + #200 matrix green beside the
|
||||
new suite — the gates compose); the mid-pass `PostsModelWriteRailTests` pin
|
||||
passed on its new path.
|
||||
- **Mutation check** (the stale card-scan pin's honest RED — its seam cannot
|
||||
exist at base, so it is GREEN-only there): completion guard reverted to the
|
||||
ID-only base form → rail-filtered `7 executed / 6 passed / 1 failed`, ONLY
|
||||
that pin, `openPieceCards → ["Hedging"]` (A's cards on B's piece); restored
|
||||
byte-exact (sha256 prefix `9c8fb55264f5ac1c` before and after), zero
|
||||
`MUTATION-CHECK` tokens repo-wide.
|
||||
- **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.
|
||||
- **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).
|
||||
- `pool: 0 in flight` at handoff — no subagents spawned (Z.ai draws: this
|
||||
main only).
|
||||
|
||||
---
|
||||
|
||||
*Log written by daedalus (brief-28, profile daedalus) — format per the write-log skill*
|
||||
@@ -5,6 +5,7 @@ Complete history of session logs in this directory, newest first. One-line summa
|
||||
<!-- write-log: full-index -->
|
||||
| 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-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 |
|
||||
|
||||
Reference in new issue
Block a user