Description
Checklist
- I have searched the Sourcery documentation for the issue, and found nothing
- I have read the common issues and fixes listed in the Sourcery troubleshooting page, and found nothing
- I have checked there are no open bugs referencing the same bug or problem
Description
On a PR that updated a dependency version in our repo (Pydantic v1 to v2) and migrated the codebase to the new version's syntax, the initial "Summary by Sourcery" generated by the sourcery-ai bot was unusually verbose and contained a bunch of points unrelated to the changes in the PR.
See some examples highlighted below:
Not sure if the extra info was somehow being extracted from Pydantic's own release notes, or somewhere else?
Upon re-generating the summary using @sourcery-ai summary
, the second attempt was much shorter and closer to what I expected:
Summary by Sourcery
Upgrade the project to Pydantic v2, updating query models to use the new syntax and methods. This includes changes to type annotations, validation logic, and dependency updates.
Enhancements:
- Improve validation of the
is_control
parameter by converting valid string values to boolean usingBeforeValidator
.- Use
model_validator
instead ofroot_validator
for model validation.- Replace
constr
withAnnotated
andStringConstraints
for type hinting and validation.Build:
- Upgrade Pydantic to version 2.10.6 and add required dependencies, including
annotated-types
,pydantic-settings
,pydantic_core
, andpython-dotenv
.- Update the typing extensions to 4.12.2.
Tests:
- Add tests to ensure that valid
is_control
values are correctly parsed as booleans.
Any advice on how to prevent this from happening in the future would be appreciated!
Side question: is there any way to tell Sourcery to replace existing PR summaries/reviewer's guides/etc. that it has generated when the bot is re-triggered manually, instead of always adding a new comment or text block on top of what's already there? This could prevent PRs from becoming unnecessarily long and verbose. Can open a separate issue for this if needed.
Code snippet that reproduces issue
Debug Information
We are using the sourcery-ai GitHub app.
IDE Version:
Sourcery Version:
Operating system and Version:
Activity