Skip to content

ci: name the modules whose tests failed - #368

Merged
antonkri merged 5 commits into
mainfrom
ci/report-failed-modules
Sep 28, 2026
Merged

antonkri merged 5 commits into
mainfrom
ci/report-failed-modules

Conversation

@antonkri

Copy link
Copy Markdown
Contributor

quality_runners.py already records an exit code per module, but the job summary it renders only has the columns module, passed, failed, skipped, total. A module whose Bazel invocation aborted during analysis therefore appears as all zeroes - indistinguishable from one that simply has no tests, while failed actively claims zero failures.

In #355 that is what hid two broken modules:

module passed failed skipped total
score_config_management 0 0 0 0
score_logging 0 0 0 0

The data was there all along - the same run prints this to the log:

{'score_config_management': {'exit_code': 1, 'failed': 0, 'passed': 0, 'total': 0},
 'score_logging':           {'exit_code': 1, 'failed': 0, 'passed': 0, 'total': 0}, ...}

Changes

Status column. Derived from the exit code that is already collected:

module status passed failed skipped total
score_baselibs pass 24217 0 50 24267
score_config_management FAILED 0 0 0 0
score_logging FAILED 0 0 0 0

Annotations. GitHub renders these above the step list of the run, so the failing module is named without opening the log:

::error title=Unit tests failed::score_logging: bazel exited with 1 and produced no test results

Explicit closing block instead of the pprint dump, as the last output of the script:

  pass    score_baselibs              24217 passed,  50 skipped
  FAILED  score_config_management    bazel exit code 1, no results
  FAILED  score_logging              bazel exit code 1, no results
========QR: 2 of 8 MODULES FAILED: score_config_management, score_logging========

PR comment. The job summary is only reachable behind the Details link, so the conversation view of a PR showed nothing beyond test_and_docs - Failing after 45m. The summary is now mirrored into a single comment that is rewritten on every run, so a PR never accumulates more than one.

Coverage after a failed test run is skipped. genhtml reads the .dat file from a fixed location, which after a failed run still holds the data of the previously tested module. In #355 the coverage report published for score_config_management in fact contained score_time's numbers:

genhtml ... --output-directory=.../artifacts/coverage/cpp/score_config_management
Found common filename prefix "/home/runner/.bazel/external/score_time+/score/time"

Note on pull_request_target

The workflow checks out the PR branch, so the two summary files could be planted by a PR and would then be published to the job summary and the comment. The test step now removes them before running, so only the run itself can write them.

quality_runners.py already records an exit code per module, but the job
summary it renders uses the columns module/passed/failed/skipped/total.
A module whose bazel invocation aborted during analysis therefore shows
up as all zeroes - indistinguishable from one that simply has no tests,
and `failed` even claims zero failures. In #355 that hid two broken
modules behind these rows:

  | score_logging           | 0 | 0 | 0 | 0 |
  | score_config_management | 0 | 0 | 0 | 0 |

Add a status column, emit ::error annotations so GitHub names the module
above the step list of the run, and close the log with an explicit block
naming the failures instead of a pprint dump.

Mirror the summary into a single comment on the pull request, rewritten
on every run. The job summary is only reachable behind the "Details"
link, so the conversation view showed nothing beyond "test_and_docs -
Failing after 45m".

Also skip coverage extraction when the test run failed. genhtml reads
the .dat file from a fixed location, which after a failed run still
holds the previous module's data: the coverage report published for
score_config_management in #355 in fact contained score_time's numbers.
Skipping the extraction removed the module from the coverage table
entirely, which is silent in the same way the zero rows were. Emit a row
with status 'skipped' instead, and suppress the coverage annotation for
those, since the unit test annotation for the same module already names
the cause.

The run of #355 shows why the table cannot simply be trusted: the
coverage published for the two modules whose tests never ran was
character-identical to the module tested just before them.

  score_config_management_cpp  lines 90.8%  functions 84.4%  branches 67.1%
  score_time_cpp               lines 90.8%  functions 84.4%  branches 67.1%

  score_logging_cpp            lines 77.6%  functions 81.8%  branches 51.2%
  score_lifecycle_cpp          lines 77.6%  functions 81.8%  branches 51.2%
Markdown has no way to colour a table cell that survives both a GitHub
comment and the Sphinx build of the same file, so carry the colour in an
emoji and keep the word next to it for readers without emoji support.
@github-actions

Copy link
Copy Markdown

The created documentation from the pull request is available at: docu-html

Comment thread .github/workflows/test_and_docs.yml Outdated
Comment on lines +92 to +96
# pull_request_target checks out the PR branch, so these two files could
# be planted by the PR itself. They are published to the job summary and
# to a PR comment, so make sure nothing but this run can write them.
rm -f docs/verification_report/unit_test_summary.md \
docs/verification_report/coverage_summary.md

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.

those files should not be committed, if we will add rm in ci pipeline we could miss that they were edited manually.
imo it doesnt prevent the problem, manual review is probably best solution here

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.

Dropped in 4d11bf7 — and with it the reason it was there.

The summary is now assembled from the script's own data and appended to $GITHUB_STEP_SUMMARY directly, so nothing reads these two files back any more. A stale or hand-edited copy can no longer be mistaken for a result of the run, which is what the rm was guarding against.

On the files themselves you're right, and it's worth noting what is actually committed today: both are three-line placeholders (## Template for a table with Unit Test execution summary), untouched since #226, kept only so the toctree in platform_verification_report.rst resolves. Removing them means teaching the docs build to generate them or to tolerate their absence — a separate change I'd rather not fold into this PR. Happy to open an issue for it if you think it's worth tracking.

Comment thread .github/workflows/test_and_docs.yml Outdated
# Mirror it into a single comment on the pull request so that a failing module
# is named in the conversation itself. The comment is rewritten on every run
# instead of appended, so a PR never collects more than one of them.
- name: Comment test summary on pull request

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.

Im not a fan of adding comments, as they require token with write perm etc. and goal is to reduce that to minimum in the future.
I would prefer it to be added to SUMMARY via env vars.

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.

Removed in 4d11bf7. quality_runners.py now appends both tables to $GITHUB_STEP_SUMMARY itself, which also let the Publish build summary shell step go away — the data is already in memory at that point, so reading the files back was a detour.

One check on the wording: I read "added to SUMMARY via env vars" as the script writing to the file GITHUB_STEP_SUMMARY points at. If you meant keeping a shell step and passing the content through a variable instead, say so and I'll switch.

One factual note, since it matters for the wider goal rather than for this PR: pull-requests: write is already declared at lines 17, 40 and 173 and already in use — deploy-versioned-pages from cicd-workflows posts the docu-html comment on every PR using find-comment + create-or-update-comment. So the scope can't be dropped from this workflow until that one changes too. Your point about not adding a second consumer of it still stands, hence the change.

What stays visible without the comment: the ::error annotations name the failing modules above the step list of the run and in the Checks tab, so it's one click instead of zero — the conversation itself only shows test_and_docs — Failing.

…e PR

Review feedback: the pull-requests:write scope should not gain another
user, and the summary is better assembled where the data already exists.

The script now appends the two tables to GITHUB_STEP_SUMMARY directly, so
the shell step that cat'ed the files and the github-script step that
mirrored them into a pull request comment both go away. Nothing reads the
markdown files back any more - they are written purely for the
documentation build - which also removes the need to delete them up front.

The failing modules stay visible without opening the log: the ::error
annotations render above the step list of the run.
@antonkri
antonkri merged commit b93537e into main Sep 28, 2026
16 of 18 checks passed
@antonkri
antonkri deleted the ci/report-failed-modules branch September 28, 2026 11:36
srinivasugithub pushed a commit to bgsw-contrib/score_reference_integration that referenced this pull request Sep 30, 2026
…overage-dashboards

Resolve merge conflict in scripts/quality_runners.py by preserving both the status
column reporting and failure annotations from main (eclipse-score#368) alongside the code
coverage portal generation and interactive dashboard links.
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.

2 participants