codeant-ai-for-open-source[bot] commented on code in PR #37009:
URL: https://github.com/apache/superset/pull/37009#discussion_r3556180675
##########
superset/views/base.py:
##########
@@ -525,8 +525,9 @@ def cached_common_bootstrap_data( # pylint:
disable=unused-argument
frontend_config["AUTH_USER_REGISTRATION_ROLE"] = app.config[
"AUTH_USER_REGISTRATION_ROLE"
]
- if should_show_recaptcha:
- frontend_config["RECAPTCHA_PUBLIC_KEY"] =
app.config["RECAPTCHA_PUBLIC_KEY"]
+ recaptcha_public_key = app.config.get("RECAPTCHA_PUBLIC_KEY")
Review Comment:
**Suggestion:** Add an explicit type annotation for this newly introduced
local variable to satisfy the type-hint requirement. [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 inferable (`str | None` from `app.config.get(...)`). This matches
the Python type-hint rule for newly added code that can be annotated.
</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=a3795abb3d734fd0862a725615c57be3&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=a3795abb3d734fd0862a725615c57be3&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:** superset/views/base.py
**Line:** 528:528
**Comment:**
*Custom Rule: Add an explicit type annotation for this newly introduced
local variable to satisfy the type-hint requirement.
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%2F37009&comment_hash=4f2742d5a7364372ded518d49925ac0b8d945007613053aba4c93358cc13f1a6&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37009&comment_hash=4f2742d5a7364372ded518d49925ac0b8d945007613053aba4c93358cc13f1a6&reaction=dislike'>👎</a>
##########
tests/unit_tests/views/test_bootstrap_auth.py:
##########
@@ -135,6 +135,27 @@ def test_recaptcha_shown_for_non_federated_auth(
assert payload["conf"]["RECAPTCHA_PUBLIC_KEY"] == "test-key"
[email protected](
+ "auth_type",
+ [AUTH_DB, AUTH_LDAP],
+)
+def test_bootstrap_does_not_crash_without_recaptcha_key(
+ app_context: None,
+ auth_type: int,
+) -> None:
+ """Missing RECAPTCHA_PUBLIC_KEY must not crash bootstrap
(#37008/#39364)."""
+ from flask import current_app
+
+ current_app.config["AUTH_TYPE"] = auth_type
+ current_app.config["AUTH_USER_REGISTRATION"] = True
+ current_app.config["AUTH_USER_REGISTRATION_ROLE"] = "Public"
+ current_app.config.pop("RECAPTCHA_PUBLIC_KEY", None)
+
+ payload = _get_bootstrap()
Review Comment:
**Suggestion:** Add an explicit type annotation for this newly introduced
local variable to satisfy the type-hint requirement for relevant variables.
[custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
The new test introduces a local variable whose type is clearly inferable and
can be annotated, but it is left untyped. This matches the Python type-hint
rule for relevant 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=17e362db53c149aea75cb02a1ee63b34&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=17e362db53c149aea75cb02a1ee63b34&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/views/test_bootstrap_auth.py
**Line:** 154:154
**Comment:**
*Custom Rule: Add an explicit type annotation for this newly introduced
local variable to satisfy the type-hint requirement for relevant variables.
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%2F37009&comment_hash=f1fd2d7132413e8ab8c9f142aadd0bba4c09c9bd7083b27d761590e318ad766d&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37009&comment_hash=f1fd2d7132413e8ab8c9f142aadd0bba4c09c9bd7083b27d761590e318ad766d&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]