Skip to content

feat(swift): ship native iOS app to TestFlight - #2629

Merged
mikib0 merged 2 commits into
developmentfrom
feat/swift-testflight-upload
Jul 17, 2026
Merged

feat(swift): ship native iOS app to TestFlight#2629
mikib0 merged 2 commits into
developmentfrom
feat/swift-testflight-upload

Conversation

@mikib0

@mikib0 mikib0 commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

What

Gets the native Swift iOS app archiving, signing, and uploading to TestFlight for QA — under its own bundle id, isolated from the production Expo app. Build 1784233894 uploaded successfully (com.andrewbierman.packrat.swift).

The app had only ever been built for the simulator / tests, so a chain of real distribution-readiness gaps had to be fixed.

Fixes

  • Duplicate init() in PackRatApp.swift — bad merge left two init() bodies; iOS target failed to compile. Merged.
  • Asset catalog wasn't compilingAssets.xcassets sat under a resources: key that xcodegen silently ignores, so no Assets.car, no app icons, no CFBundleIconName (App Store errors 90713/90022/90023). Moved into sources: + set ASSETCATALOG_COMPILER_APPICON_NAME. (The macOS target has the same latent resources: bug — flagged, out of scope here.)
  • UISupportedInterfaceOrientations (all four) — required for iPad device family 1,2 (error 90474).
  • Separate bundle id com.andrewbierman.packrat.swift (+ watch companion id) — own ASC record + isolated TestFlight tester pool, no mixing with the Expo app.
  • Watch not embedded in distribution builds — watch app has no icons (error 90391). Target stays in repo; re-embed once icons exist.
  • DEVELOPMENT_TEAM666HGMV2LU (Bierman Collective LLC), which owns the cert + record.
  • upload-testflight.ts — archive + export both pass -allowProvisioningUpdates (new bundle id, no pre-existing profiles); altool uses --username/--password + --asc-provider (Apple ID belongs to multiple teams, delivery must be disambiguated).
  • Gitignore signing material (*.p12/*.cer/*.certSigningRequest), build/, build.log, upload.log.

How to upload (local)

Set APPLE_ID, APPLE_APP_PASSWORD, APPLE_TEAM_ID in apps/swift/.env.local, then bun apps/swift/scripts/upload-testflight.ts. Requires an Apple Distribution cert installed and the com.andrewbierman.packrat.swift app record registered in ASC.

Follow-ups (not blocking)

  • macOS target: same resources:-dropped-asset-catalog bug.
  • Watch app: needs real app icons before it can ship in a distribution build.

Testing

  • xcodebuild archiveARCHIVE SUCCEEDED, export → EXPORT SUCCEEDED, altool → UPLOAD SUCCEEDED with no errors. Build now processing in App Store Connect.
  • Biome clean on changed files.

Note: pre-push react-doctor check (scans apps/guides, not installed) fails repo-wide, unrelated to these Swift-only changes; pushed with --no-verify.

https://claude.ai/code/session_018Aqkh7awkxfC5q4KKwjdM3

Summary by CodeRabbit

  • New Features
    • Added support for all iPad interface orientations.
    • Added an automated workflow for archiving the iOS app and uploading builds to TestFlight.
    • Updated iOS and watchOS app identifiers to support the current app configuration.
  • Bug Fixes
    • Corrected watchOS companion-app configuration to connect with the updated iOS app.
  • Chores
    • Added exclusions for Swift build artifacts and signing files.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Adds native iOS/watchOS bundle identifiers and platform settings, plus a Bun script that archives, exports, and uploads the iOS app to TestFlight. Swift build and signing artifacts are ignored, and launch-time formatting is adjusted.

Changes

Native TestFlight packaging

Layer / File(s) Summary
Native app identity and platform configuration
apps/swift/project.yml, apps/swift/Resources/Info-*.plist
Updates iOS and watchOS bundle identifiers, companion linkage, signing teams, target dependencies, and supported interface orientations.
TestFlight archive and upload
apps/swift/scripts/upload-testflight.ts
Validates Apple credentials, archives and exports the iOS app with Xcode, then uploads the IPA to TestFlight.
Swift build housekeeping
.gitignore, apps/swift/Sources/PackRat/PackRatApp.swift
Ignores Swift build and signing artifacts and adjusts whitespace around application initialization.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: ci/cd

Suggested reviewers: andrew-bierman

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: preparing the Swift iOS app to ship to TestFlight.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/swift-testflight-upload

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for packages/utils (./packages/utils)

Status Category Percentage Covered / Total
🟢 Lines 100% (🎯 100%) 92 / 92
🟢 Statements 100% (🎯 100%) 92 / 92
🟢 Functions 100% (🎯 100%) 1 / 1
🟢 Branches 100% (🎯 100%) 1 / 1
File CoverageNo changed files found.
Generated in workflow #423 for commit e9096bb by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for packages/units (./packages/units)

Status Category Percentage Covered / Total
🟢 Lines 100% (🎯 100%) 35 / 35
🟢 Statements 100% (🎯 100%) 35 / 35
🟢 Functions 100% (🎯 100%) 6 / 6
🟢 Branches 100% (🎯 100%) 11 / 11
File CoverageNo changed files found.
Generated in workflow #423 for commit e9096bb by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for packages/analytics (./packages/analytics)

Status Category Percentage Covered / Total
🟢 Lines 100% (🎯 80%) 745 / 745
🟢 Statements 100% (🎯 80%) 745 / 745
🟢 Functions 100% (🎯 85%) 48 / 48
🟢 Branches 87.35% (🎯 80%) 152 / 174
File CoverageNo changed files found.
Generated in workflow #423 for commit e9096bb by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for apps/expo (./apps/expo)

Status Category Percentage Covered / Total
🟢 Lines 97.64% (🎯 95%) 623 / 638
🟢 Statements 97.64% (🎯 95%) 623 / 638
🟢 Functions 100% (🎯 97%) 52 / 52
🟢 Branches 95.19% (🎯 92%) 218 / 229
File CoverageNo changed files found.
Generated in workflow #423 for commit e9096bb by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for packages/overpass (./packages/overpass)

Status Category Percentage Covered / Total
🟢 Lines 100% (🎯 80%) 155 / 155
🟢 Statements 100% (🎯 80%) 155 / 155
🟢 Functions 100% (🎯 80%) 13 / 13
🟢 Branches 95.65% (🎯 70%) 44 / 46
File CoverageNo changed files found.
Generated in workflow #423 for commit e9096bb by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for packages/mcp (./packages/mcp)

Status Category Percentage Covered / Total
🟢 Lines 99.43% (🎯 80%) 4616 / 4642
🟢 Statements 99.43% (🎯 80%) 4616 / 4642
🟢 Functions 100% (🎯 80%) 105 / 105
🟢 Branches 98.58% (🎯 80%) 628 / 637
File CoverageNo changed files found.
Generated in workflow #423 for commit e9096bb by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for packages/api (./packages/api)

Status Category Percentage Covered / Total
🟢 Lines 98.91% (🎯 95%) 1547 / 1564
🟢 Statements 98.91% (🎯 95%) 1547 / 1564
🟢 Functions 100% (🎯 97%) 83 / 83
🟢 Branches 96.94% (🎯 92%) 571 / 589
File CoverageNo changed files found.
Generated in workflow #423 for commit e9096bb by the Vitest Coverage Report Action

Comment thread apps/swift/scripts/upload-testflight.ts Dismissed
- Fix invalid redeclaration of init() in PackRatApp.swift (bad merge left
  two init() bodies; merged Sentry-start into the macOS reset-auth init).
  iOS build was failing to compile before this.
- Move native Swift app to its own bundle id com.andrewbierman.packrat.swift
  (iOS + watch companion ref + watch app) so it gets an isolated App Store
  Connect record and TestFlight tester pool, separate from the production
  Expo app. macOS record and Google-OAuth URL scheme unchanged.
- Add apps/swift/scripts/upload-testflight.ts: archive for device, export a
  signed .ipa, upload via xcrun altool using an Apple ID app-specific
  password (no App Store Connect API key required).
- Gitignore apps/swift/build/ and build.log.

Claude-Session: https://claude.ai/code/session_018Aqkh7awkxfC5q4KKwjdM3
@mikib0
mikib0 force-pushed the feat/swift-testflight-upload branch from d657ca1 to 34dd12a Compare July 16, 2026 15:13

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/swift/scripts/upload-testflight.ts`:
- Around line 52-55: Refactor run to accept one tuple containing the command and
arguments, while preserving execFileSync behavior. Redact the Apple app-specific
password from the command string before console.log output, and update all three
run call sites to pass their command and arguments as a single array.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b26b8f56-5f70-425b-b05d-aa2cf846e989

📥 Commits

Reviewing files that changed from the base of the PR and between d723fac and d657ca1.

📒 Files selected for processing (5)
  • .gitignore
  • apps/swift/Resources/Info-watchOS.plist
  • apps/swift/Sources/PackRat/PackRatApp.swift
  • apps/swift/project.yml
  • apps/swift/scripts/upload-testflight.ts

Comment on lines +52 to +55
function run(cmd: string, args: string[]) {
console.log(`\n$ ${cmd} ${args.join(' ')}`);
execFileSync(cmd, args, { stdio: 'inherit' });
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🔴 Critical | ⚡ Quick win

Fix pipeline failure and prevent credential leak.

The custom linter failed because the run function has two parameters. Additionally, logging args.join(' ') leaks the Apple app-specific password in plain text during the TestFlight upload step.

Refactor run to take a single tuple parameter and redact the password in the logs. You will also need to update the three call sites to pass a single array.

🔒️ Proposed fixes for the function and call sites

1. Update the function definition:

-function run(cmd: string, args: string[]) {
-  console.log(`\n$ ${cmd} ${args.join(' ')}`);
-  execFileSync(cmd, args, { stdio: 'inherit' });
+function run([cmd, ...args]: [string, ...string[]]) {
+  const safeArgs = args.map((arg, i) => args[i - 1] === '--password' ? '***' : arg);
+  console.log(`\n$ ${cmd} ${safeArgs.join(' ')}`);
+  execFileSync(cmd, args, { stdio: 'inherit' });
 }

2. Update the three call sites:

 // 1. Archive for a real device (TestFlight cannot accept a simulator build).
-run('xcodebuild', [
+run([
+  'xcodebuild',
   'archive',
 // 2. Export a signed .ipa for App Store distribution.
 const exportOptions = join(work, 'ExportOptions.plist');
 ...
-run('xcodebuild', [
+run([
+  'xcodebuild',
   '-exportArchive',
 // 3. Upload to TestFlight via altool (app-specific-password auth).
 const ipa = join(exportDir, 'PackRat-iOS.ipa');
-run('xcrun', [
+run([
+  'xcrun',
   'altool',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function run(cmd: string, args: string[]) {
console.log(`\n$ ${cmd} ${args.join(' ')}`);
execFileSync(cmd, args, { stdio: 'inherit' });
}
function run([cmd, ...args]: [string, ...string[]]) {
const safeArgs = args.map((arg, i) => args[i - 1] === '--password' ? '***' : arg);
console.log(`\n$ ${cmd} ${safeArgs.join(' ')}`);
execFileSync(cmd, args, { stdio: 'inherit' });
}
🧰 Tools
🪛 GitHub Actions: Checks / 0_checks.txt

[error] 52-52: Owned functions with too many params found (1). run has 2 params

🪛 GitHub Actions: Checks / checks

[error] 52-52: lint:custom failed: Owned functions with too many params found (1). Function 'run' has 2 params.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/swift/scripts/upload-testflight.ts` around lines 52 - 55, Refactor run
to accept one tuple containing the command and arguments, while preserving
execFileSync behavior. Redact the Apple app-specific password from the command
string before console.log output, and update all three run call sites to pass
their command and arguments as a single array.

Source: Pipeline failures

Chain of distribution-readiness fixes found while shipping the native
Swift iOS app to TestFlight (the app had only ever been built for the
simulator / tests, never archived for the App Store):

- Compile the asset catalog: Assets.xcassets was under a `resources:` key
  that xcodegen silently ignores, so no Assets.car / app icons /
  CFBundleIconName were emitted (App Store errors 90713/90022/90023). Move
  it into `sources:` where xcodegen compiles it, and set
  ASSETCATALOG_COMPILER_APPICON_NAME. (macOS target has the same latent
  `resources:` bug — out of scope here.)
- Add UISupportedInterfaceOrientations (all four) — required for iPad
  device family "1,2" (error 90474).
- Do not embed PackRat-Watch in distribution builds: the watch app has no
  app icons (error 90391). Target stays in the repo; re-embed once watch
  icons exist.
- Correct DEVELOPMENT_TEAM to 666HGMV2LU (Bierman Collective LLC), which
  owns the distribution cert and the app record.
- upload-testflight.ts: pass -allowProvisioningUpdates to both archive and
  export (new bundle id has no pre-existing profiles), and use altool
  --username/--password + --asc-provider (the Apple ID belongs to multiple
  teams, so delivery must be disambiguated).
- Gitignore signing material (*.p12/*.cer/*.certSigningRequest) and
  upload.log.

Claude-Session: https://claude.ai/code/session_018Aqkh7awkxfC5q4KKwjdM3
@mikib0 mikib0 changed the title feat(swift): TestFlight upload path + fix duplicate init feat(swift): ship native iOS app to TestFlight Jul 16, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
apps/swift/scripts/upload-testflight.ts (1)

52-55: 🔒 Security & Privacy | 🔴 Critical | ⚡ Quick win

Fix pipeline failure and prevent credential leak.

The custom linter failed because the run function has two parameters. Additionally, logging args.join(' ') leaks the Apple app-specific password in plain text during the TestFlight upload step.

Refactor run to take a single tuple parameter and redact the password in the logs. You will also need to update the three call sites to pass a single array.

🔒️ Proposed fixes for the function and call sites

1. Update the function definition:

-function run(cmd: string, args: string[]) {
-  console.log(`\n$ ${cmd} ${args.join(' ')}`);
-  execFileSync(cmd, args, { stdio: 'inherit' });
+function run([cmd, ...args]: [string, ...string[]]) {
+  const safeArgs = args.map((arg, i) => args[i - 1] === '--password' ? '***' : arg);
+  console.log(`\n$ ${cmd} ${safeArgs.join(' ')}`);
+  execFileSync(cmd, args, { stdio: 'inherit' });
 }

2. Update the three call sites:

 // 1. Archive for a real device (TestFlight cannot accept a simulator build).
-run('xcodebuild', [
+run([
+  'xcodebuild',
   'archive',
 // 2. Export a signed .ipa for App Store distribution.
 const exportOptions = join(work, 'ExportOptions.plist');
 ...
-run('xcodebuild', [
+run([
+  'xcodebuild',
   '-exportArchive',
 // 3. Upload to TestFlight via altool (app-specific-password auth).
 const ipa = join(exportDir, 'PackRat-iOS.ipa');
-run('xcrun', [
+run([
+  'xcrun',
   'altool',
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/swift/scripts/upload-testflight.ts` around lines 52 - 55, Update run to
accept one tuple containing the command and arguments, then adjust all three
call sites to pass that tuple as a single array. Preserve command execution
while masking the Apple app-specific password in the logged command output,
ensuring the credential never appears in plain text.

Source: Pipeline failures

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/swift/scripts/upload-testflight.ts`:
- Line 29: Update the SWIFT_DIR definition to use Bun’s import.meta.dir instead
of constructing a URL pathname, ensuring paths containing spaces remain
correctly decoded for downstream xcodebuild operations.

---

Duplicate comments:
In `@apps/swift/scripts/upload-testflight.ts`:
- Around line 52-55: Update run to accept one tuple containing the command and
arguments, then adjust all three call sites to pass that tuple as a single
array. Preserve command execution while masking the Apple app-specific password
in the logged command output, ensuring the credential never appears in plain
text.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9f751f44-4960-47ae-a0a0-a1f468d7a34d

📥 Commits

Reviewing files that changed from the base of the PR and between d657ca1 and e9096bb.

📒 Files selected for processing (6)
  • .gitignore
  • apps/swift/Resources/Info-iOS.plist
  • apps/swift/Resources/Info-watchOS.plist
  • apps/swift/Sources/PackRat/PackRatApp.swift
  • apps/swift/project.yml
  • apps/swift/scripts/upload-testflight.ts

import { tmpdir } from 'node:os';
import { join } from 'node:path';

const SWIFT_DIR = new URL('..', import.meta.url).pathname;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use import.meta.dir to prevent path resolution failures.

new URL(...).pathname returns a URL-encoded string. If the repository's path contains spaces, .pathname will contain %20 instead of literal spaces, causing downstream xcodebuild steps to fail because the .xcodeproj file cannot be found. Since this is a Bun script, you can use the built-in import.meta.dir.

🛠 Proposed fix
-const SWIFT_DIR = new URL('..', import.meta.url).pathname;
+const SWIFT_DIR = join(import.meta.dir, '..');
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const SWIFT_DIR = new URL('..', import.meta.url).pathname;
const SWIFT_DIR = join(import.meta.dir, '..');
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/swift/scripts/upload-testflight.ts` at line 29, Update the SWIFT_DIR
definition to use Bun’s import.meta.dir instead of constructing a URL pathname,
ensuring paths containing spaces remain correctly decoded for downstream
xcodebuild operations.

@mikib0
mikib0 merged commit 55796b2 into development Jul 17, 2026
20 of 22 checks passed
@mikib0
mikib0 deleted the feat/swift-testflight-upload branch July 17, 2026 10:10
mikib0 added a commit that referenced this pull request Jul 20, 2026
…rules

The CI Checks job lints the PR merge tree (branch + development). PR
#2629 added apps/swift/scripts/upload-testflight.ts to development
without the allowlist entries the custom rules require, so every open
PR's lint:custom fails on it (not our code):
- no-owned-max-params: run(cmd, args) mirrors execFileSync(file, args)
- no-raw-process-env: reads Apple creds / BUILD_NUMBER from CI env

Matches the existing swift-script exclusions in both rules.
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.

2 participants