You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "aminghadersohi (via GitHub)" <gi...@apache.org> on 2025/12/11 22:09:45 UTC

[PR] feat(mcp): add datasource field to generate_explore_link form_data [superset]

aminghadersohi opened a new pull request, #36543:
URL: https://github.com/apache/superset/pull/36543

   ## SUMMARY
   
   Add the `datasource` field to the `form_data` returned by `generate_explore_link` for consistency with `generate_chart`.
   
   This field (e.g., `"1__table"`) is needed by external clients (chatbots, etc.) to properly render charts using the form_data.
   
   ### Changes
   - Add `datasource` field to `generate_explore_link` response's `form_data`
   - Format: `"{dataset_id}__table"` (e.g., `"1__table"`)
   
   ### BEFORE/AFTER
   
   **Before:**
   ```json
   {
     "form_data": {
       "viz_type": "echarts_timeseries_bar",
       "x_axis": "ds",
       "metrics": [...]
     }
   }
   ```
   
   **After:**
   ```json
   {
     "form_data": {
       "viz_type": "echarts_timeseries_bar",
       "x_axis": "ds",
       "metrics": [...],
       "datasource": "1__table"
     }
   }
   ```
   
   ### TESTING INSTRUCTIONS
   
   1. Call `generate_explore_link` MCP tool with a valid dataset and chart config
   2. Verify the response `form_data` contains a `datasource` field with format `"{dataset_id}__table"`
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [x] Introduces new feature or API
   - [ ] Removes existing feature or API


-- 
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] feat(mcp): add datasource field to generate_explore_link form_data [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #36543:
URL: https://github.com/apache/superset/pull/36543#issuecomment-3643999540

   ## Nitpicks πŸ”
   
   <table>
   <tr><td>πŸ”’&nbsp;<strong>No security issues identified</strong></td></tr>
   <tr><td>⚑&nbsp;<strong>Recommended areas for review</strong><br><br>
   
   - [ ] <a href='https://github.com/apache/superset/pull/36543/files#diff-5f5783c745d6c46e34d8d32dac96ae489c191fae284171fd3c8755a3c212d869R97-R98'><strong>Possible overwrite</strong></a><br>The code unconditionally sets `form_data["datasource"]`, which may overwrite a `datasource` already present in the mapped `form_data`. If callers intentionally set a different datasource in `config`, this change will erase it.<br>
   
   </td></tr>
   </table>
   


-- 
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] feat(mcp): add datasource field to generate_explore_link form_data [superset]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #36543:
URL: https://github.com/apache/superset/pull/36543#issuecomment-3644025726

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/36543?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `0%` with `1 line` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 47.89%. Comparing base ([`76d897e`](https://app.codecov.io/gh/apache/superset/commit/76d897eaa2f9e137102bc194c2e3109c29d0348f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`18bfc8a`](https://app.codecov.io/gh/apache/superset/commit/18bfc8adb87cc0cddf1a8e3b83fbe7cc79430db8?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 3104 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/36543?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [.../mcp\_service/explore/tool/generate\_explore\_link.py](https://app.codecov.io/gh/apache/superset/pull/36543?src=pr&el=tree&filepath=superset%2Fmcp_service%2Fexplore%2Ftool%2Fgenerate_explore_link.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvbWNwX3NlcnZpY2UvZXhwbG9yZS90b29sL2dlbmVyYXRlX2V4cGxvcmVfbGluay5weQ==) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/36543?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff             @@
   ##           master   #36543       +/-   ##
   ===========================================
   - Coverage   60.48%   47.89%   -12.60%     
   ===========================================
     Files        1931      637     -1294     
     Lines       76236    47102    -29134     
     Branches     8568     5130     -3438     
   ===========================================
   - Hits        46114    22560    -23554     
   + Misses      28017    23887     -4130     
   + Partials     2105      655     -1450     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/36543/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Ξ” | |
   |---|---|---|
   | [hive](https://app.codecov.io/gh/apache/superset/pull/36543/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `43.52% <0.00%> (-5.64%)` | :arrow_down: |
   | [javascript](https://app.codecov.io/gh/apache/superset/pull/36543/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [presto](https://app.codecov.io/gh/apache/superset/pull/36543/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `47.15% <0.00%> (-6.65%)` | :arrow_down: |
   | [python](https://app.codecov.io/gh/apache/superset/pull/36543/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `47.89% <0.00%> (-15.62%)` | :arrow_down: |
   | [unit](https://app.codecov.io/gh/apache/superset/pull/36543/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `100.00% <ΓΈ> (+42.36%)` | :arrow_up: |
   
   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 Sentry](https://app.codecov.io/gh/apache/superset/pull/36543?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] feat(mcp): add datasource field to generate_explore_link form_data [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 #36543:
URL: https://github.com/apache/superset/pull/36543#discussion_r2612241865


##########
superset/mcp_service/explore/tool/generate_explore_link.py:
##########
@@ -94,6 +94,9 @@ async def generate_explore_link(
         # Map config to form_data using shared utilities
         form_data = map_config_to_form_data(request.config)
 
+        # Add datasource to form_data for consistency with generate_chart
+        form_data["datasource"] = f"{request.dataset_id}__table"

Review Comment:
   **Suggestion:** This unconditionally overwrites any existing `datasource` value in `form_data`, possibly discarding a valid datasource provided by `map_config_to_form_data`; only set `datasource` when it's missing or empty. [logic error]
   
   **Severity Level:** Minor ⚠️
   ```suggestion
           if "datasource" not in form_data or not form_data.get("datasource"):
   ```
   <details>
   <summary><b>Why it matters? ⭐ </b></summary>
   
   Good catch β€” blindly overwriting an existing valid datasource from map_config_to_form_data can discard intentional values. Only setting the key when missing (or falsy) preserves upstream intent and avoids surprising modifications.
   </details>
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset/mcp_service/explore/tool/generate_explore_link.py
   **Line:** 98:98
   **Comment:**
   	*Logic Error: This unconditionally overwrites any existing `datasource` value in `form_data`, possibly discarding a valid datasource provided by `map_config_to_form_data`; only set `datasource` when it's missing or empty.
   
   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.
   ```
   </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] feat(mcp): add datasource field to generate_explore_link form_data [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #36543:
URL: https://github.com/apache/superset/pull/36543#issuecomment-3644002079

   CodeAnt AI finished reviewing your PR.


-- 
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] feat(mcp): add datasource field to generate_explore_link form_data [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #36543:
URL: https://github.com/apache/superset/pull/36543#issuecomment-3643992241

   CodeAnt AI is reviewing your PR.


-- 
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] feat(mcp): add datasource field to generate_explore_link form_data [superset]

Posted by "Antonio-RiveroMartnez (via GitHub)" <gi...@apache.org>.
Antonio-RiveroMartnez merged PR #36543:
URL: https://github.com/apache/superset/pull/36543


-- 
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