Skip to content

Fix Xcode 27 build and runtime failures - #547

Merged
bradleymackey merged 1 commit into
mainfrom
maintain/xcode-27
Sep 12, 2026
Merged

bradleymackey merged 1 commit into
mainfrom
maintain/xcode-27

Conversation

@bradleymackey

Copy link
Copy Markdown
Member

Makes the package build and pass its full test suite under Xcode 27 (Swift 6.3). CI is deliberately left on macos-26 / Xcode 26.6 / iOS 26.5 — every change here is valid Swift 6.0 and compiles on both toolchains.

Build failures

Swift 6.3 adds the NoUseUnstructuredThrowingTask diagnostic and rejects retroactive Sendable conformances. Against the package's -warnings-as-errors flag, those became hard errors:

  • AsyncButton, VaultItemOnTapDecoratorViewGenerator, VaultItemFeedView discarded throwing unstructured Tasks. Errors were already deliberately swallowed at these sites, so the discard is now explicit via try? with a comment recording why.
  • IntervalTimerTests, PendingValueTests did the same. The timer tests now Issue.record(error) so a throw actually fails the test; PendingValue's task is cancelled by the test itself, so its throw stays ignored.
  • VaultItemPreviewViewGeneratorMock's VaultItemCopyActionHandler conformance required a retroactive Sendable conformance. It had no callers — every site passes VaultItemCopyActionHandlerMock — so the extension is removed rather than reaching for @unchecked Sendable, which .swiftlint.yml bans.
  • VaultDetailEncryptionEditView assigned through the @State wrappedValue setter before self was fully initialized. Now uses State(initialValue:).

Runtime crash

Data.asType used UnsafeRawBufferPointer.load(as:), which requires T-aligned memory. Data makes no alignment guarantee for its backing buffer — a slice can start at any byte offset — and the Swift 6.3 runtime traps on it. This crashed OTPAuthCodeTests and DataHelpersTests outright and took 7 HOTP/TOTP tests with them. Switched to loadUnaligned(as:).

Worth landing independently of the Xcode 27 question: this was live undefined behaviour on 26.6 too, it just happened not to trap.

Verification

Run locally on Xcode 27.0 RC1 (27A266a), iPhone 17 Pro / iOS 26.5 per Vault/README.md:

  • xcodebuild build-for-testing — TEST BUILD SUCCEEDED
  • Full suite, -parallel-testing-enabled NO — TEST EXECUTE SUCCEEDED, 13 bundles across both Default and TSAN configurations, 0 failures
  • VaultApp wrapper — BUILD SUCCEEDED
  • make format + make lint — clean

Follow-up

Bumping CI to Xcode 27 is blocked on runner availability: macos-26 tops out at 26.6, and the only image carrying Xcode 27 is the beta xcode-27 (pinned to beta 6, iOS 27.0 runtime only). Moving there would force the snapshot simulator to iOS 27.0 — bumping the guard constant in AssertSnapshotWithDeviceCheck.swift:9, updating the README, and regenerating 248 reference images. Left for when Xcode 27 reaches the GA runner image.

🤖 Generated with Claude Code

Swift 6.3 adds the NoUseUnstructuredThrowingTask diagnostic and rejects
retroactive Sendable conformances. Combined with the package's
-warnings-as-errors flag, these broke the build in several places:

- AsyncButton, VaultItemOnTapDecoratorViewGenerator and VaultItemFeedView
  discarded throwing unstructured Tasks. Errors were already deliberately
  swallowed at these sites, so the discard is now explicit via `try?`.
- IntervalTimerTests and PendingValueTests did the same. The timer tests now
  record an Issue so a throw fails the test; PendingValue's task is cancelled
  by the test itself, so its throw stays ignored.
- VaultItemPreviewViewGeneratorMock's VaultItemCopyActionHandler conformance
  required a retroactive Sendable conformance. It had no callers — every site
  passes VaultItemCopyActionHandlerMock — so the extension is removed.
- VaultDetailEncryptionEditView assigned through the @State wrappedValue
  setter before self was fully initialized. Now uses State(initialValue:).

Data.asType also crashed at runtime. UnsafeRawBufferPointer.load(as:) requires
T-aligned memory and Data makes no alignment guarantee for its backing buffer,
which the Swift 6.3 runtime now traps on. This took out the HOTP and TOTP
suites entirely. Switched to loadUnaligned(as:).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@bradleymackey
bradleymackey merged commit bb50222 into main Sep 12, 2026
32 of 34 checks passed
@bradleymackey
bradleymackey deleted the maintain/xcode-27 branch September 12, 2026 18:05
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.

1 participant