Skip to content

fix(ci): AUT-2282 exact coverage gate + test PR heads against current main - #3338

Open
svcnemo-autobot wants to merge 2 commits into
NVIDIA-NeMo:mainfrom
svcnemo-autobot:fix/coverage-gate-precision
Open

svcnemo-autobot wants to merge 2 commits into
NVIDIA-NeMo:mainfrom
svcnemo-autobot:fix/coverage-gate-precision

Conversation

@svcnemo-autobot

Copy link
Copy Markdown
Contributor

Background

The full test suite failed on main (run 34703944848 at 1f478743e) with exact coverage 94.46%. Root cause: PR #3330 merged despite the 95% gate because (1) the gate compares at zero-decimal precision, so 94.97% rounded to 95% and passed, and (2) CI tested the stale PR head d9b2122 instead of the six-commits-advanced main, so the merged main state was never checked pre-merge.

What changed

  • pyproject.toml: set [tool.coverage.report] precision = 2 so fail_under compares the exact percentage — 94.97 < 95 now exits nonzero.
  • scripts/ci/merge_current_main.sh (new): on mirrored pull-request/* checkouts, merge current origin/main into the tested tree (--no-ff, no contributor branch rewrite); a conflict fails validation; no-op on any other ref.
  • .github/workflows/unit-tests.yml: run the merge step after every Test/server-suite checkout (fetch-depth: 0) and drop the github.event_name guard on force-run-all so full suites run whenever base-ref is empty.
  • tests/unit_tests/test_ci_environment.py: cover the merge-script semantics (synthetic-merge parents, no-op on non-mirrored refs), the workflow wiring (3 merge steps, 3 fetch-depth: 0), and the coverage config (precision == 2, fail_under == 95.0).

Details

flowchart LR
  A[PR checkout] --> B{refs/heads/pull-request/*?}
  B -- no --> N[test checked-out commit]
  B -- yes --> C[fetch origin/main]
  C --> D{main ancestor of HEAD?}
  D -- yes --> N
  D -- no --> E[merge --no-ff origin/main]
  E -- conflict --> F[fail validation]
  E --> G[test synthetic merge vs current main]
  G --> H[coverage precision=2, fail_under=95.0]
Loading

Tested

  • Signed commit d81b5dafd directly on current origin/main 1f478743e; remote head verified equal after push.
  • bash -n scripts/ci/merge_current_main.sh passes.
  • The managed nemo-gym unit:core-unit-tests row could not launch in the authoring environment: the platform checkpoint consumer rejected the materialized source with status 409 on two distinct checkpoint refs after healthy materialization convergence (pre-materialization infrastructure failure; no workload was ever allocated). Local pytest is unavailable (workstation image has no python3) and local git-fixture validation is blocked (its git build disallows file:// transport). GitHub checks remain authoritative and will run on this PR.

… against current main

PR NVIDIA-NeMo#3330 merged with exact coverage 94.97% because the 95% fail_under gate
rounded to 95% at zero-decimal precision, and CI tested the stale PR head
(d9b2122) instead of the six-commits-advanced main, so the merged main
state (94.46%) was never checked pre-merge.

- set [tool.coverage.report] precision = 2 so fail_under compares the
  exact percentage (94.97 < 95 now exits nonzero)
- add scripts/ci/merge_current_main.sh: on mirrored pull-request/*
  checkouts, merge current origin/main into the tested tree so every PR
  job validates the synthetic merge with current main; a conflict fails
  validation
- wire the merge step into every unit-tests.yml checkout and drop the
  github.event_name guard on force-run-all so full suites run when the
  base-ref is empty
- cover all of the above in tests/unit_tests/test_ci_environment.py

Signed-off-by: svcnemo-autobot <svcnemo-autobot@nvidia.com>
@svcnemo-autobot
svcnemo-autobot requested a review from a team as a code owner September 12, 2026 21:23
@copy-pr-bot

copy-pr-bot Bot commented Sep 12, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:ci CI workflows, test routing, and repository automation Run CICD labels Sep 12, 2026
@svcnvidia-nemo-ci

Copy link
Copy Markdown

/ok to test d81b5da

… guards, sandbox image rewrites

Raises exact coverage above the now-exact 95% gate (94.98% on the prior
head): covers nemo_gym.decorators.experimental, judge.py's JudgeError
passthrough and failsafe missing-body guard,
_verifier_runner's absolute-path and update_expected guards, and
sandbox/utils cpu_cap_env/rewrite_image.

Signed-off-by: svcnemo-autobot <svcnemo-autobot@nvidia.com>
@svcnvidia-nemo-ci

Copy link
Copy Markdown

/ok to test 6c5e69a

@yaoyu-33 yaoyu-33 added bug Something isn't working needs-review PR is ready for code review and waiting on a reviewer ci CI, automation, test queue, or workflow infrastructure work and removed bug Something isn't working labels Sep 12, 2026
kajalj22 added a commit that referenced this pull request Sep 14, 2026
## Background

The full test suite failed on `main` with exact coverage **94.46%**.
Root cause (per triage on PR #3330's merge): the coverage gate compares
at zero-decimal precision, so an actual **94.97%** rounded to 95% and
incorrectly passed the 95% gate before merge.

This PR addresses only that rounding gap. It intentionally excludes the
stale-PR-head / merge-current-main fix tracked separately in #3338, and
does not add tests to close the pre-existing coverage gap (a separate
concern).

## What changed

- `pyproject.toml`: set `[tool.coverage.report] precision = 2` so
`fail_under` compares the exact percentage — 94.97 < 95 now exits
nonzero.
- `tests/unit_tests/test_ci_environment.py`: assert `precision == 2` and
`fail_under == 95.0` in the coverage config.

## Note

With this change alone, the repo's aggregate coverage is still below
95%, so the coverage-gated CI job on this PR is expected to fail until
coverage is separately brought up. This PR only fixes the gate's
precision, not the underlying coverage shortfall.

## Test plan

- [x] `pytest tests/unit_tests/test_ci_environment.py` passes locally
- [x] `pre-commit run --files pyproject.toml
tests/unit_tests/test_ci_environment.py` passes
- [x] DCO sign-off on the commit

---------

Signed-off-by: Kajal Jain <kajalj@nvidia.com>
@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI workflows, test routing, and repository automation ci CI, automation, test queue, or workflow infrastructure work needs-review PR is ready for code review and waiting on a reviewer Run CICD sla:triage-overdue Review assignment is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants