GeezerVison is showing github.com — Fix device diagnostics migration, failed-delivery display, and per-de… · pingdotgg/t3code@a97e0b6
File treeExpand file treeCollapse file tree Open diff view settings apps/mobile/src/features/agent-awareness migrations/postgres/20260704031500_add_mobile_device_apns_route
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/agent-awareness/deviceDiagnostics.test.ts +22Lines changed: 22 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -69,6 +69,28 @@ describe("formatDeviceDiagnosticsRows", () => { | 69 | 69 | ]); | 70 | 70 | }); | 71 | 71 |
| | 72 | + it("treats a non-2xx delivery status without a reason as a failure", () => { | | 73 | + const rows = formatDeviceDiagnosticsRows( | | 74 | + makeDevice({ | | 75 | + bundleId: "com.t3tools.t3code.preview", | | 76 | + apsEnvironment: "production", | | 77 | + hasPushToken: true, | | 78 | + hasPushToStartToken: true, | | 79 | + hasLiveActivityToken: true, | | 80 | + lastDeliveryAt: "2026-06-05T01:02:59.566Z", | | 81 | + lastDeliveryKind: "live_activity_end", | | 82 | + lastDeliveryStatus: 400, | | 83 | + lastDeliveryError: null, | | 84 | + }), | | 85 | + ); | | 86 | + | | 87 | + expect(rows[4]).toEqual({ | | 88 | + label: "Last Delivery", | | 89 | + value: "Delivery failed (400)", | | 90 | + tone: "warn", | | 91 | + }); | | 92 | + }); | | 93 | + | 72 | 94 | it("reports healthy registrations with a successful delivery", () => { | 73 | 95 | const rows = formatDeviceDiagnosticsRows( | 74 | 96 | makeDevice({ | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/agent-awareness/deviceDiagnostics.ts +9-2Lines changed: 9 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -73,14 +73,21 @@ export function formatDeviceDiagnosticsRows( | 73 | 73 | }); | 74 | 74 | } | 75 | 75 |
| | 76 | + // APNs can fail with a non-2xx status without a reason body, so a null | | 77 | + // error alone does not mean the delivery succeeded. | | 78 | + const deliveryFailed = | | 79 | + diagnostics.lastDeliveryError !== null || | | 80 | + (diagnostics.lastDeliveryStatus !== null && | | 81 | + (diagnostics.lastDeliveryStatus < 200 || diagnostics.lastDeliveryStatus >= 300)); | | 82 | + | 76 | 83 | if (diagnostics.lastDeliveryAt === null) { | 77 | 84 | rows.push({ label: "Last Delivery", value: "None yet", tone: "muted" }); | 78 | | - } else if (diagnostics.lastDeliveryError !== null) { | | 85 | + } else if (deliveryFailed) { | 79 | 86 | const status = | 80 | 87 | diagnostics.lastDeliveryStatus === null ? "" : ` (${diagnostics.lastDeliveryStatus})`; | 81 | 88 | rows.push({ | 82 | 89 | label: "Last Delivery", | 83 | | - value: `${diagnostics.lastDeliveryError}${status}`, | | 90 | + value: `${diagnostics.lastDeliveryError ?? "Delivery failed"}${status}`, | 84 | 91 | tone: "warn", | 85 | 92 | }); | 86 | 93 | } else { | |
Collapse file Copy file name to clipboard +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +ALTER TABLE "relay_mobile_devices" ADD COLUMN "bundle_id" varchar(255); | | 2 | +--> statement-breakpoint | | 3 | +ALTER TABLE "relay_mobile_devices" ADD COLUMN "aps_environment" varchar(16); |
|