feat: Add lite list endpoints, project role distribution, and cycle status filtering to the SDK#56
Conversation
📝 WalkthroughWalkthroughAdds lite-list query parameters, lite response models, client ChangesLite list endpoints
Workspace role distribution
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
@gurusainath Can we bump the SDK version |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
tests/unit/test_cycles.py (1)
39-48: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMake the
cycle_viewtest assert the filter behavior, not just the response shape.This still passes if
cycle_viewis never serialized, because it only checks envelope/types. Please assert the outgoing params through a stubbed request path, or add a result-level check that the returned cycles actually fit the"current"window.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/unit/test_cycles.py` around lines 39 - 48, The list_lite cycle_view test only verifies the response envelope and types, so it can pass even if the filter is ignored. Update test_list_lite_cycle_view to assert the actual behavior of CycleLiteListQueryParams(cycle_view="current") by stubbing or inspecting the request sent from client.cycles.list_lite, or by adding a stronger result assertion that every returned CycleLite falls within the current window. Use the existing test_list_lite_cycle_view and CycleLiteListQueryParams symbols to locate the test and make it fail when cycle_view is not serialized or honored.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@plane/api/cycles.py`:
- Around line 112-114: The Cycles API call in the get-lite path is missing the
required trailing slash, which can break routing in stricter setups. Update the
endpoint string used in the _get call within the cycles API method so it follows
the same trailing-slash convention as the other plane/api resources, keeping the
change localized to the cycles-lite request path.
In `@plane/api/modules.py`:
- Around line 106-108: The new lite endpoint in the `modules` API method is
missing the required trailing slash, which breaks the repo’s URL convention.
Update the request path in the `Modules` client method that calls `modules-lite`
so it ends with `/`, keeping it consistent with the other API endpoints and
avoiding redirect-dependent behavior.
In `@plane/api/workspaces.py`:
- Around line 58-69: Rename the new public method on WorkspacesAPI from
get_project_role_distribution to retrieve_project_role_distribution so it
matches the SDK’s CRUD-style naming convention. Update the _get call in that
method to use the trailing-slash endpoint literal
f"{workspace_slug}/project-role-distribution/" to align with the repository’s
API URL conventions. Keep the existing behavior and return type unchanged.
---
Nitpick comments:
In `@tests/unit/test_cycles.py`:
- Around line 39-48: The list_lite cycle_view test only verifies the response
envelope and types, so it can pass even if the filter is ignored. Update
test_list_lite_cycle_view to assert the actual behavior of
CycleLiteListQueryParams(cycle_view="current") by stubbing or inspecting the
request sent from client.cycles.list_lite, or by adding a stronger result
assertion that every returned CycleLite falls within the current window. Use the
existing test_list_lite_cycle_view and CycleLiteListQueryParams symbols to
locate the test and make it fail when cycle_view is not serialized or honored.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d2587688-19bd-46de-afea-944a50d42409
📒 Files selected for processing (13)
README.mdplane/api/cycles.pyplane/api/modules.pyplane/api/projects.pyplane/api/workspaces.pyplane/models/__init__.pyplane/models/enums.pyplane/models/projects.pyplane/models/query_params.pyplane/models/workspaces.pytests/unit/test_cycles.pytests/unit/test_projects.pytests/unit/test_workspaces.py
✅ Files skipped from review due to trivial changes (1)
- README.md
🚧 Files skipped from review as they are similar to previous changes (4)
- plane/api/projects.py
- plane/models/projects.py
- plane/models/init.py
- tests/unit/test_projects.py
| response = self._get( | ||
| f"{workspace_slug}/projects/{project_id}/modules-lite", | ||
| params=params.to_query_params() if params else None, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Add the trailing slash to the new lite endpoint path.
modules-lite is called without the terminal /, so this new resource method is off the repository's API URL convention and may rely on redirect behavior.
Suggested fix
- f"{workspace_slug}/projects/{project_id}/modules-lite",
+ f"{workspace_slug}/projects/{project_id}/modules-lite/",As per coding guidelines, plane/api/**/*.py: "All API endpoints should end with a trailing / and follow URL convention: {base_path}/api/v1{resource_base_path}/{endpoint}/".
📝 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.
| response = self._get( | |
| f"{workspace_slug}/projects/{project_id}/modules-lite", | |
| params=params.to_query_params() if params else None, | |
| response = self._get( | |
| f"{workspace_slug}/projects/{project_id}/modules-lite/", | |
| params=params.to_query_params() if params else None, |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@plane/api/modules.py` around lines 106 - 108, The new lite endpoint in the
`modules` API method is missing the required trailing slash, which breaks the
repo’s URL convention. Update the request path in the `Modules` client method
that calls `modules-lite` so it ends with `/`, keeping it consistent with the
other API endpoints and avoiding redirect-dependent behavior.
Source: Coding guidelines
| def get_project_role_distribution(self, workspace_slug: str) -> ProjectRoleDistribution: | ||
| """Get the distribution of project members by role across the workspace. | ||
|
|
||
| Aggregates member counts per role over all active (non-archived) | ||
| projects in the workspace. Both built-in roles (admin, contributor, | ||
| commenter, guest) and custom roles are included. | ||
|
|
||
| Args: | ||
| workspace_slug: The workspace slug identifier | ||
| """ | ||
| response = self._get(f"{workspace_slug}/project-role-distribution") | ||
| return ProjectRoleDistribution.model_validate(response) |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Align this new method with the SDK's API conventions.
This adds a new public get_* method and a slashless endpoint literal. Please rename it to retrieve_project_role_distribution and call f"{workspace_slug}/project-role-distribution/" so the new surface matches the repository conventions before it ships.
Suggested patch
- def get_project_role_distribution(self, workspace_slug: str) -> ProjectRoleDistribution:
+ def retrieve_project_role_distribution(self, workspace_slug: str) -> ProjectRoleDistribution:
"""Get the distribution of project members by role across the workspace.
@@
- response = self._get(f"{workspace_slug}/project-role-distribution")
+ response = self._get(f"{workspace_slug}/project-role-distribution/")
return ProjectRoleDistribution.model_validate(response)As per coding guidelines, plane/api/**/*.py resource methods follow CRUD verbs (create, retrieve, update, delete, list) and all API endpoints should end with a trailing /.
📝 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.
| def get_project_role_distribution(self, workspace_slug: str) -> ProjectRoleDistribution: | |
| """Get the distribution of project members by role across the workspace. | |
| Aggregates member counts per role over all active (non-archived) | |
| projects in the workspace. Both built-in roles (admin, contributor, | |
| commenter, guest) and custom roles are included. | |
| Args: | |
| workspace_slug: The workspace slug identifier | |
| """ | |
| response = self._get(f"{workspace_slug}/project-role-distribution") | |
| return ProjectRoleDistribution.model_validate(response) | |
| def retrieve_project_role_distribution(self, workspace_slug: str) -> ProjectRoleDistribution: | |
| """Get the distribution of project members by role across the workspace. | |
| Aggregates member counts per role over all active (non-archived) | |
| projects in the workspace. Both built-in roles (admin, contributor, | |
| commenter, guest) and custom roles are included. | |
| Args: | |
| workspace_slug: The workspace slug identifier | |
| """ | |
| response = self._get(f"{workspace_slug}/project-role-distribution/") | |
| return ProjectRoleDistribution.model_validate(response) |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@plane/api/workspaces.py` around lines 58 - 69, Rename the new public method
on WorkspacesAPI from get_project_role_distribution to
retrieve_project_role_distribution so it matches the SDK’s CRUD-style naming
convention. Update the _get call in that method to use the trailing-slash
endpoint literal f"{workspace_slug}/project-role-distribution/" to align with
the repository’s API URL conventions. Keep the existing behavior and return type
unchanged.
Source: Coding guidelines
…tion to send the status in list endpoint
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/unit/test_cycles.py (1)
50-67: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd one test for the deprecated
cycle_viewalias.These cases lock in the new
statuscontract, but the PR also promises backward compatibility. A small assertion usingCycleListQueryParams(cycle_view="current")would keep that deprecated path covered too.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/unit/test_cycles.py` around lines 50 - 67, Add a test covering the deprecated cycle_view alias so backward compatibility is locked in alongside the new status behavior. In test_cycles.py, extend the existing cycle list tests to call client.cycles.list with CycleListQueryParams(cycle_view="current") and assert it still returns the bare list/Cycle items, using the same client.cycles.list and CycleListQueryParams symbols to keep the legacy path covered.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tests/unit/test_cycles.py`:
- Around line 50-67: Add a test covering the deprecated cycle_view alias so
backward compatibility is locked in alongside the new status behavior. In
test_cycles.py, extend the existing cycle list tests to call client.cycles.list
with CycleListQueryParams(cycle_view="current") and assert it still returns the
bare list/Cycle items, using the same client.cycles.list and
CycleListQueryParams symbols to keep the legacy path covered.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 3d3c4a8e-a209-470e-bca5-a25e06f4355e
📒 Files selected for processing (6)
README.mdplane/api/cycles.pyplane/models/__init__.pyplane/models/enums.pyplane/models/query_params.pytests/unit/test_cycles.py
✅ Files skipped from review due to trivial changes (1)
- README.md
🚧 Files skipped from review as they are similar to previous changes (1)
- plane/models/init.py
Description
Added support for new SDK APIs to improve project, cycle, module, and workspace querying.
Changes
Lite List Endpoints
Added support for:
projects.list_lite()cycles.list_lite()modules.list_lite()These endpoints return lightweight, cursor-paginated responses for picker and lookup use cases.
Project Role Distribution
Added:
workspaces.get_project_role_distribution()This endpoint returns project member distribution across workspace roles.
Cycle Status Filtering
Added support for cycle status filtering using:
currentupcomingcompleteddraftincompleteAlso added support for the deprecated
cycle_viewalias on the full cycle list endpoint.SDK Updates
Test Scenarios