fix(skills): enforce PR comparator merge eligibility - #6646
Conversation
📝 WalkthroughWalkthroughThe PR makes Tier 0 eligibility deterministic across seven gates, adds strict renderer-side specification validation, derives verdict mode and salvage candidates from gate values, updates verdict guidance and scorecard output, and adds tests for validation, rendering, degraded salvage, and documentation alignment. ChangesTier 0 verdict flow
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant validate_spec
participant render_verdict
Caller->>validate_spec: submit verdict specification
validate_spec->>validate_spec: validate seven Tier 0 gates
validate_spec->>validate_spec: derive mode and closest_to_ready
validate_spec->>render_verdict: pass validated results
render_verdict->>Caller: emit verdict or validation error
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/pr-comparator-render-verdict.test.ts (1)
123-135: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDoc-alignment test locks in exact SKILL.md wording rather than behavior.
This test asserts literal substrings from
SKILL.md(e.g."set \winner` only to a PR in that set"`). A future wording tweak that preserves the same semantics would break this test without any behavioral regression, which is the kind of source-text lock-in the path instructions caution against.As per path instructions: "Prefer observable outcomes through the public boundary over source-text, private-shape, or mock-call assertions."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/pr-comparator-render-verdict.test.ts` around lines 123 - 135, The test keeps exact SKILL.md wording instead of validating observable behavior. Refactor “keeps the generation instructions aligned with renderer eligibility” to exercise the public comparator/rendering boundary and assert the resulting eligibility, winner, closest-to-ready, and nonzero-exit outcomes; remove literal substring assertions against SKILL.md.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@test/pr-comparator-render-verdict.test.ts`:
- Around line 123-135: The test keeps exact SKILL.md wording instead of
validating observable behavior. Refactor “keeps the generation instructions
aligned with renderer eligibility” to exercise the public comparator/rendering
boundary and assert the resulting eligibility, winner, closest-to-ready, and
nonzero-exit outcomes; remove literal substring assertions against SKILL.md.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 4f31e202-197b-45d2-950b-3c0f5017c518
📒 Files selected for processing (5)
.agents/skills/nemoclaw-maintainer-pr-comparator/SKILL.md.agents/skills/nemoclaw-maintainer-pr-comparator/scripts/render-verdict.py.agents/skills/nemoclaw-maintainer-pr-comparator/templates/verdict.md.agents/skills/nemoclaw-maintainer-pr-comparator/tiebreakers.mdtest/pr-comparator-render-verdict.test.ts
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
E2E Advisor RecommendationRequired E2E: None Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
|
E2E Target RecommendationRequired E2E targets: None Full E2E target advisor summaryE2E Target AdvisorBase: Required E2E targets
Optional E2E targets
Relevant changed files
|
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
|
Maintainer follow-up at exact head 1b03474:
No merge action taken. |
|
Let me know if there is anything I need to do that comes up. |
cv
left a comment
There was a problem hiding this comment.
Approved at exact head 1b03474. GPT-5.5 and Nemotron 3 Ultra both returned high-confidence merge_as_is with empty finding ledgers; the runtime-validation suggestions are non-blocking because the real renderer boundary is exercised by focused black-box tests and the exact-head standard CI matrix is green. E2E Advisor requires no targets, CodeRabbit has no unresolved review threads, DCO passes, and every commit is GitHub Verified. No merge action taken.
<!-- markdownlint-disable MD041 --> ## Summary Make the PR comparator derive merge eligibility from the complete Tier 0 gate set before rendering a verdict. Malformed gate data, contradictory modes, and ineligible winners now fail closed instead of producing an unsafe `MERGE PR` recommendation. ## Changes - Define one canonical seven-gate Tier 0 schema, including contributor compliance, and use it for validation and scorecard rendering. - Reject missing, unknown, or non-boolean gate values before emitting Markdown. - Derive happy and degraded modes from the eligible PR set instead of trusting caller-supplied mode data. - Reserve `winner` for fully merge-eligible PRs and use `closest_to_ready` for degraded-mode salvage guidance. - Align the comparator instructions, tiebreakers, and verdict template with the enforced renderer contract. - Add black-box regression coverage for ineligible winners, malformed gates, contradictory modes, valid merges, and degraded recommendations. ## Type of Change - [x] Code change (feature, bug fix, or refactor) - [ ] Code change with doc updates - [ ] Doc only (prose changes, no code sample modifications) - [ ] Doc only (includes code sample changes) ## Quality Gates - [x] Tests added or updated for changed behavior - [ ] Existing tests cover changed behavior — justification: - [ ] Tests not applicable — justification: - [ ] Docs updated for user-facing behavior changes - [x] Docs not applicable — justification: this changes an internal maintainer workflow; its operator-facing skill, tiebreaker, and verdict-template documentation are updated in the same change, with no public `docs/` impact. - [x] Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging) - [x] Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: reviewed the renderer as an untrusted-input boundary; one canonical gate list drives validation and display, and regression tests verify invalid specifications exit nonzero without emitting a verdict. - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## Verification - [x] PR description includes the DCO sign-off declaration and every commit appears as `Verified` in GitHub - [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or `npm run check:diff` passed when hooks were skipped or unavailable - [x] Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result or justification: `npx vitest run --project integration test/pr-comparator-render-verdict.test.ts test/maintainer-skills-policy.test.ts test/skills/check-gates-compliance.test.ts` — 54 tests passed across 3 files. - [ ] Applicable broad gate passed — `npm test` for broad runtime/test-harness changes; `npm run check` for repo-wide validation/coverage changes — command/result: not applicable; this is isolated to the internal comparator renderer and workflow contract. - [x] Quality Gates section completed with required justifications or waivers - [x] No secrets, API keys, or credentials committed - [ ] `npm run docs` builds without warnings (doc changes only) - [ ] Doc pages follow the [style guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md) (doc changes only) - [ ] New doc pages include SPDX header and frontmatter (new pages only) --- Signed-off-by: Minh Vu <vuhoangminh97@gmail.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Improvements** * PR comparison verdicts now follow stricter, fully deterministic Tier 0 eligibility rules (now based on seven gates). * Verdict rendering no longer trusts caller-provided mode/winner and rejects invalid or incomplete specs up front. * Merge recommendations are issued only for fully eligible PRs; degraded mode reports only salvageable candidates. * **Documentation** * Updated Tier 0 gate descriptions and the verdict template’s scorecard to match the new gate set and guidance. * **Tests** * Added new automated tests covering spec validation, winner/closest-to-ready safeguards, and degraded salvage behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Carlos Villela <cvillela@nvidia.com> Co-authored-by: Carlos Villela <cvillela@nvidia.com>
Summary
Make the PR comparator derive merge eligibility from the complete Tier 0 gate set before rendering a verdict. Malformed gate data, contradictory modes, and ineligible winners now fail closed instead of producing an unsafe
MERGE PRrecommendation.Changes
winnerfor fully merge-eligible PRs and useclosest_to_readyfor degraded-mode salvage guidance.Type of Change
Quality Gates
docs/impact.Verification
Verifiedin GitHubpre-commit,commit-msg, andpre-pushhooks passed, ornpm run check:diffpassed when hooks were skipped or unavailablenpx vitest run --project integration test/pr-comparator-render-verdict.test.ts test/maintainer-skills-policy.test.ts test/skills/check-gates-compliance.test.ts— 54 tests passed across 3 files.npm testfor broad runtime/test-harness changes;npm run checkfor repo-wide validation/coverage changes — command/result: not applicable; this is isolated to the internal comparator renderer and workflow contract.npm run docsbuilds without warnings (doc changes only)Signed-off-by: Minh Vu vuhoangminh97@gmail.com
Summary by CodeRabbit
Improvements
Documentation
Tests