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 <chris.cokerconstruction@gmail.com>
Co-authored-by: crgallego <chris.cokerconstruction@gmail.com>
This commit is contained in:
crgallego
2026-09-28 15:46:07 -07:00
committed by GitHub
parent 6918dd3a83
commit c96553eb13
2 changed files with 21 additions and 8 deletions

View File

@@ -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");
});

View File

@@ -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