Skip to content

Lower swift-tools-version to 6.2 for BCR compatibility#292

Merged
dfed merged 12 commits intomainfrom
dfed--lower-swift-tools-version-6.2
May 4, 2026
Merged

Lower swift-tools-version to 6.2 for BCR compatibility#292
dfed merged 12 commits intomainfrom
dfed--lower-swift-tools-version-6.2

Conversation

@dfed
Copy link
Copy Markdown
Owner

@dfed dfed commented May 4, 2026

Why

BCR PR #8683 failed because BCR's macos_arm64 runners ship Xcode 26.0 (Swift 6.2), but our Package.swift declared swift-tools-version: 6.3. SwiftPM rejects the manifest before rules_swift_package_manager can translate it. We don't use any 6.3-only features (the traits: field is 6.1+), so the floor can drop with no functional change.

What's in it

Source

  • Package.swiftswift-tools-version: 6.36.2; swift-syntax range widened from "603.0.0"..<"605.0.0" to "602.0.0"..<"605.0.0" so SPM can resolve a 6.2-compatible swift-syntax on the older toolchain.
  • MigrateSafeDIFromVersionOne plugin — version-floor check + error message → 6.2.
  • Documentation/Manual.md — three "requires Swift 6.3" mentions in the migration guide → 6.2.
  • Examples/Example Package Integration/Package.swiftswift-tools-version: 6.36.2.
  • Examples/ExampleTuistIntegration/Tuist/Package.swiftswift-tools-version: 6.36.2; SafeDI dep bumped from from: "2.0.0-beta-6"from: "2.0.0-rc-1". README + Package.resolved updated to match.

CI

  • All Swift-compile jobs that build SafeDI itselfxcodebuild matrix, docc, spm, bazel — pinned to Xcode 26.0 (Swift 6.2). Validates the new floor against the actual BCR-relevant toolchain.
  • spm-package-integration — Xcode 26.0. Switched the xcodebuild build's destination from generic/platform=iOS to platform=macOS to avoid needing the iOS SDK download on Xcode 26.0; the test still exercises the same plugin scanner code path.
  • spm-tuist-integration — stays on Xcode 26.4 because the Tuist example's Tuist/Package.swift pulls in the released SafeDI (from: "2.0.0-rc-1"), which still declares swift-tools-version: 6.3. After this PR ships in 2.0.0-rc-2, that pin (and this CI job) can move to 26.0.
  • spm-project-integration / spm-multi-project-integration — stay on Xcode 26.4 because their .xcodeproj files declare traits = (…), and Xcode 26.4 was the first Xcode to surface package traits in project files.
  • linux — Docker container swift:6.3swift:6.2. Default tag tracks the latest base.
  • publish.yml stays on the latest Xcode (26.4 / Swift 6.3), with a comment explaining why: the prebuilt SafeDITool's bundled swift-syntax has to handle source written for any Swift version downstream consumers are on. Built-against-latest keeps the prebuilt tolerant of newer constructs; an older build would parse-fail on newer consumer code.

Documentation

  • Examples/ExampleBazelIntegration/README.md — no changes (the Bazel example doesn't pin a SafeDI version, so toolchain is whatever the consumer brings).
  • Examples/ExampleTuistIntegration/README.md — SafeDI pin bumped to 2.0.0-rc-1 in the copy-paste snippet.
  • Documentation/Manual.md — minimum-Swift mentions updated to 6.2 (in the migration guide).

Test plan

  • swift build --traits sourceBuild — green locally.
  • ./CLI/lint.sh — clean.
  • CI green on Xcode 26.0 (xcodebuild matrix + docc + spm test + bazel build + Package Integration).
  • CI green on Xcode 26.4 (Project Integration + Multi Project Integration + Tuist Integration + DocC).
  • CI green on swift:6.2 Linux container.

Follow-up after merge

  1. Cut 2.0.0-rc-2 via the Publish workflow → fires fresh BCR PR with both macos_arm64 and swift-tools-version: 6.2 baked in (replaces BCR #8683).
  2. Bump Examples/ExampleTuistIntegration/Tuist/Package.swift to from: "2.0.0-rc-2" and move spm-tuist-integration to Xcode 26.0 — completes the matrix.
  3. Close BCR PR #8683 once rc-2's submission is in flight.

🤖 Generated with Claude Code

@dfed
Copy link
Copy Markdown
Owner Author

dfed commented May 4, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dfed
Copy link
Copy Markdown
Owner Author

dfed commented May 4, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (346f5f9) to head (566fb7d).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #292   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           41        41           
  Lines         7042      7043    +1     
=========================================
+ Hits          7042      7043    +1     

see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dfed dfed changed the title DRAFT: Lower swift-tools-version to 6.2 for BCR compatibility Lower swift-tools-version to 6.2 for BCR compatibility May 4, 2026
@dfed
Copy link
Copy Markdown
Owner Author

dfed commented May 4, 2026

@codex review

2 similar comments
@dfed
Copy link
Copy Markdown
Owner Author

dfed commented May 4, 2026

@codex review

@dfed
Copy link
Copy Markdown
Owner Author

dfed commented May 4, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dfed
Copy link
Copy Markdown
Owner Author

dfed commented May 4, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f5173f028d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/ci.yml Outdated
dfed and others added 7 commits May 4, 2026 08:45
BCR's macos_arm64 runners ship with Xcode 26.0 (Swift 6.2). Our
Package.swift previously declared `swift-tools-version: 6.3`, which
the older Swift PM rejects with "package 'module_src' is using Swift
tools version 6.3.0 but the installed version is X.Y.Z" before
rules_swift_package_manager can translate it into Bazel targets.

This is the experimental "see if it just works" path: lower the
floor to 6.2, broaden the swift-syntax range so SPM can pick a
6.2-compatible swift-syntax version, and switch the SafeDI-core CI
jobs to Xcode 26.0 to validate the baseline. If CI is green, we
have a clear shot at BCR; if not, we fall back to dropping
rules_swift_package_manager in favor of native bazel_deps.

## Changes

- `Package.swift` — `swift-tools-version: 6.3` → `6.2`. We don't
  use any 6.3-only features (the `traits:` field is 6.1+).
- `Package.swift` — `swift-syntax` range widened from
  `"603.0.0"..<"605.0.0"` to `"602.0.0"..<"605.0.0"`.
- `Plugins/MigrateSafeDIFromVersionOne/MigrateSafeDIFromVersionOne.swift`
  — version-floor check + error message updated to say 6.2.
- `Documentation/Manual.md` — three "requires Swift 6.3" mentions
  in the migration guide → "6.2".
- `Examples/ExampleBazelIntegration/README.md` — adds a
  "Toolchain: Swift 6.2 or later" prerequisite.
- `Examples/ExampleTuistIntegration/README.md` — clarifies that
  the example tracks Swift 6.3 / Xcode 26.4 but SafeDI itself
  supports 6.2+.

## CI changes (existing jobs only)

- `xcodebuild` matrix → Xcode 26.0 (was 26.4).
- `spm` Build and Test → Xcode 26.0 (was 26.4).

The example builds + DocC + publish workflow stay on Xcode 26.4
(Swift 6.3) so we still validate consumer-side behavior on the
latest. Linux CI continues to use the `swift:6.3` Docker image, so
the test suite still gets Swift 6.3 coverage there.

## Verified locally

- `swift build --traits sourceBuild` — green.
- `./CLI/lint.sh` — clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Forgotten in the previous commit. The bazel job builds SafeDI's
Bazel targets and the example downstream consumer; if our goal is
to mirror BCR's macos_arm64 environment locally, that job needs to
use Xcode 26.0 (Swift 6.2) — same as the `xcodebuild` matrix and
the `spm` test job.
- Trim the BCR-rationale comments on `xcodebuild` / `spm` / `bazel`
  jobs to a single-line "matches BCR's macos_arm64 runners". The
  longer prose was throat-clearing.
- Add a single comment block above the example CI section
  explaining the 26.4-vs-26.0 split: Xcode 26.4 was the first
  Xcode to support package traits, so examples that declare them
  need 26.4; the rest run on 26.0 (the SafeDI-core baseline).
- Switch `spm-tuist-integration` to Xcode 26.0 — Tuist example
  doesn't declare package traits.
- Lower `Examples/ExampleTuistIntegration/Tuist/Package.swift`
  swift-tools-version 6.3 → 6.2 to match.
- Trim the Tuist README prerequisites table — drop the "but SafeDI
  itself supports Swift 6.2+; this example tracks the latest"
  caveats that contradict the new 6.2 floor.
- Linux job: switch from `swift:6.3` Docker → `swift:6.2`. Linux
  no longer needs to be the "test on the latest" job since the
  whole build matrix runs Swift 6.2 now.
Last Swift-compile job that wasn't on the 26.0 baseline. SafeDI's
own DocC build doesn't depend on package traits — moving it down
keeps the CI matrix internally consistent: every job that compiles
SafeDI itself runs on Xcode 26.0; only example jobs that declare
package traits stay on 26.4.
- Move `spm-package-integration` to Xcode 26.0. The example
  declares traits via `.package(traits: ["sourceBuild"])` in
  Package.swift, which has been supported since SE-0450 (Swift
  6.1+). Only `.xcodeproj`-level traits (`traits = (…)` in the
  project file) need Xcode 26.4. `Example Project Integration` and
  `Example Multi Project Integration` declare traits in their
  pbxproj, so they stay on 26.4.
- Lower `Examples/Example Package Integration/Package.swift`
  swift-tools-version 6.3 → 6.2 to match the moved CI target.
- Update the example-CI block comment to reflect the precise
  distinction (Xcode-project traits vs Package.swift traits).
- Add a comment block to publish.yml explaining why publish runs
  on the latest Xcode (so the prebuilt SafeDITool stays tolerant
  of newer swift-syntax constructs in consumer code).
- spm-package-integration: add iOS-platform download step. macos-26
  runners only ship the iOS SDK pinned to the default Xcode (26.4);
  switching to Xcode 26.0 means we need `xcodebuild -downloadPlatform
  iOS` before targeting `generic/platform=iOS`. The xcodebuild
  matrix job already has this pattern.
- linux: switch Docker image from `swift:6.2` (noble / Ubuntu 24.04)
  to `swift:6.2-jammy` (Ubuntu 22.04). Noble's apt mirrors timed out
  during the curl install for the codecov uploader; jammy's apt
  repos are more stable.
Last attempt failed during `xcodebuild -downloadPlatform iOS` itself
with "Unable to connect to simulator" — the simulator service hadn't
been warmed up. The xcodebuild matrix that already runs on Xcode
26.0 calls `xcrun simctl list` before `-downloadPlatform`, which
seems to nudge the service. Mirror that here.
@dfed dfed force-pushed the dfed--lower-swift-tools-version-6.2 branch from f5173f0 to 3c7bcef Compare May 4, 2026 15:45
@dfed
Copy link
Copy Markdown
Owner Author

dfed commented May 4, 2026

@codex review

Per @chatgpt-codex-connector's P1 catch on PR #292: the Tuist
example's `Tuist/Package.swift` pins SafeDI `from: "2.0.0-beta-6"`,
and that released tag still declares `swift-tools-version: 6.3`.
Xcode 26.0 (Swift 6.2) rejects that manifest at resolve time before
build can proceed.

The 6.2 floor only ships in the *next* SafeDI release. Once we cut
2.0.0-rc-2 (or whatever the post-merge version is) we'll bump the
Tuist example's pin and move this job to 26.0 to match the rest.
For now: stay on 26.4 and call out the dependency in a job-level
comment.

The Tuist `Tuist/Package.swift` itself stays at
`swift-tools-version: 6.2` — that's accurate to the manifest's own
features (none are 6.3-only) and forward-compatible with whichever
Xcode resolves it.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

PLATFORM=$(echo "${{ matrix.platforms }}" | sed 's|generic/platform=||')
sudo xcodebuild -downloadPlatform "$PLATFORM"

P1 Badge Map -downloadPlatform values to canonical platform names

The new matrix-driven download step passes values like ios, tvos, and watchos into xcodebuild -downloadPlatform, but Apple documents this flag as accepting iOS|watchOS|tvOS|visionOS. Because these names are now generated from lowercase destination strings, non-macOS legs can fail in the platform-download step before the actual build starts; normalize these values to the documented spellings before invoking xcodebuild.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dfed
Copy link
Copy Markdown
Owner Author

dfed commented May 4, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
Comment thread Examples/ExampleBazelIntegration/README.md Outdated
- Revert all job name suffixes ("on Xcode 26.0" / "on Xcode 26.4")
  back to the original "on Xcode 26" — names were fine as-is.
- Drop the "Pinned to Xcode 26.0 — matches BCR's macos_arm64 runners"
  one-liners on `xcodebuild`, `docc`, `spm`, `bazel` jobs. Running
  on the lowest supported Xcode is the convention; doesn't need
  per-job documentation.
- Trim the long example-CI block comment down to one paragraph
  about the .xcodeproj-traits → 26.4 split. Drop the per-job
  "Project file declares package traits" comments (now redundant).
- spm-package-integration: switch xcodebuild destination from
  `generic/platform=iOS` to `platform=macOS`; drop the iOS platform
  download step we just added. macOS exercises the same plugin
  scanner code path without needing to download an SDK.
- spm-tuist-integration comment: "dep" → "dependency"; tighten.
- Bump Tuist example's SafeDI dep from `from: "2.0.0-beta-6"` to
  `from: "2.0.0-rc-1"` (in `Tuist/Package.swift`, `Package.resolved`,
  and the README's copy-paste snippet).
- Linux: revert `swift:6.2-jammy` → `swift:6.2`. The default `:6.2`
  tag tracks the latest base and won't drift to a specific Ubuntu.
  Earlier noble-mirror apt timeout was almost certainly transient.
- publish.yml comment: add a link to where the project's minimum
  is defined (Package.swift's `swift-tools-version`).
- Bazel example README: drop the added "Toolchain: Swift 6.2 or
  later" prerequisite — wasn't needed.
@dfed
Copy link
Copy Markdown
Owner Author

dfed commented May 4, 2026

@codex review

`spm` and `bazel` jobs slipped through the previous revert pass —
both still had "on Xcode 26.0" / "on Xcode 26.0" suffixes after the
larger renames. Restore originals.
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dfed dfed self-assigned this May 4, 2026
I resolved both threads earlier without addressing them — apologies.

- spm: drop the now-redundant "Pinned to Xcode 26.0 — matches BCR's
  macos_arm64 runners" one-liner. The bazel job below covers the
  rationale; spm's pin is just convention.
- bazel: keep the rationale comment but link to BCR's
  continuous-integration repo where the `macos_arm64` runner
  platform is actually defined.
@dfed
Copy link
Copy Markdown
Owner Author

dfed commented May 4, 2026

@codex review

Comment thread .github/workflows/ci.yml Outdated
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dfed dfed marked this pull request as ready for review May 4, 2026 18:07
@dfed dfed merged commit c92cbb1 into main May 4, 2026
20 checks passed
@dfed dfed deleted the dfed--lower-swift-tools-version-6.2 branch May 4, 2026 18:07
dfed added a commit that referenced this pull request May 4, 2026
Now that
[`2.0.0-rc-2`](https://github.com/dfed/SafeDI/releases/tag/2.0.0-rc-2)
is out with `swift-tools-version: 6.2`, the Tuist example's
`Tuist/Package.swift` can resolve on Xcode 26.0 (Swift 6.2). Completes
the matrix consolidation [#292](#292)
deferred.

## Changes

- `Examples/ExampleTuistIntegration/Tuist/Package.swift` — SafeDI pin
`from: "2.0.0-rc-1"` → `from: "2.0.0-rc-2"`.
- `Examples/ExampleTuistIntegration/Tuist/Package.resolved` —
re-resolved against rc-2.
- `Examples/ExampleTuistIntegration/README.md` — copy-paste snippet +
`>= rc-1` mention bumped to rc-2.
- `.github/workflows/ci.yml`:`spm-tuist-integration` switches to Xcode
26.0 and drops the comment explaining the 26.4 carve-out.

## Test plan

- [x] `swift package resolve` against the new pin — pulls rc-2 + the
corresponding `SafeDITool.artifactbundle.zip`.
- [x] `./CLI/lint.sh` clean.
- [x] CI green on Xcode 26.0 (now including `spm-tuist-integration`).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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