Repository navigation
test(tools): cover PR metadata error paths - #1613
Conversation
Check malformed events, missing draft state, and empty PR bodies through the validator CLI. Exercise the successful script entry point and assert its exit status and output. Signed-off-by: chaofengw <chaofengw@nvidia.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review. 📝 SummarySummaryAdded five regression cases in Production code, public APIs, dependencies, and artifact formats are unchanged. Architecture impact
Review outcome: PASS — no standards or spec violation was found in the reviewed evidence. This is not proof of correctness. Review finding counts are unavailable because no current review findings were supplied. The supplied objectives report 17 targeted tests passing and full statement and branch coverage for WalkthroughThe test suite now checks successful execution of ChangesMetadata validator tests
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Other Suggested reviewers: Merge Risk: ⚪ Minimal · up to The added PR metadata tests are ready to merge after normal checks. 🚥 Pre-merge checks | ✅ 8 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (8 passed)
Comment |
Background
The PR metadata validator's CLI error handling and successful script entry point lacked direct regression coverage. Add checks for malformed event JSON, missing pull-request metadata or draft state, and a null PR body.
Exit Criteria
tools/pr_metadata.py.Implementation
Add four parameterized invalid-event cases and one successful script-entry case in
tools/tests/test_pr_metadata.py. The tests use temporary event files, capture CLI output, and restoresys.argvthrough pytest's monkeypatch fixture. Production code, existing tests, coverage exclusions, dependencies, APIs, ABI, and artifact formats are unchanged.Change categories
Validation
Commands and Results
PYTHONPATH=. python3 -m coverage run --branch --source=tools.pr_metadata -m pytest -q tools/tests/test_pr_metadata.py: 17 passed, including five added cases.python3 -m coverage report -m: 109/109 statements and 34/34 branches covered, both 100%. Baseline coverage was 98/109 statements (89.9%) and 26/34 branches (76.5%); exclusions remain zero.python3 -m ruff check --config ruff.toml tools/tests/test_pr_metadata.py: passed.PYTHONPATH=core/builder:apps/benchmark:. python3 -m tools.model_ci validate: passed.PYTHONPATH=core/builder:apps/benchmark:. python3 tools/test_impact.py --validate: passed.git diff --check github/main...HEAD: passed.Hardware, Environment, and Revisions
CPU-only Linux x86_64; Python 3.12.3, pytest 9.0.3, PyYAML 6.0.3, Ruff 0.15.16, and coverage.py 7.6.10. Tested head:
5449a773e1fa251ceea5ede50787803468541ea8; upstream base:9b083a7fdac56f9d0f14084e61e2aa9dc0dc8816. Model, checkpoint, dataset, CUDA, TensorRT, and precision revisions are not applicable to this developer-tool test change.Not Run / Remaining Gaps
The full repository suite and remote CI were not run as part of local validation; GitHub CI will report its results separately. GPU execution, model parity, performance, and native C++ coverage are outside this CPU validator test scope. Full line and branch coverage does not claim coverage of every possible event payload.
Contributor Self-Review
Manually reviewed the exact diff, public CLI assertions, fixture cleanup, unchanged existing tests and production source, and matching commit-author/DCO identity. No blocking findings.
Notes For Future Readers
Keep the assertions on exit status, diagnostic output, and GitHub annotations: these are the validator's observable CI behavior. The coverage increase requires no new exclusions or dependency changes. Review starts with the five added cases in the test file.
Risk level
The change adds isolated CPU tests without altering validator behavior or model execution.