7 Commits
Author SHA1 Message Date
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 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 b02d36bb5d feat(mentor): research & library-light (S8) (#29)
CI / ci (push) Canceled after 0s
The mentor researches mid-pass and its findings arrive as candidate
source-notes with provenance inside their Session. A third museion-
tools tool, submit_research_notes, is the typed rail (ADR-0006
posture): decode-validate only, reply {"received": N}, write NOTHING
— the session is the holding area, and keeping is the writer's act.

Candidates ride the transcript as first-class rows (researchNote):
parsed from the tool call's rawInput by payload shape — the notes
array routes before the fix-card parse, titles are display text —
one row per note, all-or-nothing per batch, the wire's whitespace
rule mirrored so both boundaries agree. Resume re-materializes them
for free: replays re-run the same parse; dispositions reset honestly
(they were never persisted — engine-owned cargo, ADR-0007).

The writer curates in place (full cards in the shared transcript, no
palette — a handful curates where it lands): Keep opens the
ask-before sheet (G9; PromoteAskSheet posture — inline refusal,
buttons kept) and ONE confirm lands one plain markdown note with
provenance into the piece's research/ via writeResearchNote — the
one folder(of:) id lookup anchors it inside this Home, a symlinked
research/ refuses, collision -2; Reject vanishes, recording nothing.
The pass stub names the rail and forbids the engine writing
candidates itself; kept notes flip hasResearch, so every later pass
sees the research/ path (S8.3 at v1 depth).

Finish-audit (three reviewers) drove the whitespace-parity and
shape-routing fixes, the ResearchNoteContent dedup, and a poll-loop
fix for the debounce rig's sidecar half that the larger suite's load
had pushed past its fixed sleep — full suite green (373 tests).

Closes #29
2026-10-22 14:06:16 +02:00
AlexKucera e55747e7fe feat(library): projects & archive UI — S2 (#108)
CI / ci (push) Canceled after 0s
Variant B per the #104 prototype verdict: the library column groups
pieces by project (serif lowercase heads, collapse toggle, Pass-State
groups inside, 2px edge-bar selection shared with the new Archive
pane via LibraryPostRow). Move to Project / Archive / Move Back /
whole-project Unarchive are folder moves — post.md bytes untouched,
never clobbering, ids globally unique. File ▸ New Post ⌘N and New
Project… ⌥⌘N (CommandGroup, never CommandMenu per #84).

Every folder move flushes pending edits first and aborts when the
write failed — nothing moves without its text. Project membership and
the archived-refusal derive from freshly resolved disk paths, never
the scan snapshot. Slug and project-name comparisons fold through one
canonical key (NFC + lowercase). Two reviewer fanouts this session;
their findings are all fixed or visibly parked.

144/144 tests green (run twice), swiftformat/swiftlint clean.

Closes #108
2026-10-13 22:18:24 +02:00
AlexKucera 3ca9d4e601 feat(library): projects & archive substrate — S1 (#107)
CI / ci (push) Canceled after 0s
Pieces re-root from posts/<id>/ to projects/<name>/<id>/ with an
archive/ twin root (ADR-0012): scan walks both levels, New Piece and
Import land in the selected project else the default posts, the slug
namespace is global across projects and archive (an archived slug is
never reused), and every piece carries type: post frontmatter —
stamped by New/Import, read leniently (absent or unknown reads as
post), the file stays post.md for every content type. Write paths
resolve the folder from the id alone (folder(of:)); sessions and
sidecars never thread (project, id).

Finish-audit hardening: duplicate ids on disk (Finder copy) dedupe in
scan to the same first-match folder(of:) writes to; folder(of:) skips
hidden/symlinked projects like scan does.

Dev posts moved by hand to projects/posts/ — no migration machinery,
the app never reads the old posts/ root (#103). Full suite green
(128 unit + UI), swiftlint clean on changed files.

Closes #107
2026-10-13 17:44:44 +02:00
AlexKucera fc0dde4f7c fix(editor): honest save indicator — Changed while dirty (#83)
The dot claimed "Saved" for open posts even with unflushed keystrokes;
only draft mode told the truth. SaveState now mirrors cleanliness:
Changed while text differs from the last flush, Saved when clean. The
Saving… state is deleted — the synchronous write never lasts a render
pass. Save failed stays sticky until a write actually succeeds, and
Keep Local no longer adopts local text as flushed when the post
vanished mid-alert (that path silently killed ⌘S with "Saved" showing).

Closes #83

[Generated by AI]
2026-10-08 18:27:22 +02:00
AlexKucera f2953ee07e feat(editor): land editor core — open, edit, autosave (S1.2)
CI / ci (push) Canceled after 0s
Posts open into the TextKit2 surface (ADR-0010 mode B) lifted from
the proven spike: styled source, scaled headings, dimmed syntax,
native undo/IME. One EditorSession per open post drives a ~1 s
debounced autosave (flush on selection change, window close, app
quit; ⌘S immediate), the Saved/Saving/Failed dot, and the per-post
.museion-state.json cursor sidecar that dies with the folder.
External edits raise an explicit Reload/Keep-Local alert — the
debounce never answers it for the writer, and drafts keep the
lazy-folder first-⌘S rule (#62).

Reviewer fanout fixes folded in: session teardown at every lifecycle
exit (rename flushes before the folder move; trash cancels the
debounce), draft ⌘S continues in place, conflict holds the debounce,
rescan's disk read off-main, ~35 lines of dead code out.

Closes #19
2026-10-05 10:56:33 +02:00