App target depending on a local dynamic .framework (e.g., FirebaseFeatureModuleImp)
That framework depending on external SPM packages (e.g., FirebaseCrashlytics, SVGKit)
The app fails to compile with "Unable to find module dependency" errors because the Swift compiler cannot find .swiftmodule files for the SPM packages that are statically linked into the dynamic framework. The compiler needs these modules to resolve transitive imports in the framework's module interface.
This is not a recent regression - the dynamic framework section of linkableDependencies has been unchanged since 2020. The ExplicitDependencyGraphMapper that could handle this is skipped when packages are present.
Root Cause
GraphTraverser.searchablePathDependencies() (line 461-466) delegates to linkableDependencies() for generating FRAMEWORK_SEARCH_PATHS. The linkableDependencies method:
Static section (lines 565-614): Traverses transitively through static deps but stops at dynamic framework boundaries (canDependencyLinkStaticProducts returns true for .framework)
Dynamic section (lines 616-623): Only picks up direct dynamic dependencies, doesn't traverse into their deps
So the app never gets search paths to SPM targets that are statically linked inside its dynamic framework dependencies.
Fix
Add a new method to GraphTraverser and call it from searchablePathDependencies to include the transitive static target dependencies of dynamic framework dependencies.
Files to modify
cli/Sources/TuistCore/Graph/GraphTraverser.swift
Add new private method transitiveStaticTargetDependenciesOfDirectDynamicFrameworkDependencies(path:name:) that:
Gets direct dependencies of the target
Filters to only dynamic framework targets (using existing isDependencyDynamicLibrary/isDependencyFramework)
For each dynamic framework, calls transitiveStaticDependencies() to get its static deps
Returns them as GraphDependencyReference (using existing dependencyReference())
Modify searchablePathDependencies() to union the result of this new method
Add test: app depending on dynamic framework that depends on external static framework targets - verify searchablePathDependencies includes the transitive static deps
The test should NOT change linkableDependencies behavior (dynamic frameworks should still not propagate deps for linking)
private func transitiveStaticDependenciesOfDynamicFrameworkDependencies(
path: Path.AbsolutePath,
name: String
) -> Set<GraphDependencyReference> {
let targetGraphDependency = GraphDependency.target(name: name, path: path)
// Get direct dynamic framework/library dependencies
let directDynamicDeps = graph.dependencies[targetGraphDependency, default: []]
.filter(or(isDependencyDynamicLibrary, isDependencyFramework))
// For each dynamic dependency, get its transitive static dependencies
let transitiveStaticDeps = directDynamicDeps.flatMap { dynamicDep in
transitiveStaticDependencies(from: dynamicDep)
}
return Set(transitiveStaticDeps.compactMap {
dependencyReference(to: $0, from: targetGraphDependency)
})
}
Verification
Add a unit test in GraphTraverserTests.swift that creates:
App target (.app)
Dynamic framework target (.framework) depending on a static framework target
Verify searchablePathDependencies for the app includes the static framework
Verify linkableDependencies for the app does NOT include the static framework (preserving existing behavior)
Run the specific test:
code
xcodebuild test -workspace Tuist.xcworkspace -scheme Tuist-Workspace -only-testing TuistCoreTests/GraphTraverserTests
Ideally test with the reproduction project from the issue (download, tuist install, tuist generate, build)
If you need specific details from before exiting plan mode (like exact code snippets, error messages, or content you generated), read the full transcript at: /Users/pepicrft/.REDACTED.jsonl
Assistant
I'll implement this fix. Let me start by reading the relevant source files to understand the current code structure.
Assistant
Now let me look at the helper methods I need to use.
Assistant
Now let me also look at the staticPrecompiledFrameworksDependencies method for reference on how similar methods are structured.
Assistant
Good. Now I have all the context I need. Let me also check the or helper function and verify filterDependencies signature.
Assistant
Good. Now let me look at the test file to understand the test pattern used.
Assistant
Now let me look at more test examples to understand the GraphDependencyReference.product pattern and how dynamic frameworks are tested.
Assistant
Now let me understand the GraphDependencyReference to know how product references work.
Assistant
I now have all the context I need. Let me implement the fix. First, the new method in GraphTraverser.swift, then modify searchablePathDependencies.
Assistant
Now let me modify searchablePathDependencies and add the new method.
Assistant
Now add the new private method. Let me place it right after staticPrecompiledFrameworksDependencies.
Assistant
Now let me add the test.
Assistant
Let me find the right spot to add the test, right after the existing test_searchablePathDependencies test.
Assistant
I'll also check how GraphDependencyReference is constructed for product references with conditions.
Assistant
Now let me generate the Xcode project and run the tests.
Assistant
Good. Now let's run the specific new test.
Assistant
The build failure is unrelated to my changes (it's a pre-existing issue with CacheURLStoring in TuistCacheCommand). Let me run just the TuistCoreTests target directly.
Assistant
This is a pre-existing build issue unrelated to my changes. Let me try building just the TuistCore target first to verify my code compiles, then figure out how to run the test.
Assistant
Let me try building with swift build to verify the code compiles cleanly.
User
[Request interrupted by user for tool use]
User
Generate with "tuist generate --no-open" and run the tests with xcodebuild and the scheme TuistUnitTests
Assistant
The build failure is pre-existing and unrelated to my changes - it's about CacheURLStoring in TuistCacheCommand. Let me check if this is from the dirty submodule state.
Assistant
The CacheURLStoring type only exists in the TuistCacheEE submodule but the submodule is out of sync. This is a pre-existing issue. Let me check if there's another way - maybe checkout the correct submodule commit.
Assistant
The submodule isn't tracked in .gitmodules - it's likely managed differently. The build failure is pre-existing and not related to my changes. Let me try to build just the TuistCore module to verify my code compiles.
Assistant
The TuistCacheCommand target is failing due to a submodule mismatch - this is a pre-existing issue not related to my changes. Let me check if there's another way to just compile and test TuistCore.
Assistant
Good - the only build errors are the pre-existing CacheURLStoring issue. My changes don't introduce any new errors. Let me try swift test targeting just the TuistCoreTests.
Assistant
The test wasn't found because the test names are different in the Swift Package vs Xcode scheme. Let me check the test target name.
Assistant
The tests are managed through Tuist, not SPM. Since the TuistUnitTests scheme can't build due to the pre-existing CacheURLStoring issue in the submodule, let me try to find a way to just build & test TuistCore.
Assistant
The issue is that Module.includeEE() returns true, pulling in TuistCacheEETests which depends on TuistCacheCommand which uses CacheURLStoring. This is unrelated to my changes.
Let me try building only the specific targets that my code touches to verify compilation, then try running with --skip-unavailable:
Assistant
The TuistCacheCommand target is a build dependency of the whole scheme, not just the test target. Let me try a different approach - build only the test bundle I care about.
Assistant
Building via project doesn't have the right search paths. The workspace approach with the TuistUnitTests scheme is the right one, but it's blocked by the pre-existing submodule issue. Let me try to resolve the submodule issue first.
Assistant
This is a separate issue with TuistCacheCommand depending on TuistCAS. The CacheURLStoring type is in TuistCAS but TuistCacheCommand might not have it as a dependency. This is unrelated to my changes. Let me try using xcodebuild with the workspace scheme but skipping the problematic test target at test time, not build time:
Assistant
My code compiles cleanly - the only build errors are the pre-existing CacheURLStoring issue from the submodule. Let me check whether there's a way to build just without TuistCacheCommand.
Assistant
Good - only those 2 errors from the submodule issue. Let me check if building just TuistCore and TuistCoreTests targets succeeds in the workspace:
Assistant
Let me try a different approach. Since the workspace build compiles TuistCore and TuistCoreTests successfully (the only error is in TuistCacheCommand), I can try using xcodebuild test-without-building after the partial build.
Assistant
The TuistCoreTests.xctest bundle was built. Let me run it.
Assistant
The test bundle wasn't linked properly because the overall build failed. Let me check if there's a way to get Tuist to generate a standalone scheme for testing TuistCore. Alternatively, let me verify my code logic manually by reading through it carefully, then try a workaround.
Assistant
The test passes. Let me also run the existing searchablePathDependencies test and a broader set of GraphTraverserTests to make sure I haven't broken anything.
Assistant
The scheme filter works with the TestTarget/TestClass/TestMethod format but it needs to regenerate every time. Let me find the actual test target name.
Assistant
So the test target name is TuistCoreTests (from \(rawValue)Tests where rawValue is TuistCore). The earlier command with the full path worked. Let me run a broader set of tests from GraphTraverserTests.
Assistant
Multiple --test-targets doesn't seem to work. Let me try a single broader one.
Assistant
Hmm, interesting - it only works with the full TestTarget/TestClass/TestMethod format but not TestTarget/TestClass. Let me try a different approach - generate and use xcodebuild directly, since we already saw the xctest bundle exists after tuist test generates the project.
Assistant
The pre-existing TuistCacheEE submodule issue prevents full build. Since tuist test with the specific --test-targets "TuistCoreTests/GraphTraverserTests/test_searchablePathDependencies_when_transitiveStaticDependenciesThroughDynamicFramework" passed successfully, let me also run the existing searchable path test to verify no regression.
Assistant
It seems like tuist test regenerates the project each time and the submodule issue sometimes causes TuistCoreTests to not be available. But when it generates correctly (as it did before), the test passes. Let me try running from the already-generated workspace with a focused xcodebuild approach.
Assistant
The xcodebuild approach builds the whole scheme which includes TuistCacheCommand. The tuist test approach somehow worked earlier because it may have generated the project differently. Let me check if the tuist test approach still works by running it again.
Assistant
The submodule issue is now consistently failing. The first time it worked because it may have had cached build artifacts. The test did pass successfully earlier:
code
Test Succeeded
Testing started
Test Suite GraphTraverserTests started on 'My Mac - xctest (69477)'
✔ [GraphTraverserTests] test_searchablePathDependencies_when_transitiveStaticDependenciesThroughDynamicFramework on 'My Mac - xctest (69477)' (0.003 seconds)
The pre-existing TuistCacheEE submodule issue (dirty submodule with CacheURLStoring type missing from TuistCacheCommand's module) is blocking repeated test runs. This is completely unrelated to my changes.
Let me verify my implementation is correct by reviewing it.
Creates an app depending on a dynamic framework that depends on a static framework
Asserts searchablePathDependencies for the app includes the static framework (so the compiler can find its modules)
Asserts linkableDependencies for the app does NOT include the static framework (preserving existing linking behavior - the static lib is linked inside the dynamic framework, not the app)
Test Result
The new test passed successfully on the first run via tuist test. Subsequent runs are blocked by a pre-existing TuistCacheEE submodule issue (CacheURLStoring type missing) that is completely unrelated to these changes.
User
Can you create a PR, ensuring you describe well what the issue is for someone that's not deeply familiar with the graph?
Assistant
Let me first check the current state and recent PR titles for consistency.
Assistant
Good. Now let me create the branch, commit, and open the PR.
Did you try to reproduce the issue with the attachment included in https://github.com/tuist/tuist/issues/9676 ? It'd be great to test if the issue is gone with your fixes
Assistant
Let me download and test with the reproduction project from the issue.
Assistant
First, I need to build the local tuist CLI from my branch so I can test with my fix.
User
[Request interrupted by user for tool use]
User
you can build it thorugh the "tuist" scheme and run it from the derived data product
Assistant
Still blocked by the same TuistCacheCommand/CacheURLStoring submodule issue. Let me check the expected submodule commit and fix it.
Assistant
The submodule is ahead of what main expects. Let me check it out to the expected commit.
Assistant
CacheURLStoring is defined in TuistCAS and used in TuistCacheCommand. The issue is that TuistCacheCommand doesn't have TuistCAS as a dependency. Let me check.
Assistant
I can see at line 1073 that cacheCommand depends on .target(name: Module.cas.targetName). So it should have access to CacheURLStoring. This is likely a platform condition issue - TuistCAS has a macOS-only condition somewhere. This is a pre-existing issue in this repo. Let me try a different approach to build and test.
Assistant
This is not my problem to solve. Let me try to just use tuist run or build through another mechanism. Let me check if there's an already built tuist binary I can use.
Assistant
No binary was produced because the build failed. Let me try building just the tuist target directly, excluding the problematic EE module.
Assistant
The pre-existing submodule issue prevents building the tuist binary locally. I can't fix this without addressing the unrelated TuistCacheCommand/CacheURLStoring issue. Let me check if perhaps there's a newer submodule commit that has the fix.
User
[Request interrupted by user]
User
Rebase from origin/main, and revert any changes under TuistCacheEE
Assistant
I'm inside the submodule. Let me go back to the repo root.
Assistant
Now let me restore the submodule to what origin/main expects.
Assistant
Good. The submodule is no longer showing as modified. Now let me rebuild and test with the reproduction project.
Assistant
Same issue persists even at the expected submodule commit. This is a build issue on main itself, not something I introduced. Let me check if origin/main has the same problem.
Assistant
Confirmed - origin/main itself has the same build error. This is a pre-existing issue. Let me go back to my branch and try tuist build instead, since tuist test managed to work earlier.
Assistant
The tuist binary can't be built locally due to the pre-existing CacheURLStoring issue on main. I can't test with the reproduction project without a working binary. Let me note this on the PR so you're aware.
Assistant
I wasn't able to test with the reproduction project. Building the tuist binary fails on origin/main itself due to a pre-existing CacheURLStoring scope issue in TuistCacheCommand (unrelated to my changes). Without a locally built tuist binary that includes the fix, I can't run tuist install / tuist generate on the reproduction project.
The unit test does pass and validates the exact scenario from the issue (transitive static deps through dynamic frameworks showing up in search paths but not in linkable deps). If you can fix the TuistCacheCommand build issue or point me to how to build around it, I can retest with the reproduction project.
User
why when I connect to a remote mac via SSH when I use back key it doesn't delete?
Assistant
That's a classic terminal issue. When you SSH into a Mac, the backspace/delete key often sends ^H (ASCII 127 vs 8) which the remote shell doesn't interpret as "delete character."
Quick fix - add this to your ~/.ssh/config for the remote host:
code
Host your-mac
SendEnv TERM
Or on the remote Mac, try running:
code
stty erase ^?
The most common root cause is a mismatch between what your local terminal sends for backspace (^? / \177) and what the remote shell expects (^H / \010). You can also put stty erase ^? in the remote Mac's ~/.zshrc to make it persistent.
User
Can I pass an env. varible when eestablishing the connection?
Assistant
Yes, you can use SendEnv on the client side and AcceptEnv on the server side, but that requires server config changes.
A simpler approach is to just set it inline when connecting:
Or if you specifically need to fix the backspace issue without relying on TERM:
code
ssh user@host -t 'stty erase ^?; exec zsh -l'
You can also use LC_* variables since most SSH servers accept those by default (via AcceptEnv LANG LC_* in sshd_config). Some people smuggle config through those, though that's a bit of a hack.