bito-code-review[bot] commented on code in PR #40967:
URL: https://github.com/apache/superset/pull/40967#discussion_r3394274764
##########
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/buildQuery.test.ts:
##########
@@ -46,6 +46,24 @@ describe('Timeseries buildQuery', () => {
expect(query.orderby).toEqual([['bar', false]]);
});
+ test('should include the scatter dot size metric in query metrics', () => {
+ const queryContext = buildQuery({
+ ...formData,
+ size: 'qux',
+ });
+ const [query] = queryContext.queries;
+ expect(query.metrics).toEqual(['bar', 'baz', 'qux']);
+ });
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Test validates non-existent code</b></div>
<div id="fix">
This test (lines 49-56) expects `buildQuery` to include `formData.size`
('qux') in query metrics, but `buildQuery.ts` does not reference or handle the
`size` property. The `extractExtraMetrics` helper only processes
`timeseries_limit_metric` and `x_axis_sort`. This test will always fail until
the size metric extraction logic is implemented in the source file.
</div>
</div>
<small><i>Code Review Run #1871ad</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
##########
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/buildQuery.test.ts:
##########
@@ -46,6 +46,24 @@ describe('Timeseries buildQuery', () => {
expect(query.orderby).toEqual([['bar', false]]);
});
+ test('should include the scatter dot size metric in query metrics', () => {
+ const queryContext = buildQuery({
+ ...formData,
+ size: 'qux',
+ });
+ const [query] = queryContext.queries;
+ expect(query.metrics).toEqual(['bar', 'baz', 'qux']);
+ });
+
+ test('should dedupe the dot size metric when it is also a value metric', ()
=> {
+ const queryContext = buildQuery({
+ ...formData,
+ size: 'bar',
+ });
+ const [query] = queryContext.queries;
+ expect(query.metrics).toEqual(['bar', 'baz']);
+ });
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Test validates non-existent dedup logic</b></div>
<div id="fix">
This test (lines 58-65) expects `buildQuery` to deduplicate the size metric
when it matches an existing value metric. However, `buildQuery.ts` does not
extract or handle `formData.size` at all, so deduplication logic cannot exist.
The test cannot pass until size metric handling is implemented in the source.
</div>
</div>
<small><i>Code Review Run #1871ad</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
##########
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Scatter/controlPanel.test.ts:
##########
@@ -24,7 +24,7 @@ const config = controlPanel;
const getControl = (controlName: string) => {
for (const section of config.controlPanelSections) {
- if (section && section.controlSetRows) {
+ if (section?.controlSetRows) {
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Duplicate test control setup across test files</b></div>
<div id="fix">
Detected ~43 lines of duplicate test setup code across controlPanel.test.ts
files (Scatter:27‑69, Area:27‑69, SmoothLine:27‑69, Step:27‑69, Line:27‑69).
Consider moving common code to a shared helper to improve maintainability.
</div>
</div>
<small><i>Code Review Run #1871ad</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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]