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


##########
superset/mcp_service/semantic_layer/schemas.py:
##########
@@ -81,6 +81,7 @@ class MetricInfo(BaseModel):
     dataset_name: str | None = None
     view_id: int | None = None
     view_name: str | None = None
+    semantic_selection_version: str | None = None

Review Comment:
   **Suggestion:** The new version field is not populated by 
`get_compatible_metrics`, so external semantic views return no identity version 
and clients cannot safely pass it to `get_table`.
   
   **Assessment:** 🟠 `Major` Β· πŸ” `Occurrence: Sometimes` Β· 🏷️ `Incomplete 
implementation`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![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=fbb5fb7ab5b04a5e8a9295b9e7b60ce6&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=fbb5fb7ab5b04a5e8a9295b9e7b60ce6&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/mcp_service/semantic_layer/schemas.py
   **Line:** 84:84
   **Comment:**
        *Incomplete Implementation: The new version field is not populated by 
`get_compatible_metrics`, so external semantic views return no identity version 
and clients cannot safely pass it to `get_table`.
   
   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%2F44370&comment_hash=8846ba0663acf55c239dc7c8783a72c0d4c0bf61d45af95022a8ff41343eb56b&reaction=like'>πŸ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44370&comment_hash=8846ba0663acf55c239dc7c8783a72c0d4c0bf61d45af95022a8ff41343eb56b&reaction=dislike'>πŸ‘Ž</a>



##########
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterValue.tsx:
##########
@@ -203,6 +207,7 @@ const FilterValue: FC<FilterValueProps> = ({
       ...filter,
       datasetId,
       datasourceType,
+      semantic_selection_version,

Review Comment:
   **Suggestion:** `semantic_selection_version` is used to build the request 
but is absent from the effect dependencies, so version changes can leave filter 
queries using stale provenance.
   
   **Assessment:** 🟠 `Major` Β· πŸ” `Occurrence: Sometimes` Β· 🏷️ `Stale reference`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![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=08d3bb4a63f64be88013651da9b84e58&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=08d3bb4a63f64be88013651da9b84e58&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-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterValue.tsx
   **Line:** 210:210
   **Comment:**
        *Stale Reference: `semantic_selection_version` is used to build the 
request but is absent from the effect dependencies, so version changes can 
leave filter queries using stale provenance.
   
   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%2F44370&comment_hash=b7ecb421471f00a3cb6de132d63d73dac2dc58d9a7be22c65556afc54d541cb5&reaction=like'>πŸ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44370&comment_hash=b7ecb421471f00a3cb6de132d63d73dac2dc58d9a7be22c65556afc54d541cb5&reaction=dislike'>πŸ‘Ž</a>



##########
superset-frontend/packages/superset-ui-core/src/query/extractExtras.ts:
##########
@@ -72,6 +73,27 @@ export default function extractExtras(formData: 
QueryFormData): ExtractedExtra {
     }
   });
 
+  const selectionSources = [
+    ...getSemanticSelectionSources(formData.extra_form_data),
+    ...(formData.semantic_selection_sources ?? []),
+  ];
+  const hasUnversionedExtras = (formData.extra_filters ?? []).some(
+    filter =>
+      !['__time_range', '__time_grain', '__time_compare'].includes(filter.col),
+  );

Review Comment:
   **Suggestion:** Valid time-only extras such as `__time_col` and 
`__granularity` are treated as unversioned selections, so every query using 
them loses its valid semantic selection version.
   
   **Assessment:** 🟠 `Major` Β· πŸ” `Occurrence: Sometimes` Β· 🏷️ `Incorrect 
condition logic`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![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=c4628dc438a64267af01b5c1c1b07a01&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=c4628dc438a64267af01b5c1c1b07a01&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-frontend/packages/superset-ui-core/src/query/extractExtras.ts
   **Line:** 80:83
   **Comment:**
        *Incorrect Condition Logic: Valid time-only extras such as `__time_col` 
and `__granularity` are treated as unversioned selections, so every query using 
them loses its valid semantic selection version.
   
   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%2F44370&comment_hash=b3c07a95b55cb97c60660024fed39bdc6568ddb61e0980c7e8d1fbe7a28fa32e&reaction=like'>πŸ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44370&comment_hash=b3c07a95b55cb97c60660024fed39bdc6568ddb61e0980c7e8d1fbe7a28fa32e&reaction=dislike'>πŸ‘Ž</a>



##########
superset-frontend/src/dashboard/util/charts/getFormDataWithExtraFilters.ts:
##########
@@ -584,6 +658,21 @@ export default function getFormDataWithExtraFilters({
     ...groupByFormData,
     ...customizationExtraFormData,
     ...(chartCustomization && { chart_customization: chartCustomization }),
+    // Customizations can rewrite member fields outside extra_form_data.
+    ...(chart.form_data?.semantic_selection_version && {
+      semantic_selection_sources: [
+        ...(chart.form_data.semantic_selection_sources ?? []),
+        ...customizationIds.flatMap(id =>
+          getCustomizationSelectionSources({
+            customization: chartCustomizationItems?.find(
+              item => item.id === id,
+            ),
+            mask: dataMask[id],
+            groupByApplied: appliedGroupByIds.has(id),
+          }),
+        ),
+      ],
+    }),

Review Comment:
   **Suggestion:** The cache-hit check ignores the chart’s semantic version and 
source list, so changed provenance can return cached form data with stale 
certification or stale invalidation.
   
   **Assessment:** 🟠 `Major` Β· πŸ” `Occurrence: Sometimes` Β· 🏷️ `Cache`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![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=2c010618e97d4596a04e463324264a88&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=2c010618e97d4596a04e463324264a88&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-frontend/src/dashboard/util/charts/getFormDataWithExtraFilters.ts
   **Line:** 661:675
   **Comment:**
        *Cache: The cache-hit check ignores the chart’s semantic version and 
source list, so changed provenance can return cached form data with stale 
certification or stale invalidation.
   
   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%2F44370&comment_hash=aeb4b0311646d57332673d045162be5d9e4bf97a40c9de71c4696ff7d13ad577&reaction=like'>πŸ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44370&comment_hash=aeb4b0311646d57332673d045162be5d9e4bf97a40c9de71c4696ff7d13ad577&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