Skip to content

fix(telemetry): report a sanitized cause for device setting and app control failures - #61

Merged
lauridskern merged 3 commits into
mainfrom
cindara/sanitize-device-failure-causes
Oct 29, 2026
Merged

lauridskern merged 3 commits into
mainfrom
cindara/sanitize-device-failure-causes

Conversation

@lauridskern

@lauridskern lauridskern commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #49.

Device setting and app control failures reach Sentry as Device setting command failed. or App <action> command failed. with no cause. MOBILE-DEV-SERVER-8S alone has 275 events from 69 users, almost all device_settings.read, and none of them say what broke.

What changes

Reports keep their fixed messages, so the existing issues keep grouping. They now carry these tags, which the server.error.outcome count also gets:

  • device_platform: from the tool's target. Many events had no platform before.
  • device_command: where the failure came from, such as simctl_launch, adb_shell_am, baguette_interface or serve_emu_start. Baguette and serve-emu label their own request failures. The app control drivers label simctl, adb and plutil failures.
  • device_command_failure: exit, signal, deadline, http_status, rejected, invalid_response, connection_failed, unexpected_output and a few more. It comes from error codes, exit and HTTP statuses, and error types. Messages and output are never read.
  • device_command_status and device_command_signal.

When a device setting request fails, the service looks the device up again without starting a backend. If the device stopped or went away, the failure counts as device_unavailable and isn't reported. If the device list can't be read, the original failure is reported as before. App control now treats "current state: Shutting Down" and a few other device-gone messages as unavailable too.

captureServerError takes a reportAs error and extra tags. Diagnostic tags, including serve-emu startup tags, still come from the original error. The replacement error is created where the failure is caught, so Sentry keeps the same code location.

Tests

  • New packages/shared/test/device-command-diagnostics.test.ts covers the classification, the labels, and the device-gone patterns.
  • telemetry.test.ts checks the tags on real reports, that nothing private is sent, and that a simulator stopping mid-read creates no report. That test runs the real Baguette client against a local HTTP server.
  • device-settings.test.ts checks the device-gone lookup: stopped, gone, and an unreadable device list.

npm test passes except two tests outside this change. The relocated Baguette test needs the vendored Baguette binary and fails on main in my checkout too. The TraceSift startup test failed once under parallel load and passed three runs on its own.

…ontrol failures

Device setting and app control failures reached Sentry as one fixed message
with no cause. Each failure now names the command or backend route it came
from and how it failed, as low-cardinality tags read from error codes, exit
and HTTP statuses, and error types. Messages and output stay out of reports.

A device setting request on a device that stopped or went away now counts as
device_unavailable instead of a report. The check reads the device list
without starting a backend. App control also treats a simulator that is
shutting down as unavailable.

Closes #49
@lauridskern
lauridskern merged commit 1572584 into main Oct 29, 2026
11 checks passed
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.

fix(telemetry): report a sanitized cause for device setting and app control failures

1 participant