fix(approvals): buyer-safe toast copy; flip runtimeHealth on action failure
Buyer-script QA caught two regressions: 1. Toast on action failure leaked 'runtime-values isn't reachable' and 'Backend can't accept' — engineering jargon a buyer would read as 'product is broken'. 2. After a real 500, the button stayed enabled so a buyer could click again into the same error. Now: - Failure toast says 'The runtime engine couldn't accept that decision. Action buttons are now disabled until it recovers.' (no jargon, no raw error strings). - handleAction sets runtimeHealth='down' on the failure, which flips the runtime-note banner on and disables every action button. - Non-runtime failures get the even-shorter 'Something went wrong handling that action. Try again in a moment.'
This commit is contained in:
@@ -96,10 +96,11 @@ export default function Approvals() {
|
||||
await loadQueue();
|
||||
} catch (err: any) {
|
||||
const msg = err.message || "";
|
||||
if (/runtime-values|action_execution_failed/i.test(msg)) {
|
||||
pushToast("err", "Backend can't accept this action yet — runtime-values isn't reachable. The frontend sent the right shape.");
|
||||
if (/runtime-values|action_execution_failed|500/i.test(msg)) {
|
||||
setRuntimeHealth("down");
|
||||
pushToast("err", "The runtime engine couldn't accept that decision. Action buttons are now disabled until it recovers.");
|
||||
} else {
|
||||
pushToast("err", `Action failed: ${msg.slice(0, 100)}`);
|
||||
pushToast("err", "Something went wrong handling that action. Try again in a moment.");
|
||||
}
|
||||
} finally {
|
||||
setBusy(null);
|
||||
|
||||
Reference in New Issue
Block a user