test(m9): collapse ArgyllRunner waits under ICCERY_UI_TESTING #141

Closed
opened 2026-09-12 16:50:45 +01:00 by gronod · 0 comments
Owner

Problem

Two polling/wait intervals in ArgyllRunner (ICCeryCore) exist only to give real hardware time and add up across the ~40 UI-test launches:

  • ensureNotRunning poll — Packages/ICCeryCore/Sources/ICCeryCore/Argyll/ArgyllRunner.swift:203 — 100ms per attempt, up to 30 attempts, fires on every tool re-run via the duplicate-id guard (#50/#52).
  • XY chartread pre-kill wait — ArgyllRunner.swift:595 — 500ms Task.sleep after sending q\n before kill. No current UI test sets MOCK_CHARTREAD_MODE=xy, so this is future-proofing at zero risk today.

Change

Add a DEBUG-gated helper that reads the existing ICCERY_UI_TESTING=1 env var (same convention as AppPaths.testRoot in Packages/ICCeryCore/Sources/ICCeryCore/Paths/AppPaths.swift:54-71) and shrinks these intervals ~10x under tests:

/// DEBUG-only fast path: under `ICCERY_UI_TESTING=1` polling/wait
/// intervals shrink — same env convention as `AppPaths.testRoot`.
private static func testAwareDelay(_ nanos: UInt64) -> UInt64 {
    #if DEBUG
    if ProcessInfo.processInfo.environment["ICCERY_UI_TESTING"] == "1" {
        return nanos / 10
    }
    #endif
    return nanos
}

Apply at the two sites: Task.sleep(nanoseconds: Self.testAwareDelay(100_000_000)) and ...Self.testAwareDelay(500_000_000).

Release builds compile the #if DEBUG branch out entirely — zero production impact. No mutable static state (env read per call).

Acceptance

  • ICCeryCoreTests unaffected (no behavior change for non-ICCERY_UI_TESTING builds).
  • UI suite still green.

Scope

  • Packages/ICCeryCore/Sources/ICCeryCore/Argyll/ArgyllRunner.swift only.
  • Out of scope: SwiftUI animation disabling (no explicit animation code exists in Sources/ICCery).
## Problem Two polling/wait intervals in `ArgyllRunner` (ICCeryCore) exist only to give real hardware time and add up across the ~40 UI-test launches: - `ensureNotRunning` poll — `Packages/ICCeryCore/Sources/ICCeryCore/Argyll/ArgyllRunner.swift:203` — 100ms per attempt, up to 30 attempts, fires on every tool re-run via the duplicate-id guard (#50/#52). - XY chartread pre-kill wait — `ArgyllRunner.swift:595` — 500ms `Task.sleep` after sending `q\n` before kill. No current UI test sets `MOCK_CHARTREAD_MODE=xy`, so this is future-proofing at zero risk today. ## Change Add a DEBUG-gated helper that reads the existing `ICCERY_UI_TESTING=1` env var (same convention as `AppPaths.testRoot` in `Packages/ICCeryCore/Sources/ICCeryCore/Paths/AppPaths.swift:54-71`) and shrinks these intervals ~10x under tests: ```swift /// DEBUG-only fast path: under `ICCERY_UI_TESTING=1` polling/wait /// intervals shrink — same env convention as `AppPaths.testRoot`. private static func testAwareDelay(_ nanos: UInt64) -> UInt64 { #if DEBUG if ProcessInfo.processInfo.environment["ICCERY_UI_TESTING"] == "1" { return nanos / 10 } #endif return nanos } ``` Apply at the two sites: `Task.sleep(nanoseconds: Self.testAwareDelay(100_000_000))` and `...Self.testAwareDelay(500_000_000)`. Release builds compile the `#if DEBUG` branch out entirely — zero production impact. No mutable static state (env read per call). ## Acceptance - ICCeryCoreTests unaffected (no behavior change for non-`ICCERY_UI_TESTING` builds). - UI suite still green. ## Scope - `Packages/ICCeryCore/Sources/ICCeryCore/Argyll/ArgyllRunner.swift` only. - Out of scope: SwiftUI animation disabling (no explicit animation code exists in `Sources/ICCery`).
gronod added the Kind/Testing
Priority
Low
4
Project/ICCery-v2Feature/DevOps
labels 2026-09-12 16:50:45 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: gronod/iccery-v2-mac#141