codeant-ai-for-open-source[bot] commented on code in PR #45537:
URL: https://github.com/apache/superset/pull/45537#discussion_r4331464832
##########
superset/semantic_layers/models.py:
##########
@@ -606,6 +607,14 @@ def uid(self) -> str:
def type(self) -> str:
return "semantic_view"
+ def _provider_metrics(self) -> set[Metric]:
+ """Read the provider's metrics, classifying faults as backend
errors."""
+ return discover_semantic_metadata(self.implementation.get_metrics)
+
+ def _provider_dimensions(self) -> set[Dimension]:
+ """Read the provider's dimensions, classifying faults as backend
errors."""
+ return discover_semantic_metadata(self.implementation.get_dimensions)
Review Comment:
**Suggestion:** Python evaluates `self.implementation` before calling the
wrapper, so provider binding or `get_semantic_view` failures bypass
classification and can still surface as raw errors on metadata reads.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Rarely` ยท ๐ท๏ธ `Incomplete
implementation`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=29cc4fb0d6fe4b67b79677bb6b4546a6&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=29cc4fb0d6fe4b67b79677bb6b4546a6&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/semantic_layers/models.py
**Line:** 612:616
**Comment:**
*Incomplete Implementation: Python evaluates `self.implementation`
before calling the wrapper, so provider binding or `get_semantic_view` failures
bypass classification and can still surface as raw errors on metadata reads.
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%2F45537&comment_hash=26b886c1b4d43521b6366b7a97ae879bab5c9939c2e7441fbc5caa58ae742ee7&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45537&comment_hash=26b886c1b4d43521b6366b7a97ae879bab5c9939c2e7441fbc5caa58ae742ee7&reaction=dislike'>๐</a>
##########
superset/semantic_layers/exceptions.py:
##########
@@ -100,6 +100,45 @@ def __init__(self) -> None:
)
+ProviderResult = TypeVar("ProviderResult")
+
+# Host signals that keep their own classification when raised by a provider.
+_HOST_SIGNALS: tuple[type[BaseException], ...] = (
+ QueryObjectValidationError,
+ SemanticLayerQueryRejectedError,
+ SemanticLayerExecutionError,
+ SupersetSecurityException,
+ OAuth2RedirectError,
+ OAuth2Error,
+ SupersetCancelQueryException,
+ SoftTimeLimitExceeded,
+)
+
+
+def discover_semantic_metadata(
+ discovery: Callable[[], ProviderResult],
+) -> ProviderResult:
+ """
+ Classify a provider metadata fault as a backend error.
+
+ Discovery takes no user input, so a provider exception here is never a
+ correctable request; it must not reach generic ``ValueError`` handlers
+ that answer 400, and its text must not reach the response. This helper
+ logs only the exception type: discovery also runs for dashboards and
+ metadata views, whose logs must not carry provider detail.
+ """
+ try:
+ return discovery()
+ except _HOST_SIGNALS:
+ raise
+ except Exception as ex: # pylint: disable=broad-except
+ # Provider exception text may contain credentials or provider URLs.
+ logger.error(
+ "Semantic provider metadata discovery failed: %s",
type(ex).__name__
+ )
+ raise SemanticLayerExecutionError() from ex
Review Comment:
**Suggestion:** The chained cause retains the provider traceback; when
Superset logs this `SupersetErrorException` with `exc_info=True`, credentials
or provider URLs reappear in server logs.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Rarely` ยท ๐ท๏ธ `Security`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=d95610185db04e80bf745175b5133f5c&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=d95610185db04e80bf745175b5133f5c&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/semantic_layers/exceptions.py
**Line:** 139:139
**Comment:**
*Security: The chained cause retains the provider traceback; when
Superset logs this `SupersetErrorException` with `exc_info=True`, credentials
or provider URLs reappear in server logs.
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%2F45537&comment_hash=9841f057687932447f0d9e86077d8526722f567ac7ed65a79b0dc4cdf2512635&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45537&comment_hash=9841f057687932447f0d9e86077d8526722f567ac7ed65a79b0dc4cdf2512635&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]