Skip to content

search/export: unbounded N+1 workspace crawl with silent truncation; adopt Get Filtered Team Tasks #25

Description

@timimsms

Context

cu task search and cu export implement workspace-wide task retrieval as an unbounded N+1 crawl: enumerate workspace → spaces → folders → lists, then call GetTasks per list and match client-side. Under the 100 req/min rate limiter this is slow for any real workspace, and because only page 0 is fetched per list, results are silently incomplete for lists with more than ~100 tasks.

Evidence

  • internal/cmd/task.go:534-579 — search walks GetSpaces → GetFolders → GetLists → GetTasks(ctx, list.ID, &api.TaskQueryOptions{}) per list with no pagination (page 0 only) and filters client-side.
  • internal/cmd/export.go:112-123 — same crawl, and it swallows errors: folders, _ := client.GetFolders(ctx, space.ID) and lists, _ := client.GetLists(ctx, folder.ID), so an export can silently omit whole subtrees.
  • The ClickUp API rate limit (100 req/min) makes the per-list fan-out both slow and quota-hungry.

Suggested fix

Adopt the server-side endpoint GET /team/{team_id}/task (Get Filtered Team Tasks), which supports workspace-scoped filtering and pagination, and page through results until exhaustion. In export.go, stop discarding GetFolders/GetLists errors — at minimum surface them as warnings so exports are not silently partial.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions