fix(desktop): exclude archived channels from workstream board discovery

sq agents review flagged that the prefix-only discovery filter let an
archived loganj-ws-* channel keep appearing as an active board card.
Every other active-channel surface in this codebase (sidebar, search,
channel browser, agent autocomplete) excludes archivedAt !== null, so
apply the same rule here.

The review's second finding — one relay canvas query per rendered card
via useCanvasQuery — is the contract's specified design ("per matching
channel canvas fetch via existing canvas query/API paths") for this
bullet; batching/limiting canvas fetches is left for a later slice
rather than implemented as an unscoped addition here.

Signed-off-by: loganj <loganj@squareup.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
This commit is contained in:
loganj
2026-08-17 17:55:13 +00:00
co-authored by Claude Code
parent f1941ad912
commit 3b948d8d72
2 changed files with 25 additions and 5 deletions
@@ -18,7 +18,7 @@ function buildChannel(overrides) {
memberCount: overrides.memberPubkeys?.length ?? 0,
memberPubkeys: overrides.memberPubkeys ?? [],
lastMessageAt: null,
archivedAt: null,
archivedAt: overrides.archivedAt ?? null,
participants: [],
participantPubkeys: [],
isMember: overrides.isMember ?? false,
@@ -103,6 +103,23 @@ test("applies no creator/membership filter — every matching name is included r
]);
});
test("excludes an archived channel even when its name matches the prefix", () => {
const channels = [
buildChannel({
id: "1",
name: "loganj-ws-done",
archivedAt: "2026-01-01T00:00:00Z",
}),
buildChannel({ id: "2", name: "loganj-ws-active" }),
];
const result = filterWorkstreamChannels(channels);
assert.deepEqual(
result.map((c) => c.id),
["2"],
);
});
test("returns an empty array when nothing matches", () => {
const channels = [
buildChannel({ id: "1", name: "general" }),
@@ -2,15 +2,18 @@ import type { Channel } from "@/shared/api/types";
/**
* Channels whose name starts with this prefix are discovered as workstream
* board entries. There is no creator/ownership filter — any visible channel
* matching the prefix is included, regardless of who created or joined it.
* board entries. There is no creator/ownership filter — any visible,
* non-archived channel matching the prefix is included, regardless of who
* created or joined it.
*/
export const WORKSTREAM_CHANNEL_PREFIX = "loganj-ws-";
export function filterWorkstreamChannels(
channels: readonly Channel[],
): Channel[] {
return channels.filter((channel) =>
channel.name.startsWith(WORKSTREAM_CHANNEL_PREFIX),
return channels.filter(
(channel) =>
channel.name.startsWith(WORKSTREAM_CHANNEL_PREFIX) &&
channel.archivedAt === null,
);
}