Skip to content

Fixes for codeql_query_compile MCP tool and dump-dil argument handling#243

Merged
data-douser merged 3 commits intonextfrom
dd/dump-dil-improvements/1
Apr 13, 2026
Merged

Fixes for codeql_query_compile MCP tool and dump-dil argument handling#243
data-douser merged 3 commits intonextfrom
dd/dump-dil-improvements/1

Conversation

@data-douser
Copy link
Copy Markdown
Collaborator

Replaces PR #241.

Summary of Changes

This pull request improves the handling of the --dump-dil and --no-dump-dil flags for the codeql_query_compile CLI tool, ensuring that these flags are normalized and deduplicated between named parameters and additionalArgs. It also adds comprehensive tests to verify this behavior, making the flag handling more predictable and robust.

Outline of Changes

CLI flag normalization and precedence:

  • Refactored the logic in registerCLITool (cli-tool-registry.ts) so that for codeql_query_compile, the last occurrence of --dump-dil or --no-dump-dil in additionalArgs overrides the named dump-dil parameter, and the effective value is set in options['dump-dil']. Both flags are then filtered from the raw CLI arguments to prevent duplication.

Test coverage improvements:

  • Updated existing tests to check that options['dump-dil'] is set correctly and that neither --dump-dil nor --no-dump-dil are present in the final CLI arguments when handled. [1] [2]
  • Added comprehensive tests to verify:
    • That --dump-dil in additionalArgs overrides dump-dil: false and vice versa.
    • That the last flag in additionalArgs is respected.
    • That both flags are filtered from the CLI arguments.
    • That non-dump-dil arguments are preserved.

Applies fixes and improves tests for codeql_query_compile MCP tool
related to --dump-dil versus --no-dump-dil arg handling.
@data-douser data-douser self-assigned this Apr 12, 2026
@data-douser data-douser added the bug Something isn't working label Apr 12, 2026
@data-douser data-douser marked this pull request as ready for review April 12, 2026 23:08
@data-douser data-douser requested review from a team and enyil as code owners April 12, 2026 23:08
Copilot AI review requested due to automatic review settings April 12, 2026 23:08
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 pull request fixes codeql_query_compile handling of --dump-dil / --no-dump-dil so that flag precedence between the named dump-dil parameter and additionalArgs is deterministic (last flag in additionalArgs wins) and so the final CLI invocation avoids duplicate/conflicting flags.

Changes:

  • Normalize --dump-dil / --no-dump-dil from additionalArgs into options['dump-dil'], filter those flags from raw CLI args, and derive effectiveDumpDilEnabled from the normalized value.
  • Update/add unit tests to cover precedence, “last flag wins”, deduplication (filtering), and preservation of unrelated additionalArgs.
  • Update the built server/dist JS artifact to reflect the source change.
Show a summary per file
File Description
server/src/lib/cli-tool-registry.ts Implements dump-dil flag normalization/deduplication and fixes precedence ordering for codeql_query_compile.
server/test/src/lib/cli-tool-registry.test.ts Expands assertions and adds new cases for dump-dil/no-dump-dil precedence and filtering behavior.
server/dist/codeql-development-mcp-server.js Updates compiled distribution output for the registry change.

Copilot's findings

  • Files reviewed: 2/4 changed files
  • Comments generated: 2

Comment thread server/src/lib/cli-tool-registry.ts Outdated
Comment thread server/test/src/lib/cli-tool-registry.test.ts
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 fixes codeql_query_compile argument handling in the MCP server so that --dump-dil / --no-dump-dil are normalized consistently between the named dump-dil option and additionalArgs, with clear precedence and without forwarding duplicate/conflicting flags to the CodeQL CLI.

Changes:

  • Normalize --dump-dil / --no-dump-dil from additionalArgs (last flag wins) into options['dump-dil'], and filter both flags out of raw CLI args to prevent duplication.
  • Adjust existing unit tests to assert normalization into options['dump-dil'] and confirm flags are removed from positional/additional CLI args.
  • Add new unit tests covering precedence overrides, last-flag-wins behavior, filtering, and preservation of unrelated additionalArgs.
Show a summary per file
File Description
server/src/lib/cli-tool-registry.ts Implements last-flag-wins normalization for dump-dil flags and deduplicates them from raw CLI args for codeql_query_compile.
server/test/src/lib/cli-tool-registry.test.ts Updates existing expectations and adds multiple tests to cover precedence, deduplication, and argument preservation.
server/dist/codeql-development-mcp-server.js Updates the built artifact to reflect the registerCLITool dump-dil normalization changes.

Copilot's findings

  • Files reviewed: 2/4 changed files
  • Comments generated: 1

Comment thread server/test/src/lib/cli-tool-registry.test.ts Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Nathan Randall <70299490+data-douser@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 13, 2026 00:05
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 pull request fixes codeql_query_compile flag handling in the MCP server by normalizing and deduplicating --dump-dil / --no-dump-dil across the named dump-dil option and additionalArgs, with expanded unit tests to lock in precedence and filtering behavior.

Changes:

  • Normalize --dump-dil / --no-dump-dil from additionalArgs into options['dump-dil'] (last flag wins) and remove both flags from raw CLI args to avoid duplication.
  • Compute the effective “dump-dil enabled” behavior from the normalized option value.
  • Add/adjust unit tests to verify precedence, “last flag wins”, filtering behavior, and preservation of unrelated additionalArgs.
Show a summary per file
File Description
server/src/lib/cli-tool-registry.ts Normalizes dump-dil based on additionalArgs precedence and filters conflicting raw flags before execution.
server/test/src/lib/cli-tool-registry.test.ts Updates existing expectations and adds focused tests for precedence, deduplication, and “last flag wins”.
server/dist/codeql-development-mcp-server.js Regenerated build artifact reflecting the updated registry logic.

Copilot's findings

  • Files reviewed: 2/4 changed files
  • Comments generated: 0 new

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 pull request fixes codeql_query_compile argument handling in the MCP server so --dump-dil / --no-dump-dil supplied via additionalArgs are normalized, deduplicated, and correctly override the named dump-dil parameter, with expanded unit test coverage to prevent regressions.

Changes:

  • Normalize --dump-dil / --no-dump-dil from additionalArgs into options['dump-dil'] (last flag wins) and filter both flags from raw CLI args to avoid duplicates.
  • Compute the effective DIL-enabled behavior from the normalized options['dump-dil'] after extracting/deleting additionalArgs.
  • Update and add unit tests covering precedence, last-flag-wins behavior, filtering, and preservation of unrelated additionalArgs.
Show a summary per file
File Description
server/src/lib/cli-tool-registry.ts Implements normalized/precedence-aware dump-dil handling and removes duplicate CLI flags from additionalArgs.
server/test/src/lib/cli-tool-registry.test.ts Updates existing assertions and adds comprehensive tests for precedence/deduplication behavior.
server/dist/codeql-development-mcp-server.js Updates the committed built artifact to match the source behavior change.

Copilot's findings

  • Files reviewed: 2/4 changed files
  • Comments generated: 0 new

@data-douser data-douser merged commit 8bd3dff into next Apr 13, 2026
19 checks passed
@data-douser data-douser deleted the dd/dump-dil-improvements/1 branch April 13, 2026 00:45
data-douser added a commit that referenced this pull request Apr 16, 2026
…ing (#243)

* Fixes for codeql_query_compile dump-dil

Applies fixes and improves tests for codeql_query_compile MCP tool
related to --dump-dil versus --no-dump-dil arg handling.

* Address PR #243 review feedback

* Update server/test/src/lib/cli-tool-registry.test.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Nathan Randall <70299490+data-douser@users.noreply.github.com>

---------

Signed-off-by: Nathan Randall <70299490+data-douser@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants