yihua opened a new pull request, #19173:
URL: https://github.com/apache/hudi/pull/19173

   ### 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.
   
   ### Summary and Changelog
   
   Adds a new `Patch Coverage` GitHub Actions workflow 
(`.github/workflows/patch_coverage.yml`):
   
   - Triggers via `workflow_run` after the existing `Java CI` workflow 
completes, so all coverage from the test matrix has already been uploaded to 
Codecov (no extra test runs, no long-idle runner).
   - Resolves the PR from the CI run's head commit, reads the PR's changed-line 
(diff) coverage from the Codecov API, and posts a `coverage/patch` commit 
status.
   - Fails when changed-line coverage is below **80%**; passes at or above it. 
The threshold is a single `MIN_PATCH_COVERAGE` env var at the top of the 
workflow.
   - This gates only the lines a PR adds or modifies (patch coverage), not 
overall project coverage, so a PR is never penalized for the repository's 
existing coverage.
   - PRs with no measurable changed source lines (docs, config, test-only) 
report no diff coverage and pass automatically.
   
   To make this a merge gate, add the `coverage/patch` status to the branch 
protection required checks (separate repo-admin step).
   
   Notes:
   - `workflow_run` workflows execute the version on the default branch, so 
this gate takes effect for PRs opened after it merges (it does not run on this 
PR itself).
   - A lighter-weight native alternative is Codecov's own 
`coverage.status.patch` target in `.codecov.yml`; this workflow is used instead 
so the gate is a first-class GitHub Actions check and is independent of the 
Codecov app's status configuration. `.codecov.yml` is intentionally left 
untouched here to avoid conflicting with the in-flight Codecov config 
modernization.
   
   ### Impact
   
   CI-only. Adds one short post-CI job per pull request. No change to build or 
test behavior. Becomes a merge blocker only if the `coverage/patch` status is 
marked required in branch protection.
   
   ### Risk Level
   
   low. New workflow only; no existing workflow or build step is modified. It 
posts a commit status and fails the check on low patch coverage; it does not 
alter test execution.
   
   ### Documentation Update
   
   none
   
   ### Contributor's checklist
   
   - [ ] Read through [contributor's 
guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [x] Enough context is provided in the sections above
   - [x] Adequate tests were added if applicable
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to