bito-code-review[bot] commented on code in PR #37107:
URL: https://github.com/apache/superset/pull/37107#discussion_r2729143583
##########
superset-frontend/src/explore/components/controls/AnnotationLayerControl/index.tsx:
##########
@@ -305,8 +305,10 @@ function mapDispatchToProps(
dispatch: ThunkDispatch<any, undefined, AnyAction>,
) {
return {
- refreshAnnotationData: (annotationObj: Annotation) =>
- dispatch(runAnnotationQuery(annotationObj)),
+ refreshAnnotationData: (payload: Payload) =>
+ dispatch(
+ runAnnotationQuery(payload as Parameters<typeof
runAnnotationQuery>[0]),
+ ),
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Unsafe Type Cast Violates Standards</b></div>
<div id="fix">
The change from Annotation to Payload introduces a broad type that violates
the 'NO any types' rule, and the cast to Parameters<typeof
runAnnotationQuery>[0] is unsafe because the passed object has a local
Annotation (with properties like 'annotation': string) where AnnotationLayer is
expected (with 'value': string/number), potentially causing runtime errors when
accessing annotation.value or annotation.sourceType.
</div>
</div>
<details>
<summary><b>Citations</b></summary>
<ul>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/76dd55a/.cursor/rules/dev-standard.mdc#L16">dev-standard.mdc:16</a>
</li>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/76dd55a/AGENTS.md#L78">AGENTS.md:78</a>
</li>
</ul>
</details>
<small><i>Code Review Run #fbbf5c</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]