From 618c01af6933cd05ef423efd3f01dd50b8eb03d8 Mon Sep 17 00:00:00 2001 From: Shakker Date: Wed, 15 Jul 2026 06:57:58 +0100 Subject: [PATCH] fix: verify ClickClack workspace ids during setup --- extensions/clickclack/src/setup-surface.test.ts | 9 ++++----- extensions/clickclack/src/setup-surface.ts | 5 ++++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/extensions/clickclack/src/setup-surface.test.ts b/extensions/clickclack/src/setup-surface.test.ts index 5d2b6bb0c57c..8cd6ebd67bae 100644 --- a/extensions/clickclack/src/setup-surface.test.ts +++ b/extensions/clickclack/src/setup-surface.test.ts @@ -212,9 +212,8 @@ describe("ClickClack setup wizard", () => { }); it("keeps setup saved when workspace resolution fails", async () => { - mocks.resolveWorkspaceId.mockRejectedValue( - new Error("ClickClack workspace not found: missing"), - ); + mocks.resolveWorkspaceId.mockResolvedValue("wsp_missing"); + mocks.workspaces.mockResolvedValue([]); const note = vi.fn(async () => undefined); await expect( @@ -224,7 +223,7 @@ describe("ClickClack setup wizard", () => { channels: { clickclack: { ...configuredAccount.channels.clickclack, - workspace: "missing", + workspace: "wsp_missing", }, }, }, @@ -232,7 +231,7 @@ describe("ClickClack setup wizard", () => { }), ).resolves.toBeUndefined(); expect(note).toHaveBeenCalledWith( - 'Workspace "missing" was not found. Check the id, slug, or name, list available workspaces, and rerun setup.', + 'Workspace "wsp_missing" was not found. Check the id, slug, or name, list available workspaces, and rerun setup.', "ClickClack connection check", ); }); diff --git a/extensions/clickclack/src/setup-surface.ts b/extensions/clickclack/src/setup-surface.ts index 1625670dccca..03fdf224f39c 100644 --- a/extensions/clickclack/src/setup-surface.ts +++ b/extensions/clickclack/src/setup-surface.ts @@ -162,10 +162,13 @@ export const clickClackSetupWizard: ChannelSetupWizard = { const workspaceId = await resolveWorkspaceId(client, account.workspace); const workspaces = await client.workspaces(); const workspace = workspaces.find((candidate) => candidate.id === workspaceId); + if (!workspace) { + throw new Error(`ClickClack workspace not found: ${account.workspace}`); + } await prompter.note( t("wizard.clickclack.connected", { handle: me.handle, - workspace: workspace?.name ?? workspaceId, + workspace: workspace.name, }), t("wizard.clickclack.connectionTitle"), );