aminghadersohi opened a new pull request, #38951:
URL: https://github.com/apache/superset/pull/38951
### SUMMARY
`generate_explore_link` silently returned a broken URL (leading to a 404 in
the browser) when given a nonexistent `dataset_id`. This adds an early
`DatasetDAO.find_by_id` validation check and returns a structured error
response with an actionable message when the dataset is not found.
### BEFORE/AFTER SCREENSHOTS OR COVERAGE BLURB
**Before:** Tool returns `{"url":
"http://superset/explore/?datasource_type=table&datasource_id=99999", "error":
null}` — a broken URL with no indication of the problem.
**After:** Tool returns `{"url": "", "error": "Dataset not found: 99999. Use
list_datasets to find valid dataset IDs."}` — a clear error with guidance.
### TESTING INSTRUCTIONS
1. Call `generate_explore_link` with a nonexistent `dataset_id` (e.g.,
`99999`)
2. Verify you get a structured error response instead of a broken URL
3. Call with a valid `dataset_id` and verify normal behavior is unchanged
### ADDITIONAL INFORMATION
- Added 2 new unit tests (numeric ID and UUID cases)
- Updated 3 existing fallback tests that were accidentally passing due to
unmocked `DatasetDAO` — they now properly mock the dataset and use
`CommandException` (matching the actual catch block in `chart_utils.py`)
--
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]