codeant-ai-for-open-source[bot] commented on code in PR #42591:
URL: https://github.com/apache/superset/pull/42591#discussion_r3678814240
##########
superset-frontend/plugins/preset-chart-deckgl/src/layers/Polygon/transformProps.test.ts:
##########
@@ -529,4 +529,48 @@ describe('Polygon transformProps', () => {
expect(features[0]?.extraProps?.['SUM(population)']).toBe(50000);
expect(features[0]?.metrics?.['SUM(population)']).toBe(50000);
});
+
+ // Regression test for #33669: a boundary column literally named "polygon"
+ // (the same key this transform uses internally for the parsed geometry)
+ // reportedly broke rendering, because the raw column value could
+ // theoretically collide with the `polygon` key this function builds on
+ // each feature. `line_column` is excluded before spreading a record's
+ // other properties onto the feature, and the parsed `polygon` key is
+ // assigned last in the returned object literal, so it should always win
+ // over anything copied from the raw record, even when they share a name.
+ test('should correctly parse polygon geometry when the boundary column is
itself named "polygon"', () => {
+ const collidingColumnNameProps = {
+ ...mockChartProps,
+ rawFormData: {
+ ...mockChartProps.rawFormData,
+ line_column: 'polygon',
+ },
+ queriesData: [
+ {
+ data: [
+ {
+ polygon: JSON.stringify([
+ [-122.4, 37.8],
+ [-122.3, 37.8],
+ [-122.3, 37.9],
+ [-122.4, 37.9],
+ ]),
+ population: 50000,
+ },
+ ],
+ },
+ ],
+ };
+
+ const result = transformProps(collidingColumnNameProps as ChartProps);
+ const features = result.payload.data.features as PolygonFeature[];
+
+ expect(features).toHaveLength(1);
+ expect(features[0]?.polygon).toEqual([
+ [-122.4, 37.8],
+ [-122.3, 37.8],
+ [-122.3, 37.9],
+ [-122.4, 37.9],
+ ]);
Review Comment:
**Suggestion:** The regression test only verifies the transformed geometry
and does not verify the boundary-column value consumed by downstream
interactions. With `line_column` set to `polygon`, `addPropertiesToFeature`
excludes the raw column and the returned feature's `polygon` property contains
the parsed coordinate array, so table-filter selection and tooltip lookup
through `o.object[fd.line_column]` receive the geometry array rather than the
original boundary value. Extend the test to exercise the relevant click/tooltip
contract or adjust the implementation to preserve a separate raw boundary
value. [incomplete implementation]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ❌ Table-filter clicks emit geometry arrays instead of boundary values.
- ⚠️ Default Polygon tooltips display parsed coordinates, not raw values.
- ⚠️ Downstream filter serialization may receive an unsupported value shape.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=8e97624628244f4c8b54b2e335336de6&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=8e97624628244f4c8b54b2e335336de6&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/preset-chart-deckgl/src/layers/Polygon/transformProps.test.ts
**Line:** 569:574
**Comment:**
*Incomplete Implementation: The regression test only verifies the
transformed geometry and does not verify the boundary-column value consumed by
downstream interactions. With `line_column` set to `polygon`,
`addPropertiesToFeature` excludes the raw column and the returned feature's
`polygon` property contains the parsed coordinate array, so table-filter
selection and tooltip lookup through `o.object[fd.line_column]` receive the
geometry array rather than the original boundary value. Extend the test to
exercise the relevant click/tooltip contract or adjust the implementation to
preserve a separate raw boundary value.
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%2F42591&comment_hash=97c3ebc7267f23be1dcbe0a8ccf976e38ebaf18f7c082db1180cd45fd74cb2c1&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42591&comment_hash=97c3ebc7267f23be1dcbe0a8ccf976e38ebaf18f7c082db1180cd45fd74cb2c1&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]