From c96553eb13a073ca9f4ee1547b50ba3d28dfd4db Mon Sep 17 00:00:00 2001 From: crgallego Date: Mon, 28 Sep 2026 15:46:07 -0700 Subject: [PATCH] fix(desktop): resolve unlisted project channel requests (#7619) ## Summary - resolve project channel-creation approvals through the authoritative home-channel selector - permit owner-visible unlisted project homes when their channel and repository binding match - add regression coverage for the unlisted authoritative-home path ## Validation - `just ci` - focused project-home regression tests (10/10) - full Desktop suite (6,451/6,451) - `pnpm check` - `pnpm build` ## Manual verification After merging into a Desktop build, approve the pending LBX Copywriting workroom request from the Litbox OS project. Signed-off-by: crgallego Co-authored-by: crgallego --- .../projects/lib/projectHomeChannel.test.mjs | 16 ++++++++++++++++ .../projects/useProjectChannelRequests.ts | 13 +++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/desktop/src/features/projects/lib/projectHomeChannel.test.mjs b/desktop/src/features/projects/lib/projectHomeChannel.test.mjs index 3faaab0c0c..737ca83c8f 100644 --- a/desktop/src/features/projects/lib/projectHomeChannel.test.mjs +++ b/desktop/src/features/projects/lib/projectHomeChannel.test.mjs @@ -139,3 +139,19 @@ test("findProjectHomeByChannelId prefers the oldest listed authoritative home", ]); assert.equal(selected?.id, "original"); }); + +test("findProjectHomeByChannelId falls back to an unlisted authoritative home", () => { + const selected = findProjectHomeByChannelId("channel-a", [ + { + createdAt: 50, + id: "unlisted-home", + legacy: false, + owner: OWNER, + projectChannelId: "channel-a", + repositories: [{ channelId: "channel-a", owner: OWNER }], + visibility: "unlisted", + }, + ]); + + assert.equal(selected?.id, "unlisted-home"); +}); diff --git a/desktop/src/features/projects/useProjectChannelRequests.ts b/desktop/src/features/projects/useProjectChannelRequests.ts index 8c95ff15c7..8d50ad1b4a 100644 --- a/desktop/src/features/projects/useProjectChannelRequests.ts +++ b/desktop/src/features/projects/useProjectChannelRequests.ts @@ -6,6 +6,7 @@ import { subscribeProjectChannelRequests } from "@/features/agents/observerRelay import { useManagedAgentsQuery } from "@/features/agents/hooks"; import { useChannelsQuery } from "@/features/channels/hooks"; import { useChannelTemplatesQuery } from "@/features/channel-templates/hooks"; +import { findProjectHomeByChannelId } from "@/features/projects/lib/projectHomeSelection"; import { useProjectsQuery } from "@/features/projects/hooks"; import type { ProjectChannelRequest } from "@/features/projects/projectChannelRequest"; import { @@ -103,14 +104,10 @@ export function useProjectChannelRequests() { const project = request == null ? null - : ([...(projectsQuery.data ?? [])] - .filter( - (candidate) => - !candidate.legacy && - candidate.visibility !== "unlisted" && - candidate.projectChannelId === request.request.homeChannelId, - ) - .sort((left, right) => left.createdAt - right.createdAt)[0] ?? null); + : findProjectHomeByChannelId( + request.request.homeChannelId, + projectsQuery.data ?? [], + ); const template = request?.request.templateName == null ? null