codeant-ai-for-open-source[bot] commented on code in PR #40530:
URL: https://github.com/apache/superset/pull/40530#discussion_r3326907298
##########
superset/commands/report/execute.py:
##########
@@ -289,19 +289,19 @@ def get_dashboard_urls(
except json.JSONDecodeError:
logger.debug("Anchor value is not a list, Fall back to
single tab")
- # Merge native_filters into existing urlParams instead of
- # overwriting — dashboard_state may already have urlParams
- # (e.g. standalone=true) that must be preserved.
- state: DashboardPermalinkState = {**dashboard_state}
- state["urlParams"] = self._merge_native_filters_into_url_params(
- state.get("urlParams"), native_filter_params
- )
- return [
- self._get_tab_url(
- state,
- user_friendly=user_friendly,
+ # Skip the permalink when there is nothing meaningful to encode —
+ # an empty dashboard_state falls through to the plain URL below.
+ if native_filter_params and native_filter_params != "()":
+ state: DashboardPermalinkState = {**dashboard_state}
+ state["urlParams"] =
self._merge_native_filters_into_url_params(
+ state.get("urlParams"), native_filter_params
)
- ]
+ return [
+ self._get_tab_url(
+ state,
+ user_friendly=user_friendly,
+ )
+ ]
Review Comment:
**🟠 Architect Review — HIGH**
The new guard in get_dashboard_urls skips the single-tab permalink fallback
when native_filter_params == "()" even if dashboard_state["anchor"] is a
non-list string (the normal single-tab selection shape). In that case, a report
configured for one tab and no filters now falls through to the plain dashboard
URL, so the selected tab is no longer targeted in the screenshot.
**Suggestion:** Update the guard so that the single-tab permalink fallback
still runs whenever a valid anchor is present, and only skips creating a
permalink when both the anchor/tab targeting and native_filter_params are
effectively empty, preserving existing single-tab behavior while avoiding
permalinks for the truly empty dashboard state.
[Fix in
Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=c7d881ccd7cc42fdb15990ae6c453e98&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
| [Fix in VSCode
Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=c7d881ccd7cc42fdb15990ae6c453e98&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 an **Architect / Logical Review** comment left during a code review.
These reviews are first-class, important findings — not optional suggestions.
Do NOT dismiss this as a 'big architectural change' just because the title says
architect review; most of these can be resolved with a small, localized fix
once the intent is understood.
**Path:** superset/commands/report/execute.py
**Line:** 294:305
**Comment:**
*HIGH: The new guard in get_dashboard_urls skips the single-tab
permalink fallback when native_filter_params == "()" even if
dashboard_state["anchor"] is a non-list string (the normal single-tab selection
shape). In that case, a report configured for one tab and no filters now falls
through to the plain dashboard URL, so the selected tab is no longer targeted
in the screenshot.
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.
If a suggested approach is provided above, use it as the authoritative
instruction. If no explicit code suggestion is given, you MUST still draft and
apply your own minimal, localized fix — do not punt back with 'no suggestion
provided, review manually'. Keep the change as small as possible: add a guard
clause, gate on a loading state, reorder an await, wrap in a conditional, etc.
Do not refactor surrounding code or expand scope beyond the finding.
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>
--
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]