From e1120d016fedb9eec2da8c98b52d059972c9956d Mon Sep 17 00:00:00 2001 From: mattt Date: Fri, 20 Nov 2026 01:46:38 -0800 Subject: [PATCH 1/2] Allow extra native evaluations in a session test --- Package.resolved | 69 ++++++++++++++++++- .../NativeProfileHistoryTests.swift | 8 ++- 2 files changed, 72 insertions(+), 5 deletions(-) diff --git a/Package.resolved b/Package.resolved index c5552bd5..7c7e8320 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "89f5c2203e9317d9086cb5e90c733284ffe6bef2305e4935194614ee27bc82f8", + "originHash" : "d25fafa014562300fa3cb56cee498c25fe404b8db76f7d6f9f135310374eb2cc", "pins" : [ { "identity" : "async-http-client", @@ -28,6 +28,33 @@ "version" : "1.3.1" } }, + { + "identity" : "llama.swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/mattt/llama.swift", + "state" : { + "revision" : "dc5b8cb58bfe028f88ade84d1ad0c10842644fb4", + "version" : "3.0.0" + } + }, + { + "identity" : "mlx-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/ml-explore/mlx-swift", + "state" : { + "revision" : "19601207e9a0de51e03ee6ec0c3c5f3784275075", + "version" : "0.32.3" + } + }, + { + "identity" : "mlx-swift-lm", + "kind" : "remoteSourceControl", + "location" : "https://github.com/ml-explore/mlx-swift-lm", + "state" : { + "revision" : "3b339ad6e3b3f44c8121ecff5131c7fd55e075e6", + "version" : "3.32.3" + } + }, { "identity" : "swift-algorithms", "kind" : "remoteSourceControl", @@ -96,8 +123,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-crypto.git", "state" : { - "revision" : "6ff0a3b1471d22b4a9ce133218c42d8854f182d7", - "version" : "5.1.0" + "revision" : "da9d28d69ebe3894b18376c8f2395c2f37b8448f", + "version" : "4.5.2" } }, { @@ -127,6 +154,24 @@ "version" : "1.8.0" } }, + { + "identity" : "swift-huggingface", + "kind" : "remoteSourceControl", + "location" : "https://github.com/huggingface/swift-huggingface", + "state" : { + "revision" : "84ced3d4fa31b1bc8c74f420d346f690cb6b0f35", + "version" : "1.0.1" + } + }, + { + "identity" : "swift-jinja", + "kind" : "remoteSourceControl", + "location" : "https://github.com/huggingface/swift-jinja.git", + "state" : { + "revision" : "3104efda56131c37dda52e9142f02cc2425c02e6", + "version" : "3.2.1" + } + }, { "identity" : "swift-log", "kind" : "remoteSourceControl", @@ -225,6 +270,24 @@ "revision" : "7502b711c92a17741fa625d722b0ccbd595d8ed1", "version" : "1.7.2" } + }, + { + "identity" : "swift-transformers", + "kind" : "remoteSourceControl", + "location" : "https://github.com/huggingface/swift-transformers", + "state" : { + "revision" : "402a8a1105f52038b0949d9596981fc9e32bed17", + "version" : "1.4.0" + } + }, + { + "identity" : "yyjson", + "kind" : "remoteSourceControl", + "location" : "https://github.com/ibireme/yyjson.git", + "state" : { + "revision" : "6447536015f3d600f3d65323b10976103b337ca7", + "version" : "0.13.0" + } } ], "version" : 3 diff --git a/Tests/AnyLanguageModelTests/NativeProfileHistoryTests.swift b/Tests/AnyLanguageModelTests/NativeProfileHistoryTests.swift index 7c37812d..99abfd56 100644 --- a/Tests/AnyLanguageModelTests/NativeProfileHistoryTests.swift +++ b/Tests/AnyLanguageModelTests/NativeProfileHistoryTests.swift @@ -596,15 +596,19 @@ import Testing model: MockLanguageModel(), dynamicInstructions: CountingProjectionInstructions(evaluations: evaluations) ) + #expect(evaluations.withLock { $0 } == 0) _ = try makeFoundationModelsRequest( model: FoundationModels.SystemLanguageModel.default, session: session, prompt: AnyLanguageModel.Prompt("Current"), fmPrompt: FoundationModels.Prompt("Current") ) - #expect(evaluations.withLock { $0 } == 1) + // Foundation Models can evaluate the instructions more than once + // when it creates the native session; macOS 27.2 adds one evaluation. + let evaluationsAfterRequest = evaluations.withLock { $0 } + #expect(evaluationsAfterRequest >= 1) _ = FoundationModelsDynamicInstructionsAdapter(session: session).body - #expect(evaluations.withLock { $0 } == 2) + #expect(evaluations.withLock { $0 } == evaluationsAfterRequest + 1) } } From ae178270fae35d4a29a498d551fa96d669b91087 Mon Sep 17 00:00:00 2001 From: mattt Date: Fri, 20 Nov 2026 02:00:03 -0800 Subject: [PATCH 2/2] Restore Package.resolved from main --- Package.resolved | 69 +++--------------------------------------------- 1 file changed, 3 insertions(+), 66 deletions(-) diff --git a/Package.resolved b/Package.resolved index 7c7e8320..c5552bd5 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "d25fafa014562300fa3cb56cee498c25fe404b8db76f7d6f9f135310374eb2cc", + "originHash" : "89f5c2203e9317d9086cb5e90c733284ffe6bef2305e4935194614ee27bc82f8", "pins" : [ { "identity" : "async-http-client", @@ -28,33 +28,6 @@ "version" : "1.3.1" } }, - { - "identity" : "llama.swift", - "kind" : "remoteSourceControl", - "location" : "https://github.com/mattt/llama.swift", - "state" : { - "revision" : "dc5b8cb58bfe028f88ade84d1ad0c10842644fb4", - "version" : "3.0.0" - } - }, - { - "identity" : "mlx-swift", - "kind" : "remoteSourceControl", - "location" : "https://github.com/ml-explore/mlx-swift", - "state" : { - "revision" : "19601207e9a0de51e03ee6ec0c3c5f3784275075", - "version" : "0.32.3" - } - }, - { - "identity" : "mlx-swift-lm", - "kind" : "remoteSourceControl", - "location" : "https://github.com/ml-explore/mlx-swift-lm", - "state" : { - "revision" : "3b339ad6e3b3f44c8121ecff5131c7fd55e075e6", - "version" : "3.32.3" - } - }, { "identity" : "swift-algorithms", "kind" : "remoteSourceControl", @@ -123,8 +96,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-crypto.git", "state" : { - "revision" : "da9d28d69ebe3894b18376c8f2395c2f37b8448f", - "version" : "4.5.2" + "revision" : "6ff0a3b1471d22b4a9ce133218c42d8854f182d7", + "version" : "5.1.0" } }, { @@ -154,24 +127,6 @@ "version" : "1.8.0" } }, - { - "identity" : "swift-huggingface", - "kind" : "remoteSourceControl", - "location" : "https://github.com/huggingface/swift-huggingface", - "state" : { - "revision" : "84ced3d4fa31b1bc8c74f420d346f690cb6b0f35", - "version" : "1.0.1" - } - }, - { - "identity" : "swift-jinja", - "kind" : "remoteSourceControl", - "location" : "https://github.com/huggingface/swift-jinja.git", - "state" : { - "revision" : "3104efda56131c37dda52e9142f02cc2425c02e6", - "version" : "3.2.1" - } - }, { "identity" : "swift-log", "kind" : "remoteSourceControl", @@ -270,24 +225,6 @@ "revision" : "7502b711c92a17741fa625d722b0ccbd595d8ed1", "version" : "1.7.2" } - }, - { - "identity" : "swift-transformers", - "kind" : "remoteSourceControl", - "location" : "https://github.com/huggingface/swift-transformers", - "state" : { - "revision" : "402a8a1105f52038b0949d9596981fc9e32bed17", - "version" : "1.4.0" - } - }, - { - "identity" : "yyjson", - "kind" : "remoteSourceControl", - "location" : "https://github.com/ibireme/yyjson.git", - "state" : { - "revision" : "6447536015f3d600f3d65323b10976103b337ca7", - "version" : "0.13.0" - } } ], "version" : 3