Skip to content

CI: fix mac_build_and_test for mlx-swift >= 0.31.5 (skip package plugin validation) + swift-format 603 conformance - #404

Merged
davidkoski merged 2 commits into
ml-explore:mainfrom
GoodOlClint:pr/ci-plugin-validation
Jul 9, 2026
Merged

davidkoski merged 2 commits into
ml-explore:mainfrom
GoodOlClint:pr/ci-plugin-validation

Conversation

@GoodOlClint

Copy link
Copy Markdown
Contributor

Proposed changes

CI has been red for every PR since 2026-06-30. This PR fixes both causes; no library code is changed.

1. mac_build_and_test: package plugin validation failure

Every run now fails during Prepare packages, before any project code compiles:

Validate plug-in "CudaBuild" in package "mlx-swift"
** TEST BUILD FAILED **

Diagnosis. mlx-swift 0.31.5 (via ml-explore/mlx-swift#413) attached the new CudaBuild build-tool plugin to the Cmlx target. Xcode treats SwiftPM build-tool plugins as arbitrary build-time code and requires a one-time interactive trust approval per plugin ("Trust & Enable" in the GUI). Non-interactive xcodebuild cannot grant it, so validation fails. Because this repo pins .upToNextMinor(from: "0.31.4") with no committed Package.resolved, CI resolves the newest 0.31.x fresh each run — 0.31.5 flowed in with no commit here to blame. The timeline is airtight: the last green run (28461282349) resolved mlx-swift @ 0.31.4 and finished at 17:08 UTC on 6/30; 0.31.5 was published at 17:33 UTC, 25 minutes later. Every subsequent run fails identically.

Fix. Add -skipPackagePluginValidation to the xcodebuild build-for-testing invocation — per xcodebuild -help, "Skip validation of package plugins"; it is the standard way to build a plugin-bearing SwiftPM graph on CI (see Swift Forums on programmatic plugin trust for CI).

Why this is safe here:

  • The flag only suppresses the first-run trust prompt for this invocation. Dependency resolution, package signature validation, code signing, and test behavior are untouched.
  • The CudaBuild plugin is a no-op on macOS: its isCudaEnabled() is #if os(Linux)-gated, so on the Mac runner it returns zero build commands. SwiftPM plugins also run sandboxed (write access only to their work directory).
  • The job already checks out, builds, and runs test code from PR branches, and the plugin ships in ml-explore/mlx-swift itself — a first-party dependency — so the prompt adds no protection in this context.
  • Alternative rejected: pre-approving the fingerprint (or defaults write com.apple.dt.Xcode IDESkipPackagePluginFingerprintValidation) on the runner works but is unversioned, invisible to contributors, and silently re-breaks on a runner rebuild. The workflow flag is auditable in the repo.

2. lint: swift-format 603.0.0 import ordering

The lint job builds the latest swift-format release on each run. 603.0.0 (current) orders attributed imports (@_spi(Testing) @testable import …) after plain imports, so Tests/MLXLMTests/MTPSpeculativeTokenIteratorTests.swift — clean under the previous release — now fails pre-commit run --all on every PR's merge ref, which gates mac_build_and_test behind a failure unrelated to any PR. The second commit applies exactly the diff swift-format 603.0.0 emits (verified locally with swift-format 603.0.0 over the whole tree; this is the only file affected). A longer-term option is pinning the swift-format version in the workflow instead of always building the latest release — happy to do that here or in a follow-up if preferred.

Since pull_request workflows run from the PR merge ref, this PR's own CI run demonstrates both fixes.

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • I have added tests that prove my fix is effective or that my feature works (CI-only change — this PR's own green run is the test)
  • I have updated the necessary documentation (if needed)

🤖 Generated with Claude Code

GoodOlClint and others added 2 commits July 6, 2026 21:56
mlx-swift 0.31.5 attached the CudaBuild build-tool plugin to the Cmlx
target. Xcode requires a one-time interactive trust approval per package
plugin; non-interactive xcodebuild has no way to grant it, so every
mac_build_and_test run since 0.31.5 was published fails during package
preparation with:

    Validate plug-in "CudaBuild" in package "mlx-swift"
    ** TEST BUILD FAILED **

-skipPackagePluginValidation is the standard flag for building a
plugin-bearing SwiftPM graph on CI.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…orTests

The lint job builds the latest swift-format release; 603.0.0 orders
attributed imports after plain imports, so this file (formatted clean
under the previous release) now fails pre-commit on every PR merge ref.
This is the exact diff swift-format emits.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@davidkoski davidkoski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you! Just waiting on CI.

@davidkoski
davidkoski merged commit b4fb830 into ml-explore:main Jul 9, 2026
2 checks passed
davidkoski pushed a commit that referenced this pull request Jul 15, 2026
* Document -skipPackagePluginValidation for local test runs

mlx-swift 0.31.5 added the CudaBuild build-tool plugin, which
xcodebuild refuses to run non-interactively without this flag; PR #404
added it to CI. CONTRIBUTING.md's documented test commands weren't
updated, so contributors following them locally still hit the plugin
trust error.

Also add the docs-check CI step (scripts/verify-docs.sh), which builds DocC
documentation for every library target with warnings-as-errors.
dkgv pushed a commit to dkgv/mlx-swift-lm that referenced this pull request Jul 30, 2026
…in validation) + swift-format 603 conformance (ml-explore#404)

* CI: pass -skipPackagePluginValidation to xcodebuild

mlx-swift 0.31.5 attached the CudaBuild build-tool plugin to the Cmlx
target. Xcode requires a one-time interactive trust approval per package
plugin; non-interactive xcodebuild has no way to grant it, so every
mac_build_and_test run since 0.31.5 was published fails during package
preparation with:

    Validate plug-in "CudaBuild" in package "mlx-swift"
    ** TEST BUILD FAILED **

-skipPackagePluginValidation is the standard flag for building a
plugin-bearing SwiftPM graph on CI.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Fix swift-format 603.0.0 import ordering in MTPSpeculativeTokenIteratorTests

The lint job builds the latest swift-format release; 603.0.0 orders
attributed imports after plain imports, so this file (formatted clean
under the previous release) now fails pre-commit on every PR merge ref.
This is the exact diff swift-format emits.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
dkgv pushed a commit to dkgv/mlx-swift-lm that referenced this pull request Jul 30, 2026
…#430)

* Document -skipPackagePluginValidation for local test runs

mlx-swift 0.31.5 added the CudaBuild build-tool plugin, which
xcodebuild refuses to run non-interactively without this flag; PR ml-explore#404
added it to CI. CONTRIBUTING.md's documented test commands weren't
updated, so contributors following them locally still hit the plugin
trust error.

Also add the docs-check CI step (scripts/verify-docs.sh), which builds DocC
documentation for every library target with warnings-as-errors.
@GoodOlClint
GoodOlClint deleted the pr/ci-plugin-validation branch August 1, 2026 16:44
div0-space pushed a commit to LibraxisAI/mlx-swift-lm that referenced this pull request Nov 29, 2026
…l-events

CBv2 MTP: drop a finished step's Metal event from the arrays assistant history views (provider 0.10.13)
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