Skip to content

Commit 9d724ca

Browse files
adamleithpclaude
andcommitted
test(channels): lift taskChannel factory, note getTasks 500 cap
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 95c3826 commit 9d724ca

2 files changed

Lines changed: 12 additions & 16 deletions

File tree

packages/ui/src/features/canvas/hooks/useChannels.test.tsx

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ function folder(id: string, path: string): Schemas.FileSystem {
3333
};
3434
}
3535

36+
function taskChannel(
37+
id: string,
38+
name: string,
39+
channel_type: TaskChannel["channel_type"] = "public",
40+
): TaskChannel {
41+
return { id, name, channel_type, created_at: "2026-01-01T00:00:00Z" };
42+
}
43+
3644
let queryClient: QueryClient;
3745
function wrapper({ children }: { children: ReactNode }) {
3846
return (
@@ -109,14 +117,6 @@ describe("useChannelMutations", () => {
109117
});
110118

111119
describe("useChannelMutations rename", () => {
112-
function taskChannel(
113-
id: string,
114-
name: string,
115-
channel_type: TaskChannel["channel_type"] = "public",
116-
): TaskChannel {
117-
return { id, name, channel_type, created_at: "2026-01-01T00:00:00Z" };
118-
}
119-
120120
beforeEach(() => {
121121
vi.clearAllMocks();
122122
queryClient = new QueryClient({
@@ -219,14 +219,6 @@ describe("useChannelMutations rename", () => {
219219
});
220220

221221
describe("useChannelMutations delete", () => {
222-
function taskChannel(
223-
id: string,
224-
name: string,
225-
channel_type: TaskChannel["channel_type"] = "public",
226-
): TaskChannel {
227-
return { id, name, channel_type, created_at: "2026-01-01T00:00:00Z" };
228-
}
229-
230222
beforeEach(() => {
231223
vi.clearAllMocks();
232224
queryClient = new QueryClient({

packages/ui/src/features/canvas/hooks/useChannels.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ export function useChannelMutations() {
120120
(c) => c.channel_type === "public" && c.name === normalized,
121121
);
122122
if (backendChannel) {
123+
// getTasks caps at 500 and does not paginate, so a channel with more
124+
// than 500 tasks soft-deletes only the first page here. The channel
125+
// itself is still soft-deleted below, so any stragglers stay attached
126+
// to it and remain recoverable — nothing is lost, just left behind.
123127
const tasks = await client.getTasks({ channel: backendChannel.id });
124128
// Best-effort per task — one failed soft delete shouldn't strand
125129
// the rest or block the channel delete (the failed task stays

0 commit comments

Comments
 (0)