fix: config loader no longer discards the body of a null-header multi-document file#1919
Open
arham766 wants to merge 1 commit into
Open
fix: config loader no longer discards the body of a null-header multi-document file#1919arham766 wants to merge 1 commit into
arham766 wants to merge 1 commit into
Conversation
…-document file
An explicit null/~ first YAML document (or an empty explicit document
via a leading '---' pair) tripped the empty-file early return before
the two-document branch, so 'null / --- / <body>' silently loaded as
{}. A null first document is now treated as an empty header: dict
bodies load as themselves, list bodies take the existing snippet path
with no imports, a lone null still loads as {}, and the >2-document
error now applies to null-first files too (previously they silently
returned {}).
Part of the findings in NVIDIA#1902 (wave 2).
Signed-off-by: arham766 <arhamislam766@yahoo.com>
Contributor
|
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)
📝 WalkthroughWalkthroughThe config loader's YAML parsing logic was updated to treat a null first document in a two-document YAML file as an empty header instead of rejecting it, allowing the second document to carry the actual config body. Corresponding unit tests were added. ChangesYAML Multi-Document Header Handling
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Type of change: Bug fix
Silent data loss in the config loader (found writing #1914): a null/~ first YAML document (or empty explicit document) tripped the empty-file early return before the two-document branch, so 'null / --- / ' loaded as {} and the body vanished. A null first document is now an empty header: dict bodies load as themselves, list bodies take the existing snippet path, a lone null still loads {}, and the >2-document error now applies to null-first files too (previously silently {}). Full branch-by-branch before/after table in the review notes; three regression tests in tests/unit/recipe/test_loader.py verified to fail pre-fix with the exact {}-instead-of-body symptom; builtin presets still load (import-time validation green).
Usage
N/A
Testing
Regression tests included, each verified to FAIL with the fix reverted. Combined battery with all sibling wave fixes: 381 passed across tests/unit/torch/opt, tests/unit/torch/utils, tests/unit/recipe, and quantization test_mode. Note: the unmerged suite PRs #1913-#1916 contain behavior-documenting NOTE tests pinning the OLD behavior fixed here — whichever lands second gets the NOTE tests flipped (happy to rebase either way).
Before your PR is "Ready for review"
Additional Information
Issue: #1902 (wave-2 findings)
Summary by CodeRabbit
null.nullheader now load correctly when the actual settings are in the second document.nullYAML document now loads as an empty configuration.