Skip to content

ci: stop hashFiles() from failing jobs whose tests passed - #6003

Merged
renecannao merged 1 commit into
GH-Actionsfrom
ci/fix-coverage-hashfiles
Aug 9, 2026
Merged

ci: stop hashFiles() from failing jobs whose tests passed#6003
renecannao merged 1 commit into
GH-Actionsfrom
ci/fix-coverage-hashfiles

Conversation

@renecannao

@renecannao renecannao commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Problem

CI-basictests failed on a run where every test passed:

SUMMARY: ret_rc = [0, 0, 0]
##[error]The template is not valid. System.InvalidOperationException:
hashFiles('proxysql/ci_infra_logs/**/coverage-report/*.info') failed.
Fail to hash files under directory '/home/ci/_work/proxysql/proxysql'

#5995 added that guard to ci-basictests, ci-legacy-g2 and ci-taptests-pgsql-cluster.

Why it breaks here but not on the g9 workflows

The same expression already exists in ci-mysql84-g9.yml and works, so the expression alone isn't the problem — the runner is:

workflow runs-on workspace in logs
ci-mysql84-g9 ubuntu-22.04 (GitHub-hosted, ephemeral) /home/runner/work/...
these three resolved dynamically → self-hosted /home/ci/_work/...

On a self-hosted runner the workspace persists between runs, and the test containers leave ci_infra_logs root-owned. hashFiles() walks the tree to evaluate the glob, hits EACCES and throws instead of returning '' — note the message is "Fail to hash files under directory", a traversal failure, not a no-match. A throw inside an if: invalidates the template, so the job is marked failed after a completely green run. That's a false red, and false reds hide real ones.

Compounding it: Fix artifact permissions was gated failure() && !cancelled(), so on a passing run nothing ever chowned ci_infra_logs — exactly the case that broke.

Fix

Per workflow:

  • Replace the hashFiles() guard with a shell probe ([ -r <file> ]) exposed as a step output. A readability test cannot throw. It also checks the exact file the upload consumes — the old guard globbed ** across the whole log tree, which is both wider than needed and what made it walk unreadable directories.
  • Relax Fix artifact permissions to !cancelled(), so the tree is always readable before anything walks it — and, on a persistent runner, isn't inherited root-owned by the next job.

Verification and limits

All three files validate as YAML, and the probe path equals the upload path in each.

Not verified end to end: I can't inspect the self-hosted runner's filesystem, so the EACCES step is inference from the error wording plus the hosted/self-hosted split. What is established: #5995 introduced the expression, the tests passed, and the job died evaluating it. The shell probe removes the failure mode regardless of the precise trigger, because it cannot throw.

Summary by CodeRabbit

  • Chores
    • Improved automated test workflow reliability across supported test configurations.
    • Coverage reports are now detected more consistently before reporting or uploading.
    • Build artifacts receive the required permissions whenever workflows complete without cancellation, improving access to generated results.

CI-basictests failed on a run where every test passed:

    SUMMARY: ret_rc = [0, 0, 0]
    ##[error]The template is not valid. System.InvalidOperationException:
    hashFiles('proxysql/ci_infra_logs/**/coverage-report/*.info') failed.
    Fail to hash files under directory '/home/ci/_work/proxysql/proxysql'

#5995 added that guard to ci-basictests, ci-legacy-g2 and
ci-taptests-pgsql-cluster. The same expression already existed in the g9
workflows and works there, so the expression alone is not the problem -- the
runner is. Those workflows pin 'runs-on: ubuntu-22.04' (GitHub-hosted,
ephemeral, /home/runner/work); these three resolve the runner dynamically and
can land on a self-hosted one (/home/ci/_work), where the workspace PERSISTS
between runs and the test containers leave ci_infra_logs root-owned.

hashFiles() walks the tree to evaluate the glob. On that tree it hits EACCES and
THROWS rather than returning '' -- note the message is "Fail to hash files under
directory", a traversal failure, not a no-match. A throw inside an 'if:' makes
the template invalid, so the job is marked failed after a completely green test
run. That is a false red, and it hides real ones.

Fixes, per workflow:

  - Replace the hashFiles() guard with a shell probe ('[ -r <file> ]') exposed as
    a step output. A readability test cannot throw. It also checks the EXACT file
    the upload step consumes; the old guard globbed '**' across the whole log
    tree, which is both wider than needed and what made it walk unreadable
    directories in the first place.
  - Relax 'Fix artifact permissions' from 'failure() && !cancelled()' to
    '!cancelled()'. On a PASSING run nothing chowned ci_infra_logs, which is
    exactly the case that broke -- and on a persistent runner that root-owned
    tree is inherited by the next job.

Not verified end to end: I cannot inspect the self-hosted runner's filesystem, so
the EACCES step is inference from the error wording plus the hosted/self-hosted
split. What is established is that #5995 introduced the expression, the tests
passed, and the job died evaluating it. The shell probe removes the failure mode
regardless of which of those is the precise trigger, since it cannot throw.

All three files validate as YAML and the probe path matches the upload path in
each.
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0048abb0-ee60-4f9e-8e58-fb47286e0225

📥 Commits

Reviewing files that changed from the base of the PR and between 51ca379 and 8320713.

📒 Files selected for processing (3)
  • .github/workflows/ci-basictests.yml
  • .github/workflows/ci-legacy-g2.yml
  • .github/workflows/ci-taptests-pgsql-cluster.yml
📜 Recent review details
🔇 Additional comments (3)
.github/workflows/ci-basictests.yml (1)

257-257: LGTM!

Also applies to: 295-318

.github/workflows/ci-legacy-g2.yml (1)

255-255: LGTM!

Also applies to: 283-306

.github/workflows/ci-taptests-pgsql-cluster.yml (1)

219-219: LGTM!

Also applies to: 240-263


📝 Walkthrough

Walkthrough

Three CI workflows now run artifact-permission fixes for every non-cancelled execution. Coverage handling checks the expected report directly and uses the detection result for missing-report and Codecov-upload steps.

Changes

CI workflow updates

Layer / File(s) Summary
Artifact permission conditions
.github/workflows/ci-basictests.yml, .github/workflows/ci-legacy-g2.yml, .github/workflows/ci-taptests-pgsql-cluster.yml
Artifact-permission steps now run when jobs are not cancelled, including successful and failed executions.
Coverage file detection and reporting
.github/workflows/ci-basictests.yml, .github/workflows/ci-legacy-g2.yml, .github/workflows/ci-taptests-pgsql-cluster.yml
Each workflow checks the exact readable coverage report. Missing-report and Codecov-upload steps use the detection output instead of hashFiles() checks.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Poem

A rabbit checks the report path,
Then guards each upload on its truth.
No cancelled job is left behind,
Permissions run in every booth.
CI hops onward, neat and bright.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preventing hashFiles() errors from failing jobs after tests pass.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/fix-coverage-hashfiles

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@renecannao
renecannao merged commit 9ed9a29 into GH-Actions Aug 9, 2026
1 check passed
@sonarqubecloud

sonarqubecloud Bot commented Aug 9, 2026

Copy link
Copy Markdown

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