aminghadersohi commented on code in PR #40746:
URL: https://github.com/apache/superset/pull/40746#discussion_r3399803172
##########
superset/mcp_service/user/schemas.py:
##########
@@ -278,7 +306,7 @@ def serialize_user_object(
user_roles = getattr(user, "roles", None)
if user_roles is not None:
try:
- roles = [r.name for r in user_roles if hasattr(r, "name")]
+ roles = [sanitize_for_llm_context(r.name,
field_path=("roles",)) for r in user_roles if hasattr(r, "name") and
isinstance(r.name, str)]
Review Comment:
**high:** `sanitize_for_llm_context(r.name, field_path=("roles",))` wraps
each name as `"<UNTRUSTED-CONTENT>\nAdmin\n</UNTRUSTED-CONTENT>"` — so
`test_serialize_user_object_round_trip_with_role_objects` (test_schemas.py:106)
now asserts `info.roles == ["Admin"]` against the wrapped string and will fail.
Pre-commit/CI will break.
Either update the test assertion to match the wrapped output, or move the
`sanitize_for_llm_context` call into `_extract_role_names` so both construction
paths produce consistently sanitized values and the test expectation is clear.
--
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]