Files
museion/MuseionTests/AGENTS.md
T
AlexKuceraandClaude f21d3a6844
CI / ci (push) Canceled after 0s
feat(acp): add M0 ACP bridge — engine child + mentor pane (fixes #14)
Spawn hermes acp -p museion over NDJSON JSON-RPC stdio via a
hand-rolled thin client (no Swift SDK exists). The mentor debug
pane streams replies, renders fix-card tool calls as structured
cards (ADR-0006), cancels via session/cancel, tears down on quit
(willTerminate), and surfaces a restart prompt on engine crash —
never data loss. Version verify against state.json is advisory.

Fake ACP server test double (zsh speaking real NDJSON) covers
handshake, streaming + fix-card, drift, crash latch, cancel,
teardown. 36/36 tests green; finish-audit fixes included (wired
binaryPath, focus-loss teardown bug, double onCrash latch).

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-16 18:57:41 +02:00

2.1 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 @MainActor or nonisolated declarations in app code.
  • Deployment target and versions follow the app target; leave CURRENT_PROJECT_VERSION = 1 here.

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.swift builds fake hermes shell scripts in temp dirs and runs them through the real Process path — copy that pattern for any future child-process testing.
  • ACPClientTests.swift extends 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. Only acpTempDir remains as a helper; crash assertions use Swift Testing's confirmation (hook the callback BEFORE triggering the crash).
  • ProfileProvisionerTests.swift extends 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 in ProfileProvisionerFailureTests.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 in ProfileProvisionerTests.swift.

Verification

  • xcodebuild -project Museion.xcodeproj -scheme Museion -destination 'platform=macOS' -only-testing:MuseionTests test

Child DOX Index

  • None — flat directory.