fix(types): correct nullability of config fields in command TypedDicts#1952
Draft
bearomorphism wants to merge 1 commit intomasterfrom
Draft
fix(types): correct nullability of config fields in command TypedDicts#1952bearomorphism wants to merge 1 commit intomasterfrom
bearomorphism wants to merge 1 commit intomasterfrom
Conversation
Several command TypedDicts declared fields as non-nullable (int, str, dict, list) while argparse produces None when CLI flags are omitted. Runtime code already handles None correctly, but the type annotations were misleading. Changes: - CommitArgs: message_length_limit int -> int | None - CheckArgs: message_length_limit int -> int | None, allowed_prefixes list[str] -> list[str] | None - BumpArgs: file_name str -> str | None - ChangelogArgs: file_name, start_rev, tag_format, version_scheme, export_template, template str -> str | None; extras dict[str, Any] -> dict[str, Any] | None Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1952 +/- ##
=======================================
Coverage 98.23% 98.23%
=======================================
Files 61 61
Lines 2779 2779
=======================================
Hits 2730 2730
Misses 49 49 ☔ View full report in Codecov by Sentry. |
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.
Description
Several command TypedDicts declared fields as non-nullable (
int,str,dict,list) while argparse producesNonewhen CLI flags are omitted. Runtime code already handlesNonecorrectly (viaorfallbacks,.get(), explicitNonechecks), but the type annotations were misleading to both developers and mypy.Changes
message_length_limit: int→int | Nonemessage_length_limit: int→int | None,allowed_prefixes: list[str]→list[str] | Nonefile_name: str→str | Nonefile_name,start_rev,tag_format,version_scheme,export_template,template→ add| None;extras→dict[str, Any] | NoneScope
Type annotations only — no behavioral changes.
Related
message_length_limitconfig-ignored bug (this PR makes the types accurate; the behavioral fix is in Fix and improve test: message_length_limit #1900)message_length_limitprecedence (complementary, no conflict)message_length_limitinconsistency #1812 —ChainMap-based settings refactor (complementary, no conflict)ChainMapto rewrite the cmd options <- configuration file <- default configuration chain #1672 — tracking issue for the settings chain redesignChecklist
Was generative AI tooling used to co-author this PR?
Generated-with: GitHub Copilot CLI following the guidelines
Code Changes
uv run poe alllocally to ensure this change passes linter check and testsNo test or doc changes needed — this is a pure type annotation fix with no behavioral impact.