Skip to content

Exclude exit nodes from Java PrintCFG query for deterministic test ou…#23

Merged
data-douser merged 1 commit intomainfrom
dd/fix-java-printcfg-test
Feb 7, 2026
Merged

Exclude exit nodes from Java PrintCFG query for deterministic test ou…#23
data-douser merged 1 commit intomainfrom
dd/fix-java-printcfg-test

Conversation

@data-douser
Copy link
Copy Markdown
Collaborator

This pull request updates the PrintCFG tool to produce deterministic output by excluding exit-related control flow graph (CFG) nodes, whose ordering was previously non-deterministic across CodeQL CLI versions. The test expectations have been updated accordingly to match the new output.

Outline of Changes

Deterministic Output Improvements:

  • Added a new isExitNode predicate in PrintCFG.ql to identify exit-related CFG nodes, and updated the nodes and edges query predicates to exclude these nodes from the output. This ensures consistent output regardless of CodeQL CLI version.

Test Updates:

  • Updated the PrintCFG.expected test file for Example1.java to remove all lines referencing "Normal Exit", "Exceptional Exit", and "Exit" nodes, aligning the test expectations with the new deterministic output. [1] [2] [3] [4] [5]

@data-douser data-douser self-assigned this Feb 7, 2026
@data-douser data-douser requested review from a team and enyil as code owners February 7, 2026 04:36
Copilot AI review requested due to automatic review settings February 7, 2026 04:36
@data-douser data-douser added the bug Something isn't working label Feb 7, 2026
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 updates the Java PrintCFG CodeQL tool query to make its output deterministic across CodeQL CLI versions by excluding exit-related CFG nodes (whose relative ordering can vary), and aligns the corresponding golden test output with the new behavior.

Changes:

  • Add an isExitNode predicate to identify and filter out exit-related CFG nodes.
  • Update the nodes and edges query predicates to exclude exit nodes from graph output.
  • Update PrintCFG.expected for Example1.java to remove “Normal Exit”, “Exceptional Exit”, and “Exit” node expectations.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
server/ql/java/tools/src/PrintCFG/PrintCFG.ql Excludes exit-related CFG nodes/edges to stabilize graph output ordering across CLI versions.
server/ql/java/tools/test/PrintCFG/PrintCFG.expected Updates expected graph output to match the new filtered CFG output.

@data-douser data-douser added this pull request to the merge queue Feb 7, 2026
Merged via the queue into main with commit b69e7c6 Feb 7, 2026
27 checks passed
@data-douser data-douser deleted the dd/fix-java-printcfg-test branch February 7, 2026 05:27
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