korbit-ai[bot] commented on code in PR #35934:
URL: https://github.com/apache/superset/pull/35934#discussion_r2482372224
##########
superset/mcp_service/utils/permissions_utils.py:
##########
@@ -142,9 +142,9 @@ def get_allowed_fields(
if not user:
user = get_current_user()
- # Get sensitive fields for this object type
- sensitive_fields = SENSITIVE_FIELDS.get(object_type, set())
- sensitive_fields.update(SENSITIVE_FIELDS.get("common", set()))
+ base=SENSITIVE_FIELDS.get(object_type, set())
+ common=SENSITIVE_FIELDS.get("common", set())
+ sensitive_fields= set(base)|set(common)
Review Comment:
### Redundant Set Conversion <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The code unnecessarily converts base and common to sets twice when they are
already sets from SENSITIVE_FIELDS dictionary.
###### Why this matters
This creates unnecessary set conversions that impact performance and code
clarity without adding any value.
###### Suggested change ∙ *Feature Preview*
```python
base = SENSITIVE_FIELDS.get(object_type, set())
common = SENSITIVE_FIELDS.get("common", set())
sensitive_fields = base | common # Set union operator directly on sets
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/1516ce7a-f645-4875-aa47-527d4f518287/upvote)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/1516ce7a-f645-4875-aa47-527d4f518287?what_not_true=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/1516ce7a-f645-4875-aa47-527d4f518287?what_out_of_scope=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/1516ce7a-f645-4875-aa47-527d4f518287?what_not_in_standard=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/1516ce7a-f645-4875-aa47-527d4f518287)
</details>
<sub>
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:b2ec2961-7d92-4fbd-b9cf-2c00eea43e33 -->
[](b2ec2961-7d92-4fbd-b9cf-2c00eea43e33)
--
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]