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


##########
docs/developer_docs/components/ui/tablecollection.mdx:
##########
@@ -55,7 +55,7 @@ function Demo() {
 ## Import
 
 ```tsx
-import { TableCollection } from '@superset/components';
+import TableCollection from '@superset/components';

Review Comment:
   **Suggestion:** The import snippet shows `TableCollection` coming from the 
internal alias `@superset/components` via a default import, which differs from 
the documented public API `@superset-ui/core/components` and will mislead users 
who copy this code into their own projects. [logic error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ TableCollection docs show non-public import path.
   - ⚠️ External projects copying snippet get module-not-found errors.
   ```
   </details>
   
   ```suggestion
   import { TableCollection } from '@superset-ui/core/components';
   ```
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Run `yarn generate:superset-components` in the `docs/` workspace, which 
executes
   `docs/scripts/generate-superset-components.mjs` and generates
   `docs/developer_docs/components/ui/tablecollection.mdx` using the UI Core 
source config
   (importPrefix `@superset/components`, docImportPrefix 
`@superset-ui/core/components` at
   `docs/scripts/generate-superset-components.mjs:68-75`).
   
   2. Open the generated TableCollection docs page at
   `docs/developer_docs/components/ui/tablecollection.mdx` and scroll to the 
"Import" section
   (`lines 55–59`), which currently shows:\n ```tsx\n import TableCollection 
from
   '@superset/components';\n ```
   
   3. In a separate Superset extension or external React project, follow the 
"Usage" guidance
   from the UI Components overview generated by `generateOverviewIndex()`
   (`docs/scripts/generate-superset-components.mjs:1212-1265`), which states 
that components
   are consumed from `@superset-ui/core/components`, and copy-paste the 
TableCollection
   snippet as-is into your code.
   
   4. Run the external project build or dev server; because 
`@superset/components` is only a
   docs-only webpack alias defined in `docs/src/webpack.extend.ts:141-151` and 
not a
   published package, module resolution fails with a "Cannot find module
   '@superset/components'" error instead of correctly importing 
`TableCollection` from
   `@superset-ui/core/components`.
   ```
   </details>
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** docs/developer_docs/components/ui/tablecollection.mdx
   **Line:** 58:58
   **Comment:**
        *Logic Error: The import snippet shows `TableCollection` coming from 
the internal alias `@superset/components` via a default import, which differs 
from the documented public API `@superset-ui/core/components` and will mislead 
users who copy this code into their own projects.
   
   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.
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38486&comment_hash=264bda2dae9bb3bf9057c4a938ec10d069a0e8f07f03a46e82d60aecaeddb15d&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38486&comment_hash=264bda2dae9bb3bf9057c4a938ec10d069a0e8f07f03a46e82d60aecaeddb15d&reaction=dislike'>👎</a>



##########
docs/developer_docs/components/ui/tabs.mdx:
##########
@@ -212,7 +212,7 @@ function IconTabs() {
 ## Import
 
 ```tsx
-import { Tabs } from '@superset/components';
+import Tabs from '@superset/components';

Review Comment:
   **Suggestion:** This import example uses `import Tabs from 
'@superset/components';`, relying on an internal alias and default export 
rather than the public `@superset-ui/core/components` named export API, so 
external users following the docs will get an invalid import. [logic error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ External projects importing Tabs as documented fail to build.
   - ⚠️ Tabs docs inconsistent with overview '@superset-ui/core/components' 
guidance.
   ```
   </details>
   
   ```suggestion
   import { Tabs } from '@superset-ui/core/components';
   ```
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Generate component docs by running 
`docs/scripts/generate-superset-components.mjs`,
   which uses the UI Core Components source config with `importPrefix:
   '@superset/components'` and `docImportPrefix: 
'@superset-ui/core/components'` (see
   `docs/scripts/generate-superset-components.mjs:67-75`).
   
   2. In `generateMDX()` 
(`docs/scripts/generate-superset-components.mjs:995-1055`), observe
   that for UI components the computed `componentImportPath` becomes
   `'@superset/components'`, and the Import section template emits `import 
${componentName}
   from '${componentImportPath}';` inside the `## Import` block
   (`docs/scripts/generate-superset-components.mjs:1137-1141`).
   
   3. Confirm that the generated MDX for Tabs at 
`docs/developer_docs/components/ui/tabs.mdx`
   contains the Import snippet `import Tabs from '@superset/components';` near 
the bottom of
   the file (lines 214–216 in the PR hunk).
   
   4. Note that the docs overview page generator explicitly documents the 
public API as
   `@superset-ui/core/components` (see `generateOverviewIndex()` in
   `docs/scripts/generate-superset-components.mjs:1261-1265`), and that
   `@superset/components` is only defined as a webpack alias for the docs build
   (`docs/src/webpack.extend.ts:142-151`), so an external project that copies 
`import Tabs
   from '@superset/components';` from `tabs.mdx` and only installs 
`@superset-ui/core` will
   get a module resolution error for `@superset/components` during its build.
   ```
   </details>
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** docs/developer_docs/components/ui/tabs.mdx
   **Line:** 215:215
   **Comment:**
        *Logic Error: This import example uses `import Tabs from 
'@superset/components';`, relying on an internal alias and default export 
rather than the public `@superset-ui/core/components` named export API, so 
external users following the docs will get an invalid import.
   
   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.
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38486&comment_hash=d864ddca4cd22b0a85e3fc5fdacadb336e459fe0e8629f7c0b2d1f8b837babb1&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38486&comment_hash=d864ddca4cd22b0a85e3fc5fdacadb336e459fe0e8629f7c0b2d1f8b837babb1&reaction=dislike'>👎</a>



##########
docs/developer_docs/components/ui/slider.mdx:
##########
@@ -242,7 +242,7 @@ function VerticalDemo() {
 ## Import
 
 ```tsx
-import { Slider } from '@superset/components';
+import Slider from '@superset/components';

Review Comment:
   **Suggestion:** The import example uses the internal docs-only alias 
`@superset/components` instead of the public `@superset-ui/core/components` 
package and a default import instead of the documented named export style; 
developers copying this snippet will not be able to import the component 
correctly in their own projects. [logic error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Slider docs import snippet fails in external projects.
   - ⚠️ Developers hit module-not-found using documented import path.
   - ⚠️ Docs inconsistent with actual Slider exports in core package.
   ```
   </details>
   
   ```suggestion
   import { Slider } from '@superset-ui/core/components';
   ```
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Open the Slider documentation page backed by
   `docs/developer_docs/components/ui/slider.mdx` and locate the "Import" 
section whose
   snippet is defined at lines 242–246 in that file (verified via Read on
   `/workspace/superset/docs/developer_docs/components/ui/slider.mdx`).
   
   2. Copy the documented snippet:
   
      ```tsx
   
      import Slider from '@superset/components';
   
      ```
   
      from that "Import" section into an external React/TypeScript project that 
already
      depends on `@superset-ui/core`.
   
   3. Build or run the external project so that the bundler/TypeScript compiler 
attempts to
   resolve `@superset/components`; unlike the docs app, this external project 
does not have
   the webpack alias for `@superset/components` that is configured only for the 
docs at
   `docs/src/webpack.extend.ts:143` (found via Grep output).
   
   4. Observe the build/runtime failure: the module resolver reports an error 
such as "Module
   not found: Can't resolve '@superset/components'", even though `Slider` is 
actually
   exported for consumers from `@superset-ui-core/src/components/index.ts` as a 
named export
   (`export { default as Slider ... }`), and internal Superset code imports it 
via
   `@superset-ui/core/components/Slider` (see
   `superset-frontend/src/explore/components/controls/SliderControl.tsx:19` 
from Grep),
   confirming that the docs snippet points to a docs-only alias rather than the 
public
   package.
   ```
   </details>
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** docs/developer_docs/components/ui/slider.mdx
   **Line:** 245:245
   **Comment:**
        *Logic Error: The import example uses the internal docs-only alias 
`@superset/components` instead of the public `@superset-ui/core/components` 
package and a default import instead of the documented named export style; 
developers copying this snippet will not be able to import the component 
correctly in their own projects.
   
   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.
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38486&comment_hash=0ec288bb667c3c3c4aa54a6c6e8ce7967c75e36dd7abbf07c12881c9e89e8447&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38486&comment_hash=0ec288bb667c3c3c4aa54a6c6e8ce7967c75e36dd7abbf07c12881c9e89e8447&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