CI / ci (push) Canceled after 0s
Posts become writable end to end per the #18 map decisions: New Post holds an in-memory draft (folder appears only on first save), first save stamps the flat frontmatter block the #17 reader already parses (pass_state First Draft, origin writer, immutable after stamping), and the Post ID is the Title slug with case-insensitive collision suffixes. Explicit Rename retitles the # Title line and moves the folder (post.md stays); Delete goes to Trash. A recursive FSEvents stream keeps the list mirroring posts/ — external Finder edits included. Editor is a deliberate TextEditor stub; #19's TextKit2 editor replaces it in place while the lifecycle machinery below the view survives the swap. Two review rounds (standards/spec + finish-audit fanout) fixed: watcher start-order bug, writeNew clobber race, overwrite resurrecting vanished posts with reset origin, rename destroying non-heading first lines, draft hijacking the editor, debounce starvation under churn. Tests: 75/75 (17 new). Closes #18.
3.4 KiB
3.4 KiB
MuseionTests
Purpose
Unit tests for the Museion application target, hosted in the app process (TEST_HOST).
Ownership
Owned by the root AGENTS.md contract.
Local Contracts
- Uses Swift Testing (
@Test,#expect) — not XCTest. - Imports
@testable import Museion; app code is default-MainActor, so cross-actor tests need@MainActoror nonisolated declarations in app code. - Deployment target and versions follow the app target; leave
CURRENT_PROJECT_VERSION = 1here.
Work Guidance
- Non-trivial logic leaves one runnable check behind: the smallest test that fails if the logic breaks. No fixtures or per-function suites unless asked.
EngineGateTests.swiftbuilds fakehermesshell scripts in temp dirs and runs them through the realProcesspath — copy that pattern for any future child-process testing.ACPClientTests.swiftextends it into a full fake ACP server: a zsh script speaking real NDJSON JSON-RPC over stdio (makeFakeACP), with a per-binary mode file (crashAfterHandshake,hangOnPrompt, default full) and a base64-encoded fix-card payload — shell quoting can never break the wire JSON. OnlyacpTempDirremains as a helper; crash assertions use Swift Testing'sconfirmation(hook the callback BEFORE triggering the crash).makeStrictFakeACP(same file) guardssession/newthe way adapter ≥0.21.5 does — rejecting a missingmcpServerswith-32602— pinning the wire contract the lenient fake can't catch.ProfileProvisionerTests.swiftextends it: the fake creates the profile at<binaryDir>/profiles/<name>(self-locating, race-free under parallel tests); payload dirs are built at runtime; the bundled-payload test asserts manifest ↔ payload correspondence. #48 failure-path tests live inProfileProvisionerFailureTests.swift(own file — Not-Now defer + re-fail, config.yaml byte-identity + fresh-profile no-config (mcp_servers negative invariant), state.json engine-gate-only, copy-phase catch branch, path-traversal rejection, orphaned-temp sweep). Shared helpers (makeFakeHermes,makePayload,defaultSkills,provTempDir) are internal inProfileProvisionerTests.swift.ProfileBackupTests.swift(own helpersbackupTempDir/makeProfileFixture) injects profile/backups roots, a fixed clock, and apsScanstub — a dev machine may run the real engine, so the ps scan is never trusted in tests.PostLibraryTests.swift(#17) — throwaway Homes viamakeHome/writePostin temp dirs: bare corpus posts (First Draft/writer defaults), lenient + quoted frontmatter (pass_state/origin), lazy folders / hidden dirs / symlinks / noise not surfacing, localizedStandardCompare title sort,untitlededges (blank, marker-only, unterminated frontmatter), leading-blank-line frontmatter, default Home =~/Documents/Museion.PostStoreTests.swift(#18) — write side viastoreHome/readPost(same temp-dir pattern): slug algorithm cases (diacritics, CJK, cap, punctuation-only → untitled), lazy first write + #59 stamp round-trip throughPost.scan, untitled fallback, case-insensitive collision suffixes, rename (retitle + move, insert-title path, same-slug retitle-only, collision -2), trash removes from posts/, overwrite preservation + bare-post normalization,readBodystripping, blocked-posts failure path.
Verification
xcodebuild -project Museion.xcodeproj -scheme Museion -destination 'platform=macOS' -only-testing:MuseionTests test
Child DOX Index
- None — flat directory.