Skip to content

Update next release branch with changes from main (default)#244

Merged
data-douser merged 4 commits intonextfrom
dd/rebase-next-to-main
Apr 13, 2026
Merged

Update next release branch with changes from main (default)#244
data-douser merged 4 commits intonextfrom
dd/rebase-next-to-main

Conversation

@data-douser
Copy link
Copy Markdown
Collaborator

Summary of Changes

This pull request (PR) brings into the next branch the important, applicable changes that have merged to the main (default) branch since next diverged. Thus, this PR functions as a rebase of the protected next branch to an updated tip of the original base branch (i.e. main).

Below are the key changes grouped by theme:

Outline of Changes

Configurability and Environment Handling:

  • Added a new codeql-mcp.scanExcludeDirs setting to package.json, allowing users to specify additional directories to exclude from workspace scanning. This setting is passed to the server via the CODEQL_MCP_SCAN_EXCLUDE_DIRS environment variable, and is handled in the EnvironmentBuilder. Tests were added to verify correct behavior. [1] [2] [3]

Logging and Debugging Improvements:

  • Updated logging in DatabaseWatcher and QueryResultsWatcher to use vscode.workspace.asRelativePath for more readable paths in log messages. [1] [2] [3]
  • Enhanced logging in PackInstaller to provide clearer information about CLI version detection, pack download/install success rates, and bundled pack installs. [1] [2] [3] [4] [5]
  • Minor improvement to bundled server logging in ServerManager.

CLI Resolver Robustness:

  • Refactored CliResolver to handle concurrent CLI resolution safely, using a promise cache and a generation counter to discard stale results if the cache is invalidated during an in-flight operation. [1] [2] [3] [4] [5]

Server Definition and Notification Handling:

  • Changed file watcher behavior so that file-content changes (like new databases or query results) no longer trigger MCP server definition rebuilds, as the server auto-discovers files. Watchers now primarily log events and track known databases.
  • Improved McpProvider to debounce rapid-fire fireDidChange notifications, coalescing them into a single update and ensuring proper cleanup on disposal or restart. [1] [2] [3] [4]

Test and Mock Enhancements:

  • Added new integration tests and updated the VS Code mock workspace to support additional methods used in the extension. [1] [2]

These changes collectively improve extension stability, configurability, and maintainability.

Cherry-picked from main (36631d9) with conflicts resolved:
- extensions/vscode/test/bridge/environment-builder.test.ts: accepted
  scanExcludeDirs tests, dropped ENABLE_ANNOTATION_TOOLS preservation
  test (annotation tools are always enabled on next)
- server/dist/*: accepted next version (will rebuild)
The default (integration) scope was extracting all tools/test databases
for all 10 languages (~60 databases) when only 7 specific tools
databases plus javascript/examples are referenced by client integration
test fixtures.

Replace the blanket 'for lang in all languages' loop with an explicit
list of the 7 tools/test directories actually used:
  - cpp/tools/test/{CallGraphFrom,CallGraphFromTo,CallGraphTo}
  - javascript/tools/test/CallGraphFromTo
  - python/tools/test/CallGraphFromTo
  - rust/tools/test/{CallGraphFrom,PrintAST}

This restores the performance fix from main where integration scope
was intentionally minimal, and avoids a significant CI time regression
from extracting ~53 unnecessary databases.
@data-douser data-douser self-assigned this Apr 13, 2026
@data-douser data-douser added bug Something isn't working dependencies Pull requests that update a dependency file testing labels Apr 13, 2026
@data-douser data-douser marked this pull request as ready for review April 13, 2026 03:10
@data-douser data-douser requested review from a team and enyil as code owners April 13, 2026 03:10
Copilot AI review requested due to automatic review settings April 13, 2026 03:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the next release branch by bringing in recent main changes that improve MCP prompt UX (argument completions + optional language auto-derivation), make workspace scanning exclusions configurable, and harden extension-side operational behavior (debounced definition change notifications, safer concurrent CLI resolution, and clearer logging).

Changes:

  • Add prompt argument completions (language, query/database/SARIF paths, pack root) plus shared prompt constants and scan-exclude infrastructure.
  • Make several prompt language parameters optional and auto-derive language from codeql-pack.yml dependencies, surfacing warnings when derivation fails.
  • Improve VS Code extension stability and observability via debounced MCP definition change events, safer concurrent CodeQL CLI resolution, and expanded unit/integration tests.
Show a summary per file
File Description
server/test/src/prompts/workflow-prompts.test.ts Updates prompt schema/handler tests for optional language and new warning behavior.
server/test/src/prompts/prompt-completions.test.ts Adds unit tests for completion providers, cache behavior, and language auto-derivation helpers.
server/test/src/prompts/constants.test.ts Adds tests for shared SUPPORTED_LANGUAGES constant module.
server/test/src/lib/scan-exclude.test.ts Adds tests for default scan excludes and env-var merge/negation behavior.
server/src/tools/codeql/search-ql-code.ts Switches directory skipping to shared scan-exclude list.
server/src/prompts/workflow-prompts.ts Makes selected prompt languages optional, integrates completions, and adds language auto-derivation in handlers.
server/src/prompts/prompt-completions.ts Introduces completion providers, schema augmentation via completable(), and language derivation from pack metadata.
server/src/prompts/constants.ts Introduces shared SUPPORTED_LANGUAGES to avoid circular deps.
server/src/lib/scan-exclude.ts Adds shared default+configurable directory exclusion logic via CODEQL_MCP_SCAN_EXCLUDE_DIRS.
server/scripts/extract-test-databases.sh Speeds up default extraction by only extracting integration-test-referenced tool databases.
server/dist/codeql-development-mcp-server.js Updates bundled build output to include new server functionality.
extensions/vscode/test/suite/mcp-server.integration.test.ts Adds an integration test asserting CODEQL_PATH looks valid when present.
extensions/vscode/test/suite/mcp-completion-e2e.integration.test.ts Adds end-to-end completion tests using real VS Code API + MCP completion/complete.
extensions/vscode/test/suite/file-watcher-stability.integration.test.ts Adds stability tests ensuring file changes don’t trigger redundant definition updates.
extensions/vscode/test/server/server-manager.test.ts Updates expectations for revised bundled-server logging message.
extensions/vscode/test/server/pack-installer.test.ts Adds tests asserting improved PackInstaller logging and download/install summaries.
extensions/vscode/test/server/mcp-provider.test.ts Adds tests for debounced fireDidChange, restart behavior, and dispose cleanup.
extensions/vscode/test/extension.test.ts Extends watcher mocks and asserts watcher events don’t trigger definition/environment invalidation.
extensions/vscode/test/codeql/cli-resolver.test.ts Adds tests for concurrent resolve caching, PATH validation/version detection, and stale in-flight invalidation.
extensions/vscode/test/bridge/environment-builder.test.ts Adds tests for passing scanExcludeDirs into CODEQL_MCP_SCAN_EXCLUDE_DIRS.
extensions/vscode/src/server/server-manager.ts Tweaks bundled-server readiness log line.
extensions/vscode/src/server/pack-installer.ts Adds richer logging (CLI/target versions, pack refs, success counts) and download/install summaries.
extensions/vscode/src/server/mcp-provider.ts Debounces definition-change notifications and ensures pending timers are canceled on restart/dispose.
extensions/vscode/src/extension.ts Stops treating database/query-result file changes as definition changes (watchers now mainly log/track).
extensions/vscode/src/codeql/cli-resolver.ts Adds in-flight promise caching + generation-based stale-result discarding for safe concurrent resolution.
extensions/vscode/src/bridge/query-results-watcher.ts Improves log readability using workspace-relative paths.
extensions/vscode/src/bridge/environment-builder.ts Adds scanExcludeDirs setting propagation to server env.
extensions/vscode/src/bridge/database-watcher.ts Improves log readability using workspace-relative paths.
extensions/vscode/package.json Adds codeql-mcp.scanExcludeDirs setting definition and documentation.
extensions/vscode/esbuild.config.js Includes new integration test entry points in the extension test bundle.
extensions/vscode/mocks/vscode.ts Extends workspace mock with asRelativePath and updateWorkspaceFolders.
.github/workflows/client-integration-tests.yml Updates workflow comments to reflect faster/smaller default test DB extraction.

Copilot's findings

  • Files reviewed: 31/33 changed files
  • Comments generated: 3

Comment thread server/src/prompts/prompt-completions.ts
Comment thread server/src/tools/codeql/search-ql-code.ts
Comment thread extensions/vscode/src/server/pack-installer.ts Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR syncs next with updates from main, focusing on improved configurability, UX, and stability for the VS Code extension + MCP server (scan exclusions, prompt argument completions, more robust CLI resolution, and reduced noisy/expensive watcher + test DB behaviors).

Changes:

  • Added configurable workspace scan exclusions (codeql-mcp.scanExcludeDirsCODEQL_MCP_SCAN_EXCLUDE_DIRS) and centralized exclusion logic in the server.
  • Introduced MCP prompt argument completions (language/path/database/packRoot) plus pack-based language auto-derivation when language is omitted for select prompts.
  • Improved extension robustness: debounced server-definition change notifications, safer concurrent CLI resolution, refined logging, and faster integration-test DB extraction.
Show a summary per file
File Description
server/test/src/tools/codeql/search-ql-code.test.ts Adds regression test ensuring QL search respects dynamic scan-exclude env changes.
server/test/src/prompts/workflow-prompts.test.ts Updates schema validation expectations to make language optional in select prompts.
server/test/src/prompts/prompt-completions.test.ts New unit tests covering completion callbacks, caching, and language auto-derivation helpers.
server/test/src/prompts/constants.test.ts New test verifying shared SUPPORTED_LANGUAGES export and ordering.
server/test/src/lib/scan-exclude.test.ts New tests for default + env-configured scan exclusion behavior (including negation).
server/src/tools/codeql/search-ql-code.ts Uses shared scan-exclude set during filesystem traversal for QL search.
server/src/prompts/workflow-prompts.ts Makes language optional in select schemas, adds auto-derivation, and wires addCompletions() into prompt registration.
server/src/prompts/prompt-completions.ts Adds completion providers, schema enhancement via completable(), and pack-based language resolution helpers.
server/src/prompts/constants.ts New shared constants module to break circular deps and centralize supported languages.
server/src/lib/scan-exclude.ts New shared scan-exclusion implementation with defaults + env override/negation.
server/scripts/extract-test-databases.sh Speeds up default extraction by limiting tools DBs to those referenced by integration fixtures.
server/dist/codeql-development-mcp-server.js Updates bundled build output for new server capabilities and features.
extensions/vscode/test/suite/mcp-server.integration.test.ts Adds integration test around CODEQL_PATH presence/shape in built environment.
extensions/vscode/test/suite/mcp-completion-e2e.integration.test.ts New end-to-end tests verifying MCP completions capability + argument completion behavior.
extensions/vscode/test/suite/file-watcher-stability.integration.test.ts New integration tests ensuring file changes don’t spuriously trigger definition-change events.
extensions/vscode/test/server/server-manager.test.ts Adjusts logging assertion to match updated bundled-server messaging.
extensions/vscode/test/server/pack-installer.test.ts Adds extensive logging behavior tests for pack install/download flows.
extensions/vscode/test/server/mcp-provider.test.ts Adds debouncing + disposal behavior tests for definition-change notifications.
extensions/vscode/test/extension.test.ts Ensures db/query watcher events don’t trigger env rebuild or provider change events.
extensions/vscode/test/codeql/cli-resolver.test.ts Adds tests for concurrent resolution, PATH resolution version detection, and invalidation during in-flight resolve.
extensions/vscode/test/bridge/environment-builder.test.ts Adds tests for CODEQL_MCP_SCAN_EXCLUDE_DIRS env propagation from settings.
extensions/vscode/src/server/server-manager.ts Refines bundled-server log messaging (avoid “npm install” implication).
extensions/vscode/src/server/pack-installer.ts Adds richer install/download logs and success/skip summaries.
extensions/vscode/src/server/mcp-provider.ts Debounces fireDidChange() and cancels pending events on restart/dispose.
extensions/vscode/src/extension.ts Stops rebuilding server definition on file-content watcher events; keeps watchers for logging/known-db tracking.
extensions/vscode/src/codeql/cli-resolver.ts Adds promise caching + generation invalidation to safely handle concurrent resolves.
extensions/vscode/src/bridge/query-results-watcher.ts Improves log readability via workspace.asRelativePath().
extensions/vscode/src/bridge/environment-builder.ts Adds scanExcludeDirs setting plumbing → CODEQL_MCP_SCAN_EXCLUDE_DIRS.
extensions/vscode/src/bridge/database-watcher.ts Improves discovered/removed DB log readability via workspace.asRelativePath().
extensions/vscode/package.json Adds codeql-mcp.scanExcludeDirs setting definition and documentation.
extensions/vscode/esbuild.config.js Includes new integration test entry points in test build.
extensions/vscode/mocks/vscode.ts Extends mock with workspace.asRelativePath() and updateWorkspaceFolders().
.github/workflows/client-integration-tests.yml Updates workflow comment to reflect narrower default DB extraction scope.

Copilot's findings

  • Files reviewed: 32/34 changed files
  • Comments generated: 4

Comment thread extensions/vscode/src/server/pack-installer.ts Outdated
Comment thread server/src/prompts/prompt-completions.ts
Comment thread server/src/prompts/prompt-completions.ts
Comment thread extensions/vscode/test/suite/mcp-server.integration.test.ts Outdated
@data-douser data-douser merged commit 289d860 into next Apr 13, 2026
12 checks passed
@data-douser data-douser deleted the dd/rebase-next-to-main branch April 13, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dependencies Pull requests that update a dependency file testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants