You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "mikebridge (via GitHub)" <gi...@apache.org> on 2026/10/07 16:43:11 UTC
[PR] fix(cache): evict rejected cached GET requests [superset]
mikebridge opened a new pull request, #45055:
URL: https://github.com/apache/superset/pull/45055
### SUMMARY
Completes the follow-up deferred in #42539. `cacheWrapper` cached a rejected promise indefinitely at its key, so a transient failure on a cached GET (for example a one-off 422 or a network error) was replayed to every later caller instead of being retried. This change makes the wrapper evict a rejected promise centrally.
- A rejection observer on the cached value deletes the entry only when the rejected promise is still the one stored at the key, so a late failure from an older request cannot delete a newer replacement.
- The original promise is returned unchanged, so concurrent requests still share the in-flight promise and fulfilled values stay cached.
- The three per-caller rejection workarounds that this replaces are removed from `useDisplayControlDatasource.ts`, `hooks/apiResources/datasets.ts`, and `semanticViewStructure.ts`. Dataset cache clearing after successful saves is a separate invalidation and is unchanged.
- A later user-triggered action on the same key now issues a new request. No automatic retry loop is introduced.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A (retry behavior only, no visual change).
### TESTING INSTRUCTIONS
Run the focused Jest suites for `cacheWrapper`, `cachedSupersetGet`, `semanticViewStructure`, `useDisplayControlDatasource`, and dataset drill metadata. They cover a generic reject-then-resolve retry, in-flight sharing, a late failure versus a replacement entry, a real `cachedSupersetGet` GET, and retry/recovery in each of the three former workaround callers.
The generic retry test fails on master (the second call rejects with the original error), and the caller tests fail when the workarounds are removed without the central fix.
Verification limits: these are mocked frontend tests, and no live failing endpoint was exercised. The native frontend type-check hook could not be completed locally because the monorepo package declarations were not built, so CI is the authority for type checking. All other changed-file pre-commit hooks passed.
### ADDITIONAL INFORMATION
- [ ] Has associated issue
- [ ] Required feature flags
- [ ] Changes UI
- [ ] Includes DB Migration
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
๐ค Generated with [Claude Code](https://claude.com/claude-code)
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(cache): evict rejected cached GET requests [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #45055:
URL: https://github.com/apache/superset/pull/45055#issuecomment-6044187143
## CodeAnt PR Risk: Medium Risk
- The PR needs attention before merging; successful semantic-view structure responses remain cached for the page session.
- If a semantic view changes during that session, later consumers can use stale dimensions and metrics; confirm the intended invalidation behavior.
**Assessed commit:** `8073a35f918c`
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(cache): evict rejected cached GET requests [superset]
Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #45055:
URL: https://github.com/apache/superset/pull/45055#issuecomment-6042513257
### <span aria-hidden="true">โ
</span> Deploy Preview for *superset-docs-preview* ready!
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">๐จ</span> Latest commit | 8073a35f918cc477c545b8cbd5b33c90067bf2ec |
|<span aria-hidden="true">๐</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/6ac6769f6966e40008b8bc1b |
|<span aria-hidden="true">๐</span> Deploy Preview | [https://deploy-preview-45055--superset-docs-preview.netlify.app](https://deploy-preview-45055--superset-docs-preview.netlify.app) |
|<span aria-hidden="true">๐ฑ</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br /><br /><br />_Use your smartphone camera to open QR code link._</details> |
|<span aria-hidden="true">๐ค</span> Make changes | [Run an agent on this branch](https://app.netlify.com/projects/superset-docs-preview/agent-runs#DctRDkAwDADQu_Tbkk2kzA0cY6sKgjW1EBF3t7_3814QTbtk6AEqiBoOmotPMs55XztDgWa-NYiwGr4WykZ5ZcpLOs5SRpYtPcNYEgbCFv2EHpEba20Xu0guwvcD) |
---
<!-- [superset-docs-preview Preview](https://deploy-preview-45055--superset-docs-preview.netlify.app) -->
_To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(cache): evict rejected cached GET requests [superset]
Posted by "mikebridge (via GitHub)" <gi...@apache.org>.
mikebridge commented on code in PR #45055:
URL: https://github.com/apache/superset/pull/45055#discussion_r4214934843
##########
superset-frontend/src/utils/semanticViewStructure.ts:
##########
@@ -94,28 +91,19 @@ export const fetchSemanticViewStructure = async (
semanticViewId: number | string,
): Promise<SemanticViewStructure> => {
const endpoint = `/api/v1/semantic_view/${semanticViewId}/structure`;
- try {
- const response = await cachedSupersetGet({ endpoint });
- const {
- name,
- dimensions = [],
- metrics = [],
- semantic_selection_version,
- } = response.json?.result ?? {};
- return {
- name,
- dimensions,
- metrics,
- semantic_selection_version: semantic_selection_version ?? undefined,
- };
- } catch (error) {
- // cacheWrapper caches the promise itself and never evicts on rejection, so
- // a single failed response would poison this endpoint for the rest of the
- // page session. Evict on error so a later call refetches โ mirroring the
- // regular-dataset drill branch (hooks/apiResources/datasets.ts).
- supersetGetCache.delete(endpoint);
- throw error;
- }
+ const response = await cachedSupersetGet({ endpoint });
Review Comment:
Good catch that a successful structure response can go stale. The merge-base already used `cachedSupersetGet` at `semanticViewStructure.ts:98` and retained successful entries in `cacheWrapper.ts:28-33`; this PR keeps that behavior at :94 and only adds eviction for failed requests. Schema-change invalidation or a cache lifetime for successful responses is a separate follow-up.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(cache): evict rejected cached GET requests [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #45055:
URL: https://github.com/apache/superset/pull/45055#discussion_r4210455061
##########
superset-frontend/src/utils/semanticViewStructure.ts:
##########
@@ -94,28 +91,19 @@ export const fetchSemanticViewStructure = async (
semanticViewId: number | string,
): Promise<SemanticViewStructure> => {
const endpoint = `/api/v1/semantic_view/${semanticViewId}/structure`;
- try {
- const response = await cachedSupersetGet({ endpoint });
- const {
- name,
- dimensions = [],
- metrics = [],
- semantic_selection_version,
- } = response.json?.result ?? {};
- return {
- name,
- dimensions,
- metrics,
- semantic_selection_version: semantic_selection_version ?? undefined,
- };
- } catch (error) {
- // cacheWrapper caches the promise itself and never evicts on rejection, so
- // a single failed response would poison this endpoint for the rest of the
- // page session. Evict on error so a later call refetches โ mirroring the
- // regular-dataset drill branch (hooks/apiResources/datasets.ts).
- supersetGetCache.delete(endpoint);
- throw error;
- }
+ const response = await cachedSupersetGet({ endpoint });
Review Comment:
**Suggestion:** After the first successful fetch, this endpoint stays cached for the page session; upstream schema changes leave dimensions and metrics stale for later consumers.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Rarely` ยท ๐ท๏ธ `Cache`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill) [](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=8c4f46e04cc14164aa2e9a3b78d89d1b&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=8c4f46e04cc14164aa2e9a3b78d89d1b&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/utils/semanticViewStructure.ts
**Line:** 94:94
**Comment:**
*Cache: After the first successful fetch, this endpoint stays cached for the page session; upstream schema changes leave dimensions and metrics stale for later consumers.
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%2F45055&comment_hash=7afb92d0d31fa2b36fd8a372a1879064dd04cfe842c8ae0c94943c9bb31440cc&reaction=like'>๐</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45055&comment_hash=7afb92d0d31fa2b36fd8a372a1879064dd04cfe842c8ae0c94943c9bb31440cc&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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(cache): evict rejected cached GET requests [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #45055:
URL: https://github.com/apache/superset/pull/45055#issuecomment-6044054350
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/45055?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 82.55%. Comparing base ([`90b0a1a`](https://app.codecov.io/gh/apache/superset/commit/90b0a1a9160e742e16bc79fc79c076262242aee2?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`8073a35`](https://app.codecov.io/gh/apache/superset/commit/8073a35f918cc477c545b8cbd5b33c90067bf2ec?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 3 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #45055 +/- ##
==========================================
- Coverage 82.56% 82.55% -0.01%
==========================================
Files 3005 3005
Lines 186616 186612 -4
Branches 43240 43241 +1
==========================================
- Hits 154076 154066 -10
- Misses 29778 29784 +6
Partials 2762 2762
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/45055/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage ฮ | |
|---|---|---|
| [javascript](https://app.codecov.io/gh/apache/superset/pull/45055/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `78.32% <100.00%> (-0.01%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/45055?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(cache): evict rejected cached GET requests [superset]
Posted by "rebenitez1802 (via GitHub)" <gi...@apache.org>.
rebenitez1802 merged PR #45055:
URL: https://github.com/apache/superset/pull/45055
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org