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 2026/03/12 22:09:06 UTC

[PR] fix(mcp): extract role names as strings in UserInfo serialization [superset]

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

   ### SUMMARY
   
   `UserInfo.model_validate(owner, from_attributes=True)` in chart, dashboard, and dataset serializers passed raw SQLAlchemy `Role` objects to the `roles: List[str]` field, causing Pydantic validation errors:
   
   ```
   1 validation error for UserInfo
   roles.0
     Input should be a valid string [type=string_type, input_value=Admin, input_type=Role]
   ```
   
   This was introduced by #38407 which added the `roles` field to `UserInfo`.
   
   **Fix:**
   - Move `serialize_user_object()` to `system/schemas.py` alongside the `UserInfo` definition
   - Extract `role.name` strings from SQLAlchemy Role objects instead of passing them directly
   - Replace all `UserInfo.model_validate(owner, from_attributes=True)` calls with `serialize_user_object()` in chart, dashboard, and dataset serializers
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A - backend-only fix
   
   ### TESTING INSTRUCTIONS
   
   1. Start Superset with MCP enabled
   2. Call `get_dashboard_info` for any dashboard that has owners with roles
   3. Verify it returns successfully without Pydantic validation errors
   4. Similarly test `get_chart_info` and `get_dataset_info`
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] 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] fix(mcp): extract role names as strings in UserInfo serialization [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #38612:
URL: https://github.com/apache/superset/pull/38612#issuecomment-4050514576

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large 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] fix(mcp): extract role names as strings in UserInfo serialization [superset]

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

   ### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
   
   
   |  Name | Link |
   |:-:|------------------------|
   |<span aria-hidden="true">🔨</span> Latest commit | e4e9afe49108968cb153f38b56daa73ca16242e0 |
   |<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/69b3398358b546000968e966 |
   |<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-38612--superset-docs-preview.netlify.app](https://deploy-preview-38612--superset-docs-preview.netlify.app) |
   |<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />![QR Code](https://app.netlify.com/qr-code/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL2RlcGxveS1wcmV2aWV3LTM4NjEyLS1zdXBlcnNldC1kb2NzLXByZXZpZXcubmV0bGlmeS5hcHAifQ.FADxr04kShGh_qRbPvCFU_0W1JBEyem3QPQikMzgmDQ)<br /><br />_Use your smartphone camera to open QR code link._</details> |
   ---
   <!-- [superset-docs-preview Preview](https://deploy-preview-38612--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(mcp): extract role names as strings in UserInfo serialization [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #38612:
URL: https://github.com/apache/superset/pull/38612#issuecomment-4050973744

   **Bito Automatic Review Skipped – PR Already Merged**<br/><br/>Bito scheduled an automatic review for this pull request, but the review was skipped because this PR was merged before the review could be run.<br/>No action is needed if you didn't intend to review it. To get a review, you can type `/review` in a comment and save it


-- 
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(mcp): extract role names as strings in UserInfo serialization [superset]

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


-- 
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(mcp): extract role names as strings in UserInfo serialization [superset]

Posted by "rebenitez1802 (via GitHub)" <gi...@apache.org>.
rebenitez1802 commented on PR #38612:
URL: https://github.com/apache/superset/pull/38612#issuecomment-4050951662

   can we add `result.current_user = serialize_user_object(user)` to https://github.com/apache/superset/blob/95f61bd223ee7f72893197c77ec73a06d225443b/superset/mcp_service/system/tool/get_instance_info.py#L123 i think is the same role-extraction logic.
   


-- 
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(mcp): extract role names as strings in UserInfo serialization [superset]

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

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/38612?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 `18.18182%` with `9 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 54.40%. Comparing base ([`09e9c6a`](https://app.codecov.io/gh/apache/superset/commit/09e9c6a522ecf3cebb618fec3a965d2b55f298ad?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`e4e9afe`](https://app.codecov.io/gh/apache/superset/commit/e4e9afe49108968cb153f38b56daa73ca16242e0?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 4 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/38612?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [superset/mcp\_service/system/schemas.py](https://app.codecov.io/gh/apache/superset/pull/38612?src=pr&el=tree&filepath=superset%2Fmcp_service%2Fsystem%2Fschemas.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvbWNwX3NlcnZpY2Uvc3lzdGVtL3NjaGVtYXMucHk=) | 18.18% | [9 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/38612?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   #38612       +/-   ##
   ===========================================
   - Coverage   65.01%   54.40%   -10.62%     
   ===========================================
     Files        1817     2529      +712     
     Lines       72317   128952    +56635     
     Branches    23031    29718     +6687     
   ===========================================
   + Hits        47018    70155    +23137     
   - Misses      25299    58456    +33157     
   - Partials        0      341      +341     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/38612/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/38612/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `40.75% <18.18%> (?)` | |
   | [presto](https://app.codecov.io/gh/apache/superset/pull/38612/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `40.77% <18.18%> (?)` | |
   | [python](https://app.codecov.io/gh/apache/superset/pull/38612/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `40.85% <18.18%> (?)` | |
   
   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/38612?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