Extension: surface a disconnected-tablet warning instead of silent success

A push can succeed server-side (session created) with nowhere to actually
deliver to — the backend's pushNavigate() already distinguishes this via a
delivered:false return (see device-stream.js), but nothing in the extension
read it: every surface just said "Sent" regardless. Confirmed live on the
dev stack 2026-10-01 — the registered dev tablet hadn't heartbeated in a
month, so a push looked successful but nothing happened. Now every send
path (injected buttons' fast path + manual picker, popup's fast path +
manual picker) shows an amber "tablet isn't connected right now" warning
when delivered is false.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-10-01 12:02:56 +00:00
parent db6ffb7aa4
commit 4aeca15281
3 changed files with 28 additions and 7 deletions

View file

@ -107,7 +107,12 @@ async function pushBooking(bookingId, deviceId) {
// from other failures — used by content-script.js's default-tablet
// fast-path to decide whether to fall back to the device picker.
if (!res.ok) return { ok: false, status: res.status, error: body.error || `HTTP ${res.status}` };
return { ok: true, status: res.status };
// delivered: false means the push landed server-side (a session was
// created, the tablet will pick it up if it reconnects) but there's no
// live SSE connection for that device right now — e.g. its kiosk tab
// isn't open, or its WiFi dropped. Passed through so callers can warn
// honestly instead of claiming success a disconnected tablet never saw.
return { ok: true, status: res.status, delivered: body.delivered };
} catch (err) {
return { ok: false, error: err.message };
}