shivaam opened a new pull request, #76341:
URL: https://github.com/apache/airflow/pull/76341

   When the API refuses an action, the error toast showed only the HTTP status 
text. `createErrorToaster` used `error.message`, which for an `ApiError` is the 
status text, so deleting a running Dag run toasted "Error deleting Dag Run / 
Conflict" while the response said why:
   
   | | Toast |
   |---|---|
   | Before | **Error deleting Dag Run** — Conflict |
   | After | **Error deleting Dag Run** — The DagRun with dag_id: \`example\` 
and run_id: \`manual__…\` cannot be deleted in running state |
   
   The toaster now uses the response `detail` when there is one, through the 
existing `getApiErrorDetail` (already used by `ErrorAlert`), and keeps 
`error.message` as the fallback. Every action that goes through the shared 
toaster (delete, clear, patch, trigger, pause, …) benefits. 403s are still left 
to the MutationCache handler.
   
   Two hooks had worked around this on their own, and now use the shared helper:
   
   - `useUpdateHITLDetail` special-cased exactly this in #75645. Its test 
expected the bare `response.error` title key only on that branch; the shared 
helper translates the namespaced `hitl:response.error`, which renders the same 
text.
   - `useClearTaskInstances` showed the detail only when it contained 
"AirflowClearRunningTaskException", so other refusals such as "Cannot clear 
running task instances" still showed "Conflict".
   
   On what gets shown: the text is rendered as a React text node, so no markup 
is interpreted. It is the same detail the browser already received and that 
`ErrorAlert` already displays. Database and Dag deserialization errors keep the 
statement redacted unless `[api] expose_stacktrace` is on, and validation 
errors show only `loc` and `msg`, never the submitted `input`.
   
   Testing:
   
   - New `errorHandling.test.ts`, plus a clear-task test; both fail against the 
old code.
   - Full UI vitest suite, eslint, prettier, `tsc`, and `prek` (pre-commit and 
manual stages).
   - Manually in a local Airflow: deleting a running Dag run shows "Conflict" 
before and the reason after; clearing a running task with "Prevent rerun if 
task is running" still shows its reason.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 5.5)
   
   Generated-by: Claude Code (Opus 5.5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   


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

Reply via email to