codeant-ai-for-open-source[bot] commented on code in PR #41920:
URL: https://github.com/apache/superset/pull/41920#discussion_r3561487199
##########
tests/unit_tests/mcp_service/dashboard/tool/test_update_dashboard.py:
##########
@@ -468,6 +468,37 @@ async def test_invalid_css_is_rejected(
assert "css is invalid" in (payload.get("error") or "").lower()
mock_session.commit.assert_not_called()
+ @patch("superset.daos.dashboard.DashboardDAO.get_by_id_or_slug")
+ @patch("superset.extensions.db.session")
+ @pytest.mark.asyncio
+ async def test_ctx_info_is_awaited(
+ self, mock_session: Mock, mock_get: Mock, mcp_server: object
+ ) -> None:
+ """``ctx.info`` calls must be awaited โ ``Context.info`` is an
+ async method, so an unawaited call silently drops the log line
+ instead of raising. Assert it was actually invoked (and thus
+ awaited, since ``AsyncMock`` records only real awaits) rather
+ than just checking the response succeeded."""
+ dash = _mock_dashboard(id=42)
+ mock_get.return_value = dash
+
+ with patch.object(Context, "info", new_callable=AsyncMock) as
mock_ctx_info:
+ async with Client(mcp_server) as client:
+ await client.call_tool(
+ "update_dashboard",
+ {
+ "request": {
+ "identifier": 42,
+ "dashboard_title": "Renamed",
+ }
+ },
+ )
+
+ assert mock_ctx_info.await_count >= 2
+ awaited_messages = [c.args[0] for c in mock_ctx_info.await_args_list]
Review Comment:
**Suggestion:** Add a type annotation for this newly introduced local
variable so the new test code fully complies with the required type-hinting
rule. [custom_rule]
**Severity Level:** Minor ๐งน
<details>
<summary><b>Why it matters? โญ </b></summary>
The new local variable is introduced without a type annotation even though
its type is straightforward to express, so it fits the stated rule about
annotating relevant new Python variables.
</details>
<details>
<summary><b>Rule source ๐ </b></summary>
.cursor/rules/dev-standard.mdc (line 28)
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=2f6ea7aa5b6c4cc88f487c09dfaa555f&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=2f6ea7aa5b6c4cc88f487c09dfaa555f&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
tests/unit_tests/mcp_service/dashboard/tool/test_update_dashboard.py
**Line:** 498:498
**Comment:**
*Custom Rule: Add a type annotation for this newly introduced local
variable so the new test code fully complies with the required type-hinting
rule.
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%2F41920&comment_hash=bc9b0ce6a3f178a8abe90fee97bbe3a835c6c209082331bf7d80d1ff75aeac37&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41920&comment_hash=bc9b0ce6a3f178a8abe90fee97bbe3a835c6c209082331bf7d80d1ff75aeac37&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: [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]