Commit Graph
95 Commits
Author SHA1 Message Date
AlexKucera 46e87e678c fix(editor): editor owns file drops on macOS 27.2
Dropping an image file on the prose editor pasted the file path
instead of ingesting it (#141 follow-up, unticketed; dogfood on
macOS 27.2.1). #141 was field-verified on 27.0.1, where the
window-level SwiftUI dropDestination starved every deeper
destination; 27.2 routes a drag to the deepest destination, and a
live NSTextView registers itself for drag types, so its stock
performDragOperation pasted the path and the window destination
never fired — the same for a markdown file dropped on the editor.

The editor text views now share a FileDropTextView base that owns
the drops landing on them: URL-bearing drags route (never super) —
the prose editor through the one new AppGateState.routeFileDrop
(Cold Turkey guard, markdown → guest, anything else → ingestDrop),
which the window destination also uses for drops landing outside
the editor; the outline rows bounce; text-only drags keep the stock
drop; the pasteboard probe is memoized per changeCount. A web URL
refuses with the type strip, a vanished file refuses as missing.

+9 tests (a real NSDraggingInfo mock drives the overrides; the
router's guest/lock/ingest branches pinned), all flip-verified.
Finish-audit: three reviewers; the text-drag regression and the
outline rows' identical exposure fixed, two pre-existing ceilings
deferred in the devlog. Rail 729/729, swiftformat 0/153, swiftlint 0.
2026-12-03 16:36:47 +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 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 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 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 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 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 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 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 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 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 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 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 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
AlexKucera 218e2db397 refactor(posts): one frontmatter read/write codec
CI / ci (push) Canceled after 0s
#180: one PostFrontmatter module now owns the lenient read
(parse/split/decoded) and every write posture — fresh stamp,
merge-import, update-keys — behind one known-key table (type,
pass_state, origin; one insertion order). The three near-twin walkers
are deleted byte-identically: PostStore.stamped/splitFrontmatter/
mergedFrontmatter, LearningDecay.stampingFrontmatter,
Post.frontmatter(of:) — 21 call sites swept across seven production
files and eight test files.

The Unaided First Draft eligibility is named once and consumed by both
gates: isUnaidedFirstDraftPair (writer ∧ post — the scan's read-back
gate) and isCaptureEligible (pair ∧ First Draft — the capture gate at
pass invocation). The lenient ?? default stamp decode is extracted
with it (the third copy's deferred extraction).

One deliberate divergence from the absorbed writer, doc-commented and
pinned: mergingImport now preserves hand-edit lines above the opening
--- on import where the old split-first shape silently dropped them —
lossless through every posture is the ticket's contract. Seven codec
pins (PostFrontmatterTests) cover the posture round-trip (foreign keys
verbatim through import → save → advance → micropub), the lenient
unknown-type decode, and the predicates' truth table.

Existing pieces are untouched on disk: every posture moved verbatim
and the full suite pins the byte shapes (664/664 green; the one
under-load flake in the #179 repoint pin is pre-existing on main,
proven by a stashed-tree control run).

Closes #180
2026-11-10 10:21:32 +01:00
AlexKucera 5bf09552f6 refactor(posts): route every library write through one rail
CI / ci (push) Canceled after 0s
#179: every library-reflecting store write (draft save, session-born
post, rename, move to project, archive/restore, trash, convert,
project creation, import batch, pass advance) now rides one internal
seam — performWrite pairs the write with exactly one rescan and owns
the error strip (cleared BEFORE the write so importFiles' per-file
failure messages survive the success tail; a nil-Home refusal writes
nothing). The model owns the Home: watchedHome is private(set), set
only by bind (construction + the Settings repoint); no public method
takes a Home parameter — 14 view call sites and ~115 test call sites
swept, dead home plumbing cut. The editor's debounced flush, the card
closes, the pass substrate and the micropub publish stay off the rail
by design (own error semantics, no library regroup).

A converged review finding is closed with a guard: the pass advance
re-resolves watchedHome after the engine's minutes-long turn, so a
mid-pass Settings repoint now refuses the advance with an honest strip
message instead of silently stamping pass state into the repointed
library (wrong-piece write on a slug collision). createProject
failures now surface in the sheet AND the strip — the rail-owns-the-
strip posture supersedes the #108 sheet-only rule.

Five rail pins (PostsModelWriteRailTests, suite members): write → one
library refresh + strip cleared, failed write owns the strip, nil-Home
refusal, import batch keeps per-file messages, mid-pass repoint
refuses the advance — the last two flip-verified against their guards.
ScriptedEngine gains endHeldPrompt (release a held turn as ended).

Verification: suite 657/657 the evening this landed; the next-morning
re-run could not start — both test runners hung before establishing
connection (#134 testmanagerd wedge; an untouched control suite hangs
identically — machine state, not this diff; reboot pending). Rail pins
5/5 isolated after the last test-only edit; swiftlint at baseline
parity; swiftformat clean.

Closes #179

[Generated by AI]
2026-11-10 08:45:04 +01:00
AlexKucera 627ecf515e refactor(session): extract the engine host
CI / ci (push) Canceled after 0s
Engine lifecycle policy — spawn, handshake, respawn-on-crash, teardown,
and the per-surface residency rules (resident chat engine; one-shot
pass engines spawned per run, torn down at the verdict, ADR-0014) —
moves out of MentorSessionModel into EngineHost behind the
EngineTransport seam. The model keeps session + turn coordination and
stays the only observable the panes see; ACPEngineClient becomes the
seam's production adapter, and a scripted in-process engine
(ScriptedEngine) becomes the second adapter — engine-behaviour tests
(streaming, crash, cancel, restart, per-surface spawn) now run without
child processes, retiring the zsh fake-server rigs from logic tests
(#30 flake family). Exactly one real-process wire smoke per LLM
surface survives (chat two-act + parameterized pass1/pass2): the
held-turn cancel contract, hung-child SIGTERM teardown, handshake,
streamed turn, crash, restart.

One-shot teardown is structural (withOneShot closes at body end, every
exit path); the one-shot slot is claimed before the first suspension so
the at-most-one invariant holds across the spawn/handshake awaits.

Suite: 652 executed / 652 passed / 0 failed (653 argument cases),
counted from the xcresult; swiftformat idempotent, swiftlint clean on
touched files.

Closes #178
2026-11-09 18:26:16 +01:00
AlexKucera d14cb40e73 refactor(session): type the transcript rail
CI / ci (push) Canceled after 0s
SessionRow text rows carry (body, speaker, notice) as data — agent/
user/system plus refused/interrupted/connectionLost/kickoff/failed/
plain — typed at every append site; no stored row holds a speaker
prefix (pinned). The two wire-only classifications are sniffed once at
the append seam: a replayed pass kick-off ('Pass Pass N…') and the
engine's 'Operation interrupted:' notice. The transcript view, the
writing-session filter, and the New Post prefill switch on typed data;
rendering is identical (refusal/connection-lost rows stay agent prose
by pinned render).

Fix Card and Research Note payloads decode through one shared
ToolPayloads decoder: lenient for the transcript rail (both the nested
card-rail shape and the flat #14-era fake kept), strict for the
museion-tools MCP trust boundary with named CardErrors. Three
intentional wire tightenings at the strict entry: empty cards/notes
arrays throw instead of no-op succeeding, the camelCase
diagnosticQuestion alias is rejected (schema is snake_case), and
decode failures answer short named errors instead of DecodingError
dumps. quote/note type parity restored (present-but-wrong-type throws).
Every wire-shape fact is pinned in ToolPayloadsTests.

Full suite 653/653, swiftformat/swiftlint clean. Audit flip-verified.

Closes #177
2026-11-09 16:01:53 +01:00
AlexKucera c2eb9573db docs: shrink AGENTS.md rails 206KB to 36KB
CI / ci (push) Canceled after 0s
Museion/AGENTS.md 147KB -> 30KB, MuseionTests/AGENTS.md 60KB ->
5.4KB. Contracts, rulings, and trust gates kept; per-issue
narratives, UI round histories, and pin inventories dropped (the
test files carry their own scenario headers). Serif skill payload
deliberately untouched (mentor payload, own governance).

closes #183
2026-11-09 15:32:25 +01:00
AlexKucera efad422e03 fix(ui): finish-audit fixes — blank search glyph, quadratic truncation, scope-rail refusal leak
CI / ci (push) Canceled after 0s
CI / ci (pull_request) Canceled after 0s
Three-reviewer audit of the polish overhaul:
- magnifyinglass -> magnifyingglass (blank SF Symbol, all 3 seats)
- WordBoundaryTruncation.fit measures each word once (O(n^2) -> O(n)
  on pathological imported titles; live-title pins unchanged)
- scopeHostedSession defers behind an in-flight replay instead of
  refusing (automatic actions never leak a 'Resume refused' row);
  replay completion re-fires the pending scope — pinned over the real
  client path with loadReplayHold, flip-verified
- transcript ForEach on stable row ids, not indices
- delete dead softBorder param; fold caretPastLeadingBlanks onto
  firstContentLocation; native TextField prompt for the search field
- ElidedPathText.candidates/elide nonisolated (off-actor first(where:)
  trapped the host); new pins: degenerate truncation shapes,
  firstContentLocation, elide ladder
2026-11-07 21:13:31 +01:00
AlexKucera 3a7d495b4b feat(ui): design-council polish overhaul
CI / ci (push) Canceled after 0s
CI / ci (pull_request) Canceled after 0s
Eight arbitrated rounds over the workspace surface: piece-scoped Mentor
hosting, conversation-voice system messages, glyph-measured roster
truncation, bounded learnings/archive columns, symmetric trends grid,
top-aligned settings forms, serif editor titles, outline rail rhythm,
launch auto-focus root fix. New seams pinned by SessionScopeTests +
WordBoundaryTruncationTests; full suite green.
2026-11-07 20:41:34 +01:00
AlexKucera b2db859887 feat(settings): add Nous Portal provider (#175)
CI / ci (push) Canceled after 0s
Settings gains hermes' `nous` slug as a fourth provider on every
surface and the Provider Keys page — endpoint
https://inference-api.nousresearch.com/v1, NOUS_API_KEY, the
5-level OpenAI-compatible effort ladder, switch flagship
anthropic/claude-sonnet-5 (live-probed: the portal's docs-listed
Hermes-4 ids 404 — the inference API serves the OpenRouter catalog,
so the switch keeps the app's sonnet posture billed through Nous).
The probe speaks plain OpenAI chat-completions; an unkeyed test
borrows the shared Portal session's agent_key (the engine's own
credential — hermes' nous runtime is OAuth-only, and a portal key
and subscription bill the same account credits), gated to the
official https endpoint so the implicit credential never rides a
user-edited URL. Pass readiness rides the same fallback, so a
logged-in machine runs passes with no key. Suite 635.

Closes #175
2026-11-05 15:59:41 +01:00
AlexKuceraandCipher ad021b5267 feat(home): pin iCloud Home for fresh installs (#171)
CI / ci (push) Canceled after 0s
With no stored Home override, launch resolves once and PINS the
winner, so the Home never silently moves: a legacy
~/Documents/Museion directory wins (existing Homes migrate manually,
never silently), else <CloudDocs>/Museion when iCloud Drive is
present (dynamically resolved unprefixed path, plain FileManager —
no ubiquity entitlements, ADR-0009), else the silent Documents
fallback. Repoint-only stands (ADR-0004), zero mover code.

The ladder + probes live in HomeResolution.swift (own file —
MuseionApp.swift stays under the lint line cap); init takes an
injectable probe/defaults seam, and default constructions under
hosted tests take an early return so the runner app's real iCloud
state and defaults are never touched. 9 seam-driven tests replace
the old default-Home pin; implement + finish-audit reviews landed
the legacy-probe dir gate, the non-destructive hosted no-write
guard, and the flip-verified CloudDocs spelling pin.

Suite 628/628 (xcresult executed count). DOX: Museion/AGENTS.md,
MuseionTests/AGENTS.md, GLOSSARY.md; devlog + INDEX + CHANGELOG.

Closes #171

Co-Authored-By: Cipher <cipher@hermes.local>
2026-11-05 13:10:44 +01:00
AlexKucera a9e199fce4 feat(cold-turkey): the writing lock (#162)
CI / ci (push) Canceled after 0s
Wires #161's goal engine and #160's contract into the app: armed
from a corner dot or View ▸ Start Cold Turkey…, enforced by the
macOS app-kiosk (7-option presentation combo + fullscreen, restored
on completion), readout with hairline + near-goal terracotta, and
a completion note fading back into focus. While held: focus exit,
reading, new buffers, ⌘W/⌃⌘F/⌘N refused (key-code-matched monitor
— character matching is layout/Caps-blind; no .closeItem placement
exists), ⌘Q asks once per #163's ruling. Typing continuity holds by
construction — lock ⇒ focus freezes the branch under the editor and
chrome mounts as overlays only. Arm values type directly (1…1000
words / 1…60 min, defaults 250/5). Nothing persists.

Wayfinder map #158 Build S2; suite 620, flip-verified pins.
2026-11-04 15:58:47 +01:00
AlexKucera e3195d68fd feat(cold-turkey): pure goal engine (#161)
CI / ci (push) Canceled after 0s
Wayfinder map #158, Build S1: the pure logic slice the writing
lock consumes — no chrome, no clock of its own.

WritingGoal (words | minutes, one goal per block, fixed at arm)
+ WritingGoalRun: update(text:) takes whole-document text and
netNewWords falls out of the delta (deleting costs — net, not
gross; a big paste counts). now is injected into every call, so
the countdown cannot pause by construction; the minutes deadline
is arm+minutes (inclusive), isMet is live truth, unlatched
(delete below target un-mets — complete on the first true tick),
and progress(now:) is the clamped 0…1 the readout hairline rides.
Word counting goes through the new internal DraftStats.words(in:)
— net-words and first-draft stats share one tokenizer and can
never drift.

Finish-audit fanout: the Int() conversion trap in secondsRemaining
fixed at the seam (isFinite + Double(Int.max).nextDown cap — the
naive cap is itself off-by-one at 2^63; flip-verified pin), two
unpinnable > 0 guards in progress deleted, baselineWords narrowed
to let. Equatable and the ?? armedAt fallback kept deliberately
(S2 consumes the former; removing the latter costs formula
duplication). S2 throttle note landed on #162.

Suite 602/602 (xcresult count), swiftformat + swiftlint clean in
app and test targets. Two traps filed to the swift wiki (bare
@Suite stripped by swiftformat; the Double(Int.max) cap).
2026-11-04 12:50:02 +01:00
AlexKucera 2aa8bdabd8 feat(mentor): editorial chat voice for the transcript (#155)
CI / ci (push) Canceled after 0s
Wayfinder map #153, build slice 1 of the #154 contract: the shared
SessionTranscriptView speaks the two-color editorial voice — speaker
prefixes map onto serif agent prose (markdown at flush, verbatim
streaming), right-aligned terracotta user capsules, and the mono status
box on the fg-wash card; ThinkingBlock port; composer restyle with one
Send/Stop button, floating liveness chip, and the Debug toggle moved to
its trailing edge (Sessions pane inherits the same surface).

Finish-audit fanout hardened it: interpreted markdown opens http(s) only
(openURL gate at the sink — engine prose echoes imported content; pinned
via the pure linkVerdict seam), Caps Lock no longer turns Shift+Return
into a send (pinned), the plain-Button toggles speak state to VoiceOver,
and the dead GeometryReader wrapper is gone.

Suite 584/584 (xcresult count), flip-verified pins, swiftformat +
swiftlint clean at the error tier.
2026-11-04 09:46:21 +01:00
AlexKucera 6c57dc075b test(library): pin search seam, 7 cases (#144)
CI / ci (push) Canceled after 0s
The held branch's 7-pin suite, carried byte-identical (blob
23686761de): ranking + scan-order
preservation (the [a, c, b, d] discriminator), body-only match,
title+body dedup into the title half, case-insensitivity on both
fields, empty/whitespace query, unreadable body, and the real
readBody rail over a temp Home (frontmatter never matches).
Test coverage for the landed #144, closed by 53c314d.
2026-11-03 22:17:50 +01:00
AlexKucera 55eff3a754 feat(launch): flip to the gateless launch (#151)
CI / ci (push) Canceled after 0s
Wayfinder map #148's terminal slice (decisions #150 architecture,
#149 UX variant A): every launch now opens straight into the
workspace. The engine check (hermes acp --check) runs async from
ContentView.task via AppGateState.startLaunchCheck — provisioning
(x3 profiles) and the daily backup auto-fire the moment it passes
(the gate era's exact onEnginePass chain, moved verbatim; once per
app-launch, first window only, no-op under hosted tests). Nothing
blocks: the blocking gate sheet, the placeholder logo screen,
gateRaised/gateDismissed, EngineGateView, and the
ProvisioningFailureCard sheet are deleted (net -350 lines with the
additions).

Engine state stays visible instead of interrupting: a 44x44 rail
pill above Archive (8pt pulsing accent dot while checking, warning
glyph on an accent-12% wash when failed, nothing at all once
healthy — the slot collapses and the rail spacing closes) and
mono-10 mentor-pane header states (checking... / engine missing /
setup failed / hermes <base> once ready — the BASE version, never
the gate's derived string; session chip renders only once ready).
Failure auto-expands an anchored floating card (340pt, accent
border — floats, never blocks): engine-missing carries #40's
install steps with the gateless correction plus Copy, guide link,
Re-check (disabled-while-checking), stderr + probed path;
provisioning failure rides the same card (failing profile named,
Retry inline). Focus mode recesses the card with the rail. Panes
spawn the engine the moment the check lands (.task(id: binaryPath)
on the nil->value arrival; a nil binary never calls openSession —
that path lands the crash card). state.json semantics unchanged
(About still reads it); #38's no-silent-degradation AC survives,
carried by the pill.

New GatelessLaunchTests pin the seam (hosted-test no-op, chain
armed, pill + mentor-header visibility mappings — flip-verified);
EngineGateTests byte-untouched and green; the dead deferFailure
(#48's Not-Now) deleted with its test. PRD G1 amended; gateless
DOX pass (Museion/AGENTS.md engine section rewritten); CHANGELOG;
devlog. The #149 prototype ships lint-clean.

Verified: full-scheme test 582 passed / 0 failed / 0 skipped
(xcresult executed count, unit + UI), swiftformat lint clean,
swiftlint 0 errors on touched files, finish-audit fanout clean
(ponytail/security/general; 5 fixes applied, header-mapping pins
flip-discriminated and restored).

Closes #151
Closes #139
2026-11-03 16:50:55 +01:00
AlexKucera 4065c31ec8 feat(payload): land the VOICE payload (#58)
CI / ci (push) Canceled after 0s
Wayfinder map #56 terminal ticket (decision #57): Sandeep Swadia's
VOICE transcript distilled into the mentor's bundled skill set.

New skill owned-insight v1.0 (Owned + Insightful bound as one —
fingerprints with the Cornell evidence, pseudo-profundity, the
so-what test, the belief-difference frame; insight drill example).
reader-psychology 1.1 gains the retelling-test card (the Pass plays
the source's independent reader); prose-craft 1.1 gains the
Engagement section with the earn-the-next-line card — craft ceiling
in the wording: diagnose absent tension, never manufacture it. Old
card 15 renumbered to 16 (external refs grep-verified absent).
session-persona 1.3 gains the session-only interview-me-first
stance; the verbatim four untouched (load-order pins green).

The sanctioned app-code ride-along: owned-insight joins
allocatedSkills on all three surfaces (P1 10 · P2 9 · Chat 11,
links 27 to 30), ProfileSurfaceTests re-pinned (12-skill fixture).
seed-manifest +owned-insight; sample-pass FC-11 (the engine rail
still carries ten: FC-1..9 + FC-11, lint emits FC-10); PRD G14 in
the bundled-set section; DOX pass; devlog.

Verified: full scheme test 574 passed / 0 failed (xcresult executed
count — manifest-payload correspondence and persona-verbatim pins
in the run), swiftformat clean, swiftlint 0 errors, finish-audit
fanout clean (one LOW docs determiner fixed). Issues #56-#58
already closed on the tracker.
2026-11-03 14:35:18 +01:00
AlexKucera 4606fd4628 refactor(lint): clear the last five error spots (#147)
CI / ci (push) Canceled after 0s
The repo contract "SwiftFormat + SwiftLint must both stay clean" had
five error spots left beyond #146's PostsModel split, all mechanical.

PostStore's enum body spanned 354 against 350 — the cursor-sidecar
group (#66: CursorState + stateURL/readCursor/writeCursor, already its
own MARK section) moves verbatim into a same-file nonisolated
extension slotted chronologically before the #141 ingest MARK; the
enum body lands at 334 and PostStore.CursorState keeps its qualified
name, so no caller changes. Six single-char locals in
ProseListTextView's dropIndex/rectY/isGap get real names (plus lo/hi
in the same function — same violation class), one in ImageIngestTests'
bandedRectY. The 194-char guard in ProseList.indent and the 221-char
guard in OutlineEditorView.endDrag wrap in the house
else-carries-the-brace form (#142 landmine avoided).

PostStoreTests crossed its 1000-line ceiling at 1061 — split at the
Pass substrate MARK per the MicropubModelTests precedent: the
pass-adjacent write sides (#24/#29/#31) move byte-identical into
PostStorePassTests.swift, shared helpers storeHome/readPost/readPiece
stay internal in the original, and the #29 scenario header travels
with its tests. 63 tests in, 63 out.

The split's new parallel schedule exposed two latent test races,
reproduced idle (~50% for the first) and fixed at the root:
EditorSessionTests' sidecar poll inherited loop 1's deadline and timed
out holding flush 1's default-zero sidecar (zeros, never nil — the
telltale) — each loop now arms its own. SessionLifecycleTests' three
stderrTail asserts raced the client's main-queue stderr drain (the #30
class) — a drainStderr bounded poll now precedes each.

swiftlint reports zero errors on both targets; residual warning-tier
notices match the standing #146 posture (the error tier is the bar;
the one new notice is PostStorePassTests at 473/400 — a 1070-line
suite cannot split into two files both under 400). swiftformat clean.

Full suite 574/574 by xcresult executed count (573 unit + 1 UI smoke),
twice consecutively plus the finish-up rerun.

Closes #147
2026-11-03 13:47:01 +01:00
AlexKucera a2f6dc1653 perf(library): memoize scan parses per save (#143)
CI / ci (push) Canceled after 0s
Every FSEvents change — each 1 s autosave echo — ran Post.scan over the
whole library: read + frontmatter parse + title per post.md, O(library
bytes) per save cycle while writing, and the posts array was replaced
unconditionally, so every observing pane regrouped and re-rendered even
when nothing changed.

Post.scan now takes an optional PostScanCache (path+mtime+size-keyed
parse memo, nil default — every other caller unchanged): the readdir
walk stays the truth, only changed files are read and re-parsed. The
stamp is captured BEFORE the read and keys the store, so a mid-scan
rewrite can never be pinned as fresh — a late overlapping store keys
its own pre-read stamp and the next scan misses (review-caught race,
pinned by a same-size-rewrite test). rescan skips the posts assignment
when the scan equals the current list; @Observable invalidates on
assignment regardless of equality, so panes stop re-rendering on the
app's own autosave echoes.

Deliberately skipped (measured cold): folder(of:) caching (stat-only
walk) and refreshCards throttling (O(open piece), card surfacing
depends on it).

Closes #143
2026-11-03 11:19:50 +01:00
AlexKucera cc317b65b9 perf(editor): scope fold re-key to the edit (#142)
CI / ci (push) Canceled after 0s
With a fold open, every keystroke re-scanned the buffer, rebuilt the
full attributed string through setAttributedString (invalidating
TextKit layout for the ENTIRE document — O(n²) typing on folded
documents), and rasterized a chrome image the size of the document
(~35M pixels on a 700×50,000pt doc) to paint a handful of chevrons.

Single-line edits now re-key folds in place: a shouldChangeText
override records the edit (range + UTF-16 delta) and a pure rekey
function shifts surviving folds, kills folds whose marker line was
edited (un-hiding just that scope), and re-hides a line edited inside
a hidden scope — no parents rescan, no storage swap. Structural
edits, multi-line pastes, and wholesale loads keep the full pass; a
font probe at each survivor's scope head falls back to it whenever
hidden styling was wiped (the fence-flip restyle self-heals this way).

Chrome renders as one tiny cached layer per list parent (same glyph
rasters at ~15×18pt, geometry-flipped into the existing document-space
overlay) instead of the document-sized bitmap; an edit at/after every
parent line skips the rebuild outright, so writing at the document end
does zero geometry queries. Full-buffer scans per keystroke drop from
2–3 to one.

Finish-audit hardening: the single-line gate checks Character.isNewline
(a literal newline compare passes CRLF — one grapheme equal to neither
scalar), and apply() clears the recorded edit so structural indent/
outdent always takes the full pass (a childless unterminated block's
shift-tab is a single-line replacement that would otherwise keep a
dead fold's scope hidden — apparent line loss).

Closes #142
2026-11-03 10:40:14 +01:00
AlexKucera de1154dacd feat(editor): drop an image into the prose (#141)
CI / ci (push) Canceled after 0s
Dragging an image onto a saved post's prose editor copies it (never
moves) into the piece's assets/ under a parser-clean slugged name
(collision -2 via the shared uniqueFile helper) and inserts
![alt](assets/<slug>.<ext>) at the drop point with alt selected for
type-over — one edit step, one undo.

Routing rides the window-level SwiftUI drop destination, field-verified
to starve every deeper drag destination (nested SwiftUI targets never
fire; AppKit NSDraggingDestination overrides never fire). Pure-markdown
sets keep the open-as-guest behavior; mixed md+image sets refuse loudly
instead of silently dropping the images behind the opened markdown.

The drop point comes from NSEvent.mouseLocation mapped through the one
geometry source that answers under SwiftUI hosting —
firstRect(forCharacterRange:), bottom-up screen coords. Non-contiguous
layout returns zero/stale rects for off-screen characters, so the solve
(a pure static function, pinned by windowless tests) samples the
document, keeps only viewport-band rects, brackets the drop between two
in-band samples, binary-searches the bracket, and slides to the next
whitespace gap — a landing never splices inside a word or an existing
ref. The typewriter inset re-syncs after the edit so scrolling never
freezes. The source gate refuses folders and symlinks alike: copyItem
would land the LINK itself, and the #34 publish rail would then refuse
the whole send. Type gate = the rail's exact set (PNG/JPEG/GIF/WebP/
SVG) — nothing enters assets/ that can't ship. Drafts, outlines, and
guest surfaces refuse loudly.

Finish-audit (three fresh-context reviewers) drove the mixed-set
routing, the symlink refusal, and the pure-function extraction; every
pin flip-verified in one batched cycle. Eleven ingest tests; suite 557.

Closes #141
2026-11-02 17:47:35 +01:00
AlexKucera 695ec27e11 feat(publish): illustrations travel inline (#34)
CI / ci (push) Canceled after 0s
A piece's assets/ ink-sketch images publish with it: Send as Draft
first uploads every referenced image to Micro.blog's media endpoint
(q=config discovery, one multipart file POST per FILE — duplicate
refs share an upload), then each ![alt](assets/…) ref REWRITES IN
PLACE with its uploaded URL in the wire content. The image renders
exactly where the writer placed it and the alt rides the markdown;
the piece on disk never changes.

The first shape attached uploads as a Micropub photo property with
mp-photo-alt — live dogfood (2026-11-01) showed the theme renders
properties at the bottom of the post, losing position. No property
ships at all now; inline refs are the only transport, which also
makes the parsed body ref the only way an image ships — the alt
floor at the illustration rail is therefore the only gate a photo
needs (G12: a whitespace-empty alt refuses naming the file before
anything touches the wire; the mentor is never consulted).

Pre-flight gates every payload: the endpoint's exact formats
(PNG/JPEG/GIF/WebP/SVG), path containment resolved through symlinks
(a planted link never uploads outside-file bytes under the writer's
token), all-or-nothing uploads. A URL carrying markdown-active
characters rides the angle form ![alt](<url>) — a plain-paren
destination would close at the first ) and smuggle a live link into
the published post; the frontmatter trust gate does not cover
markdown's grammar.

Finish-audit (three reviewers) drove the angle form, the symlink
containment, the per-file upload dedup, and four pins; all four
behavior guards flip-verified in one batch cycle. Suite 546 passed /
0 failed; swiftformat + swiftlint clean. Ingest UX (drop image onto
the editor) is #141, blocked by this issue.
2026-11-01 21:52:58 +01:00
AlexKucera 414f1392ef feat(publish): Micropub draft → publish (#33)
CI / ci (push) Canceled after 0s
Two-step publish to Micro.blog over Micropub: Send as Draft (JSON
h=entry create — name = the Title, markdown content verbatim,
post-status draft), review via the preview link, then Publish (the
action=update post-status flip). The piece remembers its draft URL
as a frontmatter micropub_url stamp — in-place, body and foreign
keys byte-identical — so a draft survives a reopen; Send Again
re-drafts after edits. The app token lives in the Keychain (login
keychain; entered once in the sheet, re-offered only on auth
failure — ADR-0014's no-Keychain rule covers only provider keys
hermes reads from .env). Frontmatter category: is permitted but
never sent in v1 — pinned on the wire.

The draft URL is trust-boundary data landing in frontmatter, so
every URL passes a format gate (https + host, no line/control
characters) at BOTH ends: the response decode (Location header →
body url; the preview link is display-only, never the publish
target) and Post.scan's read-back — imported frontmatter rides
verbatim, and a newline--- rider would otherwise close the block
and reparse as attacker markdown in the writer's piece.

Twenty tests pin the wire contract, decode matrix, own-slot keychain
round-trip, stamp/scan, and the model flow (flush-first, refusal
guards, the category AC); all four audit guards are flip-verified.
Full suite 529 passed / 0 failed. Live end-to-end on a real post
(needs the owner's app token) remains open on the ticket.
2026-10-31 17:49:50 +01:00
AlexKucera 3ee6756467 feat(stats): trend view — the writer's arc (#32)
CI / ci (push) Canceled after 0s
A Trends pane (rail destination after Learnings — measurement beside
memory): one line chart per style metric (burstiness, type-token ratio,
sentence variation, trigram repetition) across unaided-first-draft
CAPTURES over time. Points are capture moments, never draft grades —
the pane answers "am I getting better," not "is this draft good." Each
card carries a first-to-last read (improving/steady/slipping at ±0.01,
direction inverted for trigram repetition — the one falling-is-better
metric; one capture shows its value with no verdict), an up/down-better
hint, and a one-line plain-language gloss of the term.

The edited-text leak is closed by construction: Post.scan reads the
five stats_* frontmatter keys into firstDraftStats only when every key
parses to a finite double AND the piece carries the capture gate's
immutable pair (origin writer, type post — not pass_state, which
legitimately advances after the capture). Import carries external YAML
verbatim, so imported ai pieces or outlines with hand-stamped keys
never render, while a migrated writer piece keeps its real arc. The
finite gate also kills a deterministic crash: Double("nan") parses, and
a non-finite peak traps the chart's y-domain construction.

The pane rides PostsModel's watched scan — no scan of its own — so it
refreshes with the library. Fixed y-domains keep single captures
visible (sentence variation scales to its peak); offset-keyed chart
identity and a title tie-break make same-second capture twins
deterministic; the empty state names how the data arrives.

Finish-audit (3 reviewers) fixed the nan/inf crash, the import leak,
same-second ordering, and cut the injectable tolerance parameter and a
label-switch enum down to raw values. Suite 508; the non-finite and
read-back-gate pins are flip-verified.

Closes #32
2026-10-31 15:12:45 +01:00
AlexKucera 97e86cf62d feat(mentor): blind read A/B judgment (#122)
CI / ci (push) Canceled after 0s
A purposeful writer action on the open post — the "Blind Read" button
beside Run Pass — triggers a whole-document advisory judgment: the
current document against the Pass-start snapshot (the newest
passes/pass-N.md on disk), decided by a FRESH session of the same
museion profile over the existing one-shot ACP rail. Both versions
travel inline in one prompt under neutral A/B position labels with
randomized order — the judge never learns which is the rewrite — and
the A/B-to-origin reveal appends only after the verdict, so the mapping
cannot leak; cancelled, refused, and spawn-failed turns reveal nothing.

Advisory-only per decision #120: no Pass State advance, no cards, no
Learnings, the roster never grows — the verdict is display-only and
dies with the transient transcript. The writer stays judge of record;
demonstrator picks and Fix Card status are untouched. Honest refusals
for the degenerate states: no snapshot yet, an unchanged document, or
a busy rail (passes and reads refuse each other; the pass bar's one
Cancel ends either).

The pass engine's spawn/session/teardown block became one shared
runOneShot rail (failure rows speak the run's own name), the pass-bar
button gates on a derived openPieceHasSnapshot flag, the fake ACP
gained a prompt-log observable, and the GLOSSARY "Blind Read" term
landed with the issue.

Finish-audit (three reviewers): a refusal still ends .ended, so the
reveal now gates on the stopReason (flip-verified pin), plus the
Cancel-rail and pass/blind-read exclusivity pins. Suite 500; swiftformat
clean; swiftlint adds no violations over the HEAD baseline.

Closes #122
2026-10-30 17:31:00 +01:00
AlexKucera 4724e00b73 feat(mentor): native deslop lint as fix cards (#6)
CI / ci (push) Canceled after 0s
PRD S3.4: the deslop doctrine's deterministic findings — banned-vocab
tiers and em-dash density — are now computed in Swift at pass
invocation, one line after the #31 stats capture, with no engine
round-trip. Findings land as real fix cards (emitter lint) through
FixCardStore, so they render in the existing palette with ask-before
Apply on mechanical mapping cards; mapped phrases (the skill's verb
swaps + #31, e.g. utilize→use) case-match their anchor per ADR-0006,
everything else closes Done/Skip. One card per phrase over its tier
allowance, whole-word case-insensitive matching (delved never fires
delve), em-dash density card first when over budget; emit dedups
against OPEN cards so re-runs make progress and the engine never
re-cards a live lint finding.

The tiers ship as data (Resources/deslop-lint.json mirroring the
deslop skill verbatim — key/landscape/highlight/bare-underscore
omitted as POS-ambiguous) with a <home>/deslop-lint.json override
that wins whenever it exists and decodes: trivially editable without
a recompile.

Finish-audit fixes folded in: whitespace-only override phrases can
no longer silently kill a whole submit (the guard mirrors the
store's trimmed validation), and submit now refuses a symlinked
cards/ dir (promote's posture — the lint auto-fires it every Run
Pass). Suite 489; one EditorSession load-flake cleared in isolation
and on the idle re-run.

Closes #6
2026-10-30 12:05:30 +01:00
AlexKucera 22bca36857 feat(mentor): pin prompt-end constraint ordering (#1)
CI / ci (push) Canceled after 0s
Both personas gain the verbatim-shared "Draft first, rules last"
section (pass 1.5, session 1.2): the writer's material enters
context before the rule skills, so the deslop constraint tables sit
after the draft, nearest the writing they govern — the PRD's
prompt-end rule. A real ACP audit (the app's exact wire — never
-z: one-shot mode swaps the skills directive and loads nothing)
showed the baseline already read the piece before deslop, but by
model choice; the pin converts observed-once into instructed-
always, and PersonaLoadOrderTests guards presence + verbatim
parity over the bundled payload.

Verified layout, probe traps, and the additive-only propagation
cost are documented in docs/research/prompt-layout-factsheet.md
with the probe script in-repo; real-run verify: piece → persona →
deslop → verdict, 6 fix cards + 2 research candidates landed on
the real rails. Suite 479 + 1 load-flake cleared in isolation.

Closes #1
2026-10-30 11:20:01 +01:00