Skip to content

feat(updates): update linked computers' apps over the link - #210

Merged
nixuuu merged 1 commit into
devfrom
feat/linked-updates-1
Nov 5, 2026
Merged

nixuuu merged 1 commit into
devfrom
feat/linked-updates-1

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Stage 1 of 2, linked updates: from one computer, update the Canopy app on a linked computer over the link.

Local control channel

  • In local mode, the desktop app opens a channel to its own bundled gateway (WatchAppControl / ReportAppControl).
  • An update requested from a linked computer runs through the same flow as a remote-mode update. The partner waits for idle, so a running turn is never killed.
  • A request from a linked computer cannot force a restart or a downgrade.

Link service

  • ComputerUpdateService with GetComputerUpdates and RequestComputerUpdate. Actions: app, check, worker.
  • It runs over the existing routed-call path, only when both sides announce the remote_app_update link capability.
  • It is never relayed. The link protocol version stays 1.

Status on A

  • The updates snapshot gains computers: each partner's own snapshot, with ids qualified by its node. A polls every 5 s.
  • Check now on A also asks each partner's app to check its own feed.

Update all order

gateway → binary workers → native agent CLIs → remote Canopy apps → linked computers' apps, last, one at a time.

  • A's bundled gateway never restarts during Update all, so A sees each partner go away and come back.
  • A partner step finishes when the partner returns with at least the planned version.
  • While the partner is offline or updating, the step waits instead of failing.
  • A failure on the partner stops the run, with its reason.

Security

  • The partner accepts calls only from a directly linked computer of the same owner; anything else gets PermissionDenied. Relayed calls are refused.
  • The partner checks its own feed and channel, and installs only a strictly newer signed release. It refuses, with a readable reason, when:
    • its updater is disabled;
    • its app is not connected;
    • it is already running its own Update all.
  • The control channel refuses paired device tokens and non-desktop gateways. Server and Docker gateways are unchanged.
  • Audit:
    • on A: computer.update.sent;
    • on the partner: computer.update.received, then desktop.update.request and desktop.update.outcome.
  • No feed URLs, binaries, credentials or downgrade grants cross the link.

Proto (additive):

  • DesktopUpdateCommand.requested_by and check;
  • DesktopUpdateState.ready;
  • ManageUpdatesRequest.node_id;
  • UpdatesSnapshot.app and computers;
  • UpdateStep.node_id and request_id;
  • new ComputerUpdate.

canopy.update.v1 is untouched, and no migration is needed.

Tests: tests/integration/linked-updates.test.ts uses two real gateways with an mTLS link and a fake app on B built from the real LocalDesktopControl and RemoteAppUpdate:

  • A sees B's version, channel and workers;
  • Check now reaches B;
  • a single update is routed, audited on both sides, waits for idle, then restarts;
  • A shows "updating" while B is down and the new version once it is back;
  • Update all puts B last and waits while it is offline;
  • an unlinked computer is refused;
  • a partner without the capability gets no action;
  • after Unlink, A cannot reach B.

check:tmp: 1365 passed, 0 failed.

Docs: docs/updates.md (new section "Połączone komputery"), docs/linked-computers.md and docs/desktop.md.

A local-mode desktop app now opens a control channel to its own bundled
gateway (WatchAppControl/ReportAppControl, service token only, desktop
role only). A directly linked computer that announces remote_app_update
can read the partner's update snapshot and ask it to check, update its
app or update one of its binary workers through ComputerUpdateService on
the existing link. The partner validates the link, its owner and the
capability, runs the update with its own updater, channel and settings,
waits for idle and restarts. Both sides write audit entries.

Update all adds linked computers' apps last, one at a time; the bundled
gateway never restarts in Update all, so the link observes the partner
coming back on the new version. Offline or "updating" partners wait.
@nixuuu
nixuuu added this pull request to stack #212 November 5, 2026 19:26
@nixuuu
nixuuu marked this pull request as ready for review November 5, 2026 19:27
@nixuuu
nixuuu merged commit 155406f into dev Nov 5, 2026
16 of 18 checks passed
@nixuuu
nixuuu deleted the feat/linked-updates-1 branch November 5, 2026 19:34
nixuuu added a commit that referenced this pull request Nov 12, 2026
Reconcile desktop journals, persisted gateway history and client snapshots with current versions or completed feed checks. Add durable owner-scoped dismissal and restart integration coverage.

Fixes: #70
Fixes: #210
Related: #536
nixuuu added a commit that referenced this pull request Nov 12, 2026
Reconcile desktop journals, persisted gateway history and client snapshots with current versions or completed feed checks. Add durable owner-scoped dismissal and restart integration coverage.

Fixes: #70
Fixes: #210
Related: #536
nixuuu added a commit that referenced this pull request Nov 12, 2026
Reconcile desktop journals, persisted gateway history and client snapshots with current versions or completed feed checks. Add durable owner-scoped dismissal and restart integration coverage.

Fixes: #70
Fixes: #210
Related: #536
nixuuu added a commit that referenced this pull request Nov 12, 2026
Reconcile desktop journals, persisted gateway history and client snapshots with current versions or completed feed checks. Add durable owner-scoped dismissal and restart integration coverage.

Fixes: #70
Fixes: #210
Related: #536
nixuuu added a commit that referenced this pull request Nov 12, 2026
Reconcile desktop journals, persisted gateway history and client snapshots with current versions or completed feed checks. Add durable owner-scoped dismissal and restart integration coverage.

Fixes: #70
Fixes: #210
Related: #536
nixuuu added a commit that referenced this pull request Nov 12, 2026
An interrupted remote app update can leave a failed journal and a
stopped Update all run visible after the target is already current.
Reconcile those records with the target's version or a completed Up to
date check, so obsolete failures stop driving the Updates header and
sidebar badge.

Restart recovery accepts the requested version or any newer SemVer
version, including an interrupted journal saved before `restarting`.
Returning on the old version remains a failure. Relevant failures offer
Request again and Dismiss on web and mobile. Dismissals require the
current request or run ID, remain owner-scoped, and survive gateway/app
restarts. Dismissing a stopped run also acknowledges its matching app
failure; it never acknowledges a newer request.

Reconciliation persists the result without starting queued later steps.
Linked-computer action responses replace cached snapshots, and clients
reject reads started before a newer action. Contracts are additive;
frozen `canopy.update.v1` is unchanged. Mobile edits are TypeScript
only, with no native configuration changes.

Caller audit: web popover, linked-computer settings, mobile rows and
stopped-run dismissal preserve the request IDs returned in snapshots.
Electron has no separate renderer dismissal IPC; control commands carry
the target-local ID unchanged to its journal. Linked-app dismissal now
also accepts a plain UUID scoped to the explicitly selected direct peer
of this owner. Existing qualified IDs retain their suffix, so another
computer's ID is rejected; the target still checks its exact current
failed request. Integration coverage exercises both forms, mismatched
requests, foreign computer suffixes, cache replacement and the target
journal acknowledgement.

### Validation

- Added gateway/desktop integration coverage for equal/newer version
recovery, old-version failure, completed Up to date checks, retry
success, durable owner-scoped dismissal, linked snapshot replacement,
and gateway replacement without launching later steps. Updated the
existing orchestration fixture to report the installed version on
success. No web UI tests added.
- Rebased onto the requested `origin/dev` (`f7ad51cc`). `bun install`
and `bun run gen:check` passed with a clean working tree. Changed-file
lint/formatting and whitespace review passed. Static self-review covered
persistence, request identity, owner boundaries, restart classification,
cache ordering, stopped-run safety, and copy.
- Focused local verification passed: `bun test
tests/integration/stale-app-updates.test.ts
tests/integration/desktop-updates.test.ts
tests/integration/update-center.test.ts` — **27 pass, 0 fail, 139
assertions**. Fixtures ran sequentially. The linked-computer suite stays
on CI because it needs two gateways. The maintainer explicitly requested
no local full `check:tmp`; full static/typecheck/test/build validation
runs in GitHub CI.
- Real-browser review passed at 1280×800 and 390×844 in light/dark, with
short, typical and long names. Reviewed the production sidebar/popover
using controlled snapshots: a relevant failure retains Request again and
Dismiss plus the other row; equal/newer target versions and a reconciled
stopped run remove the old failure, header and red badge. Clicking row
Dismiss through the real client request path preserved the qualified ID
and replaced the snapshot using a mocked acknowledgement. Backend
durability/ownership were verified separately by real gRPC integration
tests. The web shell intentionally had no live gateway; its connection
warning/502s were expected fixture-environment noise. No web UI test
suite was added. Browser tab and local web server were stopped after
review.
- EAS production-profile fingerprints match the `dev` baseline on both
platforms: iOS `6ddec9ef559ee0095ac33e94ff9418a942053b17`; Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. Mobile remains JS/TS-only;
no native runtime change.
- CI log follow-up kept rejected downgrades as failures, restored
refreshes after replacing a linked action snapshot, and corrected the
linked/request and persisted-settings test setup. Linked-app dismiss
accepts both ID forms while retaining foreign-target and stale-request
rejection.

### Copy audit — docs/copy.md §8

| Before → after | Reason |
| --- | --- |
| Failure with no acknowledgement → **Request again** and **Dismiss** |
Offer recovery and acknowledgement while keeping other update rows
visible. |
| Generic update icon label → **Request update again on {computer
name}** for a failed request | Give the retry icon a concrete accessible
action. |
| No resolved/dismissed result → **Resolved** and **Dismissed** in
mobile history | Explain terminal results without protocol terms. |
| No dismissal precondition → **Choose the current failed update to
dismiss.** / **Choose the current stopped updates to dismiss.** | State
the action when the selected request is obsolete. |
| No dismissal outcome → **The app update was dismissed. Request it
again to continue.** / **Pair this desktop app again to dismiss its
update.** | Explain the state and next action in plain English. |

- New text uses sentence case, plain glossary terms, imperative actions,
and the sentence-length limits. Action labels/statuses have no trailing
punctuation; sentences have periods.
- Error messages name the condition or the required action. Existing
restart confirmation is reused. No new empty state, external-data
warning, or humorous copy is introduced.
- Each action and outcome has one purpose. No new explanatory copy
repeats a badge or tooltip. Important information stays visible or in
existing expandable details.
- Meaning does not depend on red text or an icon alone: failures retain
text, retry icons have labels, and Dismiss has a visible label.
- Short/typical/long-name checks at desktop/phone widths and light/dark
visual review passed. Names truncate cleanly, error text wraps, recovery
actions remain available, both rows stay visible and there is no
horizontal overflow.

### Attribution

The exact-version restart classification was introduced by #70
(`16648d37b`), and #210 (`155406fc7`) introduced the linked-app
orchestration that retains the stopped result. Both predate #536; #536
is context rather than the introducing change.

Fixes: #70
Fixes: #210
Related: #536
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant