Skip to content

fix(workitems): filter work items by state in the GitLab query - #611

Merged
polaz merged 1 commit into
mainfrom
fix/#610-workitems-state-filter
Sep 24, 2026
Merged

polaz merged 1 commit into
mainfrom
fix/#610-workitems-state-filter

Conversation

@polaz

@polaz polaz commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Summary

browse_work_items list filtered by state after GitLab had paginated the unfiltered list. Closed items newer than an open one pushed it off the page, so a page could come back empty or short while hasMore was true, and hasMore described the unfiltered list.

  • The namespace, project and group listing queries pass state (IssuableState): OPEN maps to opened, CLOSED to closed, both to no filter.
  • The client-side state filter is removed; each page and its hasMore now describe the requested states only.
  • An empty state list still matches nothing, now without a request to GitLab.

Testing

Lint, unit tests and the integration suite against a live GitLab instance. The new integration test lists open items when two newer items are closed and checks the open one is on the first page.

Closes #610

Summary by CodeRabbit

  • New Features
    • Work item listings now support filtering by open or closed status across namespaces, projects, and groups.
    • Status filtering is applied before pagination, helping ensure listed results and page counts reflect the selected status.
    • Selecting both statuses continues to show work items in either state; selecting no statuses returns no results.

browse_work_items list filtered by state after GitLab had paginated the
unfiltered list, so closed items newer than an open one pushed it off the
page: a page came back empty or short while hasMore was true, and hasMore
described the unfiltered list. The namespace, project and group listing
queries now pass state (IssuableState: opened/closed, no filter for both) and
the client-side filter is gone; an empty state list matches nothing without a
request.

Closes #610
@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: structured-world/gitlab-mcp/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: ef439406-693a-4dd3-8f82-b1c7a4e95574

📥 Commits

Reviewing files that changed from the base of the PR and between 8885c54 and ac4463d.

📒 Files selected for processing (5)
  • packages/gitlab-mcp/src/entities/workitems/registry.ts
  • packages/gitlab-mcp/src/graphql/workItems.ts
  • packages/gitlab-mcp/tests/integration/workitems.test.ts
  • packages/gitlab-mcp/tests/unit/entities/workitems/registry.test.ts
  • packages/gitlab-mcp/tests/unit/entities/workitems/schema-fallbacks.test.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Work item listing now passes supported state filters to GitLab before pagination. The browse handler maps OPEN and CLOSED to GitLab state values, omits the filter when both are requested, and returns an empty result without a GitLab request for an empty state list.

Changes

Work item state filtering

Layer / File(s) Summary
Add state filters to work item queries
packages/gitlab-mcp/src/graphql/workItems.ts
The namespace, project, and group queries accept an optional state argument typed as opened or closed.
Map browse states and verify filtered pagination
packages/gitlab-mcp/src/entities/workitems/registry.ts, packages/gitlab-mcp/tests/unit/entities/workitems/*, packages/gitlab-mcp/tests/integration/workitems.test.ts
The browse handler maps requested states to GitLab values and removes client-side state filtering. Unit, fallback, and integration tests cover state mapping, empty-state handling, and filtered page results.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant browse_work_items
  participant WorkItemListQuery
  participant GitLabGraphQL
  browse_work_items->>WorkItemListQuery: Pass mapped state and pagination variables
  WorkItemListQuery->>GitLabGraphQL: Request work items
  GitLabGraphQL-->>WorkItemListQuery: Return filtered items and page information
  WorkItemListQuery-->>browse_work_items: Return filtered page
Loading

Merge Risk: ⚪ Minimal · up to ac446

Work item listings apply the requested state before pagination. No identified issue needs resolution before merging.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: applying work item state filtering in the GitLab query.
Linked Issues check ✅ Passed The PR meets the coding requirements in issue #610. registry.ts maps OPEN to opened, CLOSED to closed, omits the filter for both states, and returns an empty result without a request for an …
Out of Scope Changes check ✅ Passed The changed source and test files support issue #610. The GraphQL changes implement server-side state filtering. The registry changes implement state mapping, short-circuiting, fallback propagation, a…
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 5 files.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-24T19:02:38.094246Z ac4463d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Sep 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ages/gitlab-mcp/src/entities/workitems/registry.ts 85.71% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@polaz
polaz merged commit fee03e5 into main Sep 24, 2026
17 of 18 checks passed
@polaz
polaz deleted the fix/#610-workitems-state-filter branch September 24, 2026 19:41
@sw-release-bot sw-release-bot Bot mentioned this pull request Sep 24, 2026
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.

fix(workitems): filter work items by state server-side instead of after pagination

1 participant