[UPDATE PRIMITIVE] Fix additionalArgs precedence for --dump-dil/--no-dump-dil in codeql_query_compile#241
Closed
[UPDATE PRIMITIVE] Fix additionalArgs precedence for --dump-dil/--no-dump-dil in codeql_query_compile#241
additionalArgs precedence for --dump-dil/--no-dump-dil in codeql_query_compile#241Conversation
Add dump-dil parameter to the codeql_query_compile tool inputSchema and inject --dump-dil by default in registerCLITool handler unless explicitly disabled via dump-dil: false or --no-dump-dil in additionalArgs. Includes server unit tests and client integration test improvements. Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/7a489b70-8f73-406f-9a75-e8a15951cde2 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
After successful compilation with --dump-dil, extract the DIL content from stdout and save it to a dedicated .dil file in a log directory. The file path is appended to the tool response. - Add logDir parameter to codeql_query_compile tool - Create log directory and write .dil file post-execution - Add server unit tests for DIL file persistence - Update integration test assertions to verify DIL file output Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/7ba868e5-1215-4130-bc06-10dfb15ebf14 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
Address PR #235 review comments for codeql_query_compile DIL persistence: - Reorder path imports alphabetically (basename, delimiter, dirname, ...) - Update logDir description to match pattern used by query-run, test-run, and database-analyze (mentions CODEQL_QUERY_LOG_DIR and default path) - Defer compile log directory creation to post-execution so failed compilations do not leave empty directories behind - Make DIL file test hermetic by controlling CODEQL_QUERY_LOG_DIR via a test-scoped temp directory and restoring it in a finally block - Add test verifying no empty log directory on compilation failure - Add test verifying logDir description matches other CLI tools Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
…rom additionalArgs Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/b356b90f-7780-4b79-980c-c9b091bc9ce7 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix code comments as per review feedback
[UPDATE PRIMITIVE] Fix Apr 11, 2026
additionalArgs precedence for --dump-dil/--no-dump-dil in codeql_query_compile
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.
effectiveDumpDilEnabledwas computed beforeadditionalArgswere extracted, so--dump-dilinadditionalArgscould not overridedump-dil: falseset as a named parameter — and--dump-dil/--no-dump-dilflags were passed to the CLI as raw args alongside the conflicting named option.📝 Update Information
Primitive Details
codeql_query_compileThis PR is for updating an existing MCP server primitive and must ONLY include these file types:
✅ 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:
Rationale: This PR should contain only the files necessary to update and test the primitive.
🚨 PRs that include forbidden files will be rejected and must be revised.
🛑 MANDATORY PR VALIDATION CHECKLIST
BEFORE SUBMITTING THIS PR, CONFIRM:
Update Metadata
🎯 Changes Description
Current Behavior
effectiveDumpDilEnabledwas computed by readingoptions.additionalArgsdirectly before those args were extracted fromoptions. This caused two bugs:dump-dil: false+--dump-dilinadditionalArgs→ DIL disabled (wrong;additionalArgsshould win)--dump-dil/--no-dump-dilremained inrawAdditionalArgsand were forwarded to the CLI alongside the named option, producing conflicting duplicate flagsUpdated Behavior
rawAdditionalArgsis now extracted (aslet) andoptions.additionalArgsdeleted before normalization. The last--dump-dil/--no-dump-dilflag found inadditionalArgsis used to overrideoptions['dump-dil'], and those flags are then filtered out ofrawAdditionalArgs.effectiveDumpDilEnabledis derived from the resulting normalizedoptions['dump-dil'].Motivation
Review comment r3067391920 identified the precedence inversion and duplicate-flag issue.
🔄 Before vs. After Comparison
Functionality Changes
API Changes
No schema changes. Behavioral fix only.
Output Format Changes
No output format changes.
🧪 Testing & Validation
Test Coverage Updates
dump-dil:false+--dump-dilinadditionalArgs→additionalArgswins--no-dump-dil/--dump-dilinadditionalArgstests to reflect new normalization behaviorValidation Scenarios
dump-dilenabled) unchangeddump-dil:false+--dump-dilinadditionalArgsnow correctly enables DIL--dump-dil/--no-dump-dilno longer appear in raw CLI args when normalized viaoptionsTest Results
📋 Implementation Details
Files Modified
server/src/lib/cli-tool-registry.tsserver/test/src/lib/cli-tool-registry.test.tsCode Changes Summary
rawAdditionalArgsextraction beforeeffectiveDumpDilEnabledcomputation; added normalization pass for--dump-dil/--no-dump-dilrawAdditionalArgschanged fromconsttoletto allow filteringDependencies
🔍 Quality Improvements
Bug Fixes (if applicable)
additionalArgs: ['--dump-dil']could not overridedump-dil: falsenamed param; conflicting flags were forwarded to the CLIeffectiveDumpDilEnabledwas computed beforeoptions.additionalArgswas extracted, so the flag check and normalization operated on the wrong stateoptions.additionalArgsfirst, normalizedump-dilflags (withadditionalArgstaking precedence), filter them fromrawAdditionalArgs, then computeeffectiveDumpDilEnabledCode Quality Enhancements
effectiveDumpDilEnabledderivation simplified to a single expression🔗 References
Related Issues/PRs
codeql_query_compileenables--dump-dilby default with.dilfile persistence #235 (original--dump-dilfeature PR)🚀 Compatibility & Migration
Backward Compatibility
API Evolution
👥 Review Guidelines
For Reviewers
Please verify:
additionalArgs--dump-dil/--no-dump-dilcorrectly overrides nameddump-dilparam in both directionsTesting Instructions
Validation Checklist
dump-dil:false+--dump-dilin additionalArgs → DIL enabled ✓📊 Impact Assessment
Server Impact
AI Assistant Impact
codeql_query_compilenow honors flag precedence correctly🔄 Deployment Strategy
Rollout Considerations
Update Methodology: This update follows best practices: