Skip to content

refactor: extract app-target orchestration logic into WhiskyKit for testability #171

Description

@frankea

About 1,170 lines of real orchestration logic currently have no tests because they live in the app target, which swift test can't reach:

File Lines Untested logic
Whisky/Utils/SteamClientOrchestrator.swift ~300 per-app launch phases, client-startup single-flight, shared process snapshot, launcher-fix application
Whisky/Utils/LauncherDetection.swift ~330 launcher fix application and profiles (detection itself moved to WhiskyKit in #160)
Whisky/Extensions/Bottle+Extensions.swift ~540 bottle move/export/duplicate state machines

This is not hypothetical debt. The bottle-move corruption (#154), the in-flight guard loss (#155), and the launcher-fix bypass fixed in #166 all lived in these files, and every one shipped without a test because none was possible. Review keeps catching bugs here for a structural reason: this is exactly the code external contributors cannot compile locally (the kit builds with Command Line Tools alone; the app target needs full Xcode), so the code with the least pre-PR verification is also the code with zero CI test coverage.

Plan, in extraction order (each step is independently shippable, no behavior change intended):

  1. Bottle operations into WhiskyKit: the move/export/duplicate logic behind a small seam for the BottleVM interactions (the pin/blocklist rewrite-and-rollback, the in-flight lifecycle). The fix: dont corrupt bottle state on failed move #154/fix: keep in-flight bottles alive across registry reloads #155 fixes get regression tests at last.
  2. Launcher fix application into WhiskyKit next to LauncherType.detect: the profile table and the apply/refine rules (launcherMode gating, already-configured short-circuit). The fix: steam library follow-ups from review #166 gating semantics get pinned.
  3. Orchestrator core into WhiskyKit: the phase dictionary, single-flight client startup, snapshot TTL logic, parameterized over a process-runner protocol so tests can drive it without wine. The SwiftUI view keeps only observation and presentation.

Acceptance: the three app files become thin adapters, the extracted logic has kit tests covering the bugs we've already fixed there, and codecov's whiskykit flag picks the new files up automatically.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions