fix(ci): gate MLX tests correctly — unbreak SPM + Metal jobs#55
Merged
Conversation
Two CI jobs went red when the DeepSeek port + embeddings landed: SPM Build & Test (process abort, exit 1): - testSanitizeRoundTrip claimed to be Metal-free, but instantiating DeepseekV32Model (and the arr() helper) creates real MLXArrays — first stream init fatally aborts without default.metallib. Now gated with requireMLXRuntimeOrSkip. - factoryInstantiatesDeepseekV32FromConfig (swift-testing) has the same instantiation; gated with .enabled(if: mlxMetallibIsAvailable). The two registry-only tests stay ungated. Metal Tests (numeric divergence): - GitHub macos-26 runners expose paravirtualized Metal; strict 1e-4 parity vs Python fixtures diverges there (attention prefill/sparse, decoder layer, full model) while passing on real Apple Silicon. New requireTrustworthyMetalOrSkip() + TEST_RUNNER_MACMLX_UNTRUSTED_METAL=1 in the CI job skips the six strict-parity suites on the VM; parity stays enforced locally and on any future self-hosted runner. Behavioral MLX tests (LoRA, cache, sanitize, indexer top-k, speed sampler) still run in the Metal job. Also hoists metallibIsAvailable out of EmbeddingPoolingTests into the shared MLXTestSupport (mlxMetallibIsAvailable). Verified locally under all three CI-equivalent conditions: bare swift test (0 MLX errors, 76 XCTest/19 skips + 203 swift-testing passed), TEST_RUNNER_MACMLX_UNTRUSTED_METAL=1 xcodebuild (SUCCEEDED, parity skipped, behavioral tests ran), plain xcodebuild (SUCCEEDED, all 11 parity tests executed and passed).
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
This was referenced Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Main's CI went red after PRs #52/#53 (my miss: merged without watching checks). Root causes + fixes:
SPM Build & Test — process abort (exit 1)
testSanitizeRoundTrip's doc claimed Metal-free, butDeepseekV32Model(config)+ thearr()helper create realMLXArrays → first stream init fatally aborts withoutdefault.metallib(bareswift test). → gated withrequireMLXRuntimeOrSkip, comment corrected.factoryInstantiatesDeepseekV32FromConfig(swift-testing) instantiates the model the same way →.enabled(if: mlxMetallibIsAvailable). The two registry-only tests stay ungated.Metal Tests — strict parity diverges on paravirtualized Metal
GitHub
macos-26runners run VMs whose Metal accumulates differently from real Apple Silicon: attention prefill/sparse, decoder-layer, and full-model 1e-4 parity fail there while passing on real hardware. NewrequireTrustworthyMetalOrSkip()+TEST_RUNNER_MACMLX_UNTRUSTED_METAL=1on the CI step skips the six strict-parity suites on the VM only — parity remains enforced on developer machines and any future self-hosted Apple Silicon runner. Behavioral MLX tests (LoRA converter, prompt cache, sanitize, indexer top-k, speed sampler) still execute in the Metal job, so it keeps its value.Also hoists the metallib probe into shared
MLXTestSupport.Verification (local, all three CI-equivalent conditions)
swift test(= SPM job)TEST_RUNNER_MACMLX_UNTRUSTED_METAL=1xcodebuild (= Metal job)** TEST SUCCEEDED **; strict parity skipped; behavioral MLX tests ran** TEST SUCCEEDED **; all 11 parity tests executed + passed