Skip to content

fix(ios): repair stale RootKey XCTests and the CI that masked them#134

Open
gmaclennan wants to merge 2 commits into
mainfrom
claude/blissful-raman-9873de
Open

fix(ios): repair stale RootKey XCTests and the CI that masked them#134
gmaclennan wants to merge 2 commits into
mainfrom
claude/blissful-raman-9873de

Conversation

@gmaclennan

Copy link
Copy Markdown
Member

What & why

RootKeyStore.loadOrInitialize() and the RootKeyProvider closure return a RootKeyResult struct (.key: Data, .generated: Bool) — see ios/NodeJSService.swift and ios/RootKeyStore.swift. The example app's XCTest sources still treated the return value as raw Data and did not compile against the current API.

Test fixes

  • apps/example/tests/ios/RootKeyStoreTests.swiftfirst.countfirst.key.count, first == secondfirst.key == second.key; added XCTAssertTrue(first.generated) / XCTAssertFalse(second.generated) (first call generates, second loads).
  • apps/example/tests/ios/ComapeoCoreModuleTests.swift — the rootKeyProvider closure returned Data; wrapped it in RootKeyResult. The whole test target compiles together, so this had to be fixed alongside RootKeyStoreTests.

CI fix (why this stayed broken)

While checking why CI was green despite tests that don't compile, I found the Run integration tests step masks failures:

xcodebuild test ... 2>&1 | tee xcodebuild-test.log

The pipe makes the step exit with tee's status (always 0), so a failing or non-compiling test target reported green — the stale tests had been broken on main for weeks unnoticed. Fixed by adding set -o pipefail. Also fixed the Surface xcodebuild failure summary step, which grepped the wrong path (example/ios/…apps/example/ios/…).

Verification

Ran the full CI pipeline locally (npm install → download nodejs-mobile → backend build → expo prebuild → pod install → xcodebuild test) on Xcode 26.5 / iOS 26.5 sim.

  • Compiles & links cleanly — the four compile errors are gone and the build proceeds to launching the test host app.
  • ⚠️ Runtime not verified locally — the test host app boots the Node backend, which hits Keychain error: OSStatus -34018 (errSecMissingEntitlement) and exits before the runner connects. This is the documented "local sim can't run the backend" limitation; actual pass/fail belongs on a real device / BrowserStack.

⚠️ Heads-up

With pipefail in place and the target now compiling, the integration-tests job will actually gate on xcodebuild test for the first time — and will likely go red on the same -34018 (the example app has no keychain-access-groups entitlement and the CI build uses CODE_SIGNING_ALLOWED=NO). That's previously-hidden state surfacing, not a regression from this PR. Follow-up options: add a sim keychain entitlement, scope the job to non-backend tests, or move that coverage to the device/BrowserStack path.

🤖 Generated with Claude Code

gmaclennan and others added 2 commits June 22, 2026 15:47
`RootKeyStore.loadOrInitialize()` and the `RootKeyProvider` closure now
return `RootKeyResult` (`.key` / `.generated`), not raw `Data`. The example
app's XCTest sources still used the old shape and failed to compile:

- RootKeyStoreTests: `.count` / `==` on the result -> use `.key`, and
  assert `.generated` (true on first call, false on the second).
- ComapeoCoreModuleTests: the `rootKeyProvider` closure returned `Data`
  -> wrap in `RootKeyResult`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`xcodebuild test ... | tee xcodebuild-test.log` made the step exit with
tee's status (always 0), so a failing or non-compiling test target was
reported green -- which is why the stale RootKey XCTests went unnoticed.
Add `set -o pipefail`. Also fix the failure-summary step's log path
(`example/ios` -> `apps/example/ios`) so it can actually dump the log.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot added the fix Bug fix (changelog) label Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix (changelog)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant