Fix deterministic vscode-codeql discovery tests and dual-casing path probe in CliResolver#92
Merged
data-douser merged 2 commits intodd/codeql-path-fixes/1from Feb 26, 2026
Merged
Conversation
Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Support automatic discovery of codeql CLI distributions
Fix deterministic vscode-codeql discovery tests and dual-casing path probe in CliResolver
Feb 26, 2026
data-douser
approved these changes
Feb 26, 2026
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.
Address two review issues from PR #91:
discoverVsCodeCodeQLDistributiontests were non-asserting tautologies dependent on machine state, andCliResolver.resolveFromVsCodeDistribution()would miss the managed CLI on case-sensitive filesystems when the on-disk casing differed from the StoragePaths-provided path.📝 Update Information
Primitive Details
discoverVsCodeCodeQLDistribution(server),CliResolver(vscode extension)✅ ALLOWED FILES:
server/src/**/*.ts)server/src/tools/*.ts)server/test/**/*.ts)README.md, server docs)server/src/types/*.ts)server/src/lib/*.ts)package.json,tsconfig.json)🚫 FORBIDDEN FILES:
🛑 MANDATORY PR VALIDATION CHECKLIST
Update Metadata
candidateStorageRootsis an optional additive parameter🎯 Changes Description
Current Behavior
discoverVsCodeCodeQLDistribution()used hardcoded platform paths; tests either never called the function or assertedresult === undefined || typeof result === 'string'(always true). Tests also calledgetResolvedCodeQLDir()and asserted a tautology.CliResolver.resolveFromVsCodeDistribution()treatedvsCodeCodeqlStoragePathas exact.StoragePathsalways producesGitHub.vscode-codeql(publisher casing), but VS Code lowercases the directory togithub.vscode-codeqlon some Linux installations — discovery silently failed.Updated Behavior
discoverVsCodeCodeQLDistribution(candidateStorageRoots?)accepts injectable roots; tests use project temp dirs with real file structures and assert the exact returned binary path.CliResolver.resolveFromVsCodeDistribution()always probes bothGitHub.vscode-codeqlandgithub.vscode-codeqlsiblings under the same parent, using aSetto deduplicate if the provided path already matches one casing.Motivation
Non-asserting tests give false confidence and mask regressions. The casing mismatch caused silent discovery failure on case-sensitive filesystems (common Linux CI/developer setups).
🔄 Before vs. After Comparison
Functionality Changes
API Changes
Output Format Changes
No output format changes.
🧪 Testing & Validation
Test Coverage Updates
discoverVsCodeCodeQLDistributiontests rewritten with real FS structure and concrete path assertionscli-resolver.test.tsValidation Scenarios
distribution.jsonfast path: temp dir withdistribution.jsonpointing to index 3 → asserts exact binary path returneddistribution.json, two distribution dirs → asserts highest-numbered dir pickeddistribution.jsonpointing at index 2 with index 3 also present → asserts index 2 returneddistribution1,distribution2,distribution10→ assertsdistribution10pickedGitHub.vscode-codeqlprovided but onlygithub.vscode-codeqlon disk → asserts binary resolvedTest Results
codeql_pack_installfailure unrelated to these changes📋 Implementation Details
Files Modified
server/src/lib/cli-executor.ts— addedcandidateStorageRootsparamextensions/vscode/src/codeql/cli-resolver.ts— dual-casing probe, refactored private methods to accept explicitstoragePathserver/test/src/lib/cli-executor.test.ts— deterministicdiscoverVsCodeCodeQLDistributiontests, removed tautological assertionsextensions/vscode/test/codeql/cli-resolver.test.ts— alternate-casing test addedCode Changes Summary
resolveFromDistributionJson/Scannow accept explicit path, eliminating reliance onthis.vsCodeCodeqlStoragePathstring[] | undefined; no runtime behavior change when omittedDependencies
🔍 Quality Improvements
Bug Fixes
CliResolvermissed the managed CLI when VS Code lowercases the extension storage directorygithub.vscode-codeql,GitHub.vscode-codeql) from the same parentcli-resolver.test.tsCode Quality Enhancements
discoverVsCodeCodeQLDistributiontests are now fully deterministic and machine-independentexistsSyncimportstoragePathinstead of implicit instance field🔗 References
Related Issues/PRs
codeqlCLI distributions installed off-PATH by VS Code extension #91 (parent PR whose review comments this addresses)🚀 Compatibility & Migration
Backward Compatibility
API Evolution
candidateStorageRootsadded todiscoverVsCodeCodeQLDistribution👥 Review Guidelines
For Reviewers
Please verify:
Testing Instructions
📊 Impact Assessment
Server Impact
existsSyncchecks at startup)AI Assistant Impact
🔄 Deployment Strategy
Rollout Considerations
Update Methodology:
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.