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


##########
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/buildQuery.test.ts:
##########
@@ -64,6 +64,28 @@ describe('Timeseries buildQuery', () => {
     expect(query.metrics).toEqual(['bar', 'baz']);
   });
 
+  test('should apply contribution before rename with time comparison', () => {
+    // rename strips the `__<offset>` suffix that contribution relies on to
+    // compute each time shift separately
+    const queryContext = buildQuery({
+      ...formData,
+      metrics: ['bar'],
+      x_axis: 'ds',
+      groupby: ['col1'],
+      contributionMode: 'row',
+      comparison_type: 'values',
+      time_compare: ['1 week ago'],
+    });
+    const [query] = queryContext.queries;
+    const operations = (query.post_processing || []).map(
+      operator => operator?.operation,
+    );
+    expect(operations).toContain('contribution');
+    expect(operations.indexOf('contribution')).toBeLessThan(
+      operations.indexOf('rename'),
+    );

Review Comment:
   **Suggestion:** The regression test only checks the relative positions of 
the operator names, so it can pass even if `time_shifts` is omitted, the rename 
mapping is incorrect, or contribution values are still calculated across 
periods. Assert the generated operator options and exercise the post-processing 
result with multiple time offsets to verify the per-period normalization this 
change is intended to fix. [incomplete implementation]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Missing frontend wiring coverage can allow contribution regressions.
   - ⚠️ Timeseries comparisons may normalize periods together again.
   - ⚠️ Existing backend tests do not verify frontend operator options.
   ```
   </details>
   
   [![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)
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** 
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/buildQuery.test.ts
   **Line:** 80:86
   **Comment:**
        *Incomplete Implementation: The regression test only checks the 
relative positions of the operator names, so it can pass even if `time_shifts` 
is omitted, the rename mapping is incorrect, or contribution values are still 
calculated across periods. Assert the generated operator options and exercise 
the post-processing result with multiple time offsets to verify the per-period 
normalization this change is intended to fix.
   
   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%2F43384&comment_hash=9b56cad5907cd08fdee81bebff7c44be770f8c7deb212441101961836f49b431&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43384&comment_hash=9b56cad5907cd08fdee81bebff7c44be770f8c7deb212441101961836f49b431&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