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


##########
superset-frontend/scripts/oxlint-metrics-uploader.js:
##########
@@ -280,8 +280,8 @@ async function runOxlintAndProcess() {
 
 // Run the process, unless this file was imported (e.g. by a test) rather than
 // executed, in which case nothing should be linted or uploaded on import.
-if (require.main === module) {
+if (__filename === process.argv[1]) {
   runOxlintAndProcess().catch(console.error);
 }
 
-module.exports = { parseRuleId };
+export default { parseRuleId };

Review Comment:
   **Suggestion:** The existing Jest test imports this module with CommonJS and 
destructures `parseRuleId` from the module object, but this change exposes only 
a default export containing that property. Under the Jest transform, 
`parseRuleId` is therefore undefined and all tests and CommonJS consumers using 
the previous shape fail. Preserve a named export or update the consumers 
consistently. [api mismatch]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ Oxlint metrics uploader unit tests fail.
   - ⚠️ CommonJS consumers cannot access `parseRuleId`.
   ```
   </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)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=eb3ae1bc6cd2412da59095e29e8c9e72&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=eb3ae1bc6cd2412da59095e29e8c9e72&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/scripts/oxlint-metrics-uploader.js
   **Line:** 287:287
   **Comment:**
        *Api Mismatch: The existing Jest test imports this module with CommonJS 
and destructures `parseRuleId` from the module object, but this change exposes 
only a default export containing that property. Under the Jest transform, 
`parseRuleId` is therefore undefined and all tests and CommonJS consumers using 
the previous shape fail. Preserve a named export or update the consumers 
consistently.
   
   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%2F43686&comment_hash=459096276ab7f2a6b3ddc423a7b0bdaabf2259ed12aa3799c15e8f9e69869d1e&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43686&comment_hash=459096276ab7f2a6b3ddc423a7b0bdaabf2259ed12aa3799c15e8f9e69869d1e&reaction=dislike'>👎</a>



##########
superset-frontend/src/utils/textUtils.ts:
##########
@@ -15,15 +15,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-const loadModule = () => {
+
+const loadModule = async () => {
   try {
-    // eslint-disable-next-line global-require, import/no-unresolved
-    return require('../../../superset_text') || {};
+    // eslint-disable-next-line import/no-unresolved
+    return (await import('../../../superset_text.yml')) || {};

Review Comment:
   **Suggestion:** `import()` returns a module namespace object, so when 
`js-yaml-loader` loads the YAML the value is shaped like `{ default: parsedYaml 
}`, not the parsed YAML object itself. The exported value consequently has no 
`DB_IMAGES`, `ERRORS`, or other configured text properties, causing these 
lookups to fall back or return undefined whenever a custom `superset_text.yml` 
is present. Unwrap the module's default export before exposing it. [type error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Custom database text overrides are ignored.
   - ⚠️ Custom CRUD error messages are not applied.
   - ⚠️ Theme and database documentation overrides fall back.
   ```
   </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)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=bd8f6d9fcdeb482ba9f0615b15587fe6&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=bd8f6d9fcdeb482ba9f0615b15587fe6&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/utils/textUtils.ts
   **Line:** 22:22
   **Comment:**
        *Type Error: `import()` returns a module namespace object, so when 
`js-yaml-loader` loads the YAML the value is shaped like `{ default: parsedYaml 
}`, not the parsed YAML object itself. The exported value consequently has no 
`DB_IMAGES`, `ERRORS`, or other configured text properties, causing these 
lookups to fall back or return undefined whenever a custom `superset_text.yml` 
is present. Unwrap the module's default export before exposing it.
   
   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%2F43686&comment_hash=e3ce7ec6cec763445a52bc1c5e4229481fb3c0eaf8e32481d6e86236c197ba54&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43686&comment_hash=e3ce7ec6cec763445a52bc1c5e4229481fb3c0eaf8e32481d6e86236c197ba54&reaction=dislike'>👎</a>



##########
superset-frontend/packages/generator-superset/generators/plugin-chart/templates/babel.config.erb:
##########
@@ -17,4 +17,5 @@ config.plugins = [
   ['babel-plugin-typescript-to-proptypes', { loose: true }],
   ['@babel/plugin-proposal-class-properties', { loose: true }],
 ];
-module.exports = config;
+
+export default plugin;

Review Comment:
   **Suggestion:** The generated Babel configuration defines `config` but 
exports the undeclared identifier `plugin`. Evaluating every generated plugin's 
Babel config will throw a `ReferenceError`, preventing the generated project's 
build and test tooling from starting. Export the configuration object that was 
created above. [runtime/name resolution]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ Generated plugin Babel tooling fails during configuration loading.
   - ❌ Generated plugin builds and tests cannot start.
   ```
   </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)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=165b596f306a497d8a4f9cf09f6b928e&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=165b596f306a497d8a4f9cf09f6b928e&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** 
superset-frontend/packages/generator-superset/generators/plugin-chart/templates/babel.config.erb
   **Line:** 21:21
   **Comment:**
        *Runtime Name Resolution: The generated Babel configuration defines 
`config` but exports the undeclared identifier `plugin`. Evaluating every 
generated plugin's Babel config will throw a `ReferenceError`, preventing the 
generated project's build and test tooling from starting. Export the 
configuration object that was created above.
   
   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%2F43686&comment_hash=c7ada7d475057f668a4337fb5a24d960c7ee7e0e9f9b1ef74745fb9b6dcbe781&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43686&comment_hash=c7ada7d475057f668a4337fb5a24d960c7ee7e0e9f9b1ef74745fb9b6dcbe781&reaction=dislike'>👎</a>



##########
superset-frontend/src/types/yaml.d.ts:
##########
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+declare module '*.yaml' {
+  const content: string;
+  export default content;
+}
+
+declare module '*.yml' {
+  const content: string;
+  export default content;
+}

Review Comment:
   **Suggestion:** The declaration says YAML imports are strings, but the 
webpack rule loads them through `js-yaml-loader`, which produces parsed 
objects. This gives `textUtils` and its callers an incorrect static contract 
and causes property accesses such as `SupersetText.DB_IMAGES` and 
`SupersetText.ERRORS` to type-check against a string or module namespace 
instead of the YAML object. Declare the actual parsed object shape (or an 
appropriate record type) and align it with the loader result. [api mismatch]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Type checking rejects YAML property access.
   - ⚠️ Database configuration text types are inaccurate.
   ```
   </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)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=4980dbc8adde42659fc1f425eaf49f1d&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=4980dbc8adde42659fc1f425eaf49f1d&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/types/yaml.d.ts
   **Line:** 25:28
   **Comment:**
        *Api Mismatch: The declaration says YAML imports are strings, but the 
webpack rule loads them through `js-yaml-loader`, which produces parsed 
objects. This gives `textUtils` and its callers an incorrect static contract 
and causes property accesses such as `SupersetText.DB_IMAGES` and 
`SupersetText.ERRORS` to type-check against a string or module namespace 
instead of the YAML object. Declare the actual parsed object shape (or an 
appropriate record type) and align it with the loader result.
   
   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%2F43686&comment_hash=aaa25386dc0463a519ad8df156d4f1eb510844c058b6c34978640505e9309719&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43686&comment_hash=aaa25386dc0463a519ad8df156d4f1eb510844c058b6c34978640505e9309719&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