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


##########
superset-frontend/src/features/semanticLayers/label.ts:
##########
@@ -63,3 +63,15 @@ export const databasesLabel = () => sl(t('Databases'), 
t('Data connections'));
 /** Lower-case plural: "databases" / "data connections" */
 export const databasesLabelLower = () =>
   sl(t('databases'), t('data connections'));
+
+// ---------------------------------------------------------------------------
+// Per-datasource parent label
+// ---------------------------------------------------------------------------
+
+/**
+ * Returns the label for the parent of a datasource: "database" for datasets,
+ * "semantic layer" for semantic views. Pass the `kind` field from the
+ * combined datasource list response.
+ */
+export const parentLabelLower = (kind?: string) =>
+  kind === 'semantic_view' ? t('semantic layer') : t('database');

Review Comment:
   **Suggestion:** This new label helper bypasses the existing `sl(...)` 
feature-flag logic and always uses "database" for non-semantic-view items, so 
when semantic layers are enabled the UI will show inconsistent terminology 
("database" here vs "data connection" elsewhere). Route the fallback branch 
through the same feature-flag-aware label helper used by the other database 
labels. [logic error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Native filter dataset tooltip shows inconsistent parent label string.
   - ⚠️ Semantic layers experience uses mixed "database" and "data connection" 
terms.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Observe that semantic-layer-aware labels use the `sl` helper in
   `superset-frontend/src/features/semanticLayers/label.ts`: 
`databaseLabelLower` at lines
   57–58 calls `sl(t('database'), t('data connection'))`, and `sl` itself at 
lines 30–32
   returns the "semantic" label when `isFeatureEnabled(SEMANTIC_LAYERS_FLAG)` 
is true.
   
   2. Note that the new `parentLabelLower` helper in the same file at lines 
71–77 does not
   use `sl` and instead hardcodes `t('semantic layer')` for `kind === 
'semantic_view'` and
   `t('database')` for all other kinds, so it never produces "data connection" 
even when
   `SEMANTIC_LAYERS` is enabled.
   
   3. Follow an actual caller:
   `superset-frontend/src/features/datasets/DatasetSelectLabel/index.tsx` lines 
16–31 render
   a tooltip for datasets and call `parentLabelLower(item.kind)` on line 29 to 
render the
   parent label before the database name in the tooltip description.
   
   4. Trace how this label is used in real UI flows: `DatasetSelectLabel` is 
used by
   `DatasetSelect` in
   
`superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DatasetSelect.tsx`
   at lines 7–15 and 120–15, and `DatasetSelect` is used in the native filters 
config form
   and in chart creation (`superset-frontend/src/pages/ChartCreation/index.tsx` 
lines 4–11).
   When the `SemanticLayers` feature flag is enabled (checked via
   `isFeatureEnabled(FeatureFlag.SemanticLayers)` in `DatasetSelect.tsx` line 
32 and via
   `SEMANTIC_LAYERS_FLAG` in `label.ts`), the rest of the UI shows "data 
connection" (e.g.,
   `DatabaseList` uses `databaseLabelLower()` at
   `superset-frontend/src/pages/DatabaseList/index.tsx` lines 5–8 and 80–82), 
but
   `parentLabelLower` still renders "database" for non-`semantic_view` items, 
so a user
   opening the dataset selector or native filter dataset tooltip will see 
inconsistent
   terminology ("database: …" here vs "data connection" elsewhere).
   ```
   </details>
   
   [Fix in 
Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=05b064bceee5499fb3cae4584d01f566&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 | [Fix in VSCode 
Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=05b064bceee5499fb3cae4584d01f566&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-frontend/src/features/semanticLayers/label.ts
   **Line:** 76:77
   **Comment:**
        *Logic Error: This new label helper bypasses the existing `sl(...)` 
feature-flag logic and always uses "database" for non-semantic-view items, so 
when semantic layers are enabled the UI will show inconsistent terminology 
("database" here vs "data connection" elsewhere). Route the fallback branch 
through the same feature-flag-aware label helper used by the other database 
labels.
   
   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%2F40475&comment_hash=441521c82853a32832dfad361175907ea4a90bc20330602604e5cfa0e77ca8a9&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40475&comment_hash=441521c82853a32832dfad361175907ea4a90bc20330602604e5cfa0e77ca8a9&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