Repository navigation
fix: backport dataclass null preservation to release/0.11 - #1608
willkill07 merged 1 commit into
Conversation
Backport NVIDIA#1605 to release/0.11. (cherry picked from commit 4ff4ac2) Signed-off-by: Eric Evans II <[email protected]>
Findings
|
| Layer / File(s) | Summary |
|---|---|
Serialization option and Codec integration python/nemo_relay/typed.py |
The serializer accepts an option to preserve None values and passes it through nested dataclasses, lists, and dictionaries. DataclassCodec.to_json enables the option; other callers retain the default omission behavior. |
Codec behavior tests and documentation python/tests/test_typed.py, docs/integrate-into-frameworks/using-codecs.mdx |
Tests cover explicit None, omitted defaults, missing required fields, nested values, typed tool execution, and BestEffortAnyCodec. Documentation describes encoding and decoding behavior. |
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Possibly related issues
- Issue 1604 describes preserving explicitly supplied
Nonevalues while retaining defaults for omitted fields and errors for omitted required fields. This change covers those behaviors.
Merge Risk: 
Moderate · up to ef33d
-
Typed tool results can silently lose populated fields. Preserve those values before merging.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 2 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Overview
Backport #1605 to
release/0.11so the 0.11 patch release preserves explicitly suppliedNonein dataclass tool arguments.Details
Applies the exact three-file patch from #1605, squash-merged on
mainas 4ff4ac2, without release-specific adaptations.Public signatures are unchanged. Serialized dataclass JSON includes null fields that were previously omitted.
Validation on
release/0.11at 8e324ad plus this backport:just test-python: passed — 86 native-binding tests, 1,310 Python tests, and 24 example tests.just docs: passed, including four documentation-example tests. The published-redirect comparison was skipped because the Fern service returned HTTP 403.Where should the reviewer start?
Review the original fix in #1605, then confirm this PR contains the same changes to
python/nemo_relay/typed.py,python/tests/test_typed.py, anddocs/integrate-into-frameworks/using-codecs.mdx.Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
main.Summary by CodeRabbit
DataclassCodecnow preserves fields explicitly set toNoneas JSONnull, including in nested dataclasses, lists, and dictionaries.TypeErrorfor omitted required fields, and keeps explicitnullasNone.