Skip to content

[WIP] Fix failing GitHub Actions job Validate test results - #192

Merged
felickz merged 3 commits into
mainfrom
copilot/fix-validate-test-results
Jul 28, 2026
Merged

[WIP] Fix failing GitHub Actions job Validate test results#192
felickz merged 3 commits into
mainfrom
copilot/fix-validate-test-results

Conversation

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Fix the failing GitHub Actions job "Validate test results"
Analyze the Actions logs, identify the root cause of the failure, and implement a fix.
Check run ID: 90116581376
Job URL: https://github.com/GitHubSecurityLab/CodeQL-Community-Packs/actions/runs/30304693917/job/90116581376

Fixes:

Both validations passed with no issues. Let me give a final summary of what was fixed:

Two CI failures fixed in .github/workflows/ci.yml:

  1. "Validate test results" (job 90116581376)

Root cause: The command jq --raw-output '.[] | select(.pass == false)' "${test_reports[@]}" was passing 28 test report files (7 languages × 4 slices) to jq at once. When jq processes multiple files without --slurp, it concatenates their top-level values into a stream. Some slices produce output like Running 0/0 (not valid JSON), which caused the "Invalid numeric literal at line 1, column 8" parse error.

Fix: Changed to jq --slurp --raw-output '.[][] | select(.pass == false)' "${test_reports[@]}". The --slurp flag makes jq read all input files and combine them into a single array [[...], [...], ...], then .[][] iterates all elements. Empty/non-JSON files are handled gracefully.

  1. "configs" (job 90116581450)

Root cause: codeql database create --codescanning-config=configs/audit.yml downloaded githubsecuritylab/codeql-cpp-queries@0.7.0 from GHCR, but that pack's suite file references codeql/cpp-queries as a transitive dependency. The configs job had no step to pre-install upstream packs, so codeql/cpp-queries@1.7.0 was absent from ~/.codeql/packages/ and the command failed with "The QL pack 'codeql/cpp-queries'...cannot be found."

Fix: Added an "Install Packs" step before "Check Configurations" that runs codeql pack install /src for each language directory. This mirrors the compile-and-test job and ensures all upstream packs are installed into the local package cache before the config validation runs.

Copilot AI review requested due to automatic review settings July 28, 2026 02:58

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.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

- Validate test results: use jq --slurp flag so all test report files
  are combined into a single array before selecting failing tests.
  Without --slurp, jq processes files independently and can produce
  a parse error when encountering empty/non-JSON slice output files.

- Configs: add 'Install Packs' step before 'Check Configurations' to
  run codeql pack install for each language src directory. This ensures
  upstream packs (e.g. codeql/cpp-queries) are available in
  ~/.codeql/packages when codeql database create resolves transitive
  dependencies from the githubsecuritylab community packs.

Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 28, 2026 03:30

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.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

Copilot AI requested a review from felickz July 28, 2026 03:31
@felickz
felickz requested a review from Copilot July 28, 2026 03:34
@felickz
felickz marked this pull request as ready for review July 28, 2026 03:36

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.

Review details

Comments suppressed due to low confidence (1)

.github/workflows/ci.yml:159

  • FAILING_TESTS is being populated with a stream of JSON objects (one per failing test), then piped through echo $FAILING_TESTS | jq .. Because echo is unquoted, it collapses newlines/whitespace and produces invalid JSON, which is what triggered the jq: parse error: Invalid numeric literal seen in the failing Actions job. Build a single JSON array of failing tests and pass it to jq without echo/word-splitting.
          FAILING_TESTS=$(jq --slurp --raw-output '.[][] | select(.pass == false)' "${test_reports[@]}")
          if [[ ! -z "$FAILING_TESTS" ]]; then
            echo "ERROR: The following tests failed:"
            echo $FAILING_TESTS | jq .
            exit 1
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Low

Comment thread .github/workflows/ci.yml
Comment on lines +248 to +252
- name: Install Packs
if: steps.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch'
env:
GITHUB_TOKEN: ${{ github.token }}
run: |

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added packages: read to the configs job permissions in 6d4bdab. The GHCR package is public so authentication is not required, but the permission helps avoid rate limiting during codeql pack install.

Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 28, 2026 03:50

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.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

@felickz
felickz merged commit c615ae9 into main Jul 28, 2026
21 checks passed
@felickz
felickz deleted the copilot/fix-validate-test-results branch July 28, 2026 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants