Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ jobs:
- '.github/workflows/ci.yml'
gpui:
- 'native/gpui/**'
- 'native/guard/src/appkeep.rs'
- 'assets/**'
- 'i18n/**'
- '.github/workflows/ci.yml'
browser:
- 'native/gpui/**'
Expand All @@ -48,6 +50,8 @@ jobs:
- '.github/workflows/ci.yml'
guard:
- 'native/guard/**'
- 'native/host/src/update/**'
- 'native/host/vendor/ed25519-compact/**'
- '.github/workflows/ci.yml'
android:
- 'mobile/android/**'
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,16 @@ jobs:
- name: no test trust in a release
run: |
# feature e2e-trust (test/update's feed) trusts a key from the environment; its code carries this mark, so a release that has it is refused
if grep -aq backplane-e2e-trust-enabled native/host/target/release/backplane-hub${{ runner.os == 'Windows' && '.exe' || '' }}; then echo "::error::backplane-hub was built with feature e2e-trust"; exit 1; fi
check_no_e2e_trust() {
local bin="$1" label="$2" rc=0
[ -f "$bin" ] && [ -r "$bin" ] || { echo "::error::missing or unreadable $label at $bin"; exit 1; }
grep -aq backplane-e2e-trust-enabled "$bin" || rc=$?
if [ "$rc" -eq 0 ]; then echo "::error::$label was built with feature e2e-trust"; exit 1; fi
if [ "$rc" -ne 1 ]; then echo "::error::failed to scan $label (grep exit $rc)"; exit 1; fi
}
check_no_e2e_trust "native/host/target/release/backplane-hub${{ runner.os == 'Windows' && '.exe' || '' }}" "backplane-hub"
# the guard compiles the same updater for `backplane builds keep` (the desktop app's own updates where no guard runs)
check_no_e2e_trust "native/guard/target/release/backplane${{ runner.os == 'Windows' && '.exe' || '' }}" "backplane"
# The Bun version here is deploy/bun-version's: change them together, and update deploy/licenses/bun (NOTICE.md and Bun's LICENSE.md at that tag)
# whenever it changes. scripts/licenses.sh refuses a package built with a Bun the notices do not name.
# bun for the browser helper. Its download server has answered 504 more than once: a pinned version, kept in the Actions cache, and
Expand Down
32 changes: 31 additions & 1 deletion docs/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ Nothing starts the hub directly. The desktop app finds this layout around itself

## Who updates itself

Only a hub the guard runs from a builds folder (`BACKPLANE_BUILDS`: `builds/<tag>/`, `CURRENT`, `BAD`, `.pins/`). Otherwise the updater says so and does nothing:
A hub the guard runs from a builds folder (`BACKPLANE_BUILDS`: `builds/<tag>/`, `CURRENT`, `BAD`, `.pins/`), and a desktop app whose install has no guard running because its hub is on another machine. Otherwise the updater says so and does nothing:

| state | when |
|---|---|
| `package` | no `BACKPLANE_BUILDS`: a package install or a plain folder; its package manager updates it |
| `off` | `BACKPLANE_NO_UPDATE=1`, or a copy of a real log (`copy::on`) |
| `idle` / `checking` / `downloading` / `waiting` / `installing` / `failed` | a managed hub |
| the app's own row (below) | a desktop app in a guarded install (`builds/<tag>/`, `CURRENT`, the guard at `<prefix>/backplane`) whose `launch.json` or `hubs.json` points to a hub on another machine: no guard runs on this machine, so the app keeps its own build (see "A desktop app on another machine's hub") |

The feed is GitHub Releases (`run::FEED`); only the environment (`BACKPLANE_UPDATE_FEED`) can change it, never a setting, because any paired client can write settings. The channel is the setting `update.channel`: `stable` or `beta` (0.14's stored `nightly` reads as `beta`).

Expand Down Expand Up @@ -85,6 +86,35 @@ The guard takes one request at a time: a second one gets 409 unless the first is

The update E2E (`test/update/`) needs releases it can sign, and it never signs one with the real key. A hub built with `cargo build --features e2e-trust` also trusts one public key (PEM) from the file `BACKPLANE_E2E_TRUST_KEY` names, and only for releases below `0.1.0` (`rel::E2E_CEILING`), so a leaked test release would offer nothing. The E2E makes a fresh keypair in its private home for each run and deletes it at the end; no private key is committed. Default and release builds have none of this code: the feature's code carries the string `backplane-e2e-trust-enabled`, and `release.yml` fails a build whose `backplane-hub` contains it. A unit test shows a default build refuses a manifest signed by such a key.

## A desktop app on another machine's hub

A desktop app set up to use a hub on another machine (`~/.config/backplane-gpui/launch.json`: `"home": ""`, `"url": "http://HOST:PORT"`, or a paired remote hub in `hubs.json`) starts no hub, so no guard runs on its machine. Nothing looked at the release feed and nothing moved `CURRENT`: such an install stayed on the build it was installed with, and Settings showed only the remote hub's update line, which said nothing about it. The app now keeps its own build, with the hub updater's trust rules and the guard's files, and moves to a new build only where no other app runs and only once that build has opened its window here.

**Who does what.**

- `backplane builds keep --builds <prefix> --running <tag> --channel <c>` (the guard, `native/guard/src/keep.rs`) finds, verifies and stages. It runs the hub's own `update::rel` and `update::run`, compiled into the guard by path as `scopeprobe.rs` already is, so this is the same code and not a copy: strict channel matching (nightly tracks only nightlies), HTTPS-pinned release downloads in production (`curl_url_ok`, `--proto =https`, `-q`, `--`), the signed manifest under the one compiled-in key, the tag's shape, `BAD`, the archive's size, sha256 and members, runnable `backplane-gpui` verified in scratch before rename, `EXPECT` (`{version, commit, sha256}`) checked on any existing tree, and one rename into `builds/<tag>/`. Then it writes `app-update/next` under `app-update/state.lock` and stops. It never starts or stops a hub, never touches a build that runs, and prunes under `state.lock` with the guard's rule (`run::prunable`, which also pins `app-update/` pointers). One runs at a time (`app-update/lock`). With a guard running on this prefix (`.guard.lock`, or legacy `.pins/<port>` answering `/healthz`) it says `guard` and does nothing, because that guard owns `CURRENT`.
- The app (`native/gpui/src/selfupdate.rs`, with the rules in `native/guard/src/appkeep.rs`, which both programs compile) does the rest. It runs only in a guarded install whose launch uses a hub on another machine: either `launch.json` has a `url` with no `--url`, `BACKPLANE_HOME`, or local hub this client was started on, or `hubs.json` points to a paired non-loopback remote hub (and switching hubs in-process updates this eligibility via `switch_hub`). It never runs under `$APPIMAGE`, `BACKPLANE_HUB_BIN`, `BACKPLANE_NO_UPDATE=1`, or special test/script flags. A package install has no `builds/` layout, so it never runs there either.
- **At launch, before any window** (`appkeep::start`): every app of a prefix holds `<prefix>/clients.lock` shared while it runs. A launch that can hold it alone may move to another build; one that cannot stays where it is, so no build changes under a running app.
- A staged build newer than this one, eligible for the active channel (or marked `app-update/manual`), not in `BAD` and present is tried. The launch writes `app-update/trial` (`{tag, from, at, pid, nonce}` under `state.lock`) and replaces itself with that build's app (`BACKPLANE_APP_TRIAL=<nonce>`; `exec` on Unix keeping `CFProcessPath` so `Backplane.app` stays the app macOS launched; spawned on Windows with its PID recorded before releasing `clients.lock`). `CURRENT` still names the old build.
- A launch of the build a trial came from where that trial's PID is no longer alive means the trial never presented its window. That trial is marked `BAD` ("its app never opened its window") and this build runs. A launch while `trial.pid` is still alive stays without marking it bad, and a third build forgets the trial without blaming it (`CURRENT` moved by hand).
- **First frame presented** (`appkeep::opened`): scheduled after the first frame draws and presents (`window.on_next_frame` -> `request_animation_frame` -> `app_opened`), verifying `nonce`, `CURRENT == from`, and `!BAD`. A trial is added to `app-update/good`, becomes `CURRENT` and clears `next` (leaving any newer `next` staged since the launch intact). The build `CURRENT` already names is recorded as good. Then this build's own guard runs `builds keep`, detached, and again every six hours while the app runs (recovering automatically if a helper exits early while `checking`/`downloading`).
- `CURRENT` only ever names a build whose app presented on this machine. The launchers (`deploy/mac/launcher.c`, `backplane-app` from install.sh, the Windows guard's `backplane` with no arguments, which the Start-menu entry runs) only read `CURRENT` and run its app, so none of them changed: the switch happens inside the app they start, and every launcher already installed keeps working. A new build that crashes before its window presents costs one launch: the next launch runs the old build again, marks the new one bad and opens.
- Pruning keeps `CURRENT`, the newest three good builds (a second app opened before a switch still runs the build `CURRENT` named then), the staged build, both sides of a trial, the running build and anything pinned.

**Why the guard stages and the app switches.** The guard gets the fetch-and-stage step because the trust rules already live in the hub's updater, and the guard can compile the same files with three small dependencies (`ed25519-compact` from the hub's vendor folder, `base64`, `hex`). The app stays free of the updater, and the step runs detached, so it finishes even if the window closes. The guard cannot do the switch, because nothing runs it at launch: the launchers run the app directly, and launchers already installed are never rewritten by an update. So the app judges and moves `CURRENT` itself, through `appkeep.rs`, which the guard compiles too. `store::Builds::mark_bad`/`publish` write `BAD` and `CURRENT` through it, so the format has one writer.

**Channel.** The hub's, so the app and the hub move to the same releases. The app asks the hub's `update.status` at each connection and hourly, and keeps its channel and version per hub in `app-update/hub.json` (`hubs.<key>`) for checks made before a connection (`selfupdate::hub_said`). A channel that changes starts a check at once (serialized cleanly via `CHECK_IN_FLIGHT`/`CHECK_AGAIN`, and a keeper seeing a channel change waits on `app-update/lock` to re-check rather than dropping it). An ineligible staged build from an earlier channel is cleared from `next` (unless `manual`). This device can choose its own instead (`local-settings.json`'s `app_channel`: empty follows the hub; `stable`, `beta` or `nightly` is this computer's alone), with the chips in its Settings row: "Same as the hub (nightly)", stable, beta, nightly. The feed comes only from the environment (`BACKPLANE_UPDATE_FEED`), never from a setting, and `BACKPLANE_NO_UPDATE=1` turns all of this off, as for the hub.

**Restart to update.** A build staged here is offered at once rather than at the next launch. The sidebar says "Backplane 0.16.1 is ready." with Restart to update, and the Network row has the same button. If another window of this install is still open (`clients.lock` contended), Restart stays open and asks you to close other Backplane windows first. When alone on Unix, it replaces the running process directly via `exec` (preserving macOS `Backplane.app`); on Windows it spawns the launchers' app (`CURRENT`) with `BACKPLANE_APP_AFTER=<pid>` and exits, which waits until that PID releases `clients.lock` and tries the staged build (promoting `CURRENT` once its window presents). The hub is not touched, so nothing running there stops.

**Versions apart.** The sidebar also says when this app and its hub run different versions (`selfupdate::skew`). "This app is 0.15.2; the hub runs 0.16.0." comes with Check now (this app looks again). "The hub runs 0.15.2, older than this app (0.16.0)." comes with Check the hub (`update.check` on the hub when `canCheck` is true, which installs what it finds when no turn runs). When a build is staged here, Restart to update comes first.

**What the person sees.** A desktop client connected to any hub shows its own version beside the hub's, which is labelled "Hub: Backplane …", on Settings > Network and Settings > About: the two can differ (and Settings notes when they differ with a warning tone). Where the app is updated by this computer's hub (its guard) or by its package, the Network row says that. Where it keeps its own build, the row reads "This Mac's app: 0.16.0" (or "This computer's app") with "Up to date, checked 14:05", "v0.16.1 is ready: used the next time Backplane opens", "Updated to v0.16.1", "v0.16.2 did not start, so this build stayed", or a localized check-failure message (`gpui.appupdate.err.*`; raw details stay in `status.json` and `keep.log`). The row offers Restart to update (when a build waits), Check now and the channel chips. The words come from `appkeep::line` over `app-update/status.json`. The hub's own Check now beside it checks this device too. Phones are unaffected.

**A hand install.** On Windows, unpacking a newer zip and choosing Install puts it in `builds/` and, when no guard runs and `CURRENT` names an older build, writes it as `app-update/next` + `manual` and launches a tracked trial so `CURRENT` promotes once its window presents; when a guard owns the prefix, it leaves `CURRENT` and `next` to the guard. On Linux and macOS, install.sh run again with no guard running writes `CURRENT` itself, and a pending trial is forgotten, not blamed.

Tests: `appkeep::` and `keep::` in the guard (`cargo test`, no network; the hub's `update::` tests run there too), `selfupdate::` in the client, and `test/update/app-e2e.sh GUARD GPUI` end to end. That test builds A, B and a broken C on a loopback signed feed, with the real client under a private Xvfb: A stages B and stays as it was, a second app leaves the build alone, the next launch runs B and makes it `CURRENT`, C dies at its start and is marked bad, and B keeps running.

## Checking an update from far away

The client that asked keeps polling `/hello` (never `/healthz`, which tells a caller without a credential nothing of the build). The update is done when it answers with the new version and commit. When it still answers with the old pair after the guard's boot and stable time, and `update.status` says `failed` with the tag, the update was rolled back. `/hub/status` (paired) shows the guard's view: build, commit, good, bad, last request and recent incidents.
Expand Down
2 changes: 2 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ The line takes curl where there is one and wget where there is not (a stock Ubun

x64 and arm64. It lays the release out for the guard (docs/deploy.md): the build in `~/.local/share/backplane/builds/<tag>/`, `CURRENT` naming the one that runs, and the guard at `~/.local/share/backplane/backplane`, linked as `backplane` in `~/.local/bin` beside `backplane-app` (the desktop app). It adds Backplane to your applications menu, on macOS as Backplane.app in `~/Applications` (`BACKPLANE_NO_DESKTOP=1` skips that). The desktop app starts its home's hub under the guard, which keeps it up to date from signed releases, takes each new build on probation and goes back when one fails (`backplane hub status`, `restart`, `rollback`). `BACKPLANE_NO_DESKTOP_APP=1` installs the hub alone and starts the guard at once (home `BACKPLANE_HOME`, default `~/.backplane/hub`; port `BACKPLANE_PORT`, default the first free from 3800); `BACKPLANE_START=1` starts it with the desktop app too. Run the installer again while the guard runs and it hands the new build to the guard, on probation. Add `~/.local/bin` to your `PATH` if asked.

A desktop app set up to use a hub on another machine runs no guard of its own, so it keeps its own build up to date. It follows the hub's update channel, checks the signed release feed at launch and every six hours, stages a newer release beside the one it runs, and offers Restart to update in the sidebar (or uses it the next time Backplane opens). The sidebar also says when the app and the hub run different versions. It makes that build the current one only once its first window frame has presented, and a build that fails to start is marked bad and never tried again; on Windows, installing a newer unpacked release over an unguarded install also runs a tracked trial so `CURRENT` advances cleanly. Settings → Network shows this device's app beside the remote hub's version, with Check now and its own channel (docs/deploy.md, "A desktop app on another machine's hub"). `BACKPLANE_NO_UPDATE=1` turns it off.

## macOS (Apple silicon)

Backplane runs on Macs with Apple silicon (M1 or later) and macOS 13 or later; Intel Macs aren't supported, and the installer says so on one. The Backplane KiCad it installs needs macOS 15 or later; on an older macOS, Settings → CAD says why.
Expand Down
29 changes: 29 additions & 0 deletions i18n/en.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,35 @@ settings.settle.personal.note = Read, completed personal conversations settle af
gpui.settings.more = … {n} more
gpui.settings.textpct = {pct}% of the standard size.
gpui.settings.px = {px} px.
gpui.appupdate.hub = Hub: Backplane {version}
gpui.appupdate.label = This computer's app: {tag}
gpui.appupdate.label.mac = This Mac's app: {tag}
gpui.appupdate.differs = Differs from the hub ({hub}).
gpui.appupdate.off = Updates are off on this computer.
gpui.appupdate.guard = Updated by this computer's own hub.
gpui.appupdate.checking = Checking for updates.
gpui.appupdate.downloading = Downloading {tag}.
gpui.appupdate.ready = {tag} is ready: used the next time Backplane opens.
gpui.appupdate.failed = The last check failed.
gpui.appupdate.err.network = Could not reach the release feed.
gpui.appupdate.err.platform = No build is available for this platform.
gpui.appupdate.err.verify = Update verification failed.
gpui.appupdate.err.package = The downloaded update package could not be installed.
gpui.appupdate.closeothers = Close other Backplane windows first to update.
gpui.appupdate.idle = Up to date, checked {when}.
gpui.appupdate.never = Not checked yet.
gpui.appupdate.updated = Updated to {tag}.
gpui.appupdate.updated.when = Updated to {tag}. Up to date, checked {when}.
gpui.appupdate.stayed = {tag} did not start, so this build stayed.
gpui.appupdate.stayed.when = {tag} did not start, so this build stayed. Checked {when}.
gpui.appupdate.local = Updated with this computer's hub.
gpui.appupdate.package = Updated by its package.
gpui.appupdate.restart = Restart to update
gpui.appupdate.samehub = Same as the hub ({channel})
gpui.appnotice.ready = Backplane {tag} is ready.
gpui.appnotice.appbehind = This app is {app}; the hub runs {hub}.
gpui.appnotice.hubbehind = The hub runs {hub}, older than this app ({app}).
gpui.appnotice.checkhub = Check the hub
gpui.keys.fixed = {key}. Fixed.
gpui.keys.now = Now {key}. Press to take the next key.
gpui.keys.notyet = Not yet: {why}.
Expand Down
Loading
Loading