Fail closed on Puzzletron correctness failures - #2114
Conversation
Treat sort and slicing-equivalence mismatches as blocking correctness errors while keeping ranking-quality findings advisory. Propagate the same contract through parent sweeps and progress reports. Signed-off-by: Johannes Rausch <jrausch@nvidia.com>
Explain how width-ranking quality checks differ from sort and slicing equivalence failures, including what is measured and how strict qualification can promote warnings. Signed-off-by: Johannes Rausch <jrausch@nvidia.com>
Keep the main README focused on the first-run workflow while retaining the detailed ranking, slicing, and qualification reference in a linked topic guide. Signed-off-by: Johannes Rausch <jrausch@nvidia.com>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughSanity handling separates blocking sort and slicing correctness failures from advisory width-ranking warnings. Verdicts, diagnostics, campaign reports, tests, and Puzzletron documentation reflect the new severity and qualification behavior. ChangesSanity policy and execution
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant ParentSweep
participant SanityVerdict
participant CampaignReport
ParentSweep->>SanityVerdict: combine width, sort, and slicing findings
SanityVerdict->>SanityVerdict: classify warnings and blocking errors
SanityVerdict->>CampaignReport: publish stage verdict and finding severities
CampaignReport->>CampaignReport: render gate badges and DAG status
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feature/puzzletron_v2 #2114 +/- ##
=========================================================
+ Coverage 54.76% 55.22% +0.46%
=========================================================
Files 704 704
Lines 90869 90907 +38
=========================================================
+ Hits 49761 50200 +439
+ Misses 41108 40707 -401
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Warning
CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.
Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.
Actionable comments posted: 4
🤖 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.
Inline comments:
In `@examples/puzzletron/docs/sanity_validation.md`:
- Around line 39-44: Standardize the deterministic control terminology across
all listed documentation sites: in examples/puzzletron/docs/sanity_validation.md
lines 39-44, choose one canonical label and identify random as a legacy alias
only where needed; in examples/puzzletron/README.md lines 484-503, clarify that
random denotes the original or unsorted prefix; in
examples/puzzletron/docs/v2_architecture.md line 142 and lines 361-386, replace
inconsistent control names and align gate and qualification terminology with the
canonical label.
In `@modelopt/torch/puzzletron/diagnostics/campaign_progress_report.py`:
- Around line 503-504: Update the later empty-state return for non-empty rows
with empty axes or metrics to prefix its message with gate_summary, matching the
not-rows branch. Preserve the existing empty-state content while ensuring failed
slicing-equivalence gates remain visible.
In `@modelopt/torch/puzzletron/stages/diagnostics.py`:
- Line 3343: Unify the post-barrier completion flow around the shared verdict in
the diagnostics stage: after rank 0 evaluates the sort result, broadcast or
otherwise derive the same passed/failed value on every rank, and ensure all
ranks either follow the same failure return path or use rank 0 exclusively for
persisting the stage manifest. Update the `verdict` construction and surrounding
rank-specific handling so a failed result cannot be overwritten by another
rank’s `SanityVerdict(passed=True)`.
- Line 1615: Move the SanityVerdict import at
modelopt/torch/puzzletron/stages/diagnostics.py:1615 and the
complete_sanity_stage import at
modelopt/torch/puzzletron/stages/diagnostics.py:2741-2743 into the module-level
import section. Remove both local imports while preserving their existing
usages.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 642ff8c6-994d-42ec-8334-e1b25f5a47a2
📒 Files selected for processing (15)
examples/puzzletron/README.mdexamples/puzzletron/docs/sanity_validation.mdexamples/puzzletron/docs/v2_architecture.mdmodelopt/torch/puzzletron/diagnostics/campaign_findings.pymodelopt/torch/puzzletron/diagnostics/campaign_progress_report.pymodelopt/torch/puzzletron/diagnostics/sanity_verdict.pymodelopt/torch/puzzletron/diagnostics/width_sanity.pymodelopt/torch/puzzletron/stages/diagnostics.pytests/unit/torch/puzzletron/test_campaign_findings.pytests/unit/torch/puzzletron/test_campaign_progress_report.pytests/unit/torch/puzzletron/test_diagnostic_scoring_config.pytests/unit/torch/puzzletron/test_hidden_width_diagnostic.pytests/unit/torch/puzzletron/test_sanity_verdict.pytests/unit/torch/puzzletron/test_width_sanity_aggregation.pytests/unit/torch/puzzletron/test_width_slice_equivalence.py
💤 Files with no reviewable changes (1)
- tests/unit/torch/puzzletron/test_diagnostic_scoring_config.py
Make every rank consume the persisted sort verdict, keep empty-state gates visible, and distinguish the deterministic original-order control from seeded random permutations. Signed-off-by: Johannes Rausch <jrausch@nvidia.com>
Finalize summary evidence and stage manifests before process-group teardown so one rank writes the result and every rank consumes the same completed verdict. Signed-off-by: Johannes Rausch <jrausch@nvidia.com>
There was a problem hiding this comment.
Warning
CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.
Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/unit/torch/puzzletron/test_diagnostic_scoring_config.py (1)
125-128: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert the blocking contract this test names.
The test is named
..._records_blocking_drift, but it does not check the two fields that carry the blocking semantics: the finding severity and the summary verdict._write_sort_equivalence_summarysetsseverity="error"and"verdict": "failed", and_complete_sort_equivalence_stageconsumes those values. A regression that downgrades the severity to"warning"would still pass this test.💚 Proposed additional assertions
summary = json.loads(summary_path.read_text(encoding="utf-8")) assert summary["passed"] is False assert summary["delta"] == 0.25 assert summary["findings"][0]["stage"] == "sort_sanity" + assert summary["findings"][0]["severity"] == "error" + assert summary["verdict"] == "failed"🤖 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 `@tests/unit/torch/puzzletron/test_diagnostic_scoring_config.py` around lines 125 - 128, Extend the assertions in the diagnostic scoring test around _write_sort_equivalence_summary to verify the blocking contract: assert the finding severity is "error" and the summary verdict is "failed". Keep the existing passed, delta, and stage assertions unchanged.
🤖 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.
Inline comments:
In `@modelopt/torch/puzzletron/stages/diagnostics.py`:
- Around line 3349-3365: Update _finalize_sort_equivalence_stage so the master
rank catches any exception from _write_sort_equivalence_summary, records the
failure state, and still reaches dist.barrier(). After the barrier, propagate
the captured error on every rank so all processes fail consistently without
stranding non-master ranks.
---
Nitpick comments:
In `@tests/unit/torch/puzzletron/test_diagnostic_scoring_config.py`:
- Around line 125-128: Extend the assertions in the diagnostic scoring test
around _write_sort_equivalence_summary to verify the blocking contract: assert
the finding severity is "error" and the summary verdict is "failed". Keep the
existing passed, delta, and stage assertions unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 8e7e3206-c631-4b18-9de7-e1aabca23dbd
📒 Files selected for processing (7)
examples/puzzletron/README.mdexamples/puzzletron/docs/sanity_validation.mdexamples/puzzletron/docs/v2_architecture.mdmodelopt/torch/puzzletron/diagnostics/campaign_progress_report.pymodelopt/torch/puzzletron/stages/diagnostics.pytests/unit/torch/puzzletron/test_campaign_progress_report.pytests/unit/torch/puzzletron/test_diagnostic_scoring_config.py
🚧 Files skipped from review as they are similar to previous changes (5)
- examples/puzzletron/docs/sanity_validation.md
- tests/unit/torch/puzzletron/test_campaign_progress_report.py
- examples/puzzletron/README.md
- examples/puzzletron/docs/v2_architecture.md
- modelopt/torch/puzzletron/diagnostics/campaign_progress_report.py
Broadcast rank-zero write errors before consuming the summary so all ranks exit consistently instead of hanging at a barrier. Signed-off-by: Johannes Rausch <jrausch@nvidia.com>
What does this PR do?
Type of change: Bug fix and documentation.
Puzzletron sanity stages could record
passed: falsewhile still returning a successful stage. That allowed the campaign DAG to advance after full-width sorting or dynamic-versus-physical slicing had failed a correctness check. Reports also described width-ranking findings as advisory without explaining what they measured or how stage completion differs from campaign qualification.This change:
sanity.fail_on_warningsavailable when a campaign requires warnings to fail the stage;The outcome is that downstream stages no longer proceed using evidence from a correctness-invalid model transformation. Users can also distinguish a weak importance ranking from a broken sorting or slicing implementation and apply a stricter warning policy when scientific or release qualification requires it.
Campaign qualification remains an explicit policy decision. This change does not add a separate
qualification_blockedverdict or prescribe universal acceptance thresholds for ranking quality.Usage
Sort and slicing correctness failures always fail their stages. To also fail a sanity stage on ranking-quality warnings, enable strict warning handling:
Testing
Unit coverage exercises sanity-verdict completion, distributed sort-verdict propagation, warning escalation, parent-sweep propagation, width and slicing aggregation, and report rendering for ranking-quality findings, blocking equivalence failures, and no-metric empty states.