codeant-ai-for-open-source[bot] commented on code in PR #37516:
URL: https://github.com/apache/superset/pull/37516#discussion_r3571059263
##########
superset/commands/chart/warm_up_cache.py:
##########
@@ -96,7 +100,10 @@ def _warm_up_non_legacy_cache(self, chart: Slice) ->
tuple[Any, Any]:
query_context.force = True
command = ChartDataCommand(query_context)
command.validate()
- payload = command.run()
+ execution = command.execute(
+ ChartDataExecutionOptions(mode=ChartDataExecutionMode.CACHE_ONLY)
+ )
+ payload = execution.materialize()
Review Comment:
**Suggestion:** Add explicit type annotations for the newly introduced local
variables so their expected types are clear and statically checkable.
[custom_rule]
**Severity Level:** Minor ๐งน
<details>
<summary><b>Why it matters? โญ </b></summary>
These newly added local variables are untyped in modified Python code. Since
their expected types can be annotated, this matches the rule requiring type
hints for relevant variables.
</details>
<details>
<summary><b>Rule source ๐ </b></summary>
.cursor/rules/dev-standard.mdc (line 28)
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=a75fded95adb4c5792473d08a5fa0299&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=a75fded95adb4c5792473d08a5fa0299&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/commands/chart/warm_up_cache.py
**Line:** 103:106
**Comment:**
*Custom Rule: Add explicit type annotations for the newly introduced
local variables so their expected types are clear and statically checkable.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37516&comment_hash=43ca1120e6701fd79e47a368b9005937bdccf4ccbcff07c21254320aa534e8c2&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37516&comment_hash=43ca1120e6701fd79e47a368b9005937bdccf4ccbcff07c21254320aa534e8c2&reaction=dislike'>๐</a>
##########
superset/common/chart_data_timing.py:
##########
@@ -0,0 +1,767 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import logging
+import time
+from collections.abc import Callable, Iterator, Mapping
+from contextlib import contextmanager
+from contextvars import ContextVar, Token
+from dataclasses import dataclass, field, replace
+from enum import Enum
+from typing import Any, Literal, TYPE_CHECKING
+
+from flask import current_app
+
+if TYPE_CHECKING:
+ from superset.common.query_context import QueryContext
+
+NANOSECONDS_PER_MILLISECOND = 1_000_000
+SOURCE_TRACE_VERSION = 2
+MAX_SOURCE_TRACE_DEPTH = 8
+MAX_SOURCE_TRACE_NODES = 64
+
+SourcePhase = Literal["planning", "execution", "processing"]
+
+logger = logging.getLogger(__name__)
Review Comment:
**Suggestion:** Add an explicit type annotation to this module-level logger
variable to satisfy the type-hint requirement for relevant variables.
[custom_rule]
**Severity Level:** Minor ๐งน
<details>
<summary><b>Why it matters? โญ </b></summary>
The module defines a new module-level variable without an explicit type
annotation. This matches the Python type-hint rule for relevant variables that
can be annotated.
</details>
<details>
<summary><b>Rule source ๐ </b></summary>
.cursor/rules/dev-standard.mdc (line 28)
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=28cf7bcd88644cb1ba8cefc16dd86258&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=28cf7bcd88644cb1ba8cefc16dd86258&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/common/chart_data_timing.py
**Line:** 40:40
**Comment:**
*Custom Rule: Add an explicit type annotation to this module-level
logger variable to satisfy the type-hint requirement for relevant variables.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37516&comment_hash=32b6b430318506c97f2506a95619ce3ec60e6889e4b79408e61aa414e0fd11c7&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37516&comment_hash=32b6b430318506c97f2506a95619ce3ec60e6889e4b79408e61aa414e0fd11c7&reaction=dislike'>๐</a>
##########
superset/common/chart_data_timing.py:
##########
@@ -0,0 +1,767 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import logging
+import time
+from collections.abc import Callable, Iterator, Mapping
+from contextlib import contextmanager
+from contextvars import ContextVar, Token
+from dataclasses import dataclass, field, replace
+from enum import Enum
+from typing import Any, Literal, TYPE_CHECKING
+
+from flask import current_app
+
+if TYPE_CHECKING:
+ from superset.common.query_context import QueryContext
+
+NANOSECONDS_PER_MILLISECOND = 1_000_000
+SOURCE_TRACE_VERSION = 2
+MAX_SOURCE_TRACE_DEPTH = 8
+MAX_SOURCE_TRACE_NODES = 64
+
+SourcePhase = Literal["planning", "execution", "processing"]
+
+logger = logging.getLogger(__name__)
+
+
+class SourceKind(str, Enum):
+ """The reason a data source was contacted."""
+
+ PRIMARY = "primary"
+ SERIES_LIMIT = "series_limit"
+ TIME_OFFSET = "time_offset"
+ ANNOTATION = "annotation"
+ CURRENCY_DETECTION = "currency_detection"
+
+
+class SourceProvider(str, Enum):
+ """The implementation family that supplied data."""
+
+ SQL = "sql"
+ SEMANTIC = "semantic"
+ OTHER = "other"
+
+
+class SourceOrigin(str, Enum):
+ """Whether a source trace was captured during this execution or
replayed."""
+
+ CURRENT = "current"
+ CACHE = "cache"
+
+
+class CacheWriteOutcome(str, Enum):
+ """Outcome of a requested cache write."""
+
+ SUCCEEDED = "succeeded"
+ FAILED = "failed"
+ SKIPPED = "skipped"
+ NOT_ATTEMPTED = "not_attempted"
+
+
+_CACHE_WRITE_OUTCOME_PRIORITY = {
+ CacheWriteOutcome.NOT_ATTEMPTED: 0,
+ CacheWriteOutcome.SUCCEEDED: 1,
+ CacheWriteOutcome.SKIPPED: 2,
+ CacheWriteOutcome.FAILED: 3,
+}
Review Comment:
**Suggestion:** Add an explicit type annotation for this module-level
mapping constant so its key/value contract is type-checked. [custom_rule]
**Severity Level:** Minor ๐งน
<details>
<summary><b>Why it matters? โญ </b></summary>
This is a new module-level mapping constant introduced without a type
annotation, so it fits the rule requiring type hints on relevant variables that
can be annotated.
</details>
<details>
<summary><b>Rule source ๐ </b></summary>
.cursor/rules/dev-standard.mdc (line 28)
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=aac6c02e94024fd9924bcf46d43f9c93&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=aac6c02e94024fd9924bcf46d43f9c93&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/common/chart_data_timing.py
**Line:** 77:82
**Comment:**
*Custom Rule: Add an explicit type annotation for this module-level
mapping constant so its key/value contract is type-checked.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37516&comment_hash=0545ee1126fcd4d77bef0f028ac3157b1031672daad3f37fa27160d7e8f5be76&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37516&comment_hash=0545ee1126fcd4d77bef0f028ac3157b1031672daad3f37fa27160d7e8f5be76&reaction=dislike'>๐</a>
##########
superset/common/query_actions.py:
##########
@@ -34,7 +44,6 @@
get_time_filter_status,
)
from superset.utils.currency import (
- detect_currency,
detect_currency_from_df,
has_auto_currency_in_column_config,
Review Comment:
**Suggestion:** Add an explicit type annotation to this module-level
constant so its element type is declared instead of inferred. [custom_rule]
**Severity Level:** Minor ๐งน
<details>
<summary><b>Why it matters? โญ </b></summary>
The new module-level constant is an unannotated set, and the custom rule
explicitly requires type hints for relevant variables that can be annotated.
This is a real violation in the added code.
</details>
<details>
<summary><b>Rule source ๐ </b></summary>
.cursor/rules/dev-standard.mdc (line 28)
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=afd38c2263e54f6ea2f690956bb292db&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=afd38c2263e54f6ea2f690956bb292db&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/common/query_actions.py
**Line:** 48:53
**Comment:**
*Custom Rule: Add an explicit type annotation to this module-level
constant so its element type is declared instead of inferred.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37516&comment_hash=403aec5bfe4d85bf9d748bb7ca678837c5654c669769a22a43727a3b2c1ab028&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37516&comment_hash=403aec5bfe4d85bf9d748bb7ca678837c5654c669769a22a43727a3b2c1ab028&reaction=dislike'>๐</a>
--
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]