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


##########
superset/commands/importers/v1/utils.py:
##########
@@ -230,7 +230,11 @@ def load_configs(
                     prefix,
                     exc.messages,
                 )
-                logger.debug("Config content that failed validation: %s", 
config)
+                # Log field names only; full values can be huge (e.g. inline
+                # example data) and drown out the validation error above.
+                logger.debug(
+                    "Config fields present in %s: %s", file_name, 
sorted(config)
+                )

Review Comment:
   **Suggestion:** The validation error handler can raise a new `TypeError` 
while evaluating `sorted(config)` when the invalid parsed configuration is 
`None` or contains incomparable top-level key types. This masks the original 
`ValidationError` and prevents it from being appended to `exceptions`; log the 
keys without sorting or guard this diagnostic operation so it cannot replace 
the validation failure. [error handling]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ Import validation can abort with `TypeError`.
   - ❌ Original schema errors are not appended to `exceptions`.
   - ⚠️ Invalid bundles may receive misleading failure diagnostics.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Run an importer path that calls `load_configs()` in
   `superset/commands/importers/v1/utils.py`, which parses each bundle 
configuration and
   validates it at lines 224-225 with `schema.load(config)`.
   
   2. Provide a bundle configuration whose top-level YAML mapping contains 
mixed key types,
   such as a string field name and an integer key; the schema validation at 
line 224 raises
   the handled `ValidationError`.
   
   3. The `except ValidationError` block at lines 226-231 begins handling the 
validation
   failure, then evaluates `sorted(config)` at line 236.
   
   4. Python cannot order unlike key types during sorting, so line 236 raises 
`TypeError`
   before line 239 appends the original `ValidationError` to `exceptions`; 
`load_configs()`
   therefore propagates the diagnostic logging error instead of returning the 
collected
   validation failure. A `None` configuration would likewise be unsafe if it 
reaches this
   block, although configurations failing earlier at `config["data"]` may raise 
before this
   handler.
   ```
   </details>
   
   [![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=58452240c162461294613d1b0270db0e&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=58452240c162461294613d1b0270db0e&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/commands/importers/v1/utils.py
   **Line:** 235:237
   **Comment:**
        *Error Handling: The validation error handler can raise a new 
`TypeError` while evaluating `sorted(config)` when the invalid parsed 
configuration is `None` or contains incomparable top-level key types. This 
masks the original `ValidationError` and prevents it from being appended to 
`exceptions`; log the keys without sorting or guard this diagnostic operation 
so it cannot replace the validation failure.
   
   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%2F42399&comment_hash=09f9f47cb8ae04e89fb99f384b70eb57f07b9b89fc6d5e9703cf2e0f5ea08d1b&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42399&comment_hash=09f9f47cb8ae04e89fb99f384b70eb57f07b9b89fc6d5e9703cf2e0f5ea08d1b&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