From c5cacd9923deffb5b61ce1ad66defb125eacbdf6 Mon Sep 17 00:00:00 2001 From: Simba Zhang Date: Mon, 5 Oct 2026 08:16:38 -0700 Subject: [PATCH] chore: bump mlx-swift-lm and mlx-swift; match UserInput.Image.source in tests Upstream ml-explore/mlx-swift-lm (merged into SharpAI/mlx-swift-lm in 5152526, upstream 5e46681) turned UserInput.Image / Audio / Video from enums into structs that wrap a `Source` enum, and replaced the enum cases with static factory functions (`.ciImage(_:)`, `.url(_:)`, ...). A static func cannot be used as a pattern, so if case let .ciImage(image) = images.first no longer compiles ("pattern variable binding cannot appear in an expression") and the whole SwiftBuddyTests target fails to build, which takes `swift build --build-tests` (and the mlx-swift-lm "Test with SwiftLM (Umbrella Repo)" check) down with it. Match on `images.first?.source` instead. The assertions are unchanged. Production code needs no change: `return .ciImage(x)` / `.url(x)` / `.data(_, format:)` in OpenAIPayloads.swift, Server.swift and SwiftLMTestSTFT/main.swift resolve to the new static factories. Also bump the submodules the fix depends on (against the old pinned lm 8055044 the `.source` member does not exist, so they must land together): - mlx-swift-lm 8055044 -> 4e6e521 (SharpAI/mlx-swift-lm#74: real merge of upstream 5e46681 plus a KVarN decode-smoke warm-up and the umbrella workflow ref fix) - mlx-swift 1a2b3af -> 34bc52f (SharpAI/mlx-swift#20: mlx v0.32.2 / mlx-c ebc88f1 sync) Co-Authored-By: Claude Sonnet 5.5 --- mlx-swift | 2 +- mlx-swift-lm | 2 +- tests/SwiftBuddyTests/VLMExtractionTests.swift | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mlx-swift b/mlx-swift index 1a2b3af5..34bc52fa 160000 --- a/mlx-swift +++ b/mlx-swift @@ -1 +1 @@ -Subproject commit 1a2b3af5f6c9b96147f6eaf8e75c7d24cfa2f377 +Subproject commit 34bc52fa1efd5a3bb6cf07b5de803f0cf7cdd3ab diff --git a/mlx-swift-lm b/mlx-swift-lm index 8055044c..4e6e5216 160000 --- a/mlx-swift-lm +++ b/mlx-swift-lm @@ -1 +1 @@ -Subproject commit 8055044c045aa879b5c420e7371d0896df92534b +Subproject commit 4e6e5216852bfa9db031ab7c59cef801b6baa356 diff --git a/tests/SwiftBuddyTests/VLMExtractionTests.swift b/tests/SwiftBuddyTests/VLMExtractionTests.swift index d89246aa..e4b2a729 100644 --- a/tests/SwiftBuddyTests/VLMExtractionTests.swift +++ b/tests/SwiftBuddyTests/VLMExtractionTests.swift @@ -21,7 +21,7 @@ final class VLMExtractionTests: XCTestCase { let images = message.extractImages() XCTAssertEqual(images.count, 1) - if case let .ciImage(image) = images.first { + if case .ciImage(let image)? = images.first?.source { XCTAssertNotNil(image) XCTAssertEqual(image.extent.width, 1) XCTAssertEqual(image.extent.height, 1) @@ -44,7 +44,7 @@ final class VLMExtractionTests: XCTestCase { let images = message.extractImages() XCTAssertEqual(images.count, 1) - if case let .url(url) = images.first { + if case .url(let url)? = images.first?.source { XCTAssertEqual(url.absoluteString, "https://example.com/test.jpg") } else { XCTFail("Expected .url, got \(String(describing: images.first))")