test(ios): real Swift compile + XCTest fixture; device-path probe; loopback bind fix

Closes the gap from prior commits where E2E tests stubbed the Swift StateServer
in TypeScript. Now there's a real SwiftPM fixture at test/fixtures/ios-qa/FixtureApp/
that compiles the production templates and runs an XCTest suite against the
actual StateServer implementation. Three new test layers:

- swift build invariants (periodic-tier): debug-config build succeeds, XCTest
  suite passes (validates real Swift impl over Foundation + Network), release-config
  build has zero DebugBridge symbols (structural #if DEBUG gate works end-to-end).

- Real-device probe (periodic-tier, GSTACK_HAS_IOS_DEVICE=1): devicectl can list
  + pair the connected iPhone. Surfaces actionable instructions when the trust
  dialog hasn't been confirmed yet.

- Fixture sources copied from ios-qa/templates/ — Package.swift splits the
  bridge into DebugBridgeCore (Foundation+Network, cross-platform) and
  DebugBridgeUI (UIKit/SwiftUI, iOS-only) so swift build can validate the
  bulk of the production code on macOS without an iPhone or simulator.

Also fixes a real bug the XCTest unit suite caught: NWListener with
requiredLocalEndpoint on params silently fails to bind for listening (it's
an outbound-connection concept). Replaced with .requiredInterfaceType=.loopback
+ .acceptLocalOnly=true + a per-connection peer-address check. The fork's
inherited code had this bug; we shipped it untouched in v1.41.0.0 and the
new XCTest suite caught it immediately.
This commit is contained in:
Garry Tan
2026-05-17 20:12:03 -07:00
parent d184edef78
commit b4fe510648
11 changed files with 1246 additions and 2 deletions
+12
View File
@@ -365,6 +365,14 @@ export const E2E_TOUCHFILES: Record<string, string[]> = {
// exercised end-to-end. The no-device path is gate-tier; the with-device
// path requires GSTACK_HAS_IOS_DEVICE=1 and is periodic-tier.
'ios-qa-e2e': ['ios-qa/**', 'ios-fix/**', 'ios-design-review/**', 'ios-clean/**', 'ios-sync/**', 'test/skill-e2e-ios.test.ts'],
// Swift-build invariant test — requires the Swift toolchain. Compiles the
// fixture SPM package + runs the XCTest suite that validates the real
// Swift StateServer implementation (loopback bind, boot token rotation,
// session lock). Periodic-tier — Swift build is heavier than TS unit tests.
'ios-qa-swift-build': ['ios-qa/templates/**', 'test/fixtures/ios-qa/FixtureApp/**', 'test/skill-e2e-ios-swift-build.test.ts'],
// Real-device path — only runs with GSTACK_HAS_IOS_DEVICE=1 + a paired
// iPhone. Validates the CoreDevice agent + iOS SDK toolchain. Periodic-tier.
'ios-qa-device': ['ios-qa/templates/**', 'test/fixtures/ios-qa/FixtureApp/**', 'test/skill-e2e-ios-device.test.ts'],
};
/**
@@ -635,6 +643,10 @@ export const E2E_TIERS: Record<string, 'gate' | 'periodic'> = {
// /ios-qa daemon + codegen — no-device path runs every PR (no hardware
// dependency, deterministic). with-device path requires GSTACK_HAS_IOS_DEVICE.
'ios-qa-e2e': 'gate',
// Swift toolchain only, no device required, but heavier than TS unit tests.
'ios-qa-swift-build': 'periodic',
// Requires a real connected + paired iPhone. Manual-trigger only.
'ios-qa-device': 'periodic',
};
/**