Skip to content

Shared: Adjust semantics of optional inline expectation tags#21772

Open
hvitved wants to merge 1 commit intogithub:mainfrom
hvitved:inline-test-optional
Open

Shared: Adjust semantics of optional inline expectation tags#21772
hvitved wants to merge 1 commit intogithub:mainfrom
hvitved:inline-test-optional

Conversation

@hvitved
Copy link
Copy Markdown
Contributor

@hvitved hvitved commented Apr 29, 2026

Before this PR, inline expectation comments with optional tags were simply ignored, which is most likely not what was intended.

With this PR, inline expectation comments with optional tags are instead checked, meaning there must be an accompanying actual result. The converse, however, is not checked (which is what makes the comment optional).

@hvitved hvitved force-pushed the inline-test-optional branch from 7429434 to 79baaad Compare April 29, 2026 09:33
@hvitved
Copy link
Copy Markdown
Contributor Author

hvitved commented Apr 29, 2026

@hvitved hvitved added the no-change-note-required This PR does not need a change note label Apr 29, 2026
@hvitved hvitved marked this pull request as ready for review April 29, 2026 11:22
@hvitved hvitved requested a review from a team as a code owner April 29, 2026 11:22
Copilot AI review requested due to automatic review settings April 29, 2026 11:22
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

Adjusts the inline-expectations test harness so that “optional tag” annotations on expectations are no longer ignored, and are instead validated against actual results (while keeping the optionality asymmetric for results).

Changes:

  • Treat expectation comments with optional tags as requiring a matching actual result.
  • Introduce an ignoreTag hook to allow tests to explicitly ignore expectations for certain tags.
Show a summary per file
File Description
shared/util/codeql/util/test/InlineExpectationsTest.qll Updates optional-tag semantics, adds an ignore-tag hook, and updates related documentation/comments.

Copilot's findings

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

Comment on lines +150 to +154
* Holds if expectations marked with `expectedTag` are optional.
*
* An expectation with an optional tag acts as a normal expectation, meaning that there
* must be a matching result. In contrast, a result with an optional tag does not require
* a matching expectation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants