fix(explore): exclude permalink_key from chart URL params - #43354
Conversation
RESERVED_CHART_URL_PARAMS was missing permalink_key while the analogous RESERVED_DASHBOARD_URL_PARAMS already excluded it. This asymmetry let a dashboard permalink's permalink_key, merged into a chart's form_data via a shared cache keyed only by sliceId, get copied into the chart's own Explore URL when opened from a dashboard. On refresh, Explore forwarded that dashboard-salted key to the explore permalink resolver, which fails key decoding against the wrong salt and falls back to a stub datasource, producing the "missing datasource" error. Add permalink_key to RESERVED_CHART_URL_PARAMS, mirroring the pattern already used correctly on the dashboard side and in FilterBar's EXCLUDED_URL_PARAMS. As an accepted side effect, this also makes Explore's own permalink key (/explore/p/<key>/) drop out of the URL after refresh instead of staying sticky, matching FilterBar's existing behavior for dashboards. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #43354 +/- ##
=======================================
Coverage 66.73% 66.73%
=======================================
Files 2876 2876
Lines 164201 164201
Branches 37887 37887
=======================================
Hits 109580 109580
Misses 52465 52465
Partials 2156 2156
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Code Review Agent Run #912344Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
gabotorresruiz
left a comment
There was a problem hiding this comment.
Thanks for the fix, Joe. The change is clearly safe and I verified it end to end:
- The new test fails on master without the constants change (only the
RESERVED_CHART_URL_PARAMSassertion) and passes with it; theurlUtils,ExploreViewContainerandexploreUtilssuites all pass locally with the change applied. - None of the consumers of
RESERVED_CHART_URL_PARAMSneedspermalink_keyto pass through. Nice side effect:getChartUrlParamsuses the same list, so this also keeps a stalepermalink_keyout of theurlParamsstored in newly created explore permalinks. - The failure mode reproduces exactly as described: I put a dashboard-namespace key into an Explore URL on a running master build and got the "Missing datasource" panel, because
/api/v1/explore/resolvespermalink_keyahead ofform_data_key(superset/commands/explore/get.py) and a dashboard key fails to decode under the explore salt.
One question, not a blocker: I could not reproduce the ingress with the listed steps on master head. The dashboard URL's permalink_key gets replaced by native_filters_key by the filter bar's URL update (its EXCLUDED_URL_PARAMS already contains permalink_key), and "Edit chart" navigates to /explore/?dashboard_page_id=...&slice_id=... without carrying dashboard query params, so on my build the key never reached the Explore URL and refresh worked even without the fix. Which branch or flow did you hit this on? Asking mainly to figure out whether release branches need a backport. The exclusion still has a live effect on master either way: form_data.url_params picks up permalink_key whenever Explore is loaded from a permalink (merge_request_params), and without this change any later URL rewrite copies it back into the address bar, where it then shadows form_data_key on refresh.
|
Thanks for digging into this — good catch, and you're right that the literal repro steps alone won't trigger it on every dashboard/build. Answering both parts: Which flow actually leaks the key (not the "Edit chart" link): You're correct that That cache-hit is a real precondition, not automatic — it depends on dashboard/filter state at the moment "Edit chart" is clicked (matching cached filters for that slice). In testing this reproduced on 1 of 8 seeded example dashboards, so a clean build/dashboard with no prior matching cache entry for that slice — which sounds like what you hit — will genuinely take the clean path and never carry Branch / backport: This was reproduced and fixed against
So yes — this looks like a genuine backport candidate for |
SUMMARY
Opening a dashboard permalink and editing a chart into Explore, then refreshing the Explore page, can render Explore's "missing datasource" error.
RESERVED_CHART_URL_PARAMSwas missingpermalink_key, so a dashboard-scoped permalink key could be copied into a chart-scoped Explore URL by the URL-rewrite logic inExploreViewContainer. On refresh, that key is sent to the backend and resolved against the wrong key-value namespace (dashboard vs. explore permalinks use different backend resources/salts), which fails and surfaces as a missing-datasource error.This adds
permalink_keytoRESERVED_CHART_URL_PARAMS, mirroring its existing presence inRESERVED_DASHBOARD_URL_PARAMSand the same exclusion pattern already used in the dashboard's native filter bar.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — this is a fix to URL-parameter handling, not a visual change.
TESTING INSTRUCTIONS
Also covered by the added unit test:
superset-frontend/src/constants.test.ts.ADDITIONAL INFORMATION