Repository navigation
fix(ci): keep JVM warnings out of codeql test JSON reports (stacked on #240) - #242
Merged
Merged
Conversation
Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
…trings
getImportStringFrom compared the config file's dotted path against
Import.getImportString() with matches("%" + importString). That non-equality
string join gives the optimizer nothing to bind on, and with CodeQL 2.27.3
(github/codeql codeql-cli/v2.27.3) it planned a cartesian product of ~33k
import tuples with the 15M-row locations_default relation, filling the runner
disk.
Materialize the config's dotted-path suffixes in a pragma[nomagic] helper and
join on string equality instead.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…anches hotspots-ci.yml only triggers for PRs targeting main, so a PR stacked on chore/update-codeql-cli-* would get no hotspots signal. Drop this commit before merging the fix into the bump branch. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
`ci.yml` redirects each `codeql test run --format=json` process's stdout straight into `test_report_slice_N_of_4.json`. The JVM prints its own warnings to stdout too, so a stray line such as [0.001s][warning][perf,memops] Cannot use file /tmp/hsperfdata_runner/2405 because it is locked by another process (errno = 11) ahead of the JSON made `jq` fail in "Validate test results" even though every test passed. Four JVMs start at the same instant per language job, which makes the per-PID hsperfdata file collision possible. 1. Pass `-J=-XX:-UsePerfData` to `codeql test run` so the JVM never creates those files. 2. In "Validate test results", drop anything before the opening `[` of each report before running `jq`, emit a warning when something was dropped, and still fail if the remainder is not valid JSON. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The stacked PR has no reported end-to-end CI checks exercising the modified CodeQL invocation and report validation.
No open issues 🎉
What changed in this PR
This PR hardens CodeQL CI report handling against JVM warnings that can corrupt JSON output and fail validation despite passing tests.
Changes:
- Disables JVM performance-data files for
codeql test runto prevent the observed lock warning. - Removes leading output before the report’s array opener, emits a warning when output is removed, and retains JSON and test-failure validation.
| File | Description |
|---|---|
.github/workflows/ci.yml |
Updates the CodeQL JVM option and sanitizes reports before validation. |
Review effort: Balanced
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.
Stacked on #240 (which is stacked on #238). Base is
felickz-hotspots-oom-codeql-2-27-3, so the diff here is only theci.ymlchange.Problem
On the #240 CI run, all 13
compile-and-testjobs passed and every reported test passed, but "Validate test results" failed withjq: parse error: Invalid numeric literal at line 1, column 8.The bad file was
javascript-test-results/test_report_slice_1_of_4.json. Its first line was a JVM warning, not JSON:ci.ymlstarts fourcodeql test run --format=jsonprocesses at once and redirects each one's stdout directly into its report file. The JVM writes its own warnings to stdout too, so anything it prints ahead of the JSON corrupts the report. I scanned the test reports from 6 recent CI runs (about 150 files) and this was the only polluted one, so it is rare, but nothing in the workflow tolerates it.Changes
-J=-XX:-UsePerfDatato thecodeql test runcommand. This stops the JVM from creating the per-PID/tmp/hsperfdata_<user>/<pid>file whose lock collided. The CLI accepts-J=<opt>(confirmed locally).[of each report (a lone[, or[]for an empty report) before runningjq. A::warning::is emitted when something was dropped, and the step still fails if the remainder is not valid JSON or contains a failing test.Testing
I ran the exact validate step from the workflow file under bash against sample reports:
[]reportThe
-Jflag was only checked for CLI acceptance. Its effect oncodeql test runis exercised by this PR's own CI run.Notes
mainon its own.ci.ymlonly triggers for PRs targetingmain. See the check status on this PR to confirm whether it runs when stacked.