aminghadersohi commented on PR #39912: URL: https://github.com/apache/superset/pull/39912#issuecomment-4390638012
Addressed in f20e95ba0dd7a7cf4e09bb76ba5cfd0ae5c4c594. Root cause: the middleware was lazy-importing `estimate_response_tokens`, `format_size_limit_error`, `INFO_TOOLS`, and `truncate_oversized_response` *inside* the methods, so those names never existed on the `superset.mcp_service.middleware` module — patching the conventional `superset.mcp_service.middleware.estimate_response_tokens` path raised `AttributeError`, which is why I had originally targeted the definition module. Fix: hoisted all four imports to module level. Now `superset.mcp_service.middleware.estimate_response_tokens` exists as a normal module attribute and the test patches it where it's used, the way the convention assumes. Not strictly needed but the right call — keeps tests robust against future churn and gets rid of three pointless local imports. -- 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]
