-
Notifications
You must be signed in to change notification settings - Fork 4
[SILO-934] feat: add advanced search endpoint for work items #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
276ec1b to
3ff7bb8
Compare
|
Linked to Plane Work Item(s) This comment was auto-generated by Plane |
📝 WalkthroughWalkthroughAdds an advanced search API to WorkItems, new request/response types in WorkItem model, repository documentation (CLAUDE.md), increased Jest timeout, and new unit and e2e tests covering query and nested filter scenarios. Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Client
participant API as WorkItems API
participant Server as Server
participant DB as Database
Client->>API: advancedSearch(workspaceSlug, { query, filters, limit })
API->>Server: POST /workspaces/{workspaceSlug}/work-items/advanced-search/
Server->>DB: execute query with nested AND/OR filters
DB-->>Server: matching work items
Server-->>API: AdvancedSearchResult[]
API-->>Client: AdvancedSearchResult[] (id, name, sequence_id, project_id, workspace_id, ...)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
3ff7bb8 to
1715393
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@tests/e2e/project.test.ts`:
- Around line 100-115: The E2E test using client.workItems.advancedSearch is
flaky because indexing can lag; update the test to retry the advancedSearch call
(using e2eConfig.workspaceSlug and query: workItem1.name) with a short
exponential/backoff (e.g., sleep 500ms then increase) for a bounded number of
attempts (e.g., 5–10) until results.length > 0 or timeout, then run the existing
assertions against the found item (workItem1.id, .name, .sequence_id,
.project_id, .workspace_id); ensure the retry loop fails the test if no results
after max attempts to preserve test correctness.
In `@tests/unit/work-items/work-items.test.ts`:
- Line 2: The import list in the test file imports AdvancedSearchResult but it
is unused; edit the import statement that currently reads "import { WorkItem,
AdvancedSearchResult } from \"../../../src/models/WorkItem\";" and remove
AdvancedSearchResult so only WorkItem is imported, ensuring ESLint unused-import
errors are resolved.
🧹 Nitpick comments (1)
CLAUDE.md (1)
28-28: Rephrase repeated “Tests …” sentence starters for readability.Minor style tweak to improve flow.
✏️ Suggested rewording
-Tests live in `tests/unit/` and `tests/e2e/`. Tests require a `.env.test` file (copy from `env.example`) with real workspace/project IDs. Tests run sequentially (`maxWorkers: 1`) to avoid API rate limits. Jest uses `tsconfig.jest.json` via ts-jest. +Tests live in `tests/unit/` and `tests/e2e/`. A `.env.test` file (copy from `env.example`) with real workspace/project IDs is required. They run sequentially (`maxWorkers: 1`) to avoid API rate limits. Jest uses `tsconfig.jest.json` via ts-jest.
| @@ -1,5 +1,5 @@ | |||
| import { PlaneClient } from "../../../src/client/plane-client"; | |||
| import { WorkItem } from "../../../src/models/WorkItem"; | |||
| import { WorkItem, AdvancedSearchResult } from "../../../src/models/WorkItem"; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused AdvancedSearchResult import to satisfy lint.
ESLint flags this as unused.
🧹 Suggested fix
-import { WorkItem, AdvancedSearchResult } from "../../../src/models/WorkItem";
+import { WorkItem } from "../../../src/models/WorkItem";📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import { WorkItem, AdvancedSearchResult } from "../../../src/models/WorkItem"; | |
| import { WorkItem } from "../../../src/models/WorkItem"; |
🧰 Tools
🪛 ESLint
[error] 2-2: 'AdvancedSearchResult' is defined but never used.
(unused-imports/no-unused-imports)
🤖 Prompt for AI Agents
In `@tests/unit/work-items/work-items.test.ts` at line 2, The import list in the
test file imports AdvancedSearchResult but it is unused; edit the import
statement that currently reads "import { WorkItem, AdvancedSearchResult } from
\"../../../src/models/WorkItem\";" and remove AdvancedSearchResult so only
WorkItem is imported, ensuring ESLint unused-import errors are resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@tests/unit/work-items/work-items.test.ts`:
- Around line 123-131: The test calls client.workItems.advancedSearch with
filters using workItem.priority which can be undefined; update the test to guard
against that by supplying an explicit fallback before calling advancedSearch
(e.g. const priority = workItem.priority ?? '<desired-default>' and use priority
in the filter) so the filter never contains undefined; modify the call to
client.workItems.advancedSearch(workspaceSlug, { filters: { and: [ { priority }
] }, limit: 10 }) to reference the guarded variable.
1715393 to
a428480
Compare
Add POST /work-items/advanced-search/ supporting text queries and recursive AND/OR filter groups, with unit and e2e tests. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
a428480 to
f3321c1
Compare
Description
Type of Change
Test Scenarios
References
SILO-934
Summary by CodeRabbit
New Features
Documentation
Tests
Chores