fix(ios): disclose whether a canceled read-only runner send was written

Merged
TH
2mo ago
+248-8

Summary

Follow-up to #3385 (#3383) with the reviewer's three notes:

  • Read-only route cancellation (runner-startup-transport.ts): waitForRunner used to throw a bare canceled error. A cancellation before any connect attempt was therefore charged and drained with one status poll. It now discloses dispatched: 'no', and the exchange withdraws the charge. An interrupted attempt now counts as possibly written, so a send that was already in flight still drains. The reviewer's suggested one-liner alone would have missed that.
  • Refused connection withdraws its charge whether or not the request was canceled, because the runner never got the command. The doc comments now say so, and a test pins it.
  • status_unavailable exit: a test where status answers started and then the runner exits shows the drain stops at once, leaves the charge abandoned, and reports status_unavailable.

5 files touched, all in packages/platform-apple/src/runner.

Validation

Commit f1a6cfd70. pnpm check:affected --run passed (3182 tests). Each connect route keeps dispatched: no only when its own failure proves nothing was written. eager-closure-budgets.test.ts passed. An earlier run timed out in two interaction-contract tests while host load was about 220. Both pass alone and passed on the rerun.

Each new test failed with its fix reverted: the dispatch disclosure, the canceled-only withdraw, and the missing break.

No live device run: these are unit-level changes to error disclosure and charge accounting, with no new device path.

🤖 Generated with Claude Code