merge main (2cfd8b9) into opt branch
CI / ci (push) Canceled after 0s
CI / ci (pull_request) Canceled after 0s
CI / ci (push) Canceled after 0s
CI / ci (pull_request) Canceled after 0s
Fold origin/main (2cfd8b9, #187 library-search stale-after-mutation)
into opt/cold-turkey-full-tokenization. Only conflict was the
docs/devlog/INDEX.md both-added-row; resolved keep-both in
newest-first order. No code files touched by the resolution:
Museion/ and MuseionTests/ carry #187's hunks verbatim.
This commit is contained in:
commit
7cd5e6964e
7 files changed
+224
-11
No files matched your search
@@ -0,0 +1,27 @@
|
||||
# Library search snapshots invalidated by library writes — the #144/#157 mounted gap
|
||||
|
||||
> **Date:** 2026-11-11
|
||||
> **Type:** fix (finding `museion/library-search-stale-after-mutation`; no Gitea ticket)
|
||||
> **Reference:** #144 (library search), #157 (LibrarySearch seam + pure suite — mounted invalidation explicitly unpinned), #179 (the write rail this extends), #143 (the equality-gated `posts` assignment whose blind spot this closes)
|
||||
|
||||
## Goal
|
||||
|
||||
PostsPaneView's search stored a snapshot in `matches` but its only task identity was `trimmedQuery` (`.task(id: trimmedQuery)` at PostsPaneView.swift:333 on 5915178). Library mutations never re-keyed the task, so the sweep never re-ran: after Archive/Trash from a result row's own context menu, the archived post REMAINED in the non-archived search results even after `model.posts` rescanned; new, renamed, and externally edited matching pieces never entered or left the results until the query changed or the view remounted. Body-only changes had no signal at all — #143's equality-gated assignment keeps `posts` still when a rewritten post.md parses to an equal Post.
|
||||
|
||||
## What Was Done
|
||||
|
||||
- **The rail extension** (PostsModel.swift): `rescan()` now bumps `contentRevision` whenever a scan sees the library change — a Post-list change OR any re-read post.md (the scan cache's miss counter deltas across the detached scan; a miss is one disk read + parse). Archive/trash/rename arrive as list changes; a body-only edit arrives as a cache miss (metadata-equal — the #143 skip keeps the panes still; the bump alone re-keys the search). The `posts`-assignment skip is untouched: panes never regroup on autosave echoes, and an unchanged rescan (all cache hits) does not bump — pinned.
|
||||
- **The mounted key + gate** (LibrarySearch.swift, pure seam): `LibrarySearch.SearchKey` (query, homePath, revision) and `LibrarySearch.Snapshot` (key + results) with `isFresh(for:)` — a landed sweep renders only under the key that computed it.
|
||||
- **The view rewiring** (PostsPaneView.swift): the column's `.task(id:)` keys on the full `searchKey` (trimmed query + Home + `model.contentRevision`), so library writes and Home repoints restart the sweep; the task captures its key at start and lands the snapshot under it; body renders a snapshot only while `isFresh(for: searchKey)` — stale rows drop to the recompute spinner instead of lingering. A mid-sweep key change cancels at the existing `Task.isCancelled` guards, and even a raced assignment cannot render — the body-side gate refuses it.
|
||||
- **Tests** (MuseionTests/LibrarySearchTests.swift, new `LibrarySearchSnapshotTests` suite): the pure key/gate pin, plus controller-level pins over the real rescan rail (`makeModelHome` + `pollUntil` convention) proving archive, trash, and a same-query body edit each move the revision through the standing-snapshot `isFresh` gate; a guard pin that an unchanged rescan keeps the revision. The three rail pins were committed red first (c0cd60b: 3 failed / 2 passed) and turned green with the fix (becad45: 5/5).
|
||||
|
||||
Not done (out of scope): a render harness for the SwiftUI column itself — no UI automation per house style; the invalidation is observable at controller level, which is what the view consumes.
|
||||
|
||||
## Verification
|
||||
|
||||
- Baseline on pristine 5915178 (before any edit, after a stash): `xcodebuild -project Museion.xcodeproj -scheme Museion -destination 'platform=macOS' -derivedDataPath <scratch>/dd-base -resultBundlePath <scratch>/base.xcresult -only-testing:MuseionTests test` → ** TEST SUCCEEDED **, exit 0; xcresult summary: totalTestCount 681, result Passed.
|
||||
- RED @ c0cd60b: same invocation with `-only-testing:MuseionTests/LibrarySearchSnapshotTests` → ** TEST FAILED **, exit 65; failedTests 3 (archive, trash, body-edit — exactly the briefed failure set), passedTests 2.
|
||||
- GREEN focused @ becad45: same focused invocation → ** TEST SUCCEEDED **, exit 0; 5/5 passed, 0 failed.
|
||||
- GREEN full @ becad45 (code head; the later docs commit adds no compiled code): full `-only-testing:MuseionTests` → ** TEST SUCCEEDED **, exit 0; xcresult summary: totalTestCount 686, passedTests 686, failedTests 0, skippedTests 0 (baseline 681 + the 5 new pins, zero confounds).
|
||||
- swiftlint: 279 violations / 60 serious in 141 files at base; identical counts at the fix head (the two PostsModel warnings and one PostsPaneView file-length warning pre-exist, only their line counts grew). swiftformat: 0 files require formatting, touched and whole-tree.
|
||||
- Known flake EditorSessionTests/debounce not encountered in either full run on this base.
|
||||
@@ -6,6 +6,7 @@ Complete history of session logs in this directory, newest first. One-line summa
|
||||
| Date | Type | File | Summary |
|
||||
|------|------|------|---------|
|
||||
| 2026-11-13 | opt | [20261113-cold-turkey-full-tokenization_log.md](20261113-cold-turkey-full-tokenization_log.md) | Unticketed opt (argus digest): minutes feeds skip word counting entirely; DraftStats.words count-only — no token array per keystroke; +3 pins (RED-first rail-trip seam, corpus equivalence), suite 684 |
|
||||
| 2026-11-11 | fix | [20261111-fix-library-search-stale-after-mutation_log.md](20261111-fix-library-search-stale-after-mutation_log.md) | Search snapshots re-key on Home + a rescan-rail content revision (list change OR re-read post.md — body-only edits included); stale rows drop to the recompute spinner (#144/#157 mounted gap) |
|
||||
| 2026-11-10 | follow-up | [20261110-issue179-followup-bind-root-task_log.md](20261110-issue179-followup-bind-root-task_log.md) | Bind hoisted to the WorkspaceView root task (stale watchedHome after repoint); PR #185 closed as superseded by 5bf0955 |
|
||||
| 2026-11-10 | issue | [20261110-pr184-deferred-empty-piece-scope-lost-audit_log.md](20261110-pr184-deferred-empty-piece-scope-lost-audit_log.md) | PR #184 finish-audit: dead Equatable cut, restart-race ceiling named, titled-apply pin + hangOnPromptLoad rig mode |
|
||||
| 2026-11-10 | issue | [20261110-issue182-profilelayout-config-set-rail_log.md](20261110-issue182-profilelayout-config-set-rail_log.md) | ProfileLayout owns every profile path; HermesConfigRail owns the config-set CLI contract; audited, 684 green (#182) |
|
||||
|
||||
Reference in new issue
Block a user