Commit Graph
235 Commits
Author SHA1 Message Date
AlexKucera 70dd47ed8c fix(editor): normalize the guest watch's disk read
The external guest's watch read disk raw while the session's text and
lastFlushedText came through readDocument's normalizing external
branch, so diskTextChanged saw a difference on every BOM/CRLF file and
raised conflictAlert on unchanged content — re-arming after each
sibling directory event and after either alert answer, blocking
departures and quit until the user's own flush rewrote the file
normalized (finding museion/external-watch-compares-unnormalized-text,
argus cycle-6; unticketed, brief-32).

Extract the external branch (BOM strip + CRLF->LF) into
EditorSession.readExternalDocument(at:) — one shared normalizer, two
callers: the open read (readDocument) and the watch's onEvent. The #67
compare is now normalized-to-normalized; what readDocument loads is
unchanged.
2026-11-30 22:17:13 +01:00
AlexKucera b69ddd3963 test(editor): pin the external watch's false 67 conflict
CI / ci (push) Canceled after 0s
The external guest's watch (PostsModelImports.startExternalWatch)
reads disk raw while the session's text/lastFlushedText came through
readDocument's normalizing external branch (BOM strip + CRLF->LF), so
diskTextChanged raised conflictAlert on unchanged BOM/CRLF files —
re-arming after every sibling directory event and after either alert
answer, blocking departures and quit (brief-32, argus cycle-6).

Three RED pins over the real watch closure
(externalWatcher.onEvent): no conflict on an unchanged BOM/CRLF
guest, no re-arm after yes-reload or keep-local, and the load-bearing
negative — a real foreign write still raises. Targeted rail at base:
11 executed / 8 passed / 3 failed (all three new pins), 164
SwiftCompile lines.
2026-11-30 22:15:58 +01:00
AlexKucera 5341c4ee53 Merge pull request 'fix(editor): Home repoint rides the departure gate; document identity is (Home, ID) [museion/home-repoint-retains-old-editor-target]' (#202) from fix/home-repoint-retains-old-editor-target into main
CI / ci (push) Canceled after 0s
2026-11-24 08:55:35 +01:00
AlexKucera cac66f6e76 docs(brief-28 r1): evidence classes, r1 verify line, changelog/index to 717
CI / ci (push) Canceled after 0s
CI / ci (pull_request) Canceled after 0s
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.
2026-11-23 22:38:43 +01:00
AlexKucera 92344e224c test(editor): pin the rescan stale-Home verdict and the draft-survives repoint (review r1)
CI / ci (push) Canceled after 0s
MF-1: the hoisted `guard watchedHome == home` in rescan was live logic
with no pin — the only new guard still observable after the gate (a
scan started under A can sit in its detached hop while the gate passes
and bind flips to B; landing after B's own scan it would hold A's list
under the B binding until the next B-side event, which with nothing
open is never). `scanLibrary` is the per-model injectable library
scanner beside `scanPieceCards` (captured before the hop); the pin
parks an A scan past the repoint, lets B's scan land, releases, and
asserts the list is still B's and `contentRevision` did not move.

Mutation check: hoist removed → rail-filtered `9 executed / 8 passed /
1 failed`, ONLY that pin, `posts.map(\.id) → ["alpha"]` and
`contentRevision → 3` vs `revision → 2`; restored byte-exact (sha256
prefix d86ce09d6b7e6bd2 before and after).

N-1: the draft-survives-repoint decision pinned — newPost targets the
selected A piece's project, the draft rides the repoint intact, and
`saveDraft()` lands under B only, in the draft's OWN project even
though B does not have it (materialize creates with intermediates).

Filtered GREEN: PostsModelRepointTests + PostsModelDepartureTests
19/19. swiftformat 0/152, swiftlint 0.
2026-11-23 22:34:23 +01:00
AlexKucera 97712fbacb docs(brief-28): name the filter trap precisely — file name ≠ suite name
CI / ci (push) Canceled after 0s
The PostsModelTests.swift file holds free-function @Tests AND the
PostsModelWriteRailTests suite; the filter matched neither. The devlog
row said 'free functions' alone, which undersold it.
2026-11-23 20:26:54 +01:00
AlexKucera 108075239d docs(brief-28): session log, INDEX row, changelog entry
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 at ca265d3b, full rail 715/715 at 8b0d43a,
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.
2026-11-23 20:26:27 +01:00
AlexKucera 8b0d43aed8 fix(editor): Home repoint rides the departure gate; document identity is (Home, ID)
CI / ci (push) Canceled after 0s
Settings committed the new Home and bind flipped watchedHome without
departing the open session: the session's immutable target kept the
OLD Home, a same-slug piece in the new library made the ID-only
reselect return it, and autosave/Save/quit wrote the old library
while structural operations resolved against the new one. #198's
departure gate never saw this seam; a no-collision piece was torn
down by the vanish path with its dirty buffer dropped.

The gate runs BEFORE anything commits. PostsModel.repoint(to:) is a
document departure through the same sessionMayDepart (all three legs:
unanswered #67, failed flush, never-loaded retype — no parallel
gate); on refusal nothing changes (preference, watchedHome, the
session's (A, id) target, its buffer), on acceptance the departed
piece's state dies with it. AppGateState.repointMuseionHome(to:)
commits the preference and its persistence only after the gate;
WorkspaceView's Settings binding routes through it and the root
.task(id:) binds the model after that commit — the dumb binder. A
refusal speaks the #198 reason the way #200's quit refusal does
(hosted-guarded alert: no Posts strip is in sight from Settings).
Nothing auto-reopens after an accepted repoint — the writer picks
from the new list; the in-memory draft survives (no Home until first
save; dropping it would drop the only copy).

Document identity is (Home, ID) everywhere — EditorSession.targets
is the pair, PostsModel.openSessionTargets the model-side question;
every ID-only session comparison is retired: select's reselect
no-op, openUnguarded, the structural rail (rename/trash/move/archive/
restore/unarchive + flushOrAbort), conversion, the pass guard (its
answer now carries the Home it validated), Micropub's launch, the
lock's arm/body reads. Async continuations re-validate identity at
COMPLETION: refreshCards (launch and hop-back — the old ID-only guard
let a scan from the previous library land its cards on the new
library's same-slug piece) and rescan (the stale-Home verdict is
hoisted: a scan that outlived a repoint applies nothing, not just
the vanish check; the #67 disk read runs only for a session targeting
the scan's own Home). scanPieceCards is the per-model injectable
scanner the deterministic stale-scan pin needs.

Tests: PostsModelRepointTests (7) move to the gated entry and go
green (17/17 with PostsModelDepartureTests — the #198 matrix stays
green and composes); the stale-scan pin's RED is a mutation check
(completion guard reverted to ID-only → only that pin fails, cards
→ ["Hedging"]; restored byte-exact). The #179 mid-pass repoint pin
drives the real Settings path now (repoint + bind). swiftformat 0/152,
swiftlint 0.
2026-11-23 20:23:57 +01:00
AlexKucera bce6abb38b test(editor): pin Home repoint as a document departure — RED at ca265d3
CI / ci (push) Canceled after 0s
PostsModelRepointTests (6 pins over a two-Home same-slug rig,
projects/posts/shared/post.md in both libraries): the gate runs
before anything changes (failed flush, unanswered #67, never-loaded
retype — sessionMayDepart's three legs), the same-slug piece opens
from B and saves there (flush AND quit), a no-collision repoint lands
the dirty buffer before tearing down, and a pass started after the
repoint runs against the new library.

RED at ca265d3bd3 on the rail
(-only-testing:MuseionTests/PostsModelRepointTests): 6 executed /
0 passed / 6 failed, zero compile errors — each on the finding's
signature: the retained A session under the B binding
(session.text = "A body, typed in A", targets(home: B) false), B's
edits landing on A's disk, watchedHome = B despite a refused flush,
and the no-collision vanish path dropping the dirty buffer.

The tests speak the Settings path as it exists at base (bind), which
has no gate to refuse through; the fix commit moves each repoint call
to the gated entry. EditorSession gains the pure identity predicates
the assertions speak in (targets(postID:home:) / targets(home:)) —
read-only, no behavior change.
2026-11-23 20:16:02 +01:00
AlexKucera ca265d3bd3 docs(issue-201): apply brief-25 AGENTS sentences
CI / ci (push) Canceled after 0s
Apply PR #198's consented owner-apply sentences to the
PostsModelWrites/PostsModelImports bullets: the departure gate
(sessionMayDepart/departOpenDocuments) and the guarded dismissal
(dismissExternal -> Bool) now name brief-25's contract. Patch
regenerated against merged HEAD (cbe16f0); git apply --check clean,
3-way clean, no other AGENTS.md content touched.

One disclosed deviation from round 1 (its accuracy-extension
precedent): "the same two gates" -> "the same gates" — #200's
finish-audit added a third sessionMayDepart leg (never-loaded
session hold), so "two" would contradict the adjacent flushOrAbort
clause.

Closes #201
2026-11-19 13:28:21 +01:00
AlexKucera cbe16f0442 docs(issue-200): log, changelog, AGENTS contracts
CI / ci (push) Canceled after 0s
Session log + INDEX row + rolling window, CHANGELOG Fixed entry,
and the #200 quit-gate contracts in the Museion/AGENTS.md chain
(delegate's two refusals, PostsModel shutdown/active, gate
family, wiring) plus the MuseionTests suite map rows — including
the PR #198 gap (PostsModelDepartureTests had never been listed)
and the gitnexus index-count refresh.
2026-11-19 13:18:26 +01:00
AlexKucera 2334afc392 fix(editor): quit rides the departure gate
shutdown() flushed both sessions best-effort and ignored the
results — quitting with an unanswered #67 conflict wrote local
text over the foreign disk body (flush() holds for conflicts
only in the debounce), 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 runs both sessions through sessionMayDepart,
and the failed-flush-at-quit posture is BLOCK QUIT —
applicationShouldTerminate (quitReply(posts:), before the Cold
Turkey ask) refuses termination with one spoken reason via a
hosted-guarded alert. PostsModel.active (weak, registered by
AppGateState.init — the WritingLockState.active precedent) is
the delegate's reachability.

Finish-audit fixes folded in: sessionMayDepart refuses a
never-loaded session's retyped words (its flush is a vacuous
success — the same gap closed for navigation); shutdown stays
void (no production reader of a Bool).

+5 pins (conflict hold, clean flush, guest flush, never-loaded
refusal, delegate refusal incl. chmod-injected flush failure),
all flip-verified. Rail 708/708; format+lint clean.

Closes #200
2026-11-19 13:18:19 +01:00
AlexKucera 55be3d1a2f Merge pull request 'fix(acp): engine backpressure cannot defeat deadlines or teardown [museion/acp-backpressure-defeats-timeout-and-shutdown]' (#199) from fix/acp-backpressure-defeats-timeout-and-shutdown into main
CI / ci (push) Canceled after 0s
2026-11-19 10:38:17 +01:00
AlexKucera 9ccfe83ec0 refactor(acp): land PR #199 audit fixes
CI / ci (push) Canceled after 0s
CI / ci (pull_request) Canceled after 0s
Reviewer fanout (ponytail/security/general) over #199 found no
behavior defects. Apply the accepted non-behavioral findings:

- requestOutcome helper dedups the two outcome tasks; the two
  discarded wedge tasks drop their unread do/catch scaffolding
- awaitBounded doc names its real bound (window is green-world
  only; the RED-world watchdog is the fake's /bin/sleep 30 exit)
- send() gains a ponytail ceiling comment: queued sends are
  unbounded and a send racing close() writes onto a closed handle
  (benign, probe-verified) — bounded by the model's sequential
  sends; guard if a looping caller appears
- request() doc notes a timed-out request's bytes may still land
  on the wire (late replies dropped, ids never reused)

Suite 697/697 green post-change; format+lint clean.
2026-11-19 10:34:16 +01:00
AlexKucera ce21057586 docs(audit-199): record brief-27 writerQueue contract in the AGENTS chain 2026-11-19 10:17:47 +01:00
AlexKucera b2d01c852a Merge pull request 'fix(editor): guard document departure on failed flushes [museion/failed-flush-discarded-on-document-switch]' (#198) from fix/failed-flush-discarded-on-document-switch into main
CI / ci (push) Canceled after 0s
2026-11-19 09:45:30 +01:00
AlexKucera ae3b99c7ea docs: brief-27 session log, INDEX row, changelog entry
CI / ci (pull_request) Canceled after 0s
CI / ci (push) Canceled after 0s
Docs-only (code identical to the fix commit 89cd377, where the
697/697 suite ran): devlog carries the site-class enumeration with
disproofs, the decisions table, and the gates; CHANGELOG gains the
user-facing acp backpressure entry.
2026-11-17 22:36:56 +01:00
AlexKucera 89cd377814 fix(acp): engine backpressure cannot defeat deadlines or teardown
CI / ci (push) Canceled after 0s
A hung engine that stops reading stdin fills the 64 KB pipe, and
the client's synchronous send blocked its one serial queue — the
same queue that carries request deadlines, request registration,
and close()'s bookkeeping barrier. A blocked writer therefore
defeated the request timeout, starved Stop/lifecycle calls, and
made close() queue.sync behind the stuck write before SIGTERM was
ever reachable; EngineHost's MainActor close callers turned that
into an app-wide unbounded hang on restart or quit (argus probe:
2M-char request with 0.1 s timeout never timed out; a watchdog
close never returned).

Separate the writer from the state: stdin writes (and the stdin
handle's own close, which a blocked write may still own) now ride
a dedicated serial writerQueue, so the state queue is I/O-free —
deadlines fire, Stop is accepted, follow-up requests register,
and close() runs bookkeeping, SIGTERM -> grace -> SIGKILL -> reap
without ever queueing behind the writer. Wire order is preserved
(all send sites funnel through the one serial writer queue) and
the healthy-engine contract is untouched.

Focused serialized EngineSmokeTests: 6 executed / 6 passed at the
fix (3 of them RED at base on exactly the three mechanisms).
2026-11-17 22:27:49 +01:00
AlexKucera 33b7fe0f9f test(acp): pin blocked-writer backpressure regressions
CI / ci (push) Canceled after 0s
RED at base for the acp-backpressure finding: on the unfixed
transport a hung engine that stops reading stdin fills its pipe,
and the synchronous send wedges the client's one serial queue —
the request deadline never fires, follow-up bookkeeping starves,
and close() blocks behind the stuck write (argus probe: 2M-char
request, 0.1 s timeout, watchdog close never returned).

Three smokes over the existing rig, using a new neverRead fake
mode (execs /bin/sleep — the probe's inert non-reading child;
never a real profile): deadline fires while blocked, Stop +
bookkeeping answer while blocked, close returns bounded and reaps
the child. A fourth smoke (new serverPing fake mode) pins the
healthy contract — round trip, -32601 reply delivery over the
wire, idempotent clean close — and passes at base.

Focused serialized run at base: 6 executed / 3 passed / 3 failed
— exactly the three blocked-writer smokes fail, on mechanism.
2026-11-17 22:26:05 +01:00
AlexKucera ffb9457a63 integrate main: #193 PostsModel split (Watcher/Writes/Imports) into failed-flush departure guard
CI / ci (push) Canceled after 0s
CI / ci (pull_request) Canceled after 0s
# Conflicts:
#	Museion/PostsModel.swift
#	docs/devlog/INDEX.md
2026-11-17 20:12:53 +01:00
AlexKucera bb4bfa2675 docs: #193 session log + distilled learnings
CI / ci (push) Canceled after 0s
Split PostsModel/WorkspaceView/PostsPaneView into 8 domain-extension
files (move-only, three audits concur; 693/693 via the verify rail).
One commit per source file precedes this log.

Closes #193
2026-11-17 18:00:10 +01:00
AlexKucera 2a02b95ed0 refactor(posts): split PostsPaneView into PostsLibraryColumn/LibraryPostRow (#193) 2026-11-17 17:55:47 +01:00
AlexKucera 70cd1c2b55 refactor(workspace): split WorkspaceView into ArchivePaneView/Sheets/Chrome (#193) 2026-11-17 17:39:39 +01:00
AlexKucera 902e860bd8 refactor(posts): split PostsModel into Watcher/Writes/Imports files (#193) 2026-11-17 17:39:39 +01:00
AlexKucera f50fecfc60 docs: gate-running learnings → full-test.sh rail
CI / ci (push) Canceled after 0s
Collapse #192: the root AGENTS.md testing learnings shrink to what
scripts/full-test.sh cannot encode. Eight gate-running recitals become
the one-line pointer; MuseionTests/AGENTS.md Verification names the
script instead of the raw xcodebuild line.

Deleted → encoded by:
- #30 flake ritual → --serialized rerun + no-concurrent-lint rule;
  pre-push no-push-while-live pid scan
- #31/#134 executed-count-not-banner + vacuous filters →
  xcresulttool-authoritative counts; zero-executed summary exits
  nonzero (full-test.sh:431-449)
- #178 parameterized @Test count arithmetic → summary-based counting
- #33/#179 newest-bundle race → per-run pinned -resultBundlePath
  (:190), each run polls its own dir
- #177 grep -c chain break → the script is the single gate command
- #177 build/test split under timeout cap → detached run (the split
  existed only to dodge the cap)
- #182 test-without-building stale green → obviation: rail builds+tests
  in one detached run; residual covered by no-push-while-live + kept
  #197 learning
- lint-gate scoping recital → scripts/hooks/pre-push header + push-
  delta scoping loop

Retained (script cannot encode): #197 stale binaries + FSEvent quiesce,
#162 ticker, #178 transport double, #33 keychain, #151 seam, #134
reboot remedy, #147 pair, #142/#143/#180/#181 format family.

Two-axis review (Standards + Spec subagents): spec PASS — all 8
mappings verified against script body, not header claims; standards
follow-ups applied (pointer scoped to its section; Commands-block
xcodebuild line marked ad-hoc/outside-the-rail).

Verify: swiftformat --lint 0/141, swiftlint 0 findings, full-test.sh
693/693; gitnexus detect-changes low, 0 flows.

Closes #192
2026-11-17 16:52:56 +01:00
AlexKucera d7fd11cf0d chore(lint): repo-wide green becomes the contract
CI / ci (push) Canceled after 0s
Close the lint arc #194-#197: deliberate-style rule disables with
rationales (#194), filter-safe test renames + --test-case-name-format
preserve (#195), every surviving warning fixed through the sanctioned
lint-stable shapes (#196), and the docs now state the true contract
(#197): bare swiftlint . reports zero violations and swiftformat .
reformats nothing, while push gates stay scoped to the push's own
files (settled #190 design) — the pre-push hook's stale 'pre-existing
violations' rationale blocks refreshed, gate logic untouched.

Also in the sweep: quiesce the FSEvent-burst watcher race in
LibrarySearchTests (two rescans double-count one shared PostScanCache
miss; benign revision over-bump), pin the learnings scan's symlink-skip
contract (flip-verified — defended in depth by the lstat guard AND
contentsOfDirectory's own symlink refusal), reorder that scan's guard
so cheap rejections precede the directory listing, and park the roster
chmod window with a ceiling comment.

Finish-audit: 3 reviewers, 0 blocking; the one code finding was
disproved by probe (&& out-binds ?? — the guard was correct). Suite
693/693 via scripts/full-test.sh; swiftlint 0 violations; swiftformat
0/141; hook rig 23/23.

Closes #197
2026-11-17 16:29:46 +01:00
AlexKucera 0ab00eb7b6 feat(scripts): verify rail + pre-push hook
CI / ci (push) Canceled after 0s
Port classis full-test.sh (071966e) as Museion's one-command verify
loop: run/start/status/summary over detached xcodebuild, per-run
pinned xcresult bundles with atomic run-dir allocation (#33/#179),
xcresulttool-authoritative counts (#31/#178), zero-match filters
fail (#31/#134), --serialized rerun is the record (#30/#147), per-
test timeouts + wedge observability (#134). Default scope:
MuseionTests.

install-hooks.sh + pre-push: no push while any run is live, lint
gate scoped to the push's Swift files (bare swiftlint . exits 2 on
main — spike/ + one tests file), autofix-rewrite guard. New-ref
pushes lint the merge-base delta vs refs/remotes/origin/main and
fail closed on unscopable history; a full-ref spelling defeats
refs/tags shadowing.

scripts/test-full-test.sh: 23-check acceptance rig with an
executed-count guard. Four finish-audit rounds; every guard
flip-verified both directions. Suite 692/692 through the rail
itself.

Closes #190
2026-11-17 12:14:12 +01:00
AlexKucera 9497661145 docs(devlog): brief-25 session log + INDEX row
CI / ci (push) Canceled after 0s
brief-25 [failed-flush-discarded-on-document-switch]
2026-11-16 21:01:06 +01:00
AlexKucera 250a662f3e fix(editor): guard document departure on failed flushes
teardown(flushFirst:) discarded flush()'s result, so document
navigation (newPost, newOutline, select, openExternal, dismissExternal,
openUnguarded) dropped the outgoing dirty session after a failed write
and replaced the only retained copy of the unsaved prose.

One shared departure gate now covers every site, placed before any
document-specific state clears:

- sessionMayDepart(_:): flushOrAbort's two gates (unanswered #67
  conflict holds; failed flush holds) lifted to document departure —
  flushOrAbort routes through it unchanged.
- dismissExternal() -> Bool: the guest departs only when its flush
  lands; on failure the guest, its buffer, and its watcher stay live.
- departOpenDocuments(): the full-switch composition (guest + post
  session) behind newPost/newOutline/openExternal.
- select/openUnguarded gate their same-id-conditional session teardowns
  through sessionMayDepart directly.

Departure now aborts with the strip error set and the dirty session
retained; retrying after writability returns lands the edits and
completes the switch. All six PostsModelDepartureTests pins RED at
11b196d, GREEN with this change.

brief-25 [failed-flush-discarded-on-document-switch]
2026-11-16 20:17:58 +01:00
AlexKucera ecd14d1714 test(editor): pin document departure aborting on failed flushes
CI / ci (push) Canceled after 0s
RED at pinned base 11b196d: all six PostsModelDepartureTests pins fail.
Document departure (newPost, newOutline, select, openExternal,
dismissExternal, openUnguarded) tears the outgoing session down with
teardown(flushFirst: true), discards the flush result, and replaces the
only retained copy of unsaved prose when the write fails. Both
navigation families (saved-post session, external guest) pinned with
injected write failures (read-only piece folder / guest directory), plus
the unanswered #67 conflict hold. Retry after writability is restored
proves the edits land and the switch then completes.

brief-25 [failed-flush-discarded-on-document-switch]
2026-11-16 20:14:32 +01:00
AlexKucera 11b196d68a Merge pull request 'test(folds): typing-budget operation-count pin at N/2N [fold-typing-budget-pin]' (#189) from opt/fold-typing-budget-pin into main
CI / ci (push) Canceled after 0s
2026-11-14 08:03:53 +01:00
AlexKucera a5dc06d67f docs(devlog): brief-24 — fold typing budget pin
CI / ci (push) Canceled after 0s
CI / ci (pull_request) Canceled after 0s
Session log + INDEX row: instrument design, the three pins, the
dual-dispatch incident and hunk-level decontamination, fresh
post-decontamination gates (692/692, mutation pair), and two
typing-cost observations routed to the dispatcher (chrome-layer
parent rescan per keystroke; fenceDelimCount whole-buffer pass per
keystroke).
2026-11-13 17:21:24 +01:00
AlexKucera c460545c59 test(folds): pin the typing budget at N/2N
CI / ci (push) Canceled after 0s
The #142 in-place re-key had correctness coverage but no typing-cost
guard — a quiet fallback to the full pass keeps every correctness
pin green while restoring O(buffer) work per keystroke. Add an
operation-count instrument (never wall-time): ProseList.parents
gains an observeLines reporter, refreshFolds/refreshFoldRendering
thread a per-call observer, and a per-instance onLineScan hook
windows the paths that call refreshFolds() bare (the PostEditorView
coordinator tail). No shared state — the hosted suite is parallel.

Three pins: zero scanned lines for typing beside a fold at N=204
and 2N=404 lines; an exact-count control (206/406) proving the
instrument is live and scaling; and a through-seam pin driving real
insertText through a real ProseTextView.Coordinator into
refreshFolds() — zero scans, fold survives, self-controlling with
its own 206 liveness assert. Mutation-checked: severing the single
observer firing fails the control and the through-seam pin.
2026-11-13 17:21:16 +01:00
AlexKucera 7ed304124e Merge pull request 'opt(goal): minutes feeds do no word work; word rail goes count-only [cold-turkey-full-tokenization]' (#188) from opt/cold-turkey-full-tokenization into main
CI / ci (push) Canceled after 0s
Reviewed-on: #188
2026-11-13 16:51:04 +01:00
AlexKucera 7cd5e6964e merge main (2cfd8b9) into opt branch
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.
2026-11-13 16:41:15 +01:00
AlexKucera 2cfd8b9f79 Merge pull request 'fix(search): re-key the mounted sweep on Home + library content revision (museion/library-search-stale-after-mutation)' (#187) from fix/library-search-stale-after-mutation into main
CI / ci (push) Canceled after 0s
2026-11-13 10:00:58 +01:00
AlexKucera 7de8e2f7a1 docs(devlog): cold-turkey full-tokenization opt branch
CI / ci (push) Canceled after 0s
CHANGELOG [Unreleased] > Changed entry + session log + INDEX row for
the unticketed opt pass (minutes feeds skip word counting; word rail
count-only; no token array per keystroke). Suite 684.
2026-11-13 04:24:04 +01:00
AlexKucera 9f4d9ef9ea perf(cold-turkey): minutes feeds skip word counting; word rail goes count-only
CI / ci (push) Canceled after 0s
Root cause (re-derived live at 5915178): WritingLockState.feed ->
WritingGoalRun.update counted words for EVERY goal type, and
DraftStats.words built the complete lowercased token array
(text.split(whereSeparator:).map(lowercased)) just to return .count —
O(document) allocation + lowercasing per keystroke on the main actor
for minutes goals whose verdict/progress/readout never read the count
(argus probe at efbde25c: minutes ~0.32/3.07/16.64 ms per update at
1k/10k/50k words, linear in document size).

Fix, two halves, semantics byte-stable:
- update(text:) guards on .words — a minutes run does no word work
  on feed at all; its accounting freezes at the arm-time baseline
  (currentWords was dead state for minutes runs: readout, isMet,
  progress, and the completion note all ride the clock).
- DraftStats.words becomes a count-only Character pass over maximal
  isLetter/isNumber runs — never materializing the lowercased
  [String]. Identical count by construction: the tokenizer's split
  (which always omits empty subsequences) yields exactly the maximal
  runs; equivalence pinned against the split expression over a
  mixed-script/emoji/punctuation/number corpus in DraftStatsTests.

WritingGoalRun.init (arm-time baseline) keeps counting once per arm
through the same rail — now also allocation-free. Callers unchanged
(update's countWords defaults to DraftStats.words); the words-goal
net accounting is pinned unchanged ('a words update takes exactly
one word-rail trip' + all existing net-delta pins).
2026-11-13 04:21:28 +01:00
AlexKucera dde99c8a75 test(goal): pin zero word-rail trips for minutes updates (RED)
CI / ci (push) Canceled after 0s
The argus opt pass (2026-11-09, unticketed digest finding
cold-turkey-full-tokenization): every editor keystroke feeds the whole
document through WritingGoalRun.update, which counted words for ALL
goal types — a minutes verdict ignores the count, so the feed paid
whole-document tokenization (lowercased [String] allocation) per
keystroke on the main actor for nothing (argus probe: ~16.6 ms/update
at 50k words, linear in document size).

Pins, RED-first where constructible:
- WritingGoalTests 'a minutes update takes zero word-rail trips' —
  RED at base (base takes one trip per update).
- WritingGoalTests 'a words update takes exactly one word-rail trip' —
  the skip boundary: words goals keep live accounting.
- DraftStatsTests 'word rail equals the split tokenizer over a mixed
  corpus' — semantic equivalence pin (old split expression as inline
  reference over mixed scripts, emoji, punctuation, numbers,
  empties); green at base by design — it is the equivalence proof.

Instrument: update(text:countWords:) gains an injectable word-rail
seam (default DraftStats.words) — per-call counting instead of a
global counter, which would race the hosted suite's parallel
DraftStats calls. No behavior change in this commit; update still
counts for every goal.
2026-11-13 04:20:15 +01:00
AlexKucera 93d97f2e35 docs(devlog): library search stale-after-mutation fix
CI / ci (push) Canceled after 0s
CI / ci (pull_request) Canceled after 0s
Session log + INDEX row + CHANGELOG entry for the snapshot
invalidation fix: the rescan-rail content revision and the mounted
key/gate, with the red-first verification trail.
2026-11-11 22:21:46 +01:00
AlexKucera becad45883 fix(search): re-key sweep on Home and content revision
CI / ci (push) Canceled after 0s
The snapshot's only task identity was the trimmed query, so library
mutations never restarted the sweep: archived and trashed rows kept
rendering in the results, and renamed, new, or since-edited pieces
never entered them until the query changed or the view remounted.

Extend the #179 write rail's rescan with the missing signal: every
scan that changes the Post list OR re-reads any post.md (a body-only
edit compares equal as a Post — #143's skip) bumps
PostsModel.contentRevision. Key the mounted sweep to the full
LibrarySearch.SearchKey (query + Home + revision) and gate rendering
on Snapshot.isFresh, so a landed sweep drops to the recompute state
the moment the library moves under it. The posts-assignment skip
stays: panes never regroup on the bumps, only the search re-keys.
2026-11-11 22:20:14 +01:00
AlexKucera c0cd60b798 test(search): red pin for snapshot invalidation
CI / ci (push) Canceled after 0s
The mounted search snapshot is keyed only to the trimmed query, so
library mutations never restart the sweep: archived/trashed rows
linger in the results and edited bodies never enter them until the
query changes or the view remounts.

Pin the invalidation contract at controller level, the way the pure
seam is pinned: LibrarySearch.SearchKey (query + Home + the model's
content revision) and the LibrarySearch.Snapshot isFresh gate decide
whether a landed sweep may render. The rail pins drive the real
rescan path and prove archive, trash, and a same-query body edit
each move PostsModel.contentRevision. The property is a stub here —
never bumped — so those three pins fail red on this commit.
2026-11-11 22:19:01 +01:00
AlexKucera 5915178ce8 docs(design): capture product and design system
CI / ci (push) Canceled after 0s
Record durable product truth in PRODUCT.md (platform, users, the
Mentor Loop, hard rules, brand commitments) and the incumbent visual
system in DESIGN.md (the Scholar's Desk two-paper world with
normative tokens and named rules), plus the impeccable config and
renderable-component sidecar. Gives the design tooling an authority
to check future UI work against.
2026-11-11 16:35:48 +01:00
AlexKucera 06ab149c55 Merge pull request 'fix(posts): bind rides the WorkspaceView root task (#179 follow-up)' (#186) from fix/posts-bind-root-task into main
CI / ci (push) Canceled after 0s
2026-11-10 16:56:39 +01:00
AlexKucera b8089534cf fix(posts): bind rides the WorkspaceView root task (#179 follow-up)
CI / ci (push) Canceled after 0s
CI / ci (pull_request) Canceled after 0s
The pane-local PostsPaneView .task(id: home) unmounted with the Posts
pane, leaving watchedHome stale after a Settings Home repoint while the
Archive pane and every root sheet (import / new project / convert) kept
writing through it. The bind now rides the WorkspaceView root task:
first frame + every repoint, whichever pane is showing. Comments and
the Museion/AGENTS.md bullet name the one writer honestly.

Follow-up to #179 (5bf0955) from the PR #185 finish-audit; PR #185
closed as superseded — two complete implementations of the same ticket,
main's stack carries six commits on top. Suite 681/681, lint parity.
2026-11-10 16:56:17 +01:00
AlexKucera a3ef007562 test(session): finish-audit closeout for #184
CI / ci (pull_request) Canceled after 0s
CI / ci (push) Canceled after 0s
Three-reviewer fanout over PR #184's deferred nil-scope fix:

- pin the titled drain's APPLY half (unpinned suite-wide) over a new
  hangOnPromptLoad rig mode (prompt parks, load answers);
  flip-verified against a nil-only drain guard
- cut the dead Equatable on PendingScope (converged finding)
- name the same-turn pendingRestart ceiling on the drain: respawn's
  .starting window drops the consumed scope; consume-at-apply is the
  upgrade path (follow-up ticket)
- changelog + devlog for the PR; AGENTS.md rails refreshed

Suite 654 executed / 0 failed; swiftformat clean; swiftlint
unchanged (both warnings pre-exist on main).
2026-11-10 16:25:58 +01:00
AlexKucera 704e7a83fd fix(session): drain a deferred nil scope as an explicit clear
pendingScopePieceTitle: String? conflated 'no pending request' with a
pending request whose target is nil (the writer left the piece — New
Post, unsaved draft, external guest, nothing open). Both deferral
branches stored the target and the drain guarded on the optional, so a
deferred nil target was silently dropped: at turn end (sendPrompt,
runOneShot) or replay completion (resumeSession) the old piece's
activeEntry survived under a nothing-open context, contrary to the
scope contract (#176 class).

Pending-ness now rides PendingScope (none | scope(String?)) — a nil
target drains through scopeHostedSession like any titled target and
clears activeEntry. Titled deferrals and the immediate path are
unchanged.

Verified: SessionScopeTests 4/4 green (both RED pins now green in
45 ms — the clear lands at the drain, not a deadline); full unit bundle
653/653 green; swiftformat 0 files; swiftlint exit 0 (two pre-existing
warnings in MentorSessionModel.swift, unchanged kind).
2026-11-10 16:25:01 +01:00
AlexKucera 1b56b0d779 test(session): pin deferred nil scope lost at stream and replay drain
Leaving the piece mid-stream (New Post over a streaming reply) or
mid-replay defers a nil scope request like any switch, but the drain
guards on the optional title — an explicit nil target (clear) is
indistinguishable from no pending request, so activeEntry survives on
the old piece under a nothing-open context.

Two RED pins over the scripted rig: hangOnPrompt (stream parks, cancel
ends it, drain at sendPrompt turn end) and loadReplayHold (replay parks,
releaseHeldLoad completes it, drain at resume). Both fail on this base:
executed 4 / passed 2 / failed 2 (the two new pins).
2026-11-10 16:24:30 +01:00
AlexKucera a8b158ca26 refactor(profiles): one layout + config-set rail
CI / ci (push) Canceled after 0s
#182: ProfileLayout owns the profile root default and every per-profile
path (dir, .env, configured marker, gateway pid, skills dir) — the five
scattered profile-root literals are gone; the provisioner, the settings
writer, and backup/restore derive paths only through it, pinned once in
ProfileLayoutTests. RESTORE.md prose and the ps-scan grep keep their
literal text deliberately (doc text and argv matching, not paths).

HermesConfigRail owns the config set/unset contract once: argv shape
(+--force), provider-first hoisting (switching providers clears a stale
inherited base_url — a caller can no longer order it wrong), ✓-line
verification, unset-idempotence. The provisioner seeds provider/default/
max_tokens; the writer edits provider/default/effort/base_url — each
keeps its own key list, only the mechanism and ordering rule unify. The
rail's Failure carries key/profile/excerpt for both error surfaces.

Audit hardenings folded in: a leading-dash value refuses before any
spawn (free-text model/endpoint fields cannot reach the child CLI as
options), whitespace-only endpoints read as empty at both writer gates,
the deliberate 500-char excerpt cap is pinned not just commented, and
the failed-unset branch is pinned (the fake hermes grew a
config-unset-fails knob).

Full suite 684 passed / 0 failed; dash + whitespace pins flip-verified.

Closes #182
2026-11-10 11:32:47 +01:00
AlexKucera f49e4b6ca0 refactor(settings): provider facts as data
CI / ci (push) Canceled after 0s
#181: ModelProvider is the provider-descriptor table — label, effort
ladder, flagship, endpoint, env var joined by wire dialect (chat/models
paths + the SSE decoder selector), auth mode (Bearer vs Anthropic's
header pair), keyless (nous rides the Portal login), and the ONE
trailing-slash endpoint trim. The probe's URL builders, auth headers,
and stream-decoder picks select by data; the per-dialect bodies and
decoders stay separate functions, not switch clothing.

ProviderCredential.resolve is the ONE credential rail (provider key,
else the shared Portal session key for keyless providers — official
endpoint ONLY, never a user-set URL). Settings' Test Connection and the
new PassReadiness module both call it; the twice-implemented #175
fallback can no longer drift. One deliberate tightening, reviewer-
blessed: a nous pass profile on a custom base_url with no pasted key now
reads missingKey where the old session-model fallback said ready — the
old copy had no endpoint gate at all.

Pass readiness leaves the session model (PassReadiness.swift maps each
pass surface to ready/missingKey/unknown over the descriptor;
MentorSessionModel stores the verdicts and reads no keys or auth
files). runPass and blindRead run their guards through one shared rail
(guardOpenPieceRun) — identical refusal strings, blockers named
honestly. No app-side model-settings store (ADR-0014 red line).

Rider: the #179 mid-pass repoint pin polls the rig's hasHeldPrompt
before releasing the held turn — runningPass flips before the one-shot
engine parks its prompt, so firing into that window false-failed under
parallel-suite load.

Full suite 668/668 (xcresult executed count). Finish-audit: three
reviewers (ponytail/security/general), zero findings above LOW; two
ponytail trims and one pin tightening applied.

Closes #181
2026-11-10 10:58:29 +01:00