Skip to content

feat: rich filters + pql on work-item list endpoints, add listWorkspace [WEB-7393]#43

Open
dheeru0198 wants to merge 2 commits into
mainfrom
feat/web-7393-rich-filter-pql-workspace-workitems
Open

feat: rich filters + pql on work-item list endpoints, add listWorkspace [WEB-7393]#43
dheeru0198 wants to merge 2 commits into
mainfrom
feat/web-7393-rich-filter-pql-workspace-workitems

Conversation

@dheeru0198
Copy link
Copy Markdown
Member

Summary

Exposes the new external API's structured filtering capability across every work-item list method in the SDK, plus a new listWorkspace method for the workspace-scoped paginated list endpoint added in makeplane/plane-ee#7376.

Changes

  • ListWorkItemsParams now accepts filters?: Record<string, unknown> (the existing pql?: string field is unchanged) plus the standard cursor / per_page / order_by / fields / expand fields. AdvancedSearchWorkItem also gains an optional pql?: string.
  • New prepareWorkItemParams(params) helper (exported from WorkItems/index.ts) JSON-encodes filters into the single filters= query parameter the API expects; everything else passes through unchanged.
  • New WorkItems.listWorkspace(workspaceSlug, params) calling GET /workspaces/<slug>/work-items/. Returns a paginated envelope with full total_results; spans every project in the workspace the caller can view (per-project authorization and conditional grants are honored server-side).
  • WorkItems.list, Cycles.listWorkItemsInCycle, and Modules.listWorkItemsInModule route through the helper. The latter two had params?: any previously — now properly typed as ListWorkItemsParams.
  • Real-API tests for filters on list and listWorkspace (real-API pattern, matches existing test conventions).
  • README: new "Filtering work items" section with TypeScript examples.
  • Version bump 0.2.11 → 0.2.12.

Backend

Test plan

  • pnpm install + pnpm build — succeeds
  • pnpm check:lint — 0 errors (105 pre-existing warnings unrelated)
  • pnpm check:format — clean (auto-formatted)
  • Real-API run: configure .env.test against an env with the plane-ee branch deployed; pnpm test -- --testPathPattern=tests/unit/work-items should pass the new list_workspace_work_items_with_filters test plus the structured-filters test.

References

  • Work item: WEB-7393

🤖 Generated with Claude Code

Expose the new external API's structured filtering capability on every
work-item list method in the SDK.

- ListWorkItemsParams now accepts `filters?: Record<string, unknown>`
  (the existing `pql?: string` field is unchanged) plus the standard
  pagination/ordering fields. AdvancedSearchWorkItem also gains `pql`.
- New `prepareWorkItemParams` helper JSON-encodes `filters` into the
  `filters=` query parameter the API expects; everything else passes
  through unchanged.
- New `WorkItems.listWorkspace(workspaceSlug, params)` calling
  GET /workspaces/<slug>/work-items/ — paginated, total_results,
  spans every project the caller can view.
- `WorkItems.list`, `Cycles.listWorkItemsInCycle`, and
  `Modules.listWorkItemsInModule` route through the helper. Typed the
  `params` argument on the latter two (was previously `any`).
- Real-API tests for `filters` on `list` and `listWorkspace`.
- Bump version to 0.2.12.

Backend: makeplane/plane-ee#7376
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

Warning

Review limit reached

@dheeru0198, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 32 minutes and 13 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 60f4616b-a4cc-4006-90c6-1668e36a61ff

📥 Commits

Reviewing files that changed from the base of the PR and between b5534e8 and 7225a96.

📒 Files selected for processing (7)
  • README.md
  • package.json
  • src/api/Cycles.ts
  • src/api/Modules.ts
  • src/api/WorkItems/index.ts
  • src/models/WorkItem.ts
  • tests/unit/work-items/work-items.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/web-7393-rich-filter-pql-workspace-workitems

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@makeplane
Copy link
Copy Markdown

makeplane Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds SDK support for Plane’s newer work-item list filtering features (structured filters + existing pql) across project, cycle, and module list endpoints, and introduces a new workspace-scoped work-item listing method to match the backend’s new endpoint.

Changes:

  • Extend ListWorkItemsParams to include filters plus cursor/pagination/sorting fields; add optional pql to AdvancedSearchWorkItem.
  • Add prepareWorkItemParams() to JSON-encode filters into the filters= query parameter, and route work-item list endpoints through it.
  • Add workItems.listWorkspace(...) and update docs/tests + bump package version to 0.2.12.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/unit/work-items/work-items.test.ts Adds real-API tests for structured filters and the new workspace-scoped list endpoint.
src/models/WorkItem.ts Updates list/search parameter types to include filters, pql, and pagination/sorting fields.
src/api/WorkItems/index.ts Adds prepareWorkItemParams, wires it into list endpoints, and introduces listWorkspace.
src/api/Modules.ts Types module work-item listing params as ListWorkItemsParams and routes through the helper.
src/api/Cycles.ts Types cycle work-item listing params as ListWorkItemsParams and routes through the helper.
README.md Documents how to use filters and pql, including workspace-scoped listing.
package.json Bumps SDK version to 0.2.12.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +131 to +139
const filtered = await client.workItems.list(workspaceSlug, projectId, {
filters: { priority: "urgent" },
});

expect(filtered).toBeDefined();
expect(Array.isArray(filtered.results)).toBe(true);
const ids = filtered.results.map((wi) => wi.id);
expect(ids).toContain(urgent.id);
expect(ids).not.toContain(low.id);
Comment on lines +166 to +176
const unfiltered = await client.workItems.listWorkspace(workspaceSlug);
expect(unfiltered).toBeDefined();
expect(typeof unfiltered.total_results).toBe("number");

const filtered = await client.workItems.listWorkspace(workspaceSlug, {
filters: { priority: "urgent" },
});
expect(filtered).toBeDefined();
expect(filtered.total_results).toBeLessThanOrEqual(unfiltered.total_results);
expect(filtered.total_results).toBeGreaterThan(0);
} finally {
Comment thread src/models/WorkItem.ts Outdated
fields?: string;
expand?: string;
/**
* Plane Query Language expression for structured filtering.
Address Copilot review:

- `list with structured filters` test could be flaky: the just-created
  urgent item might land on a later page in busy workspaces, breaking
  `expect(ids).toContain(urgent.id)`. Add `order_by: "-created_at"` and
  `per_page: 100`, and also assert that every returned item has
  `priority === "urgent"` — that's the property the test is meant to
  prove regardless of pagination luck.
- `listWorkspace` filters test could pass even when filtering was
  ignored (it only checked `total_results` bounds). Add the same
  per-item `priority === "urgent"` assertion plus the same pagination
  flags.
- `pql` docstring in `WorkItem.ts` said "expression for structured
  filtering", which is misleading — `filters` is structured, `pql` is
  string-based. Reword.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants