Skip to content

fix(actions): surface inner result envelope (no more false-success on failed actions)#69

Merged
xuyushun441-sys merged 1 commit into
mainfrom
fix/action-result-envelope
Jun 1, 2026
Merged

fix(actions): surface inner result envelope (no more false-success on failed actions)#69
xuyushun441-sys merged 1 commit into
mainfrom
fix/action-result-envelope

Conversation

@xuyushun441-sys
Copy link
Copy Markdown
Contributor

Problem

Object-action / flow / api routes wrap the handler's own result, so a transport 200 with { success: true } can still carry an inner { success: false, error } in data — e.g. {"success":true,"data":{"success":false,"error":"Action 'clone_opportunity' not found"}}. dispatchServerAction / dispatchFlow / dispatchApi only checked the outer flag, so a failed action was reported to the user as success with no error (flagged during the 7.5 verification).

Fix

Add a shared interpretEnvelope() that unwraps one level and honours the inner success, lifting the inner error for display; use it at all three dispatch sites. This is the same envelope trap useTriggerFlow already handles for flow runs.

Verification

  • ✅ New interpretEnvelope unit tests, including the exact production payload (inner success:false → failure with lifted error), outer-failure, non-OK HTTP, and the success/reload cases — 6 pass.
  • eslint + tsc clean; full suite 1141 pass (20 pre-existing snapshot failures, unrelated).
  • The identical inner-success path was already browser-verified last PR (flow-trigger error toast), via the same toast mechanism runRecordAction uses.

Closes the follow-up noted in #63 / #64.

🤖 Generated with Claude Code

…t report success

Object-action / flow / api routes wrap the handler's own result, so a transport
200 with `{ success: true }` can still carry an INNER `{ success: false, error }`
in `data` (e.g. "Action 'x' not found"). dispatchServerAction/dispatchFlow/
dispatchApi only checked the OUTER flag, so a failed action was reported to the
user as success with no error.

Add a shared interpretEnvelope() that unwraps one level and honours the inner
`success`, lifting the inner `error` for display. Use it at all three dispatch
sites. (Same envelope trap useTriggerFlow already handles for flow runs.)

Unit-tested against the real payload; lint + typecheck clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@xuyushun441-sys xuyushun441-sys merged commit a189076 into main Jun 1, 2026
1 of 4 checks passed
@xuyushun441-sys xuyushun441-sys deleted the fix/action-result-envelope branch June 1, 2026 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants