From 840ff6f30187774f2c0999d721a07cf80bb3caca Mon Sep 17 00:00:00 2001 From: pablof7z Date: Fri, 24 Jul 2026 13:03:46 +0300 Subject: [PATCH] Fix bundled engine lookup for Xcode-built app bundles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit EngineClient.bundled() only looked under a "Resources/bin" or "bin" subdirectory inside Bundle.module, which is where SwiftPM's `.process` resource rule keeps it under `swift build`/`swift test`. Xcode's resource-processing build phase instead flattens the same file straight into the bundle's Resources root, so every real .app build failed to find it — surfacing as "The bundled simulation engine is missing" for both direct UI actions (e.g. the 1B cohorts preset) and Claude/MCP-driven runs, since both execute through the same running app instance. Add a subdirectory-less fallback lookup. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01BUKvEN7BPfWJobSZwQrabK --- FIPSDPackage/Sources/FIPSDFeature/EngineClient.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/FIPSDPackage/Sources/FIPSDFeature/EngineClient.swift b/FIPSDPackage/Sources/FIPSDFeature/EngineClient.swift index ff6d64d..917bf9d 100644 --- a/FIPSDPackage/Sources/FIPSDFeature/EngineClient.swift +++ b/FIPSDPackage/Sources/FIPSDFeature/EngineClient.swift @@ -21,6 +21,11 @@ struct EngineClient: Sendable { let executableURL: URL static func bundled() throws -> Self { + // SwiftPM's `.process(...)` resource rule preserves the `Resources/bin` + // and `bin` subdirectories when building via `swift build`/`swift test`, + // but Xcode's resource-processing build phase flattens the same + // resource straight into the bundle's Resources root when building the + // .app target — so the lookup falls back to a subdirectory-less search. guard let url = Bundle.module.url( forResource: "fips-wind-tunnel", withExtension: nil, @@ -29,6 +34,9 @@ struct EngineClient: Sendable { forResource: "fips-wind-tunnel", withExtension: nil, subdirectory: "bin" + ) ?? Bundle.module.url( + forResource: "fips-wind-tunnel", + withExtension: nil ) else { throw EngineClientError.executableMissing } return Self(executableURL: url) }