Repository navigation
perf(updates): drive the update center by events - #459
Merged
Merged
Conversation
nixuuu
marked this pull request as ready for review
November 9, 2026 21:01
The gateway announces update center changes (OverviewUpdate.updates_changed: updater state, checks and worker update reports, merged per 250 ms) and advertises the "updates" feed. A linked computer's change refreshes its snapshot here at once, past the read cooldown; the settled read notifies clients. GetClientCapabilities reads the gateway name from its identity instead of building a full computers snapshot. Web: one update center per tab shared by the indicator and both panels; it reads on events, every 2 s only while something updates, once a minute for older gateways and never while hidden. Capabilities renegotiate on overview connection changes and every 5 min instead of every 5 s; the remote BFF reuses a negotiation for 60 s and renegotiates on failing calls. Config notices and Computers share one computers read without 3 s timers; network access and devices check at 30 s / 60 s while visible. Mobile: the update provider follows the same events; devices follow their events instead of a 15 s poll.
nixuuu
force-pushed
the
perf/fetch-4-updates
branch
from
November 9, 2026 21:11
ab50d22 to
4aba0ae
Compare
nixuuu
added a commit
that referenced
this pull request
Nov 10, 2026
A remote app-update request could reach a desktop that was already checking or downloading automatically. `checkRemote()` rejected that overlap, and `RemoteAppUpdate` persisted it as a failed installation. Preparation, metadata checks and downloads also had no controller deadlines, so an unresolved request after sleep could retain the running lock indefinitely. The overlap guard originates in #70; #373's check-only command calls `check()`, so it did not introduce that guard. Without logs from the affected Mac, whether its operation was still progressing or hung cannot be distinguished. Manual and remote checks now share the current operation and its actual checking/downloading progress. Channel changes queue behind it and retain downgrade confirmation. Preparation and metadata checks have 60-second deadlines; downloads have a 30-minute total limit and a 90-second stall limit based on increasing transferred bytes. Cancellation propagates to release-feed requests and downloads. Recovery replaces the updater and isolates its download directory, ignoring retired events and late responses. Previously staged updates retain their installable updater. On macOS, module-level commit tokens track the shared native feed: ordinary installs call Squirrel synchronously without replaying `task.done`. Only a displaced feed is replayed, serialized behind any pending finalizer. Local ZIP replay has no controller deadline and propagates actual staging failures through installation error handling; a failed replay remains eligible for retry. Suspend pauses the automatic timer. Resume/unlock recovery is debounced for 5 seconds, restarts stale work through the original shared promise, and restores the schedule. If a timeout finishes before the wake handler, automatic checks retry once; Never suppresses that automatic retry. A persisted busy-only failure reports the live updater phase, while real installation failures remain Failed. Gateway mapping and protobuf contracts are unchanged, including the frozen update service. Updated the Polish operational docs. Validation: - `bun install`, `bun run gen:check`, `bun run typecheck`, `bun run lint`, `bun run format:check`, and `bun run --filter @canopy/web build` passed for the initial change. After the native-feed revision, focused desktop tests, full typecheck, lint and format:check passed again, with a final focused desktop typecheck after the replay-retry refinement. - 29 focused desktop tests passed: 12 controller/remote-coordinator regressions, 13 existing updater/feed/staging tests, and 4 native-feed tests using fakes. Coverage includes joining during checks/downloads, hung prepare/metadata, stale resume, stalled and total download deadlines, repeated progress, error cleanup, queued channels, retained staged updates, Never, and persisted busy versus genuine failures. The native-feed tests verify synchronous installation without re-staging, replay after another commit, serialization behind an unfinished replacement, and real failure propagation followed by a safe retry. - No web UI tests, E2E, or full local `check:tmp` run. CI remains the full-suite gate. Signed macOS sleep/resume and installation were not exercised on this Linux machine; native-feed ownership and replay are covered with fakes, while actual Squirrel staging remains unverified on a real Mac. The web build completed with chunk-size warnings. Copy audit (`docs/copy.md` §8): - Busy-only `Wait for the current app update operation to finish, then retry.` → existing live checking/downloading/ready statuses. Overlap requires no user action and is no longer presented as a failure. - Unbounded wait → `Update timed out. Check the connection, then retry.` Two short sentences identify the event and next action; no protocol names or internal jargon. - Existing action names, genuine failure messages, confirmations, and status layouts remain in use. No new terms, repeated facts, humor, or color-only meaning. No UI templates changed; name-length/responsive/browser review was not run for this controller-only change. Related: #70 Related: #373, #459
This was referenced Nov 13, 2026
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 4 of 5. The update center, capabilities and computer metadata are driven by events.
What changes
updates_changed(829). It covers updater state, checks and worker update reports, merged into one notice per 250 ms, and addsupdatestofeeds. When a linked computer announces a change, its snapshot here refreshes at once instead of waiting for the read cooldown, and the settled read notifies clients. The cooldown no longer limits progress freshness.GetClientCapabilitiesreads the gateway name from its identity instead of building a full computers snapshot (routes, peers, notices) on every call.GetComputersread without 3 s timers (one 60 s visible check; 2 s only while a pairing invitation is valid). Network access checks every 30 s and devices every 60 s, while visible.Measurements
Tests:
tests/integration/update-center.test.ts(an idle stream gets no notices; update progress is pushed), plus the existinglinked-updates,desktop-updates,updatesandgateway-rolesuites.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.