feat(live-activity): honour the streamer's liveActivityPush flag - #671
Open
RonenMars wants to merge 2 commits into
Open
feat(live-activity): honour the streamer's liveActivityPush flag#671RonenMars wants to merge 2 commits into
RonenMars wants to merge 2 commits into
Conversation
The client half starts a Live Activity locally from session_update frames, independently of whether the server can push to it. On a server with liveActivityPush off that produces the worst version of the feature: a Lock Screen card that only updates while you are already looking at the phone, then freezes on backgrounding and expires silently after ~8h. Both reconcilers now return early unless the server opted in — Android's ongoing notification included, since it renders the same feature. The lookup is synchronous against a per-server cache because reconcile() runs on every frame and cannot await an HTTP round-trip. Unknown reads as off, one request per server, and a failed lookup is not cached so a dropped request does not pin the feature off until the app restarts. A server too old to serve the endpoint reads as off and logs liveActivity.legacyServer, since that is the only path where surfaces stop appearing without anyone choosing it.
…ration suite The liveActivityPush gate short-circuits reconcile() before any decision, so seven cases in LiveActivity.reconcile.test.tsx asserted against a reconciler that had already returned. They exercise the reconciler's behaviour, not whether the server opted in, so the gate is mocked on for the suite the same way the unit suites do it. Adds the missing off-case: an opened turn posts nothing when the flag is off.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The client half starts a Live Activity locally from
session_updateframes, independently of whether the server can push to it.Against a server with
liveActivityPushoff that produces the worst version of the feature: a Lock Screen card that only updates while you are already looking at the phone, then freezes the moment the app backgrounds and expires silently at iOS's ~8h cap.Both reconcilers now return early unless the server opted in.
Android's ongoing notification is included — it renders the same feature, so one flag has to govern both.
Why the lookup is synchronous
reconcile()runs on everysession_updateframe and cannot await an HTTP round-trip per frame, soisLiveActivityEnabled(serverId)answers from a per-server cache and kicks the fetch off in the background.The one behaviour change worth flagging
A server too old to serve
GET /api/config/feature-flagsreads as off rather than being grandfathered on.An old streamer is precisely one where the push half cannot exist, so "on" there would guarantee the degraded local-only path — the exact thing this flag exists to stop.
It also keeps the upgrade direction sane: grandfathering would mean upgrading your streamer removes a visible feature.
Because that is the only path where surfaces stop appearing without anyone choosing it, it logs
liveActivity.legacyServerwith theserverId.From the phone the absence looks identical to a server that answered
false, and that log line is what separates "upgrade the streamer" from "check the flag".Server side
Requires RonenMars/threadbase-streamer#545, which adds the flag and gates the server half.
Until that lands, every server 404s the endpoint and reads as off.
Verified state
tsc --noEmitclean, eslint clean on all changed files.Full unit suite: 1006 passed, 106 suites, 0 failed.
New coverage: 7 cases for the gate module (unknown-then-resolved, explicit off, legacy 404 + its log, per-server independence, request collapsing, retry-after-failure), plus reconcile-level on/off cases for both platforms.
The iOS suite had never exercised
reconcile()at all — only the pure helpers — so those two cases are new ground.