Repository navigation
Conversation
This was referenced Jul 4, 2026
yihua
force-pushed
the
ci-patch-coverage-gate
branch
2 times, most recently
from
July 7, 2026 01:29
78f5fd1 to
8eea756
Compare
yihua
marked this pull request as ready for review
July 30, 2026 19:44
hudi-agent
reviewed
Jul 30, 2026
hudi-agent
left a comment
Contributor
There was a problem hiding this comment.
No reviewable code files in this PR.
cc @yihua
Add a Patch Coverage workflow that runs after Java CI uploads coverage to Codecov, reads the PR's changed-line (diff) coverage from the Codecov API, and posts a failing commit status when it is below 80%. This enforces test coverage on new and modified code without penalizing a PR for the repository's existing overall coverage. Docs/config/test-only PRs with no measurable changed source lines pass automatically.
- Poll the Codecov commit endpoint until state=complete and the session count stops growing before reading diff coverage, so the gate does not score a partially-merged report from the multi-job CI matrix and fail PRs spuriously. Fail open if Codecov never settles within the budget. - Post (and update in place) a patch-coverage report comment on the open PR so the result is visible before merging, in addition to the coverage/patch commit status.
Switch the trigger from workflow_run to pull_request so the guard runs on the PR itself (including the PR that introduces it), instead of loading the definition from the default branch. The job's own pass/fail is the gate and the result is written to the run summary, so it works for fork PRs where the token is read-only; the PR comment is posted best-effort on top. Skips immediately when no main-source (.java/.scala) lines changed, and waits for Codecov to finish aggregating the CI matrix uploads before scoring.
The gate runs concurrently with Java CI and Codecov reports state=complete after every individual upload, so scoring on state+session-stability alone could read a 1-session partial report and fail spuriously (observed: 0% patch coverage while the coverage-producing test jobs were still running). First block until the Java CI run for this head SHA is completed (all uploads submitted), then require Codecov's session count to hold steady across consecutive polls before reading diff coverage. Bump the budget to cover the full matrix plus Codecov merge.
yihua
force-pushed
the
ci-patch-coverage-gate
branch
from
September 10, 2026 18:08
8eea756 to
cc123a9
Compare
hudi-agent
reviewed
Sep 10, 2026
hudi-agent
left a comment
Contributor
There was a problem hiding this comment.
No reviewable code files in this PR.
cc @yihua
Collaborator
This branch has not been deployed
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.
Describe the issue this Pull Request addresses
There is no CI gate on the test coverage of the code a PR changes. Overall project coverage is tracked in Codecov, but a PR can add or modify code with little or no test coverage and still pass CI. This adds an enforceable minimum on changed-line (patch) coverage, evaluated and reported on the PR itself before merge.
Summary and Changelog
Adds a new
Patch CoverageGitHub Actions workflow (.github/workflows/patch_coverage.yml):pull_request: opened / synchronize / reopened), so it evaluates the PR's own changed-line coverage and reports on the PR before merge..java/.scalalines, so docs/config/test-only PRs are not blocked and do not wait on CI.state=completeand the session count stops growing), then reads the changed-line (diff) coverage. This avoids scoring a partially merged report from the multi-job matrix and failing PRs spuriously. If Codecov does not settle within the time budget it fails open.MIN_PATCH_COVERAGEenv var.Notes:
pull_requestruns from forks; in that case the result is still shown via the check and the run summary (the comment is skipped).coverage.status.patchtarget in.codecov.yml; this workflow is used instead so the gate is a first-class GitHub Actions check..codecov.ymlis intentionally left untouched here to avoid conflicting with the in-flight Codecov config modernization.Patch Coveragecheck to branch protection required checks (separate repo-admin step).Impact
CI-only. Adds one job per pull request that changes main source. No change to build or test behavior. Becomes a merge blocker only if the check is marked required in branch protection.
Risk Level
low. New workflow only; no existing workflow or build step is modified. It fails open if Codecov is unavailable, and does not alter test execution.
Documentation Update
none
Validation
Validated end-to-end against two throwaway PRs (both closed), each carrying this workflow plus a small hudi-utilities probe:
An earlier iteration scored while CI was still running (Codecov reported
state=completeafter a single upload), reading a partial 0% and failing #19174 spuriously; the workflow now waits for the Java CI run to complete and for the Codecov session count to stabilize before scoring.Contributor's checklist