Report parameter type annotation changes in breaking_changes_checker#46488
Report parameter type annotation changes in breaking_changes_checker#46488
Conversation
Agent-Logs-Url: https://github.com/Azure/azure-sdk-for-python/sessions/7307acbf-333b-4395-82a2-30c62acb07b4 Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates the breaking-changes checker to report parameter type annotation changes (previously dropped), ensuring signature annotation diffs are surfaced as breaking changes.
Changes:
- Add a new breaking-change category
ChangedParameterTypewith corresponding message templates. - Detect
"type"diffs inrun_parameter_level_diff_checksand emit the new breaking-change record. - Document the new category in the tool README and add tests covering method + module-level function cases.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| scripts/breaking_changes_checker/breaking_changes_tracker.py | Adds ChangedParameterType and emits breaking changes when a parameter’s annotation string changes. |
| scripts/breaking_changes_checker/README.md | Documents ChangedParameterType in the breaking-change categories table. |
| scripts/breaking_changes_checker/tests/test_breaking_changes.py | Adds coverage ensuring annotation type changes are reported for both methods and functions. |
…Type message Agent-Logs-Url: https://github.com/Azure/azure-sdk-for-python/sessions/188636e9-5885-4621-8d36-62951b7a761f Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
Pass test locally and pls take a review. @catalinaperalta |
|
The changes lgtm, I did wonder if we could implement it as an independent checker like the ones found under this directory: https://github.com/Azure/azure-sdk-for-python/tree/main/scripts/breaking_changes_checker/checkers I wouldnt block on it if it's too complicated |
- Add comment on line 297 to clarify that param_type checks are about parameter kind (positional vs keyword) - Add comment on line 302 to clarify that the type check is about parameter type annotations This addresses feedback from code review: the terminology distinction between 'param_type' (which is actually the parameter kind) and 'type' (which is the type annotation) was confusing. Comments now make this clear. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@catalinaperalta I make a rough estimation then find it may need some refactor if implement same logic in checkers. So I hope we could keep current design then refactor it if needed in another PR. |
Do you mean because you'd have to do more parsing to get back down to the parameter type? |
Yes. |

The breaking-changes tool silently ignored parameter annotation changes (e.g.
tag_map: Optional[str]→tag_map: Optional[Dict[str, List[str]]]).run_parameter_level_diff_checksonly branched ondefaultandparam_type(parameter kind), so diffs on thetypefield produced bycreate_parameterswere dropped.Changes (
scripts/breaking_changes_checker/)breaking_changes_tracker.pyBreakingChangeType.CHANGED_PARAMETER_TYPEand message templatesCHANGED_PARAMETER_TYPE_MSG/CHANGED_PARAMETER_TYPE_OF_FUNCTION_MSG.diff_type == "type"inrun_parameter_level_diff_checks, dispatching to newcheck_parameter_annotation_type_changed(mirrors the existing kind check; emits stable→current annotation strings).None, as produced bycreate_parameterswhenarg.annotationisNone) to the distinct display string<no annotation>, so it can be disambiguated from an explicitNoneannotation (stored as the string"None") in the reported message.README.md— addChangedParameterTyperow to the breaking-change categories table.tests/test_breaking_changes.pytest_parameter_annotation_type_changedcovers both class-method and module-function cases, including theOptional[str]→Optional[Dict[str, List[str]]]scenario from the issue.test_parameter_annotation_type_missing_vs_explicit_nonecovers the missing-vs-explicitNoneannotation disambiguation.Example output
Notes
ChangelogTrackerinherits this viasuper().run_checks()— no additional wiring needed.typediffs, so current expectations are unaffected. Reviewers may want to consider whether anazure-mgmt-*allowlist entry is desirable given regeneration churn.