Files
museion/MuseionTests/AGENTS.md
T
AlexKucera c2eb9573db
CI / ci (push) Canceled after 0s
docs: shrink AGENTS.md rails 206KB to 36KB
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

55 lines
5.2 KiB
Markdown

# 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.
- Always give `@Suite` its string argument — bare `@Suite` is stripped by this repo's swiftformat.
- Imports `@testable import Museion`; app code is default-MainActor, so cross-actor tests need `@MainActor` or nonisolated declarations in app code.
- Deployment target and versions follow the app target; leave `CURRENT_PROJECT_VERSION = 1` here.
## Work Guidance
Conventions every suite follows. Per-suite pin inventories are NOT kept here — each test file opens with a scenario header naming its issue and pins; read the file.
- One runnable check per non-trivial fact: the smallest test that fails if the logic breaks. No fixtures or per-function suites unless asked.
- Never touch the real machine: throwaway Homes in temp dirs (`makeHome`, `storeHome`, `makeModelHome`, `makeSessionHome`, `importHome`); every `ProfileProvisioner.perform` call injects `masterRoot` (the default writes the REAL Application Support); keychain tests inject their OWN account slot (a live production token is never read, replaced, or deleted); roster/defaults under hosted tests redirect to temp or assert `.standard` byte-unchanged; `psScan` is stubbed (a dev machine may run the real engine).
- Shared helpers are `internal` in the founding file. When a suite crosses a file-length or type-body ceiling, split the new pins into their own file and keep the helpers where they are (PostStorePassTests, MicropubModelTests, MCPToolsPromoteTests, SettingsModelWritePathTests precedents).
- Fake child processes (the fake `hermes` CLI, the fake ACP zsh server) speak the live-probed wire shapes over the real `Process` path; payloads ride base64 so shell quoting can never break the wire JSON; every spawn appends to `<name>-spawn-log` and every `session/prompt` to `<name>-prompt-log` (the which-engine-ran / what-it-was-asked observables). Every fake-spawning test tears down via `defer` at rig creation (`client.close()`/`model.shutdown()`, both idempotent).
- Waiting: bounded poll loops, each arming its OWN deadline; poll for the watcher rescan after disk writes. Lock/goal machine tests pass `spawnsTicker: false` — the real 1 s ticker could complete a met goal before an injected tick (the #30/#147 flake family).
- Suite-name filters (`-only-testing:MuseionTests/<Suite>`) do not run free functions — pin things as suite members.
### Suite map
- `EngineGateTests`, `GatelessLaunchTests` — engine probe; gateless launch seam, status-pill and header state mappings.
- `ACPClientTests` — fake ACP server + client wire contract (handshake, streaming, thought lane, crash, cancel, teardown; `makeFakeACP` helpers shared repo-wide).
- `ProfileProvisionerTests`, `ProfileSurfaceTests`, `ProfileSkillMigrationTests`, `ProfileProvisionerFailureTests`, `ProfileBackupTests` — provisioning, symlink migration, failure paths, backup (one fake-`hermes` harness).
- `PostLibraryTests`, `PostStoreTests`, `PostStorePassTests` — scan, write side, pass substrate, stats capture, research notes.
- `DraftStatsTests`, `TrendViewTests` — text metrics and the trend view's pure facts.
- `WritingGoalTests`, `WritingLockTests` — Cold Turkey goal engine + lock machine (kiosk calls no-op under hosted tests by construction — never pinned by driving them).
- `MicropubTests`, `MicropubModelTests`, `MicropubMediaTests` — publish wire contract, model flow, media/illustration surface.
- `MCPToolsTests`, `MCPServerWireTests`, `MCPToolsPromoteTests`, `LearningsPaneTests`, `LearningDecayTests` — museion-tools store, wire, promote, learnings pane, decay.
- `FixCardApplyTests` — fix-card apply/skip/done lifecycle.
- `PostsModelTests`, `PassRunTests`, `BlindReadTests`, `EngineLifecycleTests`, `SessionLifecycleTests`, `SessionScopeTests` — model orchestration: passes, blind read, per-surface engines, session lifecycle, scoped hosting.
- `DeslopLintTests` (with the `DeslopLintWiringTests` member) — native lint findings, config story, emit loop.
- `EditorSessionTests`, `ReadingPresenterTests`, `ProsePresenterTests`, `FocusModeTests`, `ImportExternalTests`, `ImageIngestTests` — editor session, reading pipeline, editing-surface parity, focus math, import + image ingest.
- `OutlineTreeTests`, `OutlinePresenterTests`, `OutlineDragTests`, `EscEventProbeTests` — outliner model, projection, drag plumbing, Esc delivery probe.
- `ProseListTests`, `ProseRekeyTests` — prose list model + fold rendering, fold rekey pipeline.
- `SettingsModelTests`, `SettingsModelWritePathTests`, `HermesSettingsWriterTests`, `ProviderProbeTests`, `ProviderProbeTransportTests` — settings model, real CLI write path, probe decode + request builders.
- `WordBoundaryTruncationTests`, `PolishSeamTests`, `ResearchCandidateTests`, `PersonaLoadOrderTests` — UI pure seams, research candidates, persona payload contract (the four-shared-sections + load-order pins).
## Verification
- `xcodebuild -project Museion.xcodeproj -scheme Museion -destination 'platform=macOS' -only-testing:MuseionTests test` — verify by the xcresult EXECUTED count, never the SUCCEEDED banner.
## Child DOX Index
- None — flat directory.