codeant-ai-for-open-source[bot] commented on code in PR #43473:
URL: https://github.com/apache/superset/pull/43473#discussion_r3845835989
##########
superset-frontend/src/components/Chart/chartAction.ts:
##########
@@ -767,9 +769,20 @@ export function exploreJSON(
response,
json,
() =>
- requestChartData(true).then(({ response: r, json: j }) =>
- handleChartDataResponse(r, j),
- ) as Promise<QueryData[]>,
+ requestChartData(true).then(({ response: r, json: j }) => {
Review Comment:
**Suggestion:** The cache-read retry still sends `enableAsyncMode: true`;
when the completed result is not in the cache, the server submits another
background task and returns 202 rather than merely probing the cache. The
subsequent synchronous fallback therefore causes every uncacheable completion
to execute the query twice and leaves the duplicate task running. Avoid
scheduling another async task during the retry, or go directly to a synchronous
request after task completion. [performance]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Uncacheable chart results execute duplicate background tasks.
- ⚠️ Extra GTF work increases query and worker load.
- ⚠️ Duplicate tasks can compete for database resources.
```
</details>
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=5e701f69369044399bddfe4d0eecf2e7&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=5e701f69369044399bddfe4d0eecf2e7&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset-frontend/src/components/Chart/chartAction.ts
**Line:** 772:772
**Comment:**
*Performance: The cache-read retry still sends `enableAsyncMode: true`;
when the completed result is not in the cache, the server submits another
background task and returns 202 rather than merely probing the cache. The
subsequent synchronous fallback therefore causes every uncacheable completion
to execute the query twice and leaves the duplicate task running. Avoid
scheduling another async task during the retry, or go directly to a synchronous
request after task completion.
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%2F43473&comment_hash=96f11df8fa4dd66107ac3259910908f67e574f913b8595960b7dbd674fa0836d&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43473&comment_hash=96f11df8fa4dd66107ac3259910908f67e574f913b8595960b7dbd674fa0836d&reaction=dislike'>👎</a>
##########
superset-frontend/src/components/Chart/chartAction.ts:
##########
@@ -767,9 +769,20 @@ export function exploreJSON(
response,
json,
() =>
- requestChartData(true).then(({ response: r, json: j }) =>
- handleChartDataResponse(r, j),
- ) as Promise<QueryData[]>,
+ requestChartData(true).then(({ response: r, json: j }) => {
+ // Tasks succeeded, but if the result was never cached the
+ // re-request returns another 202 (NullCache is refused
server-side,
+ // yet an oversized result or a per-query disabled timeout still
+ // skips the write). Fall back to a synchronous fetch, which
returns
+ // the payload inline, instead of looping on an uncacheable
request.
+ if (r.status === 202) {
+ return requestChartData(true, true).then(
Review Comment:
**Suggestion:** The synchronous fallback changes only the async mode and
keeps `force` disabled through `requestChartData(true, true)`. If the original
request used `force: true` and an older result is already cached while the
newly completed task failed to write its result, this fallback can return that
older cached result instead of the result requested by the user. Preserve the
original force semantics for the fallback, or explicitly bypass the cache.
[logic error]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Forced chart refreshes can display stale DATA-cache results.
- ⚠️ Dashboard refreshes may show outdated query results.
- ⚠️ User-requested cache bypass semantics are lost.
```
</details>
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=4d638e493b7045ccafd3c3f5c330f3dd&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=4d638e493b7045ccafd3c3f5c330f3dd&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset-frontend/src/components/Chart/chartAction.ts
**Line:** 779:779
**Comment:**
*Logic Error: The synchronous fallback changes only the async mode and
keeps `force` disabled through `requestChartData(true, true)`. If the original
request used `force: true` and an older result is already cached while the
newly completed task failed to write its result, this fallback can return that
older cached result instead of the result requested by the user. Preserve the
original force semantics for the fallback, or explicitly bypass the cache.
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%2F43473&comment_hash=56b498ab53e364505a2c2bf665049323290e708a15effa3f523273200935e40c&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43473&comment_hash=56b498ab53e364505a2c2bf665049323290e708a15effa3f523273200935e40c&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]