Skip to content

Commit 786ecad

Browse files
stuartwdouglasVimesclaude
committed
fix(navigation): let bare buzz:// open Buzz without a broken-link notice
Builderlab's console "Open Buzz app" links to bare `buzz://`. The OS ingress treated it as malformed, so the button showed "This link doesn't work" (and opened Inbox on a cold start). Native already brings the app forward on any deep link, so ingress now skips bare `buzz://` and `buzz:///`: no notice, no navigation, and it never displaces a real link queued in the same batch. Other malformed links keep the notice; tests that used `buzz://` as their malformed example now use `buzz://unknown`. Co-authored-by: Vimes <d26902ac60a55be3ce7c6bb44cf3b0a0a09cf3b89067f6d9cc6e2e5015bd59a3@remote-agent-pilot.communities.buzz.xyz> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Stuart Douglas <[email protected]>
1 parent f798f37 commit 786ecad

4 files changed

Lines changed: 77 additions & 18 deletions

File tree

‎docs/deep-links.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ The OS ingress accepts the Buzz link forms and nothing else:
3030
- `buzz://add-community?relay=<wss-url>[&name=<name>]`
3131
- `buzz://plugin?id=<plugin id>[&page=<page id>][&route.<key>=<value>...]`
3232
- `buzz://agent/new?card=<id>`
33+
- `buzz://` (also `buzz:///`), the Builderlab console's **Open Buzz app**: it
34+
only brings Buzz to the front and opens nothing, at cold start too. It shows
35+
no notice and never replaces a link still waiting to open
3336

3437
External authorization links show owner consent. They never grant access on arrival. The [external app protocol](agents.md#external-app-authorization) defines the callback, S256 exchange, scopes, and expiry. Handshake values stay outside navigation history.
3538

@@ -105,7 +108,7 @@ link; HTTPS itself is not registered as an OS handler. `buzz://connect`
105108
community **Open in Buzz**; `name` is ignored) are the same form without a code:
106109
they open the join dialog with the relay prefilled or, when this device already
107110
belongs to that community, switch to it. Links that name no destination, such
108-
as bare `buzz://`, unknown hosts, missing or malformed parameters, malformed join
111+
as unknown hosts, missing or malformed parameters, malformed join
109112
or community links, incomplete entity or plugin links and oversize links, show a "This
110113
link doesn't work" notice. In a running app the notice shows over the current
111114
page, and history is unchanged. A link that launches the app, read before the
@@ -156,7 +159,7 @@ For OS ingress, use a packaged app or debug bundle. Write a link by hand, such a
156159
`buzz://channel/general` or `buzz://message?channel=general&id=<64-hex event id>`.
157160
A warm packaged app should come to the front and open the conversation. A cold
158161
start should launch, show the start page, then open the destination once the
159-
client is ready. A malformed link such as `buzz://` or
162+
client is ready. A malformed link such as `buzz://unknown` or
160163
`buzz://join?relay=example` must show the "This link doesn't work" notice over
161164
the current page when warm, and open Inbox with it on a cold start. Ordinary `just desktop` keeps in-app Buzz links and
162165
**Copy link**, but external `buzz://` delivery is not a supported development

‎src/app/entity-navigation.test.tsx‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ it("keeps an OS entity intent through real community selection and Retry in App"
231231
// page in place: no visit, and history is unchanged.
232232
const before = current.navigation.snapshot();
233233
await act(async () => {
234-
queue.push("buzz://");
234+
queue.push("buzz://unknown");
235235
ping();
236236
});
237237
await screen.findByRole("dialog", { name: "This link doesn’t work" });
@@ -276,7 +276,7 @@ it.each([
276276
const identity = new Promise<void>((resolve) => (release = resolve));
277277
const { current } = bindCommunityLinks(
278278
origin,
279-
async () => ["buzz://"],
279+
async () => ["buzz://unknown"],
280280
identity,
281281
);
282282
await waitFor(() => expect(current.plugins.startup()).not.toBe("loading"));
@@ -311,7 +311,9 @@ it.each([
311311
it("opens Inbox for a malformed launch link when the catalog settles after the client", async () => {
312312
let release = () => {};
313313
catalogGate.value = new Promise<void>((resolve) => (release = resolve));
314-
const { current } = bindCommunityLinks(origin, async () => ["buzz://"]);
314+
const { current } = bindCommunityLinks(origin, async () => [
315+
"buzz://unknown",
316+
]);
315317
await waitFor(() =>
316318
expect(current.communities.snapshot()).toMatchObject({
317319
status: "ready",
@@ -339,7 +341,9 @@ it("opens Inbox for a malformed launch link when the catalog settles after the c
339341
it("opens Inbox for a malformed launch link when Inbox activates last", async () => {
340342
let release = () => {};
341343
inboxGate.value = new Promise<void>((resolve) => (release = resolve));
342-
const { current } = bindCommunityLinks(origin, async () => ["buzz://"]);
344+
const { current } = bindCommunityLinks(origin, async () => [
345+
"buzz://unknown",
346+
]);
343347
await waitFor(() => {
344348
expect(current.communities.snapshot()).toMatchObject({
345349
status: "ready",
@@ -375,7 +379,9 @@ it("keeps a malformed launch link on the start page when the catalog turning Inb
375379
"buzzodz.plugins.v1",
376380
JSON.stringify({ version: 3, enabled: { "buzz.inbox": false } }),
377381
);
378-
const { current } = bindCommunityLinks(origin, async () => ["buzz://"]);
382+
const { current } = bindCommunityLinks(origin, async () => [
383+
"buzz://unknown",
384+
]);
379385
await waitFor(() =>
380386
expect(current.communities.snapshot()).toMatchObject({
381387
status: "ready",
@@ -420,7 +426,7 @@ it("a malformed link in a running app retires an earlier link's Try again", asyn
420426
});
421427
await screen.findByRole("button", { name: "Try again" });
422428
await act(async () => {
423-
queue.push("buzz://");
429+
queue.push("buzz://unknown");
424430
ping();
425431
});
426432
await screen.findByRole("dialog", { name: "This link doesn’t work" });

‎src/features/navigation/deep-links.test.ts‎

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ it("holds a malformed cold-start link until Inbox can open, then explains it onc
398398
t.stop();
399399
});
400400
it.each([
401-
"buzz://",
401+
"buzz://unknown",
402402
"buzz://message?channel=general",
403403
"buzz://message?channel=general&id=not-an-event",
404404
"buzz://channel/%E0%A4%A",
@@ -427,9 +427,9 @@ it.each([
427427
it("explains each repeated malformed warm link without adding visits, then opens a valid one", async () => {
428428
const t = harness(ready);
429429
await settle();
430-
t.arrive("buzz://");
430+
t.arrive("buzz://unknown");
431431
await settle();
432-
t.arrive("buzz://");
432+
t.arrive("buzz://unknown");
433433
await settle();
434434
expect(t.log).toEqual(["rejected", "rejected"]);
435435
expect(t.host.accepted).not.toHaveBeenCalled();
@@ -444,8 +444,51 @@ it("explains each repeated malformed warm link without adding visits, then opens
444444
});
445445
t.stop();
446446
});
447-
it("explains a malformed launch link over the start page, adding no visit, when Inbox is turned off", async () => {
447+
it.each(["buzz://", "buzz:///"])(
448+
"a bare warm link (%s) only brings Buzz forward: no notice, visit or failure",
449+
async (url) => {
450+
const t = harness(ready);
451+
await settle();
452+
await t.host.navigation.open({ version: 1, kind: "settings" });
453+
const before = t.host.navigation.snapshot();
454+
t.arrive(url);
455+
await vi.waitFor(() => expect(t.take).toHaveBeenCalledTimes(2));
456+
await settle();
457+
expect(t.host.rejected).not.toHaveBeenCalled();
458+
expect(t.host.accepted).not.toHaveBeenCalled();
459+
expect(t.host.fail).not.toHaveBeenCalled();
460+
expect(t.host.navigation.open).toHaveBeenCalledTimes(1);
461+
expect(t.host.navigation.snapshot()).toMatchObject({
462+
entry: { id: before.entry.id },
463+
status: "opened",
464+
});
465+
t.stop();
466+
},
467+
);
468+
it("a bare launch link opens the ordinary start page, not Inbox with a notice", async () => {
448469
const t = harness(loading, ["buzz://"]);
470+
await vi.waitFor(() => expect(t.take).toHaveBeenCalledTimes(1));
471+
await settle();
472+
t.become(ready);
473+
await settle();
474+
expect(t.log).toEqual([]);
475+
expect(t.host.navigation.snapshot().entry.target).toEqual({
476+
version: 1,
477+
kind: "home",
478+
});
479+
t.stop();
480+
});
481+
it("a bare link queued after a real one does not displace it", async () => {
482+
const t = harness(loading, ["buzz://channel/general", "buzz://"]);
483+
await vi.waitFor(() => expect(t.take).toHaveBeenCalledTimes(1));
484+
await settle();
485+
t.become(ready);
486+
await settle();
487+
expect(t.log).toEqual([channelOpen]);
488+
t.stop();
489+
});
490+
it("explains a malformed launch link over the start page, adding no visit, when Inbox is turned off", async () => {
491+
const t = harness(loading, ["buzz://unknown"]);
449492
t.inbox("off");
450493
await settle();
451494
const before = t.host.navigation.snapshot();
@@ -461,7 +504,7 @@ it("explains a malformed launch link over the start page, adding no visit, when
461504
it.each(["on", "off"] as const)(
462505
"holds a malformed launch link until Inbox availability settles (%s)",
463506
async (settled) => {
464-
const t = harness(loading, ["buzz://"]);
507+
const t = harness(loading, ["buzz://unknown"]);
465508
t.inbox("loading");
466509
await settle();
467510
const before = t.host.navigation.snapshot();
@@ -481,7 +524,7 @@ it.each(["on", "off"] as const)(
481524
},
482525
);
483526
it("a newer user visit cancels a malformed launch link waiting for Inbox", async () => {
484-
const t = harness(loading, ["buzz://"]);
527+
const t = harness(loading, ["buzz://unknown"]);
485528
t.inbox("loading");
486529
await settle();
487530
t.become(ready);
@@ -493,7 +536,7 @@ it("a newer user visit cancels a malformed launch link waiting for Inbox", async
493536
});
494537
it("never reports a held malformed link as denied when the account changes", async () => {
495538
const other = "f".repeat(64);
496-
const t = harness({ ...ready, status: "loading" }, ["buzz://"]);
539+
const t = harness({ ...ready, status: "loading" }, ["buzz://unknown"]);
497540
try {
498541
await vi.waitFor(() => expect(t.take).toHaveBeenCalledTimes(1));
499542
await settle();
@@ -511,7 +554,9 @@ it("never reports a held malformed link as denied when the account changes", asy
511554
}
512555
});
513556
it("a newer user visit cancels a malformed link waiting for a community", async () => {
514-
const t = harness({ status: "ready", viewer, selected: null }, ["buzz://"]);
557+
const t = harness({ status: "ready", viewer, selected: null }, [
558+
"buzz://unknown",
559+
]);
515560
try {
516561
await vi.waitFor(() => expect(t.take).toHaveBeenCalledTimes(1));
517562
await settle();
@@ -684,7 +729,7 @@ it("a malformed warm link retires an earlier link's recovery and restores the pa
684729
await vi.waitFor(() =>
685730
expect(t.host.navigation.snapshot().retryable).toBe(true),
686731
);
687-
t.arrive("buzz://");
732+
t.arrive("buzz://unknown");
688733
await vi.waitFor(() => expect(t.host.rejected).toHaveBeenCalledTimes(1));
689734
expect(t.host.navigation.snapshot()).toMatchObject({
690735
entry: { id: before.entry.id },

‎src/features/navigation/deep-links.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ type Client = Pick<ClientSnapshot, "status" | "viewer" | "selected">;
4646
// normalized its case before this bridge receives it. Every address outside the
4747
// Buzz link grammar, unknown hosts included, parses to null; the app has no link
4848
// form of its own beyond the Buzz ones.
49+
50+
// Bare `buzz://` ("Open Buzz") only asks for the app, which native has already
51+
// brought to the front. It names no intent, so ingress skips it; it is never held,
52+
// bound or rejected, and still parses to null. Windows can add a root path.
53+
const OPEN_APP_LINK = /^buzz:\/\/\/?$/;
4954
const buzzLink = (url: unknown) =>
5055
typeof url === "string" && url.startsWith("buzz:")
5156
? parseBuzzLink(url)
@@ -277,7 +282,7 @@ export function bindDeepLinks(
277282
let url: string | undefined;
278283
for (let index = urls.length - 1; index >= 0; index--) {
279284
const candidate = urls[index];
280-
if (typeof candidate === "string") {
285+
if (typeof candidate === "string" && !OPEN_APP_LINK.test(candidate)) {
281286
url = candidate;
282287
break;
283288
}

0 commit comments

Comments
 (0)