codeant-ai-for-open-source[bot] commented on code in PR #41031:
URL: https://github.com/apache/superset/pull/41031#discussion_r3534259206
##########
superset-frontend/packages/superset-core/src/theme/types.ts:
##########
@@ -237,6 +237,16 @@ export interface SupersetSpecificTokens {
* Fallback: transparent
*/
buttonSecondaryActiveBorderColor?: string;
+
+ /**
+ * Results grid customization tokens.
+ * Control the appearance of AG Grid-backed result tables (e.g. SQL Lab).
+ */
+ resultsGridRowHeight?: number;
+ resultsGridHeaderFontWeight?: number;
+ resultsGridHeaderFontSize?: number;
+ resultsGridBorderRadius?: number;
+ resultsGridNoStriping?: boolean;
Review Comment:
**Suggestion:** These new theme tokens are only added to the TypeScript
interface, but they are not registered in the frontend token-name registry
(`SUPERSET_CUSTOM_TOKENS`), so the theme editor will incorrectly flag them as
unknown tokens. Wire these token names into `src/theme/utils/antdTokenNames.ts`
(and its tests) so custom themes using these keys are recognized instead of
producing false validation warnings. [incomplete implementation]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Theme editor warns that resultsGrid tokens are unknown.
- ⚠️ Theme authors may distrust new grid customization tokens.
- ⚠️ Validation output misclassifies resultsGrid tokens as unknown.
```
</details>
<details>
<summary><b>Steps of Reproduction ✅ </b></summary>
```mdx
1. Open the Theme Modal UI, implemented in
`superset-frontend/src/features/themes/ThemeModal.tsx` where
`useThemeValidation` is
invoked at lines 150-164 to validate the current theme JSON
(`currentTheme?.json_data`).
2. In the Theme Modal JSON editor, add Superset-specific result grid tokens
under the
`token` object, for example: `"resultsGridRowHeight": 32`,
`"resultsGridHeaderFontSize":
13`, etc., which are defined in the `SupersetSpecificTokens` interface in
`superset-frontend/packages/superset-core/src/theme/types.ts` at lines 42-50.
3. The `useThemeValidation` hook in
`superset-frontend/src/theme/hooks/useThemeValidation.ts` (lines 86-115)
parses the JSON
into `AnyThemeConfig` and calls `validateTheme(config)` from
`superset-frontend/src/theme/utils/themeStructureValidation.ts` (line 52),
which iterates
over `Object.entries(tokens)` at lines 165-184 to validate each token name.
4. During validation, `validateTheme` calls `isValidTokenName(name)` at line
177, which
delegates to `getValidTokenNames()` in
`superset-frontend/src/theme/utils/antdTokenNames.ts` (lines 96-107). Since
`SUPERSET_CUSTOM_TOKENS` at lines 25-84 does not include
`resultsGridRowHeight`,
`resultsGridHeaderFontWeight`, `resultsGridHeaderFontSize`,
`resultsGridBorderRadius`, or
`resultsGridNoStriping`, `isValidTokenName` returns false, causing
`validateTheme` to add
a warning at lines 176-183 with message `Unknown token
'resultsGridRowHeight' - may be
ignored by Ant Design`, which `useThemeValidation` turns into AceEditor
annotations at
lines 119-137, so the Theme Modal highlights these new result grid tokens as
unknown even
though they are officially defined in the theme types.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=ab3af1bf996d43c6b8a8a43446a998d7&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=ab3af1bf996d43c6b8a8a43446a998d7&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/packages/superset-core/src/theme/types.ts
**Line:** 245:249
**Comment:**
*Incomplete Implementation: These new theme tokens are only added to
the TypeScript interface, but they are not registered in the frontend
token-name registry (`SUPERSET_CUSTOM_TOKENS`), so the theme editor will
incorrectly flag them as unknown tokens. Wire these token names into
`src/theme/utils/antdTokenNames.ts` (and its tests) so custom themes using
these keys are recognized instead of producing false validation warnings.
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%2F41031&comment_hash=2abebb1f8a8131791d8f187dd7761d647db0f22d417eefa5fac5f449a047c029&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41031&comment_hash=2abebb1f8a8131791d8f187dd7761d647db0f22d417eefa5fac5f449a047c029&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]