-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
✨ feat(aci): pass legacy rule_id
in notification action for links
#88282
Conversation
data={ | ||
"actions": [cls.build_rule_action_blob(action, detector.project.organization.id)] | ||
}, | ||
data=dict(data), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even though RuleData
is a TypedDict
, mypy was still complaining if i didn't do this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you know what the mypy error was? wonder if it's correctly trying to call something out 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incompatible type for "data" of "Rule" (got "RuleData", expected "dict[str, Any]") [misc]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://discuss.python.org/t/should-typeddict-be-compatible-with-dict-any-any/40935 seems like this is by design?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah typeddicts can't be downcast to generic dict -- that would allow key stuffing -- here's an example:
class TD(TypedDict):
x: int
y: int
def stuffs_keys(d: dict[str, Any]) -> None:
d['unrelated'] = 1
def takes_td_names(*, x: int, y: int) -> None: ...
def f():
d: TD = {'x': 1, 'y': 2})
stuffs_keys(d) # disallowed!
takes_td_names(**d) # would error now!
credit to @asottile-sentry
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## master #88282 +/- ##
=======================================
Coverage 87.72% 87.73%
=======================================
Files 9991 9994 +3
Lines 565802 565784 -18
Branches 22253 22247 -6
=======================================
+ Hits 496358 496388 +30
+ Misses 69021 68975 -46
+ Partials 423 421 -2 |
5b44ffc
to
0b5f9bd
Compare
…88282) in workflow engine, while we are sending notifications: if we haven't rolled out the new ui, we must build links to the old ui. this means for issue alerts, we need to find the legacy `rule_id` and build a link using that so that we can build links correctly. in this pr, i make it so we pass it as part of rule data. in a follow up pr, i will use this field in the many places where we build links to generate the correct link.
in workflow engine, while we are sending notifications:
if we haven't rolled out the new ui, we must build links to the old ui. this means for issue alerts, we need to find the legacy
rule_id
and build a link using that so that we can build links correctly.in this pr, i make it so we pass it as part of rule data. in a follow up pr, i will use this field in the many places where we build links to generate the correct link.