codeant-ai-for-open-source[bot] commented on code in PR #41975:
URL: https://github.com/apache/superset/pull/41975#discussion_r3603599710


##########
tests/unit_tests/db_engine_specs/test_bigquery.py:
##########
@@ -430,6 +430,78 @@ def test_get_default_catalog(mocker: MockerFixture) -> 
None:
     assert BigQueryEngineSpec.get_default_catalog(database) == "project"
 
 
[email protected](
+    ("sqlalchemy_uri", "schema", "expected_project"),
+    [
+        ("bigquery://uri-project", None, "uri-project"),
+        ("bigquery:///uri-project", None, "uri-project"),
+        ("bigquery://", "dataset_name", None),
+    ],
+)
+def test_get_client_resolves_uri_project_with_service_account_credentials(
+    mocker: MockerFixture,
+    sqlalchemy_uri: str,
+    schema: str | None,
+    expected_project: str | None,
+) -> None:
+    """Test that service-account clients use the project from the engine 
URI."""
+    from superset.db_engine_specs.bigquery import BigQueryEngineSpec
+
+    credentials_info = {"project_id": "credential-project"}
+    credentials = mock.Mock()

Review Comment:
   **Suggestion:** Add explicit type annotations for newly introduced local 
mock variables in this test to comply with the type-hint rule. [custom_rule]
   
   **Severity Level:** Minor ๐Ÿงน
   <details>
   <summary><b>Why it matters? โญ </b></summary>
   
   This newly added local mock variable is unannotated in modified Python code, 
and it can be annotated with a mock-related type, so the suggestion correctly 
identifies a real type-hint omission.
   </details>
   <details>
   <summary><b>Rule source ๐Ÿ“– </b></summary>
   
   .cursor/rules/dev-standard.mdc (line 28)
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=d847c89d615d4ce5aa7ad977a9272266&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=d847c89d615d4ce5aa7ad977a9272266&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/db_engine_specs/test_bigquery.py
   **Line:** 451:451
   **Comment:**
        *Custom Rule: Add explicit type annotations for newly introduced local 
mock variables in this test to comply with the type-hint 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%2F41975&comment_hash=0bdce5ab9884035264da6ba19a83c0fcf0d2bea5ef3b81bb7b7f8a8c38c73aa4&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41975&comment_hash=0bdce5ab9884035264da6ba19a83c0fcf0d2bea5ef3b81bb7b7f8a8c38c73aa4&reaction=dislike'>๐Ÿ‘Ž</a>



##########
tests/unit_tests/db_engine_specs/test_bigquery.py:
##########
@@ -430,6 +430,78 @@ def test_get_default_catalog(mocker: MockerFixture) -> 
None:
     assert BigQueryEngineSpec.get_default_catalog(database) == "project"
 
 
[email protected](
+    ("sqlalchemy_uri", "schema", "expected_project"),
+    [
+        ("bigquery://uri-project", None, "uri-project"),
+        ("bigquery:///uri-project", None, "uri-project"),
+        ("bigquery://", "dataset_name", None),
+    ],
+)
+def test_get_client_resolves_uri_project_with_service_account_credentials(
+    mocker: MockerFixture,
+    sqlalchemy_uri: str,
+    schema: str | None,
+    expected_project: str | None,
+) -> None:
+    """Test that service-account clients use the project from the engine 
URI."""
+    from superset.db_engine_specs.bigquery import BigQueryEngineSpec
+
+    credentials_info = {"project_id": "credential-project"}

Review Comment:
   **Suggestion:** Add an explicit type annotation for this local dictionary to 
satisfy the type-hint requirement for relevant variables in new code. 
[custom_rule]
   
   **Severity Level:** Minor ๐Ÿงน
   <details>
   <summary><b>Why it matters? โญ </b></summary>
   
   The new local dictionary is introduced in modified Python code without any 
type annotation, and it is a variable that can reasonably be annotated, so this 
matches the type-hint rule.
   </details>
   <details>
   <summary><b>Rule source ๐Ÿ“– </b></summary>
   
   .cursor/rules/dev-standard.mdc (line 28)
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=2304467a904c4efa8a150bdd7c9ddd84&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=2304467a904c4efa8a150bdd7c9ddd84&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/db_engine_specs/test_bigquery.py
   **Line:** 450:450
   **Comment:**
        *Custom Rule: Add an explicit type annotation for this local dictionary 
to satisfy the type-hint requirement for relevant variables in new code.
   
   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%2F41975&comment_hash=669c7ebfe694954ebbe1640efd79b334099500584fc7efc3c86a733025f5fe87&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41975&comment_hash=669c7ebfe694954ebbe1640efd79b334099500584fc7efc3c86a733025f5fe87&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]

Reply via email to