codeant-ai-for-open-source[bot] commented on code in PR #42594:
URL: https://github.com/apache/superset/pull/42594#discussion_r3679063329
##########
superset-frontend/plugins/plugin-chart-echarts/test/utils/series.test.ts:
##########
@@ -694,6 +695,39 @@ describe('extractGroupbyLabel', () => {
});
});
+describe('extractDataTotalValues', () => {
+ test('sums numeric metric values across a stacked datum', () => {
+ const { totalStackedValues, thresholdValues } = extractDataTotalValues(
+ [{ __timestamp: '2000-01-01', metric_a: 10, metric_b: 20 }],
+ { stack: true, percentageThreshold: 50, xAxisCol: '__timestamp' },
+ );
+ expect(totalStackedValues).toEqual([30]);
+ expect(thresholdValues).toEqual([15]);
+ });
+
+ // Regression for #36401: query results containing integers beyond
+ // Number.MAX_SAFE_INTEGER are parsed as native BigInt (see
+ // packages/superset-ui-core/src/connection/callApi/parseResponse.ts).
+ // Summing a BigInt datum value against the Number accumulator here
+ // throws instead of producing a stacked total.
+ test('does not throw when a stacked datum contains a BigInt metric value',
() => {
+ const data: DataRecord[] = [
+ {
+ __timestamp: '2000-01-01',
+ metric_a: 10,
+ metric_b: BigInt('9007199254740993'),
+ },
+ ];
+ expect(() =>
+ extractDataTotalValues(data, {
+ stack: true,
+ percentageThreshold: 50,
+ xAxisCol: '__timestamp',
+ }),
+ ).not.toThrow();
Review Comment:
**Suggestion:** The regression test only verifies that the function does not
throw, so an implementation that drops the BigInt metric, returns an incorrect
total, or produces an unusable threshold would still pass. Assert the expected
`totalStackedValues` and `thresholdValues` using the chosen numeric
representation to verify that stacking remains functionally correct.
[incomplete implementation]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ❌ Regression suite can accept incorrect stacked totals.
- ⚠️ Timeseries thresholds remain functionally unverified.
- ⚠️ MixedTimeseries stacking behavior remains unverified.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=7a278ace79ff4f03a34736c407554240&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=7a278ace79ff4f03a34736c407554240&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/plugins/plugin-chart-echarts/test/utils/series.test.ts
**Line:** 721:727
**Comment:**
*Incomplete Implementation: The regression test only verifies that the
function does not throw, so an implementation that drops the BigInt metric,
returns an incorrect total, or produces an unusable threshold would still pass.
Assert the expected `totalStackedValues` and `thresholdValues` using the chosen
numeric representation to verify that stacking remains functionally correct.
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%2F42594&comment_hash=ae0ea2a2bc8728d948643c0f7a010f1e2f7366e44d8af634907f523af6789c6a&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42594&comment_hash=ae0ea2a2bc8728d948643c0f7a010f1e2f7366e44d8af634907f523af6789c6a&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]