Skip to content

Conversation

@Prashant-Surya
Copy link
Member

@Prashant-Surya Prashant-Surya commented Feb 3, 2026

Description

  • Add POST /work-items/advanced-search/ supporting text queries and recursive AND/OR filter groups
  • Add both unit and e2e tests for this

Type of Change

  • Feature (non-breaking change which adds functionality)

Test Scenarios

  • Verified through unit and e2e tests

References

SILO-934

Summary by CodeRabbit

  • New Features

    • Added advanced search for work items with query support and nested AND/OR filters.
  • Documentation

    • Added a new developer guidance document for the repository.
  • Tests

    • Added unit and end-to-end tests covering advanced search scenarios.
  • Chores

    • Increased test timeout to accommodate longer-running tests.

@makeplane
Copy link

makeplane bot commented Feb 3, 2026

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

@coderabbitai
Copy link

coderabbitai bot commented Feb 3, 2026

📝 Walkthrough

Walkthrough

Adds 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

Cohort / File(s) Summary
Documentation
CLAUDE.md
New repository guidance for using Claude Code: project overview, commands, testing setup, architecture patterns, and conventions.
API Layer
src/api/WorkItems/index.ts
Added advancedSearch(workspaceSlug: string, data: AdvancedSearchWorkItem): Promise<AdvancedSearchResult[]> which POSTs to /workspaces/{workspaceSlug}/work-items/advanced-search/.
Models & Types
src/models/WorkItem.ts
Added exported types: AdvancedSearchFilter (recursive AND/OR filter shape), AdvancedSearchWorkItem (query, filters, limit), and AdvancedSearchResult (id, name, sequence_id, project_identifier, project_id, workspace_id, optional metadata).
Tests (E2E & Unit)
tests/e2e/project.test.ts, tests/unit/work-items/work-items.test.ts
Added e2e and unit tests for advancedSearch: query-only, filter-based, and nested AND/OR filter cases with assertions on result arrays and required fields.
Test Config
jest.config.js
Increased testTimeout from 30000 to 60000.

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, ...)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Hopping through filters, query in paw,

I sniff for matches, nested ANDs I saw,
Returning items tidy and bright,
Tests run longer, everything's right,
A little hop, and the search is raw.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'add advanced search endpoint for work items' directly reflects the main change: adding a new POST endpoint for advanced search functionality with query and filter support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/advanced-search

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.

Copy link

@coderabbitai coderabbitai bot left a 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";
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

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.

Suggested change
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.

Copy link

@coderabbitai coderabbitai bot left a 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.

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>
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.

3 participants