You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "rusackas (via GitHub)" <gi...@apache.org> on 2026/10/20 04:05:32 UTC
[PR] fix(mcp): clean up nits from PNG chart preview review [superset]
rusackas opened a new pull request, #45509:
URL: https://github.com/apache/superset/pull/45509
### SUMMARY
Small follow-ups from #44558's review (caller-scoped PNG chart previews) that weren't worth holding that merge for:
- `get_chart_preview.py` now imports `PNG_MAGIC_BYTES` from `superset.utils.screenshots` instead of duplicating the magic-byte literal.
- `PreviewFormatGenerator` is no longer constructed on the `png` branch, where it was built then discarded.
- The PNG-size-rejection path in `ResponseSizeGuardMiddleware` now logs `mcp_response_size_exceeded` via `event_logger`, matching the text-response rejection path right above it (previously silent).
- The guarded tool name moved from a bare `"get_chart_preview"` string literal into a `PNG_PREVIEW_TOOLS` frozenset constant in `response_size_utils.py`, matching the house style used by `COMMITTED_WRITE_TOOLS`, `RESPONSE_AWARE_SUGGESTION_TOOLS`, etc.
### TESTING INSTRUCTIONS
- `pytest tests/unit_tests/mcp_service/chart/tool/test_get_chart_preview.py tests/unit_tests/mcp_service/test_middleware.py` (281 passed)
- `pre-commit run` on the touched files
### 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
๐ค Generated with [Claude Code](https://claude.com/claude-code)
--
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): clean up nits from PNG chart preview review [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #45509:
URL: https://github.com/apache/superset/pull/45509#discussion_r4321736280
##########
superset/mcp_service/middleware.py:
##########
@@ -2220,11 +2221,33 @@ async def on_call_tool(
else None
)
if (
- tool_name == "get_chart_preview"
+ tool_name in PNG_PREVIEW_TOOLS
and isinstance(content, dict)
and content.get("type") == "png"
):
if actual_bytes > self.png_max_bytes:
+ logger.warning(
+ "Response blocked for %s: %d bytes exceeds png_max_bytes of %d",
+ tool_name,
+ actual_bytes,
+ self.png_max_bytes,
+ )
+ try:
+ event_logger.log(
+ user_id=get_user_id(),
+ action="mcp_response_size_exceeded",
+ dashboard_id=None,
+ duration_ms=None,
+ slice_id=None,
+ referrer=None,
+ curated_payload={
+ "tool": tool_name,
+ "actual_bytes": actual_bytes,
+ "max_bytes": self.png_max_bytes,
+ },
+ )
Review Comment:
This mirrors the existing size-exceeded audit write a few lines above (same synchronous `event_logger.log` call, same try/except), and it only fires on the rare oversize-PNG rejection, so I am keeping it consistent rather than special-casing this branch.
--
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): clean up nits from PNG chart preview review [superset]
Posted by "aminghadersohi (via GitHub)" <gi...@apache.org>.
aminghadersohi commented on code in PR #45509:
URL: https://github.com/apache/superset/pull/45509#discussion_r4331757964
##########
superset/mcp_service/middleware.py:
##########
@@ -2220,11 +2221,33 @@ async def on_call_tool(
else None
)
if (
- tool_name == "get_chart_preview"
+ tool_name in PNG_PREVIEW_TOOLS
and isinstance(content, dict)
and content.get("type") == "png"
):
if actual_bytes > self.png_max_bytes:
+ logger.warning(
+ "Response blocked for %s: %d bytes exceeds png_max_bytes of %d",
+ tool_name,
+ actual_bytes,
+ self.png_max_bytes,
+ )
+ try:
+ event_logger.log(
Review Comment:
`event_logger.log` commits to the metadata DB on the transport loop. The sibling oversize write hops off it via `run_in_metadata_thread` (L2270), per L980: tool workers can hold every pooled connection while they wait on this loop, so the loop must never wait for one itself.
```suggestion
await run_in_metadata_thread(
event_logger.log,
```
--
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): clean up nits from PNG chart preview review [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas merged PR #45509:
URL: https://github.com/apache/superset/pull/45509
--
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): clean up nits from PNG chart preview review [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #45509:
URL: https://github.com/apache/superset/pull/45509#issuecomment-6283464167
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/45509?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 `7 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 64.91%. Comparing base ([`1e18d01`](https://app.codecov.io/gh/apache/superset/commit/1e18d01d76d6736dd3c22770f3840b8378776fd7?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`18eb97e`](https://app.codecov.io/gh/apache/superset/commit/18eb97edb55535f343eb8f395b4a82ad7841734a?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
| [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/45509?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/middleware.py](https://app.codecov.io/gh/apache/superset/pull/45509?src=pr&el=tree&filepath=superset%2Fmcp_service%2Fmiddleware.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvbWNwX3NlcnZpY2UvbWlkZGxld2FyZS5weQ==) | 0.00% | [5 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/45509?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...perset/mcp\_service/chart/tool/get\_chart\_preview.py](https://app.codecov.io/gh/apache/superset/pull/45509?src=pr&el=tree&filepath=superset%2Fmcp_service%2Fchart%2Ftool%2Fget_chart_preview.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvbWNwX3NlcnZpY2UvY2hhcnQvdG9vbC9nZXRfY2hhcnRfcHJldmlldy5weQ==) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/45509?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [superset/mcp\_service/utils/response\_size\_utils.py](https://app.codecov.io/gh/apache/superset/pull/45509?src=pr&el=tree&filepath=superset%2Fmcp_service%2Futils%2Fresponse_size_utils.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvbWNwX3NlcnZpY2UvdXRpbHMvcmVzcG9uc2Vfc2l6ZV91dGlscy5weQ==) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/45509?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 #45509 +/- ##
==========================================
- Coverage 65.15% 64.91% -0.24%
==========================================
Files 3053 3053
Lines 200638 200643 +5
Branches 46820 46820
==========================================
- Hits 130717 130256 -461
- Misses 66981 67443 +462
- Partials 2940 2944 +4
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/45509/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/45509/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `34.91% <0.00%> (-0.01%)` | :arrow_down: |
| [mysql](https://app.codecov.io/gh/apache/superset/pull/45509/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [postgres](https://app.codecov.io/gh/apache/superset/pull/45509/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/45509/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `36.66% <0.00%> (-0.01%)` | :arrow_down: |
| [python](https://app.codecov.io/gh/apache/superset/pull/45509/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `52.75% <0.00%> (-0.41%)` | :arrow_down: |
| [sqlite](https://app.codecov.io/gh/apache/superset/pull/45509/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `52.64% <0.00%> (-0.01%)` | :arrow_down: |
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 Harness](https://app.codecov.io/gh/apache/superset/pull/45509?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] fix(mcp): clean up nits from PNG chart preview review [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 #45509:
URL: https://github.com/apache/superset/pull/45509#discussion_r4321738125
##########
superset/mcp_service/middleware.py:
##########
@@ -2220,11 +2221,33 @@ async def on_call_tool(
else None
)
if (
- tool_name == "get_chart_preview"
+ tool_name in PNG_PREVIEW_TOOLS
and isinstance(content, dict)
and content.get("type") == "png"
):
if actual_bytes > self.png_max_bytes:
+ logger.warning(
+ "Response blocked for %s: %d bytes exceeds png_max_bytes of %d",
+ tool_name,
+ actual_bytes,
+ self.png_max_bytes,
+ )
+ try:
+ event_logger.log(
+ user_id=get_user_id(),
+ action="mcp_response_size_exceeded",
+ dashboard_id=None,
+ duration_ms=None,
+ slice_id=None,
+ referrer=None,
+ curated_payload={
+ "tool": tool_name,
+ "actual_bytes": actual_bytes,
+ "max_bytes": self.png_max_bytes,
+ },
+ )
Review Comment:
โ
**Customized review instruction saved!**
**Instruction:**
> Do not flag synchronous event_logger.log calls in rare rejection paths in this middleware when they mirror established audit logging behavior; keep those paths consistent rather than recommending branch-specific async handling.
**Applied to:**
- `superset/mcp_service/middleware.py`
---
๐ก *To manage or update this instruction, visit: [CodeAnt AI Settings](https://app.codeant.ai/org/settings/learnings)*
--
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): clean up nits from PNG chart preview review [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 #45509:
URL: https://github.com/apache/superset/pull/45509#discussion_r4321392724
##########
superset/mcp_service/middleware.py:
##########
@@ -2220,11 +2221,33 @@ async def on_call_tool(
else None
)
if (
- tool_name == "get_chart_preview"
+ tool_name in PNG_PREVIEW_TOOLS
and isinstance(content, dict)
and content.get("type") == "png"
):
if actual_bytes > self.png_max_bytes:
+ logger.warning(
+ "Response blocked for %s: %d bytes exceeds png_max_bytes of %d",
+ tool_name,
+ actual_bytes,
+ self.png_max_bytes,
+ )
+ try:
+ event_logger.log(
+ user_id=get_user_id(),
+ action="mcp_response_size_exceeded",
+ dashboard_id=None,
+ duration_ms=None,
+ slice_id=None,
+ referrer=None,
+ curated_payload={
+ "tool": tool_name,
+ "actual_bytes": actual_bytes,
+ "max_bytes": self.png_max_bytes,
+ },
+ )
Review Comment:
**Suggestion:** Because `event_logger.log` performs synchronous database I/O, this PNG-rejection path blocks the asyncio transport loop until the audit write completes, delaying unrelated calls.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes` ยท ๐ท๏ธ `Performance`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill) [](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=c2ba1fbd166f41d887c146937566a2d3&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=c2ba1fbd166f41d887c146937566a2d3&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/mcp_service/middleware.py
**Line:** 2236:2248
**Comment:**
*Performance: Because `event_logger.log` performs synchronous database I/O, this PNG-rejection path blocks the asyncio transport loop until the audit write completes, delaying unrelated calls.
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.
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>
<a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45509&comment_hash=fe258f2e3a85e0410bee584183be4166f888a54d19ada5a001ef5406a02d1e43&reaction=like'>๐</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45509&comment_hash=fe258f2e3a85e0410bee584183be4166f888a54d19ada5a001ef5406a02d1e43&reaction=dislike'>๐</a>
--
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): clean up nits from PNG chart preview review [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on code in PR #45509:
URL: https://github.com/apache/superset/pull/45509#discussion_r4331773360
##########
superset/mcp_service/middleware.py:
##########
@@ -2220,11 +2221,33 @@ async def on_call_tool(
else None
)
if (
- tool_name == "get_chart_preview"
+ tool_name in PNG_PREVIEW_TOOLS
and isinstance(content, dict)
and content.get("type") == "png"
):
if actual_bytes > self.png_max_bytes:
+ logger.warning(
+ "Response blocked for %s: %d bytes exceeds png_max_bytes of %d",
+ tool_name,
+ actual_bytes,
+ self.png_max_bytes,
+ )
+ try:
+ event_logger.log(
Review Comment:
This new `mcp_response_size_exceeded` audit event has no test coverage: the existing PNG-rejection tests (`test_png_response_budget_over_real_mcp_transport`, `test_png_budget_counts_metadata_at_exact_boundary`) only assert the `ToolError`, while the text-path equivalent asserts `event_logger.log` was called with that action. If this block were dropped or its action renamed, the oversize-PNG rejections would silently stop being audited and CI would stay green. Could you patch `event_logger` in one of the PNG-over-budget cases and assert the action and `curated_payload` (`tool`, `actual_bytes`, `max_bytes`)?
--
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): clean up nits from PNG chart preview review [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #45509:
URL: https://github.com/apache/superset/pull/45509#issuecomment-6307804997
@aminghadersohi good catch, done. The test patches `run_in_metadata_thread` and asserts it gets `event_logger.log`. Checked it goes red with the hop swapped back for a direct call.
--
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): clean up nits from PNG chart preview review [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #45509:
URL: https://github.com/apache/superset/pull/45509#issuecomment-6283218223
## CodeAnt PR Risk: Medium Risk
- The PR needs attention before merging: oversized PNGs invoke event logging inline in the async middleware path.
- If that logging performs blocking database I/O, rejected previews can stall unrelated MCP calls.
**Assessed commit:** `18eb97edb555`
--
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): clean up nits from PNG chart preview review [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #45509:
URL: https://github.com/apache/superset/pull/45509#discussion_r4332132679
##########
superset/mcp_service/middleware.py:
##########
@@ -2220,11 +2221,33 @@ async def on_call_tool(
else None
)
if (
- tool_name == "get_chart_preview"
+ tool_name in PNG_PREVIEW_TOOLS
and isinstance(content, dict)
and content.get("type") == "png"
):
if actual_bytes > self.png_max_bytes:
+ logger.warning(
+ "Response blocked for %s: %d bytes exceeds png_max_bytes of %d",
+ tool_name,
+ actual_bytes,
+ self.png_max_bytes,
+ )
+ try:
+ event_logger.log(
Review Comment:
Good catch, pushed that. It hops through `run_in_metadata_thread` now, same as the text-path write.
##########
superset/mcp_service/middleware.py:
##########
@@ -2220,11 +2221,33 @@ async def on_call_tool(
else None
)
if (
- tool_name == "get_chart_preview"
+ tool_name in PNG_PREVIEW_TOOLS
and isinstance(content, dict)
and content.get("type") == "png"
):
if actual_bytes > self.png_max_bytes:
+ logger.warning(
+ "Response blocked for %s: %d bytes exceeds png_max_bytes of %d",
+ tool_name,
+ actual_bytes,
+ self.png_max_bytes,
+ )
+ try:
+ event_logger.log(
Review Comment:
Good call, added `test_png_over_budget_rejection_is_audited`. It patches `event_logger` and asserts the action plus the `tool`/`actual_bytes`/`max_bytes` payload.
--
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): clean up nits from PNG chart preview review [superset]
Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #45509:
URL: https://github.com/apache/superset/pull/45509#issuecomment-6305843504
### <span aria-hidden="true">โ
</span> Deploy Preview for *superset-docs-preview* ready!
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">๐จ</span> Latest commit | 70c77144b3becfb14a121e405f0f31d1bcaef87c |
|<span aria-hidden="true">๐</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/6ad8166f797d0d6384bb2228 |
|<span aria-hidden="true">๐</span> Deploy Preview | [https://deploy-preview-45509--superset-docs-preview.netlify.app](https://deploy-preview-45509--superset-docs-preview.netlify.app) |
|<span aria-hidden="true">๐ฑ</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br /><br /><br />_Use your smartphone camera to open QR code link._</details> |
|<span aria-hidden="true">๐ค</span> Make changes | [Run an agent on this branch](https://app.netlify.com/projects/superset-docs-preview/agent-runs#q1YqKMrPLShRslJS0lFKKkrMS84AstMyK_Rzkwt0C_LSdQuKUssyU8t18zJLioFqUlILcvIrPVOAqswSUywMzczSzC3NUwxSzIwtTJKSjIyMLJRqAQ) |
---
<!-- [superset-docs-preview Preview](https://deploy-preview-45509--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