rusackas opened a new pull request, #40585:
URL: https://github.com/apache/superset/pull/40585

   ### SUMMARY
   
   TDD regression tests for #28248. All 6 tests currently **FAIL**, pinning two 
related bugs in SQL Lab error handling:
   
   **Bug 1 — traceback swallowed in logs (both execution paths)**
   - `superset/sql_lab.py` `get_sql_results`: outer `except Exception` calls 
`logger.debug("Query %d: %s", query_id, ex)` — no `exc_info`, traceback is 
discarded from Celery worker logs.
   - `superset/sql/execution/celery_task.py` `execute_sql_task`: identical 
pattern.
   
   **Bug 2 — stacktrace missing from error payload**
   - `handle_query_error` (legacy) and `_handle_query_error` (new path) return 
a dict with `status`, `error`, and `errors` keys — but no `stacktrace` key. 
Neither the UI nor external log pipelines can surface the root cause to the 
user.
   
   The fix is straightforward: change `logger.debug(...)` → 
`logger.exception(...)` in the outer except blocks, and add a `stacktrace` key 
(populated with `traceback.format_exc()`) to the returned payload.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — test-only PR.
   
   ### TESTING INSTRUCTIONS
   
   ```bash
   # Confirm all 6 tests fail (bug is present):
   pytest tests/unit_tests/test_sqllab_error_stacktrace.py -v
   # Expected: 6 failed
   
   # After applying the fix, all 6 should pass:
   pytest tests/unit_tests/test_sqllab_error_stacktrace.py -v
   # Expected: 6 passed
   ```
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: #28248
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   Closes #28248


-- 
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