Skip to content

Java: Address testFailures in inline expectations tests#22077

Open
geoffw0 wants to merge 4 commits into
github:mainfrom
geoffw0:javainline
Open

Java: Address testFailures in inline expectations tests#22077
geoffw0 wants to merge 4 commits into
github:mainfrom
geoffw0:javainline

Conversation

@geoffw0

@geoffw0 geoffw0 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Address testFailures in inline expectations tests. Annotations should always be updated so that the testFailures section of the .expected file is empty.

These particular testFailures have been around for a while and have evolved a bit as changes were made. My interpretation is that we just got into a bad habit of not updating the annotations, or perhaps didn't understand how to do so correctly where several queries are run on the same test source (which can be fiddly). i.e. I don't think we've uncovered any surprising issues here.

@geoffw0 geoffw0 added the Java label Jun 29, 2026
@geoffw0 geoffw0 requested a review from a team as a code owner June 29, 2026 08:40
Copilot AI review requested due to automatic review settings June 29, 2026 08:40
@geoffw0 geoffw0 added the no-change-note-required This PR does not need a change note label Jun 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR cleans up long-standing inline-expectations mismatches in the Java experimental “quantum” query tests by updating inline annotations so that the postprocess-generated testFailures result set is empty, allowing the testFailures section to be removed from the .expected files.

Changes:

  • Updated inline expectation markers (// $ Source[...], // $ Alert[...], // $ SPURIOUS: ...) to correctly match the emitted results, including query-scoped tags where multiple .qlref tests share the same Java source file.
  • Removed stale testFailures sections from affected .expected files now that the annotations align with the actual query results.
  • Adjusted alert/source marker placement to the correct lines for matching (for example, moving an Alert marker to the line where the problem is actually reported).
Show a summary per file
File Description
java/ql/test/experimental/query-tests/quantum/examples/WeakOrUnknownKDFIterationCount/WeakKDFIterationCount.expected Removes obsolete testFailures section after annotation alignment.
java/ql/test/experimental/query-tests/quantum/examples/WeakOrUnknownKDFIterationCount/UnknownKDFIterationCount.expected Removes obsolete testFailures section and normalizes expected output after annotation alignment.
java/ql/test/experimental/query-tests/quantum/examples/WeakOrUnknownKDFIterationCount/Test.java Updates inline markers to be query-scoped and places Alert on the correct line.
java/ql/test/experimental/query-tests/quantum/examples/InsecureOrUnknownNonceSource/InsecureIVorNonceSource.java Adds a query-scoped Source marker for the static-IV case to match the path-problem source.
java/ql/test/experimental/query-tests/quantum/examples/InsecureOrUnknownNonceSource/InsecureIVorNonceSource.expected Removes obsolete testFailures section after annotation alignment.
java/ql/test/experimental/query-tests/quantum/examples/BadMacUse/BadMacUse.java Scopes Source/Alert markers per query and marks known false positives as SPURIOUS.
java/ql/test/experimental/query-tests/quantum/examples/BadMacUse/BadMacOrderMacOnEncryptPlaintext.expected Removes obsolete testFailures section after annotation alignment.
java/ql/test/experimental/query-tests/quantum/examples/BadMacUse/BadMacOrderDecryptToMac.expected Removes obsolete testFailures section after annotation alignment.
java/ql/test/experimental/query-tests/quantum/examples/BadMacUse/BadMacOrderDecryptThenMac.expected Removes obsolete testFailures section after annotation alignment.

Review details

  • Files reviewed: 9/9 changed files
  • Comments generated: 0
  • Review effort level: Low

@owen-mc

owen-mc commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Looks good to me. I'll give @github/ps-codeql a week to review before I approve, in case they have more insight from having written these tests.

@geoffw0

geoffw0 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

Sounds good to me. @github/ps-codeql I'm happy to answer your questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Java 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.

3 participants