9aa03145646413d2505e0f94432d7dd73ef08990
5
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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. |
||
|
|
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 |
||
|
|
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] |
||
|
|
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  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  — 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. |
||
|
|
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. |