Skip to content

test(aci): Opt more of workflow_engine into the mypy stronglist #93671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 17, 2025

Conversation

kcons
Copy link
Member

@kcons kcons commented Jun 16, 2025

Add mostly basic type annotations.

@kcons kcons requested review from a team as code owners June 16, 2025 23:04
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 16, 2025
Copy link

codecov bot commented Jun 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #93671       +/-   ##
===========================================
+ Coverage   46.31%   88.02%   +41.70%     
===========================================
  Files       10310    10327       +17     
  Lines      594449   595742     +1293     
  Branches    23127    23127               
===========================================
+ Hits       275320   524383   +249063     
+ Misses     318636    70866   -247770     
  Partials      493      493               

Comment on lines 48 to 57
class ActionGroupStatusAnnotations(TypedDict):
frequency: int
frequency_minutes: timedelta
difference: timedelta


if TYPE_CHECKING:
AnnotatedActionGroupStatus = WithAnnotations[ActionGroupStatus, ActionGroupStatusAnnotations]
else:
AnnotatedActionGroupStatus = Any
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we shouldn't be stuffing attributes into random models. please make something which wraps this properly rather than this hack

also note that WithAnnotations is broken so this will make mypy cache not work properly

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you point me to an example of what you mean by 'something which wraps this properly'? I don't recall seeing any other examples of annotated things that work with mypy, so when I saw this case, I went with what the django mypy lib recommends for this case.
Not a long term concern for this particular PR, as I have another PR brewing that deletes this code, just for my general education.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh actually sorry I misread this -- still WithAnnotations is broken and generally to be avoided. I thought this was the other case I'm chasing down where unrelated attributes are being stuffed into a Group object (not using django's querying engine)

here's an example of one of those such things I cleaned up a while back: #72367

still to make this type safe-r I would adjust this function to return a separate class with the annotated attributes extracted (such that WithAnnotations doesn't escape this function via return value and end up in the mypy cache)

something like:

class ActionGroupStatusWithFrequency(NamedTuple):
    action_status_group: ActionStatusGroup
    frequency: ...
    ...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, rebased away the need for this altogether, but thanks for the info.

Copy link
Member

@asottile-sentry asottile-sentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kcons kcons enabled auto-merge (squash) June 17, 2025 15:44
@kcons kcons merged commit 864ff93 into master Jun 17, 2025
64 checks passed
@kcons kcons deleted the kcons/stronglist branch June 17, 2025 16:00
billyvg pushed a commit that referenced this pull request Jun 18, 2025
andrewshie-sentry pushed a commit that referenced this pull request Jun 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants