Skip to content

CI: actually run the Swift test suites (#440) - #459

Merged
Nabzx merged 2 commits into
mainfrom
swift-tests-in-ci-440
Sep 26, 2026
Merged

Nabzx merged 2 commits into
mainfrom
swift-tests-in-ci-440

Conversation

@Nabzx

@Nabzx Nabzx commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

Closes #440 (the CI half - see below for what's still open).

The gap

hotkey-helper and accessibility-helper both have real test suites wired as .testTarget in their Package.swift - HotkeyMatcherTests (XCTest) and AccessibilityInjectionTests (Swift Testing). Nothing ever ran them: .github/workflows/build.yml only ran npm ci && npm run build && npm test, and none of scripts/build-{hotkey,accessibility,transcription}-helper.sh call swift test either - they only do swift build -c release. Same shape as #425: a native-side regression could merge on a green check because the check never looked at Swift at all.

The fix

Two new CI steps: swift test --package-path native/hotkey-helper and swift test --package-path native/accessibility-helper.

What's still open

transcription-helper has no Tests/ directory and no test target - its main.swift (JSON protocol parsing, WAV/file-path branching, FluidAudio bridging) stays untested. The issue itself scoped that out as a bigger lift (mocking FluidAudio's AsrManager), and this PR doesn't attempt it. It's also still not built in CI at all, unlike the other two - worth its own follow-up once a test target exists for it, since building it standalone right now would only prove it compiles, not add coverage.

Verification

Can't run swift test in this sandbox - a pre-existing local toolchain gap (no such module 'Testing'), unrelated to this change (swift build on both packages is clean, before and after). accessibility-helper's suite specifically uses the Testing framework, which needs a recent-enough Xcode - macos-latest GitHub runners should have it, and this PR's own CI run is the actual proof either way.

🤖 Generated with Claude Code


Update: the first real CI run of this suite (this PR's own first push) immediately failed two tests - retriesFocusResolutionWhenTheAXTreeWasBrieflyNotReady and settleGuardPassesOnceTheTargetStabilizes - exactly the kind of thing #440 exists to catch. Root cause: both built a FakeAccessibilityTarget without valueToReadBack (defaults to nil), so rung 1's readback confirmation (focused.readValue(), then after.contains(text)) could never succeed and both silently fell through to rung 2. Not a production regression - InjectionEngine.swift is untouched - just two test fixtures missing the one line every other rung-1 test already has. Fixed in the second commit.

hotkey-helper and accessibility-helper both have real test targets,
wired into their Package.swift - nothing ever invoked them. Same shape
as #425: a native-side regression could merge on a green check because
the check never looked.

transcription-helper has no test target (needs FluidAudio mocked out
first) and isn't built in CI either - that gap stays open, called out
in the new comment rather than silently left for someone to rediscover.

Claude-Session: https://claude.ai/code/session_0144sxo5CJiyk99vaR7sgjuj
The first CI run of accessibility-helper's suite - ever, since #440's
CI step is what runs it for the first time - failed two tests neither
this session nor anyone else had actually seen fail: retriesFocus-
ResolutionWhenTheAXTreeWasBrieflyNotReady and settleGuardPassesOnce-
TheTargetStabilizes.

Both built a FakeAccessibilityTarget without valueToReadBack, which
defaults to nil. InjectionEngine's rung 1 confirms a write by reading
the field back (`let after = focused.readValue(), after.contains(text)`)
- against a fake with nothing to read back, that binding always fails,
so both tests silently fell through to rung 2 and asserted an outcome
("wrote into the field") the fake could never produce. Not a
production regression - InjectionEngine.swift is unchanged - just a
test fixture missing the one line every other rung-1 test already has.

Claude-Session: https://claude.ai/code/session_0144sxo5CJiyk99vaR7sgjuj
@Nabzx
Nabzx merged commit ac2dcb6 into main Sep 26, 2026
1 check passed
@Nabzx
Nabzx deleted the swift-tests-in-ci-440 branch September 26, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Swift test suites exist but nothing ever runs them

1 participant