feat(desktop): add dismissible banner pointing to the new buzz app (#9379)

## Summary

The Buzz 1.0 desktop app now lives in
[block/buzz-app](https://github.com/block/buzz-app). This adds a banner
to the 0.X desktop app that tells users, and lets them download the new
app's installer without leaving the app.

- A full-width banner sits under the top chrome: "A new Buzz app is
here! This version is being retired, so grab the new one whenever you
get a chance."
- **Upgrade** downloads the installer for this machine inside the app. A
dialog shows the progress, then the saved file's name and folder with
**Show in Finder** (worded per platform) and **Done**. The file goes to
the Downloads folder and is revealed in the file manager. It is never
opened, mounted or run.
- **Cancel**, Escape or the dialog's close button stops a running
download and removes the partial file.
- When no installer can be resolved for this machine (unsupported
platform, or the manifest fetch fails or is slow), **Upgrade** opens
`https://buzz.xyz` in the browser instead.
- **More info** opens the [upgrade
guide](https://github.com/block/buzz-app/blob/main/docs/upgrading.md) in
the browser.
- Dismissing (×, labelled "Remind me later") stores a timestamp in
`localStorage`. The banner is read once per mount, so it comes back on
the next launch (or community switch) once 24h have passed.
- It is hidden in the huddle room window.

## Demo


https://github.com/user-attachments/assets/1f1916e8-f32d-4ec0-8e60-fe7c85dd4a57

Recorded on macOS (Apple Silicon) from a native debug build with the
real Rust backend: a full download, **Done**, then a second download
cancelled part-way.

- The network is throttled through a local proxy so the progress stays
visible. Unthrottled, the installer arrives in about two seconds.
- The app was launched with a scratch home folder, so the path in the
dialog is a scratch path, and the Finder window that the reveal opens is
left out of the recording.
- Presses are accessibility presses, marked with an orange ring. The OS
cursor is not shown.

## How the download works

- **Which installer:** a Tauri command reports this install's key
(`macos-arm64`, `macos-x64`, `windows-x64`, `linux-appimage` or
`linux-deb`). The webview reads the matching entry from the [buzz-app
download
manifest](https://raw.githubusercontent.com/block/buzz-app/download-feed/downloads.json)
once per banner mount.
- **Validation:** Rust re-validates the URL on every call. It must be
`https://github.com/block/buzz-app/releases/download/<tag>/<file>`, with
a restricted tag and file-name character set and the extension this
machine installs. The webview names a URL and nothing else.
- **Redirects:** a dedicated HTTPS-only client follows at most 5
redirects, and only to `github.com`, `objects.githubusercontent.com` or
`release-assets.githubusercontent.com`.
- **Limits:** 512 MiB, 15 s to connect, 30 s for headers, 30 s without a
byte, 60 min in total. One download at a time.
- **Saving:** the body is written to `<name>.<random>.part` in the
Downloads folder, then renamed to `<name>` (or `<name> (1)` and so on)
without ever replacing an existing file. The partial file is removed on
failure, on cancel and at app exit. A partial left by a crash or
force-quit is removed on the next launch.
- **Downloaded-from-the-internet marking:** macOS gets the
`com.apple.quarantine` attribute a browser would write, and Windows gets
the Mark of the Web (`Zone.Identifier`). If the mark cannot be written,
the download fails and the file is not kept.
- **Failures:** the dialog says what went wrong in plain words.
Transient failures lead with **Try again**. Failures a retry cannot fix
lead with **Download in browser**, which opens the validated installer
URL.

## Testing

- Unit: `deprecationBannerVisibility.test.mjs`,
`newAppInstaller.test.mjs` (manifest and URL rules),
`newAppInstallerDownload.test.mjs` (dialog state), and a jsdom test of
the download hook.
- Rust: `new_app_installer_tests.rs` covers URL validation, the redirect
policy, limits, naming without overwrite, cancel and shutdown cleanup,
launch cleanup, and the quarantine and Mark of the Web values. CI runs
this crate's tests on Linux and on `windows-latest`, so the Mark of the
Web test writes a real alternate data stream there. The quarantine test
runs on macOS only, which CI builds but does not test.
- Smoke: `tests/e2e/deprecation-banner.spec.ts` drives the banner, the
download dialog, each failure's actions, cancel and the keyboard paths
against the mock bridge.
- Native, macOS arm64 debug build: the download was saved with
`com.apple.quarantine` set and revealed in Finder; cancel removed the
partial; the download kept running while the window was hidden; SIGTERM
and a menu quit mid-download removed the partial; after a force kill the
next launch removed it.

Not verified by hand:

- The Windows and Linux flows in a running app, including SmartScreen on
Windows.
- The Gatekeeper prompt when opening the downloaded DMG, and the macOS
Downloads-folder consent prompt, which need a signed build.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Kalvin Chau <kalvin@block.xyz>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Matt Toohey <contact@matttoohey.com>
This commit is contained in:
Kalvin C
2026-11-13 00:08:25 -08:00
committed by GitHub
parent 3d3f9cf153
commit 1fc6a71ef9
29 changed files with 4952 additions and 0 deletions

View File

@@ -33,6 +33,12 @@ import { switchManagedAgentModel } from "@/shared/api/agentControl";
import { getAudioMediaLoadSchedulerSnapshot } from "@/features/messages/lib/audioMediaLoadScheduler";
import { mockSearchHitMatches } from "./e2eBridgeSearch.ts";
import { selectMockHistory } from "./e2eBridgeHistory.ts";
import {
handleMockInstallerCancel,
handleMockInstallerDownload,
handleMockInstallerReveal,
installMockInstallerDownloadControls,
} from "./e2eBridgeInstallerDownload.ts";
import {
createMockSubscription,
hasMockSubscription,
@@ -499,6 +505,9 @@ type E2eConfig = {
* Linux .deb install where Tauri's updater cannot swap the binary).
* Defaults to true for all existing tests. */
autoUpdateSupported?: boolean;
/** Manifest key `new_app_installer_target` returns. Defaults to none, so
* the deprecation banner never fetches the installer manifest. */
newAppInstallerTarget?: string;
/** Reject `plugin:opener|open_url` to exercise browser-return fallback UI. */
openerError?: string;
/** Delay binding signatures so specs can exercise request supersession. */
@@ -1422,6 +1431,8 @@ declare global {
content: string;
tags: string[][];
}>;
/** While set, applying a community to the mock backend fails with this message. */
__BUZZ_E2E_APPLY_COMMUNITY_ERROR__?: string;
/** Structured merge error returned by the mock native merge command. */
__BUZZ_E2E_PROJECT_MERGE_ERROR__?: {
code: string;
@@ -11556,6 +11567,7 @@ export function maybeInstallE2eTauriMocks() {
(window as Window & { isTauri?: boolean }).isTauri = true;
}
mockWindows(config.mock?.windowLabel ?? "main");
installMockInstallerDownloadControls();
window.__BUZZ_E2E_COMMANDS__ = [];
window.__BUZZ_E2E_COMMAND_PAYLOADS__ = [];
window.__BUZZ_E2E_COMMAND_LOG__ = [];
@@ -12951,6 +12963,9 @@ export function maybeInstallE2eTauriMocks() {
return activeConfig?.mock?.linkPreviewMetadata ?? null;
}
case "apply_workspace": {
if (window.__BUZZ_E2E_APPLY_COMMUNITY_ERROR__) {
throw new Error(window.__BUZZ_E2E_APPLY_COMMUNITY_ERROR__);
}
const applyDelayMs = activeConfig?.mock?.applyCommunityDelayMs ?? 0;
if (applyDelayMs > 0) {
return new Promise((resolve) =>
@@ -14882,6 +14897,14 @@ export function maybeInstallE2eTauriMocks() {
// Default true so all existing tests continue to use the auto-update
// path. Set mock.autoUpdateSupported: false to simulate a .deb install.
return activeConfig?.mock?.autoUpdateSupported !== false;
case "new_app_installer_target":
return activeConfig?.mock?.newAppInstallerTarget ?? null;
case "download_new_app_installer":
return handleMockInstallerDownload(payload);
case "cancel_new_app_installer_download":
return handleMockInstallerCancel();
case "reveal_new_app_installer":
return handleMockInstallerReveal();
case "relay_reconnect_hook":
return null;
case "relay_reconnect_hook_configured":

View File

@@ -0,0 +1,112 @@
import type {
InstallerDownloadEvent,
InstallerDownloadOutcome,
InstallerFailureReason,
} from "@/shared/api/newAppInstallerDownload";
type MockChannel = { onmessage?: (event: InstallerDownloadEvent) => void };
type ActiveDownload = {
channel: MockChannel | undefined;
fileName: string;
settle: (outcome: InstallerDownloadOutcome) => void;
};
declare global {
interface Window {
/**
* Drives the mock `download_new_app_installer` command, which stays
* pending until a spec finishes or fails it, or the app cancels it.
*/
__BUZZ_E2E_INSTALLER_DOWNLOAD__?: {
progress: (receivedBytes: number, totalBytes: number | null) => void;
finish: () => void;
fail: (reason: InstallerFailureReason) => void;
isActive: () => boolean;
/**
* Makes the next cancel lose the race with the final move: the cancel
* call returns, then the download settles as saved.
*/
finishOnNextCancel: () => void;
/** Makes the next `reveal_new_app_installer` call fail. */
failNextReveal: () => void;
};
}
}
const MOCK_DOWNLOADS_FOLDER = "/Users/e2e/Downloads";
// Like the backend, the mock runs one download at a time.
let active: ActiveDownload | null = null;
let finishesOnNextCancel = false;
let failsNextReveal = false;
function settleAsSaved() {
active?.settle({
status: "saved",
fileName: active.fileName,
folder: MOCK_DOWNLOADS_FOLDER,
});
}
export function handleMockInstallerDownload(
payload: unknown,
): Promise<InstallerDownloadOutcome> {
if (active) {
return Promise.resolve({ status: "failed", reason: "busy" });
}
const { url, onEvent } = payload as { url: string; onEvent?: MockChannel };
const fileName = new URL(url).pathname.split("/").at(-1) ?? "";
return new Promise((resolve) => {
active = {
channel: onEvent,
fileName,
settle: (outcome) => {
active = null;
resolve(outcome);
},
};
onEvent?.onmessage?.({ kind: "started", fileName });
});
}
export function handleMockInstallerCancel(): null {
if (finishesOnNextCancel && active) {
finishesOnNextCancel = false;
settleAsSaved();
} else {
active?.settle({ status: "cancelled" });
}
return null;
}
export function handleMockInstallerReveal(): Promise<null> {
if (failsNextReveal) {
failsNextReveal = false;
return Promise.reject(new Error("the file manager did not open"));
}
return Promise.resolve(null);
}
export function installMockInstallerDownloadControls() {
active = null;
finishesOnNextCancel = false;
failsNextReveal = false;
window.__BUZZ_E2E_INSTALLER_DOWNLOAD__ = {
progress: (receivedBytes, totalBytes) =>
active?.channel?.onmessage?.({
kind: "progress",
receivedBytes,
totalBytes,
}),
finish: settleAsSaved,
fail: (reason) => active?.settle({ status: "failed", reason }),
isActive: () => active !== null,
finishOnNextCancel: () => {
finishesOnNextCancel = true;
},
failNextReveal: () => {
failsNextReveal = true;
},
};
}