Shared CFG: check abrupt completion origins - #22423
Draft
yoff wants to merge 1 commit into
Draft
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds shared CFG validation ensuring language-supplied abrupt completions originate from their associated in/additional node.
Changes:
- Registers
invalidAbruptCompletionOriginin CFG consistency checks. - Adds generated regression coverage for Java, C#, and Python consumers.
Show a summary per file
| File | Description |
|---|---|
shared/controlflow/codeql/controlflow/ControlFlowGraph.qll |
Implements and registers the consistency check. |
python/ql/test/library-tests/ControlFlow/successors/InvalidAbruptCompletionOrigin.ql |
Adds Python validation. |
python/ql/test/library-tests/ControlFlow/successors/InvalidAbruptCompletionOrigin.expected |
Records expected Python results. |
java/ql/test/library-tests/controlflow/basic/InvalidAbruptCompletionOrigin.ql |
Adds Java validation. |
java/ql/test/library-tests/controlflow/basic/InvalidAbruptCompletionOrigin.expected |
Records expected Java results. |
csharp/ql/test/library-tests/controlflow/graph/InvalidAbruptCompletionOrigin.ql |
Adds C# validation. |
csharp/ql/test/library-tests/controlflow/graph/InvalidAbruptCompletionOrigin.expected |
Records expected C# results. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 7/7 changed files
- Comments generated: 0
- Review effort level: Balanced
Contributor
|
All of the added qltests and corresponding expected files are unnecessary, since this is a consistency query. |
yoff
marked this pull request as draft
August 25, 2026 13:14
Contributor
Author
|
Sorry, this was meant to be a draft. It is currently completely copilot, so I need to look it over. |
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.
Summary
invalidAbruptCompletionOriginto the shared CFG consistency checks;Input2::beginAbruptCompletionorigins, requiring each origin to be eithernode.isIn(ast)ornode.isAdditional(ast, _);consistencyOverviewand add generated overview tests for every current consumer: Java, C#, and Python.This intentionally does not inspect the shared library's combined private
beginAbruptCompletion, whose unmatched final catch-clause completion legitimately originates atisAfterValue.Motivation
This follows the consistency-check suggestion from review of #22380: #22380 (comment). The change is independent of #22380 and contains no Python-specific CFG behavior change.
Validation
codeql query compile --search-path=. java/ql/consistency-queries/CfgConsistency.ql csharp/ql/consistency-queries/CfgConsistency.ql python/ql/consistency-queries/CfgConsistency.qlcodeql test run --search-path=. --consistency-queries java/ql/consistency-queries -- java/ql/test/library-tests/controlflow/basic— 28 tests passedcodeql test run --search-path=. --consistency-queries csharp/ql/consistency-queries -- csharp/ql/test/library-tests/controlflow/graph— 13 tests passedcodeql test run --search-path=. --consistency-queries python/ql/consistency-queries -- python/ql/test/library-tests/ControlFlow/successors— 7 tests passedNo invalid abrupt-completion origins or unrelated expected-output churn were found in the three consuming languages.