fix(react-devtools): let the command's own failure outrank the cleanup stop

Merged
TH
1mo ago
+69-10

Problem

react-devtools stop ran the user's action in a try/finally and cleaned the remote companion up in the finally. When both fault — the action fails and the companion could not be confirmed stopped — the cleanup failure replaces the action's failure, so the user sees teardown noise instead of the fault that actually happened.

Change

Collect both outcomes and let the action's fault win. A companion the host would not confirm stopped still fails the command when the action passed, whatever it rejects with (not only an Error). In the both-fault case the companion's verdict goes to stderr beside the thrown action fault, so nothing is discarded on either path.

Split out of #3551 to keep that PR inside its diff budget and one command family. #3551 keeps the finally shape, which already propagates an unconfirmed stop; this PR changes only which fault wins, and stops losing the other one.

Validation

  • pnpm typecheck, pnpm lint, pnpm check:affected --run pass locally at the pushed head.
  • Mutation checks: removing the stderr write fails only the ordering test; removing the stopped throw makes the action-fault path return a value it must not.

Follows up on #3551.