Files
npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67dandTyler Longwell 697ffaa8f0 feat(push): durable per-address wake latch (migration 0025 + state machine)
One latch row per lease address (community, author, installation) replaces
row-per-event wake fanout in push_wake_outbox. States idle -> pending ->
sending; folds during pending are write-free, folds during sending set only
the owed_* triple (claimed identity immutable), every sending exit is the
same promote-or-idle rule. Accepted deliveries stamp a durable
cooldown_until consulted when the next cycle is armed, bounding accepted
wakes to one per address per cooldown window regardless of gateway speed.

Migration 0025 creates + seeds the latch table from live legacy outbox rows
and leaves push_wake_outbox fully intact for the dual-drain rollout window
(0026 owns retirement). Two global partial indexes back the two-arm
(pending-due / expired-sending recovery) claim.

No caller switches in this commit: relay behavior is unchanged. Covered by
11 PG state-transition tests (incl. fast-gateway cooldown, owed promotion,
retry/recovery request_id stability, lease rotation, brownfield seed) plus
a populated-database migrator test with an in-flight sending row.

Plan: PUSH_LEASE_DB_PERF_PLAN.md Rev 5 (blessed 9/9/9 by Eva + Wren).
Co-authored-by: Tyler Longwell <tlongwell@block.xyz>
Signed-off-by: Tyler Longwell <tlongwell@block.xyz>
2026-07-20 10:40:31 -04:00
..