Commit Graph
2 Commits
Author SHA1 Message Date
AlexKucera 6aa31a419a feat(microblog): show Micro.blog publish status
The publish sheet flipped a draft live and remembered nothing, so
nothing on disk said a piece was out and the library could not show
it. A successful Publish now stamps `micropub_published` in the
piece's frontmatter; the row and the sheet read `published <date>`
or `draft on Micro.blog`, and a published piece's menu opens the
live post.

Sending a piece again no longer creates a second post: a piece that
remembers its post updates it in place (name and content only, so
categories set on Micro.blog survive). An image whose bytes are
unchanged rides its earlier upload through a per-piece memo. When
Micro.blog answers 404 the piece forgets both keys and the sheet
offers a fresh draft; a clear that cannot land says so instead of
claiming the link is gone.

Museion's micropub keys are dropped at the import boundary. An
imported `micropub_url` passes the format gate and would aim the
in-place update at one of the writer's own posts under their token,
so the keys are treated like `origin`: ours to set, never a foreign
file's to carry in. Publish is model-owned and trust-gates its URL
before anything is stamped.

Tests read recorded requests through an optional accessor: an
out-of-range subscript after a failed count expectation trapped the
hosted runner and reported every queued test as crashed.

+16 tests net (17 new pins in MicropubStatusTests, one retired whose
premise the in-place design voids); every new pin was watched fail
on its own guard. Rail 752/752; SwiftFormat and SwiftLint clean.
Reviews: standards + spec during the build, then a three-reviewer
finish audit. Docs: AGENTS.md bullets and learnings, GLOSSARY
terms, CHANGELOG [Unreleased], README, and the devlog.

Closes #206
2026-12-04 17:45:35 +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