Skip to content

chore(ios): clear swift-format debt blocking iOS CI#7

Merged
lchogan merged 1 commit into
mainfrom
chore/swift-format-cleanup
Apr 22, 2026
Merged

chore(ios): clear swift-format debt blocking iOS CI#7
lchogan merged 1 commit into
mainfrom
chore/swift-format-cleanup

Conversation

@lchogan

@lchogan lchogan commented Apr 22, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes the iOS CI failure surfaced on PR #2 (Dependabot's actions/checkout bump) by clearing ~25 swift-format errors that have been accumulating on main since Phase 0.

Root cause: PR #1 merged via auto-merge without branch protection, so a failing iOS ${\color{red}build-test}$ check didn't block it. Every Phase 0 code review flagged "pre-existing swift-format issues" and deferred. Now any PR that touches `ios/**` or the iOS workflow fails CI.

Effect: iOS CI on main will go green after this merges, unblocking PR #2 and all future iOS PRs.

Changes

1. Auto-formatted (swift-format --in-place)

Swept 17 whitespace / indentation / AddLines errors:

  • `RootView.swift` — 12 indentation fixes in the nested switch
  • `AppleSignInService.swift` — 1 line break before the dangling-brace class declaration
  • `SignUpWallView.swift` — 3 long-line wraps

2. Hand-added 4 docblocks

swift-format's `ValidateDocumentationComments` and `AllPublicDeclarationsHaveDocumentation` rules required:

3. String-literal rewrite (no disable pragma)

The 164-char email explanation in SignUpWallView.swift previously used `// swiftlint:disable:next line_length`. Rewrote as a 3-part string concatenation — Swift compiler folds literal concatenations at compile time, so zero runtime cost, and no pragma dance when swift-format re-flows the file.

4. New `.swiftlint.yml` disabled_rule: `opening_brace`

swift-format wraps long protocol conformance lists onto multiple lines with the opening brace on its own line (see AppleSignInService:81-86 — NSObject + ObservableObject + ASAuthorizationControllerDelegate + ASAuthorizationControllerPresentationContextProviding is too long for one line). SwiftLint's `opening_brace` rule insists the brace stay on the declaration line. The existing precedent in this file (commit `ed6d8eb`) is that swift-format is authoritative; same rationale applies here.

Test plan

  • `xcrun swift-format lint --strict Flashcards` → exit 0
  • `swiftlint --config .swiftlint.yml --strict Flashcards` → 0 violations, 38 files
  • `xcodebuild test` → TEST SUCCEEDED (19 FlashcardsTests + 1 UI test)
  • CI itself will confirm once this PR runs

After merge, PR #2 (actions/checkout bump) should re-run and go green.

🤖 Generated with Claude Code

main's iOS workflow has been failing swift-format --strict since PR #1
merged (auto-merge bypassed the check since no branch protection).
Every Phase 0 code review flagged "pre-existing swift-format issues
in unrelated files" and deferred. This clears the debt so CI goes
green for PR #2 and future iOS changes.

Changes:
- Ran `swift-format format --in-place` which auto-fixed 17 whitespace,
  indentation, and AddLines errors across RootView, AppleSignInService,
  and SignUpWallView.
- Hand-added 4 docblocks swift-format required:
  - MWButtonPress.body(content:) full param/return doc
  - MWScreen.body one-line ///
  - MWAccentKey.mwAccent(_:) — Returns: section
  - Borders.mwStroke(...) — Returns: section
- Rewrote the 164-char string in SignUpWallView as a 3-part
  concatenation so no disable pragma is needed. Compiler folds the
  concatenation at compile time.
- Added `opening_brace` to .swiftlint.yml's disabled_rules. swift-format
  wraps long protocol-conformance lists onto multiple lines with the
  opening brace on its own line (see AppleSignInService:81-86);
  SwiftLint's opening_brace rule fights that. Same precedent as the
  existing trailing_comma disable — swift-format is authoritative.

Verified:
- `swift-format lint --strict Flashcards` → exit 0
- `swiftlint --strict Flashcards` → 0 violations, 38 files
- `xcodebuild test` → TEST SUCCEEDED (19 FlashcardsTests + 1 UI test)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lchogan lchogan merged commit 681c82b into main Apr 22, 2026
1 check failed
lchogan pushed a commit that referenced this pull request Apr 22, 2026
The post-PR-#7 iOS run on main failed at the Coverage step — not tests.
Build succeeded, all 20 tests passed, but:

    $(find ~/Library/Developer/Xcode/DerivedData -name '*.xcresult' | head -1)

expanded to empty because xcodebuild wrote DerivedData somewhere the find
command didn't look (runners don't always honor the default ~/Library path).
xcrun xccov view got called with an empty arg and failed with "Must supply
a report or archive to view", which bubbled up as an overall CI failure.

Two changes:
1. Pin DerivedData to ios/build/DerivedData via -derivedDataPath, so the
   xcresult lives at a known, workspace-relative location.
2. Make the Coverage step tolerant of a missing xcresult — log + exit 0
   instead of crashing. Coverage reporting is informational; a missing
   report should never fail the pipeline.

Also added `set -o pipefail` to the Build & Test step so a future
xcodebuild failure isn't hidden by xcbeautify's exit code.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
lchogan pushed a commit that referenced this pull request Apr 22, 2026
The post-PR-#7 iOS run on main failed at the Coverage step — not tests.
Build succeeded, all 20 tests passed, but:

    $(find ~/Library/Developer/Xcode/DerivedData -name '*.xcresult' | head -1)

expanded to empty because xcodebuild wrote DerivedData somewhere the find
command didn't look (runners don't always honor the default ~/Library path).
xcrun xccov view got called with an empty arg and failed with "Must supply
a report or archive to view", which bubbled up as an overall CI failure.

Two changes:
1. Pin DerivedData to ios/build/DerivedData via -derivedDataPath, so the
   xcresult lives at a known, workspace-relative location.
2. Make the Coverage step tolerant of a missing xcresult — log + exit 0
   instead of crashing. Coverage reporting is informational; a missing
   report should never fail the pipeline.

Also added `set -o pipefail` to the Build & Test step so a future
xcodebuild failure isn't hidden by xcbeautify's exit code.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
lchogan pushed a commit that referenced this pull request Apr 22, 2026
The post-PR-#7 iOS run on main failed at the Coverage step — not tests.
Build succeeded, all 20 tests passed, but:

    $(find ~/Library/Developer/Xcode/DerivedData -name '*.xcresult' | head -1)

expanded to empty because xcodebuild wrote DerivedData somewhere the find
command didn't look (runners don't always honor the default ~/Library path).
xcrun xccov view got called with an empty arg and failed with "Must supply
a report or archive to view", which bubbled up as an overall CI failure.

Two changes:
1. Pin DerivedData to ios/build/DerivedData via -derivedDataPath, so the
   xcresult lives at a known, workspace-relative location.
2. Make the Coverage step tolerant of a missing xcresult — log + exit 0
   instead of crashing. Coverage reporting is informational; a missing
   report should never fail the pipeline.

Also added `set -o pipefail` to the Build & Test step so a future
xcodebuild failure isn't hidden by xcbeautify's exit code.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
lchogan pushed a commit that referenced this pull request Apr 22, 2026
The post-PR-#7 iOS run on main failed at the Coverage step — not tests.
Build succeeded, all 20 tests passed, but:

    $(find ~/Library/Developer/Xcode/DerivedData -name '*.xcresult' | head -1)

expanded to empty because xcodebuild wrote DerivedData somewhere the find
command didn't look (runners don't always honor the default ~/Library path).
xcrun xccov view got called with an empty arg and failed with "Must supply
a report or archive to view", which bubbled up as an overall CI failure.

Two changes:
1. Pin DerivedData to ios/build/DerivedData via -derivedDataPath, so the
   xcresult lives at a known, workspace-relative location.
2. Make the Coverage step tolerant of a missing xcresult — log + exit 0
   instead of crashing. Coverage reporting is informational; a missing
   report should never fail the pipeline.

Also added `set -o pipefail` to the Build & Test step so a future
xcodebuild failure isn't hidden by xcbeautify's exit code.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
lchogan pushed a commit that referenced this pull request Apr 22, 2026
The post-PR-#7 iOS run on main failed at the Coverage step — not tests.
Build succeeded, all 20 tests passed, but:

    $(find ~/Library/Developer/Xcode/DerivedData -name '*.xcresult' | head -1)

expanded to empty because xcodebuild wrote DerivedData somewhere the find
command didn't look (runners don't always honor the default ~/Library path).
xcrun xccov view got called with an empty arg and failed with "Must supply
a report or archive to view", which bubbled up as an overall CI failure.

Two changes:
1. Pin DerivedData to ios/build/DerivedData via -derivedDataPath, so the
   xcresult lives at a known, workspace-relative location.
2. Make the Coverage step tolerant of a missing xcresult — log + exit 0
   instead of crashing. Coverage reporting is informational; a missing
   report should never fail the pipeline.

Also added `set -o pipefail` to the Build & Test step so a future
xcodebuild failure isn't hidden by xcbeautify's exit code.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
lchogan added a commit that referenced this pull request Apr 22, 2026
The post-PR-#7 iOS run on main failed at the Coverage step — not tests.
Build succeeded, all 20 tests passed, but:

    $(find ~/Library/Developer/Xcode/DerivedData -name '*.xcresult' | head -1)

expanded to empty because xcodebuild wrote DerivedData somewhere the find
command didn't look (runners don't always honor the default ~/Library path).
xcrun xccov view got called with an empty arg and failed with "Must supply
a report or archive to view", which bubbled up as an overall CI failure.

Two changes:
1. Pin DerivedData to ios/build/DerivedData via -derivedDataPath, so the
   xcresult lives at a known, workspace-relative location.
2. Make the Coverage step tolerant of a missing xcresult — log + exit 0
   instead of crashing. Coverage reporting is informational; a missing
   report should never fail the pipeline.

Also added `set -o pipefail` to the Build & Test step so a future
xcodebuild failure isn't hidden by xcbeautify's exit code.

Co-authored-by: Luke Hogan <lukehogan@Mac.localdomain>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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