Skip to content

[FIX]: correct GitHub commit status when test output files are missing#1091

Open
x15sr71 wants to merge 2 commits intoCCExtractor:masterfrom
x15sr71:fix/use-get-test-results-for-status-computation
Open

[FIX]: correct GitHub commit status when test output files are missing#1091
x15sr71 wants to merge 2 commits intoCCExtractor:masterfrom
x15sr71:fix/use-get-test-results-for-status-computation

Conversation

@x15sr71
Copy link
Copy Markdown
Contributor

@x15sr71 x15sr71 commented Apr 5, 2026

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.

My familiarity with the project is as follows (check one):

  • I have never used the project.
  • I have used the project briefly.
  • I have used the project extensively, but have not contributed previously.
  • I am an active contributor to the project.

Problem

progress_type_request() determined pass/fail for the GitHub commit status check using two raw SQL queries — one counting exit code mismatches, one counting non-null TestResultFile.got values. If the VM never wrote a TestResultFile row at all (missing output, failed mid-run), both counts return 0 and the platform posts a fake ✅ SUCCESS to GitHub even though no output was ever compared.

Fix

Replace the dual-query block with get_test_results(test) — already used by the test detail page, update_build_badge, and get_info_for_pr_comment. It correctly treats a missing row as an error:

if len(outputs) > 0:
    test_error = True  # output expected but never recorded → FAILURE

The result is also passed into update_build_badge() to avoid a redundant second call.

Changes — mod_ci/controllers.py only, no schema change:

  • Remove unused from sqlalchemy.sql.functions import count
  • update_build_badge(status, test)update_build_badge(status, test, test_results=None) — existing callers unaffected
  • Replace dual-query block with get_test_results + any(category['error'] for category in test_results)
Scenario Before After
Output correct
Output wrong
No output at all ✅ wrong ❌ correct

Bot PR comments and test detail UI were already using get_test_results — both unaffected.

@x15sr71 x15sr71 changed the title fix: correct GitHub commit status when test output files are missing [FIX]: correct GitHub commit status when test output files are missing Apr 5, 2026
@x15sr71 x15sr71 force-pushed the fix/use-get-test-results-for-status-computation branch from 329f2bd to edeeee7 Compare April 5, 2026 16:06
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 5, 2026

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.

1 participant