Dropping an image file on the prose editor pasted the file path instead of ingesting it (#141 follow-up, unticketed; dogfood on macOS 27.2.1). #141 was field-verified on 27.0.1, where the window-level SwiftUI dropDestination starved every deeper destination; 27.2 routes a drag to the deepest destination, and a live NSTextView registers itself for drag types, so its stock performDragOperation pasted the path and the window destination never fired — the same for a markdown file dropped on the editor. The editor text views now share a FileDropTextView base that owns the drops landing on them: URL-bearing drags route (never super) — the prose editor through the one new AppGateState.routeFileDrop (Cold Turkey guard, markdown → guest, anything else → ingestDrop), which the window destination also uses for drops landing outside the editor; the outline rows bounce; text-only drags keep the stock drop; the pasteboard probe is memoized per changeCount. A web URL refuses with the type strip, a vanished file refuses as missing. +9 tests (a real NSDraggingInfo mock drives the overrides; the router's guest/lock/ingest branches pinned), all flip-verified. Finish-audit: three reviewers; the text-drag regression and the outline rows' identical exposure fixed, two pre-existing ceilings deferred in the devlog. Rail 729/729, swiftformat 0/153, swiftlint 0.
9.2 KiB
9.2 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. - Always give
@Suiteits string argument — bare@Suiteis stripped by this repo's swiftformat. @Testnames: backticked sentence style is the convention; plain lowercase-camel identifiers are the deliberate exception where name-level-only-testingaddressability matters (#195) —.swiftformatsets--test-case-name-format preserve, so both shapes are format-clean.- 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
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); everyProfileProvisioner.performcall injectsmasterRoot(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.standardbyte-unchanged;psScanis stubbed (a dev machine may run the real engine). - Shared helpers are
internalin 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). - Engine tests run IN-PROCESS at the
EngineTransportseam (#178):ScriptedEngine.swiftholds the scripted adapter (mode strings mirroring the retired zsh fake: full/crashAfterHandshake/hangOnPrompt/hangOnPromptLoad/cancelOnPrompt/refuseOnPrompt/noStopReason/strayResearchOnPrompt/loadReplay*/strictMcp), the shared payloads (ScriptedPayloads), and the rig roots — build rigs there, never duplicate. Spawn observables: the rig's spawned-profiles record (which engine ran), transport identity (mentor.host.chat/oneShot) where pid pins used to live,isClosedfor reaped. Child processes appear in EXACTLY ONE suite —EngineSmokeTests, one real-process wire smoke per LLM Surface (chat/pass1/pass2, ADR-0014) over the zsh fake (makeFakeACP/acpTempDir, defined in ACPClientTests.swift, kept as the wire fixture). The fake-hermesCLI harness (ProfileProvisioner/Backup suites) still speaks realProcesswith base64 payloads,<name>-spawn-log,<name>-prompt-log, anddeferteardown at rig creation. - 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— turn-outcome seam + view predicates over the scripted engine (#178: the client wire contract itself lives in EngineSmokeTests;makeFakeACP/acpTempDirremain here as the shared wire fixture).ScriptedEngine.swift— #178: the scripted in-processEngineTransportadapter, shared payloads, and the scripted rig roots every engine suite builds on.EngineSmokeTests— #178: the ONLY child-spawning suite — one real-process end-to-end wire smoke per LLM Surface (chat onmuseion: handshake/stream/verdict/crash/restart/teardown; pass1/pass2: own engine under its profile, teardown reap, chat engine untouched); brief-27: the blocked-writer regression rig (never-reading/bin/sleepfake mode — deadline/Stop-delivery/bounded-close stay live behind a full stdin pipe) + theserverPinghealthy-contract smoke.ProfileLayoutTests,HermesConfigRailTests— #182: the layout's one pinning suite (root default + every per-profile path builder against literals) and the config-set rail's ONE contract suite (argv+--force, provider-first hoisting, ✓-line verification, unset idempotence, structured Failure) — both over the shared fake-hermes double; callers' suites pin only their own key lists.ProfileProvisionerTests,ProfileSurfaceTests,ProfileSkillMigrationTests,ProfileProvisionerFailureTests,ProfileBackupTests— provisioning, symlink migration, failure paths, backup (one fake-hermesharness).PostLibraryTests,PostStoreTests,PostStorePassTests,PostFrontmatterTests— scan, write side, pass substrate, stats capture, research notes, the frontmatter codec (#180: posture round-trips, lenient decode, named eligibility predicates).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); #200: the quit delegate pins —quitReply(posts:)refuses while an open piece can't depart (block-quit posture), the refusal alert itself is hosted-guarded.PostsModelDepartureTests— brief-25/#198: document departure guarded — a navigation whose outgoing flush fails (injected read-only dirs) or hits an unanswered #67 conflict aborts and retains the dirty session/guest; #200: quit-time shutdown pins — foreign disk body untouched across a conflicted shutdown, clean dirty session and the open guest flush, a never-loaded session's retyped words refuse (vacuous-flush gap).MicropubTests,MicropubModelTests,MicropubMediaTests— publish wire contract, model flow, media/illustration surface.MCPToolsTests,MCPServerWireTests,MCPToolsPromoteTests,ToolPayloadsTests,LearningsPaneTests,LearningDecayTests— museion-tools store, wire, promote, tool-payload decoder shapes (strict + lenient, #177), learnings pane, decay.FixCardApplyTests— fix-card apply/skip/done lifecycle.PostsModelTests,PassRunTests,BlindReadTests,EngineLifecycleTests,SessionLifecycleTests,SessionScopeTests,TranscriptRailTests— model orchestration over the scripted in-process engine (#178): passes, blind read, per-surface engines, session lifecycle, scoped hosting, the typed transcript rail (#177 — speaker/notice type facts through the scripted engine, prefix-free invariant, append-seam classifiers), and the #179 write-rail pins in PostsModelTests (write → one library refresh + strip cleared; failed write owns the strip; nil-Home refuses cleanly; import batch keeps per-file strip messages; mid-pass Home repoint refuses the advance —endHeldPromptis the rig hook that ends a held turn normally, polled to viahasHeldPromptfirst:runningPassflips before the one-shot engine parks its prompt, so firing into that window false-fails under load).DeslopLintTests(with theDeslopLintWiringTestsmember) — 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 + the 27.2 drag-routing seam (DragInfoStub, the suite's NSDraggingInfo mock: a Finder-shaped drag routes through the text view and never pastes the path; text-only drags keep the stock drop; outline rows bounce; the probe followschangeCount; web URLs and vanished files refuse with the right notice) + the one router's pins (guest, Cold Turkey refusal, ingest hand-off, mixed refusal).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,ProviderCredentialTests— settings model, real CLI write path, probe decode + request builders, the #181 ONE credential resolution (pasted key wins, keyless fallback on the official endpoint, custom-endpoint and no-login refusals).WordBoundaryTruncationTests,PolishSeamTests,ResearchCandidateTests,PersonaLoadOrderTests— UI pure seams, research candidates, persona payload contract (the four-shared-sections + load-order pins).
Verification
./scripts/full-test.sh start+statuspolling is the sanctioned verify rail (#190): detached run, per-run pinned bundle, counts fromxcresulttoolonly, zero-match filters FAIL (vacuous-green trap),--serializedrerun for parallel-load flakes, per-test timeouts naming wedged tests.
Child DOX Index
- None — flat directory.