Skip to content

fix(ci): gate MLX tests correctly — unbreak SPM + Metal jobs#55

Merged
magicnight merged 1 commit into
mainfrom
fix/ci-mlx-gating
Jul 8, 2026
Merged

fix(ci): gate MLX tests correctly — unbreak SPM + Metal jobs#55
magicnight merged 1 commit into
mainfrom
fix/ci-mlx-gating

Conversation

@magicnight

Copy link
Copy Markdown
Owner

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, but DeepseekV32Model(config) + the arr() helper create real MLXArrays → first stream init fatally aborts without default.metallib (bare swift test). → gated with requireMLXRuntimeOrSkip, 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-26 runners 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. New requireTrustworthyMetalOrSkip() + TEST_RUNNER_MACMLX_UNTRUSTED_METAL=1 on 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)

Condition Result
bare swift test (= SPM job) 0 MLX errors; 76 XCTest (19 skips) + 203 swift-testing passed (previously: fatal abort)
TEST_RUNNER_MACMLX_UNTRUSTED_METAL=1 xcodebuild (= Metal job) ** TEST SUCCEEDED **; strict parity skipped; behavioral MLX tests ran
plain xcodebuild (local dev) ** TEST SUCCEEDED **; all 11 parity tests executed + passed

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).
@cursor

cursor Bot commented Jul 8, 2026

Copy link
Copy Markdown

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.

@magicnight magicnight merged commit 63893a4 into main Jul 8, 2026
3 checks passed
magicnight added a commit that referenced this pull request Jul 8, 2026
docs: CHANGELOG for PRs #55-#57 + roadmap refresh
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