Repository navigation
Decide the number values each output can write in one place, with one int64 range for msgspec - #5445
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
| Layer / File(s) | Summary |
|---|---|
Shared numeric constraint rules src/datamodel_code_generator/_constraint_applicability.py, src/datamodel_code_generator/types.py |
Output metadata now specifies accepted integer ranges and non-finite bound handling. Shared helpers provide numeric conversion, integer-range checks, and strict constraint normalization. |
Generator constraint normalization src/datamodel_code_generator/model/msgspec.py, src/datamodel_code_generator/model/pydantic_base.py |
Both generators use shared numeric keywords and strict constraint normalization. Msgspec uses the shared output rules when it checks integer constraints. |
Msgspec integer-range checks src/datamodel_code_generator/model/_decisions/tag_value.py, src/datamodel_code_generator/parser/_passes/imports.py |
Tag-value refusal and wide-integer detection use the shared msgspec integer-range check instead of local signed 64-bit bounds. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Merge Risk: 
Minimal · previous review 39d89
-
The shared numeric rules preserve existing constraint handling and msgspec integer limits. No actionable merge-blocking issue remains; merge after normal checks pass.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. 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 11 functions across 6 files.
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Merging this PR will improve performance by 53.18%2 warnings
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
# Conflicts: # src/datamodel_code_generator/parser/_passes/imports.py
Breaking Change AnalysisResult: No breaking changes detected Reasoning: The PR is an internal refactor that moves the number-constraint helpers into _constraint_applicability. It adds saturating_float, exact_float, is_non_finite, non_finite_written, int_beyond_values, int_constraint_beyond_values, NUMBER_FIELD_KEYWORDS, and the int_values and drops_non_finite_bounds rows of OutputKeywords. Only the msgspec output sets those rows, to the signed 64-bit range and True; the base and Pydantic outputs keep None and False. The two private _get_strict_field_constraint methods are replaced by one shared strict_number_constraint function in types.py that keeps the same logic. msgspec still drops non-finite bounds, Pydantic still keeps them, and the per-keyword int64 limits rebuilt from the range match the removed _INT_META_LIMITS table exactly: gt up to 263-2, lt from -263+1, the rest across the full range. The Struct tag, Enum and Literal int range, and float-precision checks give the same results as before. Every removed name is private and public helpers such as normalize_integer_constraint are kept, so there are no CLI, public API, template or Python version changes. The accepted cells in the behaviour diff gate cover allOf schemas that now become root models, which the gate notes credit to the earlier PR 5401 and which this diff does not touch; the crash-fix cell for an import named like a builtin package is also unrelated, so this PR causes no default-output change. This analysis was produced by the release draft workflow |
|
🎉 Released in 0.88.0 This PR is now available in the latest release. See the release notes for details. |
Summary by CodeRabbit