rouse-context/work
Jason Monk cee47059e5
Defensively reconcile foreground notification against live tunnel state (#510) (#513)
#506 fixed the root cause of the stuck "Connecting…" foreground notification
(the foss UnifiedPush wake no longer ANRs the main thread, so the lifecycleScope
`tunnelClient.state` collector in observeStateChanges runs normally and
reconciles to "Connected"). This adds a belt-and-suspenders reconcile so a
tunnel whose socket is genuinely ESTABLISHED can never be left showing
"Connecting…", independent of whether that Main-dispatcher collector was
momentarily starved.

reconcileNotification() re-renders the foreground notification from
`tunnelClient.state.value` (ground truth), reusing updateNotification() so the
copy is identical. It is called from two hooks that can't be missed:
- in onStartCommand's coroutine right after awaitReady(), on every wake;
- immediately after a successful connect() returns (socket established).

StateFlow replays its current value to new collectors, so a transition is not
normally dropped — the collector is not a true single point of failure. This
reconcile is purely defensive hardening; no user-facing flow changes.

Co-authored-by: monkopedia-coder <monkopedia+coder@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 17:12:41 -04:00
..
src Defensively reconcile foreground notification against live tunnel state (#510) (#513) 2026-06-23 17:12:41 -04:00
build.gradle.kts FOSS #476: move Firebase out of :work so the foss APK links zero firebase-* (#477) 2026-06-14 12:51:06 -04:00