Admin ca2130258b [fix](alarm): make dismissal stick and count the devices
Four defects, three of them the same missing piece of the delivery ledger.

- listSubscriptions scanned nine destinations for ten columns and read a NULL
  subscriber_user_id into a uuid. Every alert with an anonymous subscriber
  answered 500 ("number of field descriptions must equal number of
  destinations, got 10 and 9"), and the client renders a failed read as an
  empty list — so 'Subscribed devices' said 0 while the row existed. The
  listing now uses the same scan as every other subscription read.
- alarmStatus reported the alert's commanded state, not the caller's own. An
  alert stays 'triggered' until the owner disarms or every subscriber acks, so
  a device that had already dismissed the alarm was told active:true on every
  poll and re-raised its takeover. active is now true only while the caller
  still owes the newest trigger; the owner keeps seeing their own alert.
- ackAlarm required an eventId, which the native takeover launch does not
  have. A dismissal that cannot name its event now clears the subscription's
  whole outstanding set (AckAllDeliveries / AckAllForSubscriber), so the debt
  cannot survive because the client could not echo a uuid.
- The device ledger probe (gated on DATABASE_URL, like the lifecycle probe)
  pins the per-subscriber debt, the ack-all semantics and the cascade that
  takes a device token with the destroyed alert.

Verified against the dev database and through Maestro: 2 subscriptions listed,
device A acked -> its status turns active:false while device B still gets the
409 check-in, ack-all without eventId clears the debt and drains the alert.
2026-10-19 19:34:24 +01:00
2026-10-18 22:31:16 +01:00
2026-10-18 22:31:16 +01:00
2026-10-18 22:31:16 +01:00
2026-10-18 22:31:16 +01:00
2026-10-18 22:31:16 +01:00
2026-10-18 22:31:16 +01:00
2026-10-18 22:31:16 +01:00
2026-10-18 22:31:16 +01:00
2026-10-18 22:31:16 +01:00
2026-10-18 22:31:16 +01:00
S
Description
No description provided
214 KiB
Languages
Go 94.5%
PLpgSQL 3.4%
HTML 0.8%
Python 0.5%
Dockerfile 0.4%
Other 0.4%