Fix indexStorePath/indexDatabasePath being transposed in BSP response - #1576
Open
AnupamKumar-1 wants to merge 1 commit into
Open
Fix indexStorePath/indexDatabasePath being transposed in BSP response#1576AnupamKumar-1 wants to merge 1 commit into
AnupamKumar-1 wants to merge 1 commit into
Conversation
indexStorePath pointed at a directory nothing writes to, while indexDatabasePath returned the real index store location. BSP clients like SourceKit-LSP opened a valid-but-empty store and silently returned no results. Fixes swiftlang/swift-package-manager#10350
AnupamKumar-1
requested review from
cmcgee1024,
daveinglis,
jakepetroules,
mhrawdon,
owenv,
rconnell9 and
rjmansfield
as code owners
July 29, 2026 02:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes swiftlang/swift-package-manager#10350
Note: the linked issue was filed against
swift-package-manager, but the root cause is inswift-build's BSP server implementation, so the fix lives here.Summary
indexStorePathandindexDatabasePathinSWBBuildServer's BSPbuild/initializeresponse were transposed:indexStorePathderived a sibling directory (dirname(indexDataStoreFolderPath)/index-store) that nothing ever writes to.indexDatabasePathreturnedindexDataStoreFolderPathdirectly — i.e. the real index store location — mislabeled as a database path.Any BSP client that trusts
indexStorePath(e.g. SourceKit-LSP withswiftPM.buildSystem: "swiftbuild") opens a valid-but-empty store and silently returns no results for cross-file queries.Fix
indexStorePathnow returnsarenaInfo.indexDataStoreFolderPathdirectly — the actual directory the build writes index data into.indexDatabasePathnow derives a sibling directory (DataStoreDB, following the naming convention already used for adjacent Index.noindex paths inSWBTestSupport/Misc.swift:DataStore,PrecompiledHeaders,Build) so a client can safely create its own IndexStoreDB without colliding with the raw store.Verification
Reproduced and confirmed with a real package, using the
swiftbuildbackend end-to-end:-index-store-pathfrom a verboseswift build --build-system swiftbuild -vcompile invocation.swift package experimental-build-server --build-system swiftbuilddirectly over stdio with a rawbuild/initializerequest and confirmed the advertised paths didn't match the real one (before fix).indexStorePathnow matches the real store path, and.build/out/v5/{units,records}are confirmed present exactly whereindexStorePathclaims.indexDatabasePathnow points at a distinct, non-colliding sibling path.Testing
Added
indexStoreAndDatabasePathsAreNotTransposedinBuildServerTests.swift, which constructs a build request with an explicitSWBArenaInfoand assertsindexStorePathmatches the real derived-data path whileindexDatabasePathremains distinct from it. Verified the test fails without the fix and passes with it.