refactor(android): centralize session error encoding

Merged
TH
7h ago
+21-29

Summary

Let SessionResponseWriter own session error fields. Viewport, gesture, snapshot and automation handlers previously repeated the exception-class/message fallback rule. Keep fresh error envelopes where required and preserve automation's injected=false evidence on its existing bundle. One-shot instrumentation handling remains separate.

Five files change: four Java modules and the baseline. Java source shrinks by 4 lines / 173 bytes including helper overhead. Native clones fall from 82 to 78; prune exactly the four removed fingerprints, with no additions. No linked issue or production scope expansion.

Validation

  • Head fbb09c1971c60e03aefd80a23cf18caf9bd0118d; base eedc0df3d2168275dcd89ed21613c3362d595731.
  • AGENT_DEVICE_VITEST_MAX_WORKERS=1 pnpm check:affected --run --head fbb09c1971c60e03aefd80a23cf18caf9bd0118d: passed, exactCommit: true; receipt run-1iUcOm, 39 passed / 25 skipped / 2 deduplicated checks. Related-test selection contains no TS changes; 40 focused protocol/failure tests passed separately.
  • pnpm build:android: passed, including Java compilation and the existing JVM suite. Independent Apex source review: no findings.
  • Manual Android 15 / emulator-5556: rebuilt APK passed eight socket checks for unknown command, gesture errors, CR/LF sanitization, input refusal, viewport/snapshot recovery and cold snapshot timeout. Request IDs and typed accessibility-timeout mapping verified through production parsers. Both instrumentation runs quit; forwards removed.
  • EOF, null/empty messages and post-dispatch failure were inspected but not forced live. GitHub owns full coverage, integration, platform smoke and packaged-size evidence. Manual checks are not automatic regression coverage.