fix(approvals): buyer-safe toast copy; flip runtimeHealth on action failure
build-and-publish / test (push) Has been cancelled
build-and-publish / image (push) Has been cancelled

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:
2026-06-14 17:14:09 +04:00
parent d4d74cb685
commit c2815b4f7f
2 changed files with 110 additions and 3 deletions
+4 -3
View File
@@ -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);