[UPDATE PRIMITIVE] Refresh rust PrintAST/PrintCFG .expected to match macro-expanded output#270
Merged
enyil merged 1 commit intocodeql/upgrade-to-v2.25.3from May 4, 2026
Conversation
Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/beb1ad8c-da44-4beb-8483-c2b6d9e1f2b7 Co-authored-by: enyil <87337678+enyil@users.noreply.github.com>
data-douser
added a commit
that referenced
this pull request
May 4, 2026
* Upgrade CodeQL CLI dependency to v2.25.3 * Fix upgrade-packs.sh to actually refresh pack lock files Previously, codeql pack upgrade was a no-op for packs with pinned codeql/<lang>-all dependencies because the existing pin already satisfied the constraint. This left codeql-pack.lock.yml files unchanged across CLI bumps, even though newer compatible library pack versions were available. The fix temporarily rewrites the pinned dependency to a wildcard before running codeql pack upgrade, then restores the manifest and pins it to the version resolved into the lock file. Also regenerates all pack lock files and re-pins manifests against CodeQL CLI v2.25.3, and refreshes ruby/rust/swift PrintAST/PrintCFG .expected files for benign output ordering and library behavior changes introduced by the upgraded codeql/*-all packs. * Skip update-codeql cron run when upgrade branch already exists Adds a 'check-existing-branch' job that runs after detect-update and gates the create-pr job. On scheduled (cron) runs, if the target 'codeql/upgrade-to-vX.Y.Z' branch already exists on origin, the rest of the pipeline is skipped so peter-evans/create-pull-request does not force-push over reviewer commits or follow-up fixes (such as manually-applied lock-file refreshes). The check is bypassed on workflow_dispatch so a maintainer can always force a refresh by re-running the workflow manually. * Refresh rust PrintAST/PrintCFG expected with rust toolchain installed CI runs query unit tests with install-language-runtimes: true, which makes rustc/cargo available to the rust extractor and causes println! and similar macros to be expanded to their stdlib internals was performed without rust installed locally, so the expected files captured the collapsed output and did not match CI. Re-learned with rustc 1.95.0 installed via rustup, matching the CI runner environment. * Refresh rust PrintAST/PrintCFG expected to match macro expansion output (#270) Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/beb1ad8c-da44-4beb-8483-c2b6d9e1f2b7 Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: enyil <87337678+enyil@users.noreply.github.com> --------- Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com> Co-authored-by: Nathan Randall <data-douser@github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: enyil <87337678+enyil@users.noreply.github.com>
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.
The
Query Unit Tests - rustjob was failing becauseserver/ql/rust/tools/test/PrintAST/PrintAST.expectedandPrintCFG/PrintCFG.expecteddid not include thegetMacroCallExpansion()subtrees that the rust extractor emits when a Rust toolchain is available (as in CI viainstall-language-runtimes: true). A previous refresh attempt captured only a partial expansion.📝 Update Information
Primitive Details
rustPrintAST / PrintCFG queries✅ Only
.expectedtest fixtures underserver/ql/rust/tools/test/are touched.🛑 MANDATORY PR VALIDATION CHECKLIST
Update Metadata
🎯 Changes Description
Current Behavior
CI runs the rust query unit tests with the Rust toolchain present, so
MacroCall.getMacroCallExpansion()resolves to expanded AST/CFG nodes (e.g.vec!,println!,format_args_nl!). The committed.expectedfiles only contained the unexpanded variant, soPrintASTandPrintCFGfailed withFAILED(RESULT).Updated Behavior
.expectedfiles now contain the fully macro-expanded AST/CFG output produced by the same query + extractor combination CI uses.Motivation
Unblock CI on the v2.25.3 upgrade branch.
🔄 Before vs. After Comparison
Functionality Changes
No query, schema, or output-format changes. Only
.expectedfixtures regenerated via:codeql test run --learn \ --additional-packs=server/ql/rust/tools \ -- server/ql/rust/tools/test/PrintAST \ server/ql/rust/tools/test/PrintCFGOutput Format Changes
Expected fixtures now include
getMacroCallExpansion()subtrees, e.g.:and CFG edges are corrected from
...::format_args_nl!...placeholders to the expandedFormatArgsExpr/ template-string targets.🧪 Testing & Validation
Test Results
codeql test runforserver/ql/rust/tools/test: 5/5 passed locally with rustc available, matching CI's environment.📋 Implementation Details
Files Modified
server/ql/rust/tools/test/PrintAST/PrintAST.expected(+105)server/ql/rust/tools/test/PrintCFG/PrintCFG.expected(+34/-4)Code Changes Summary
Dependencies
🔍 Quality Improvements
Bug Fixes
Query Unit Tests - rustjob failed onPrintAST.qlrefandPrintCFG.qlref..expectedregeneration was performed against an extractor run without macro expansion, so the fixtures lackedgetMacroCallExpansion()subtrees that CI consistently produces.codeql test run --learnwith the Rust toolchain installed locally, capturing the canonical expanded output..expectedregenerations for rust must be performed withrustc/cargoonPATH, equivalent toinstall-language-runtimes: truein CI.🚀 Compatibility & Migration
Backward Compatibility
👥 Review Guidelines
Testing Instructions
Requires
rustc/cargoonPATHto reproduce CI's macro expansion behavior.📊 Impact Assessment
Test fixtures only — no runtime, server, or AI-assistant impact.
🔄 Deployment Strategy
Update Methodology:
codeql test run --learnagainst the same extractor configuration as CI