Repository navigation
perf(mobile): share one overview stream and stop settings reloads - #456
Merged
Merged
Conversation
One WatchOverview per pairing: overview, appearance and shared reads listen to one bus, so the gateway opens one remote subscription per linked home instead of two. The mobile snapshot now carries settings read after the subscription began (additive MobileOverviewSnapshot.settings); a reconnect needs no extra GetSettings, and older gateways fall back to one read. Settings navigation no longer reloads settings, overview and threads, and a mutation reads only its own resource. Sidebar, alerts, bot settings and connector access share one bot list with one request in flight. Move progress polls GetMoves only. Adds QueryCache in @canopy/domain: keyed shared reads with in-flight dedupe, coalesced invalidation, fencing after set/forget/dispose and a bounded LRU.
nixuuu
marked this pull request as ready for review
November 9, 2026 21:01
This was referenced Nov 13, 2026
nixuuu
added a commit
that referenced
this pull request
Nov 18, 2026
…gs (#986) ## Nightly.75 console report - Reproduced the `actorAvatars` exception and `derived_inert` warnings by invalidating avatar reads just before a PR snapshot reset. Scheduled refreshes now use a mounted subscriber, and a later explicit read uses its own fetch function. - Preserve the saved timeline anchor through a slow initial snapshot. Start the positioning deadline once data arrives and compare watch liveness against loaded history. Routine history paging still contributes to the diagnostics counter. Actionable recovery warnings keep their reason. - Open a cold thread through the owner-scoped GetThread RPC while the overview stream is rebuilding. Skip Git scans for unavailable placements. Report busy, missing, oversized and timed-out checkouts in the panel, retain the last successful counts on a transient scan failure, and cancel an abandoned shared HTTP request when its last reader leaves. - Skip idle web, desktop and BFF diagnostics submissions. Reserve admission and checkpoint space for active sessions within the existing 6 MiB budget. A frozen minute carries its checkpoints even if RPC load exhausted the space for its metric series. The screenshots omit response bodies and the expanded recovery objects. The tests cover concrete paths to the reported statuses. Genuine connectivity and rate limits still surface. ## Local verification - Focused shared-query, overview invalidation, BFF state and reads, Git status, thread history/watch, client diagnostics and persistence tests. Gateway, domain and web typechecks passed. Lint and formatting checked on edited files. Full gate runs in CI. - Chromium at 1280 and 390 px, light and dark. PR reset and avatar reload produced no exception or Svelte warning after the fix. In a 1000-turn thread, a 2.25 s initial snapshot delay restored an 8 px scroll offset. A real checkout reported its changed file, and a removed worktree issued no Git request. Desktop rapid navigation cancelled the in-flight request. At phone width in both themes, closing thread details and navigating to the removed worktree started one Git read, cancelled it once and issued no further Git request. ## Copy audit Reviewed all ten items in docs/copy.md §8. Generic Git refresh failures now identify the missing directory, busy checkout, size limit or timeout and give a recovery action. Directory terminology matches the glossary. Short, typical and long names were checked at desktop and phone widths. All items pass or are inapplicable. Fixes: #456 Fixes: #569 Fixes: #672 Fixes: #799 Fixes: #847 Fixes: #900
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.
Part 1 of 5 of the shared-reads stack. It follows a read-only audit of redundant client fetching. The rule throughout: projects, workers, models and similar data change only on known events or the user's own actions. Read them once, keep them in shared memory, update them from the stream or the mutation response, and never ask again for unchanged values.
What changes
state/overview-bus.tsxowns the onlyWatchOverview; overview, appearance and shared reads listen to it. Before,AppearanceProvideropened a second full-snapshot stream, so the gateway also opened two remote subscriptions per linked home.MobileOverviewSnapshot.settings = 3carries settings read after the subscription began, so a reconnect needs no extraGetSettings. Older gateways leave it unset, and the phone then readsGetSettingsonce after the snapshot. Settings versions only grow: an older read never replaces a newer event.ListBotsread with one request in flight. Alerts keep their baseline semantics: the first list read after each connection, so nothing is replayed.GetMovesonly, no longer through the mutation wrapper that also ran PreviewMove + GetOverview + ListThreads on every tick.QueryCachein@canopy/domain/shared-query. Keyed shared reads with in-flight dedupe, invalidation coalesced over 40 ms with one trailing read, reads dropped as older afterset, fencing afterforget/dispose(unpair, new pairing), failures that keep the last value, and a bounded LRU. Unit tests cover dedupe, empty-but-loaded, coalescing, fencing, error retention and eviction.The unary GetOverview/ListThreads bootstrap stays. mobile.md says it is intentional for first-render latency, and the single stream removes the duplicate without adding a wait.
Measurements (mobile request sequence replayed against two linked gateways)
Runtime fingerprint (
[email protected] fingerprint:generate --build-profile production) matchesdev: iOS6ddec9ef559ee0095ac33e94ff9418a942053b17, Android5f6eae3ab278f1cd543e9ed763f923a319b65ec9. The change ships over the air.Tests:
packages/domain/src/shared-query.test.ts,tests/integration/settings-expansion.test.ts(the snapshot carries the owner's settings, never another owner's, and later changes arrive as events).How it was measured
scripts/bench/client-stack.tson private ports (dev BFF, server role, synthetic worker), base =devata423af85, after = top of this stack. Resource Timing counted/api/*requests per path in a visible tab. Scenarios: S1 sidebar idle 127 s; S2 Settings → Connectors open 126 s; S3 Settings → Workers open 127 s; S4 nine in-app Settings navigations in 27 s. The BFF routes are pass-throughs, so gateway call counts equal these.tests/integration/support/linked-timeouts.ts), counting RPCs served by the linked home and linked reads started here.Copy audit (docs/copy.md §8)
No UI text was added or changed. Existing messages ("Could not load bots.", "Could not load connectors.", "Could not load settings. Check the connection and retry.") moved to shared stores unchanged.