refactor(apple-runner): generate the Swift runner error-code enums from runner-contract.ts

Merged
TH
7d ago
+390-645

Summary

The Swift RunnerWireErrorCode and RunnerPassThroughErrorCode enums were a hand-written copy of the TypeScript declarations, kept equal by regex guards. pnpm generate:runner-error-codes now writes both enums into RunnerErrorCodes.swift from RUNNER_ERROR_CODES and RUNNER_PASS_THROUGH_CODES (moved from the guard into runner-contract.ts). All 44 constant names and raw values are identical, so there is no wire change and no protocol version bump. The change is not behaviour-changing.

  • The UITests folder is a synchronized group with one target for every platform, so the new file needs no project.pbxproj entry.
  • New runner-error-codes gate: renders again and fails on drift. Owned by the generated file, runner-contract.ts, and the generator.
  • Deleted: the 1:1 parity tests, the enum-body readers, and a second Swift enum reader with three tests in apple-runner.
  • Kept: the UPPER_SNAKE literal guard and the emitted-constant check. ErrorPayload.code is a String, so neither the generator nor the compiler sees ErrorPayload(code: "NEW_CODE") or a constant that no emit site uses. WAIVED_LITERALS is unchanged.

20 files. Generator +74; Swift +60/โˆ’99; guards and tests +169/โˆ’538. No scope expansion.

Validation

At a2138a54ef:

  • pnpm build:xcuitest:ios: TEST BUILD SUCCEEDED with RunnerErrorCodes.swift compiled (run before the rebase onto current main).
  • pnpm check:runner-error-codes, check:gate-manifest, check:affected:test, check:layering, check:fallow, check:production-exports, check:xctest-selection, check:packaged-runner-swift, check:quick: pass.
  • runner-code-literals and runner-error-classification tests: pass.

No full check:affected --run receipt: CI owns it. CI obligations: unit suite, and the iOS, macOS host, tvOS, visionOS and watchOS runner builds as evidence that every platform compiles.

๐Ÿค– Generated with Claude Code


Autofix with [code]smith
Open in [code]smith ยท Need help on this PR? Tag @codesmith-bot with what you need.