codeant-ai-for-open-source[bot] commented on code in PR #37516:
URL: https://github.com/apache/superset/pull/37516#discussion_r3689716579
##########
superset/charts/data/api.py:
##########
@@ -611,15 +639,18 @@ def _get_data_response(
) -> Response:
"""Get data response and optionally log is_cached information."""
try:
- result = command.run(force_cached=force_cached)
+ result = command.execute(force_cached=force_cached)
except ChartDataCacheLoadError as exc:
return self.response_422(message=exc.message)
except ChartDataQueryFailedError as exc:
return self.response_400(message=exc.message)
# Log is_cached if extra payload callback is provided
- if add_extra_log_payload and result and "queries" in result:
- is_cached_values = [query.get("is_cached") for query in
result["queries"]]
+ materialized_result = result.materialize()
+ if add_extra_log_payload and materialized_result.get("queries"):
+ is_cached_values = [
+ query.get("is_cached") for query in
materialized_result["queries"]
+ ]
add_extra_log_payload(is_cached=is_cached_values)
Review Comment:
**Suggestion:** The synchronous response path now always logs `is_cached` as
a list, even when the response contains one query. This disagrees with
`_log_is_cached`, which preserves the existing scalar boolean shape for
single-query requests, so event-log consumers receive different types depending
on whether the request followed the synchronous or async cache path. Normalize
the single-query case to emit the scalar value and only use a list for multiple
queries. [api mismatch]
<details>
<summary><b>Severity Level:</b> Minor ๐งน</summary>
```mdx
- โ ๏ธ Single-query event telemetry has inconsistent `is_cached` types.
- โ ๏ธ Log consumers must handle scalar and single-element-list values.
- โ ๏ธ Cache observability differs between synchronous and async paths.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=7ff33f5ecc544009a42a5ba3edaed90f&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=7ff33f5ecc544009a42a5ba3edaed90f&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/charts/data/api.py
**Line:** 649:654
**Comment:**
*Api Mismatch: The synchronous response path now always logs
`is_cached` as a list, even when the response contains one query. This
disagrees with `_log_is_cached`, which preserves the existing scalar boolean
shape for single-query requests, so event-log consumers receive different types
depending on whether the request followed the synchronous or async cache path.
Normalize the single-query case to emit the scalar value and only use a list
for multiple queries.
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=2223018fb8c5949700bf50eda8bcab2f792f6e1d85a354371c958a5faa6c356b&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37516&comment_hash=2223018fb8c5949700bf50eda8bcab2f792f6e1d85a354371c958a5faa6c356b&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]