Skip to content

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

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

svcnemo-autobot wants to merge 4 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 <[email protected]>
@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
Contributor

/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 <[email protected]>
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

/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 <[email protected]>
@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Sep 14, 2026
@yaoyu-33 yaoyu-33 added the complexity:low Localized change in one scope with a small, straightforward review surface label Sep 15, 2026
yaoyu-33
yaoyu-33 previously approved these changes Sep 19, 2026
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

/ok to test 0c6fe17

The branch base (d81b5da) and the merge resurrected two unit-test files
that upstream main had already deleted:

- test_decorators.py: asserts the experimental decorator prints to stdout
  (capsys .out); upstream now emits the warning on stderr via rich, so
  test_experimental_warns_then_returns_result fails deterministically.
- test_sandbox_utils.py: orphaned; nothing imports it.

Both are absent from the merge base and from current main. Removing them
restores the PR to only its intended change (the synthetic-merge-vs-main CI
gate) on top of main.

Signed-off-by: svcnemo-autobot <[email protected]>
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

/ok to test c8ea729

@github-actions github-actions Bot removed the sla:triage-overdue Review assignment is over the one-business-day SLA label Sep 21, 2026
@yaoyu-33
yaoyu-33 marked this pull request as draft November 18, 2026 01:54
@yaoyu-33

Copy link
Copy Markdown
Contributor

We’re doing some cleanup of the open PR list. This PR has had no activity for over a month, so I’ve moved it back to draft.

If this change is still needed, please resolve any merge conflicts and mark the PR ready for review again when it’s ready to merge. Thanks!

@ko3n1g ko3n1g closed this Nov 18, 2026

This branch was previously deployed

1 inactive deployment
public — c8ea729f Deployed Sep 19, 2026 by copy-pr-bot[bot] via release / finalize / notify #3255
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 complexity:low Localized change in one scope with a small, straightforward review surface needs-review PR is ready for code review and waiting on a reviewer Run CICD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants