Skip to content

Conversation

@sriramveeraghanta
Copy link
Member

@sriramveeraghanta sriramveeraghanta commented Sep 29, 2025

Description

  • Added new work item endpoints for issues. Adding deprecation comment for the old urls.

Type of Change

  • Improvement (change that would cause existing functionality to not work as expected)

Summary by CodeRabbit

  • New Features

    • Added project label endpoints for listing/creating and viewing/updating/deleting labels.
  • Changes

    • Consolidated and reorganized work-item routes and API route grouping for projects and states.
  • Deprecations

    • Legacy issue routes deprecated in favor of new work-item routes but remain available for compatibility.

Copilot AI review requested due to automatic review settings September 29, 2025 15:58
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 29, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Replaces issue import with work_item and label imports, adds dedicated label routes, reorganizes root urlpatterns order to include project/state/module earlier, and preserves legacy work-item routes by concatenating old_url_patterns with new work-items routes.

Changes

Cohort / File(s) Summary
Root URL aggregation
apps/api/plane/api/urls/__init__.py
Replaces issue_patterns import with work_item_patterns and label_patterns; reorders and expands urlpatterns to include asset, cycle, intake, label, member, module, project, state, user, and work_item pattern groups.
Label routing
apps/api/plane/api/urls/label.py
Adds urlpatterns for label endpoints: workspaces/<str:slug>/projects/<uuid:project_id>/labels/LabelListCreateAPIEndpoint (GET, POST) and .../labels/<uuid:pk>/LabelDetailAPIEndpoint (GET, PATCH, DELETE).
Work item routing and legacy preservation
apps/api/plane/api/urls/work_item.py
Removes label view imports, introduces old_url_patterns (legacy endpoints) and new_url_patterns (new work-items-prefixed endpoints), and exports urlpatterns = old_url_patterns + new_url_patterns.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant C as Client
    participant R as Router (__init__.py)
    participant WI as work_item module
    participant L as label module
    participant V as View handlers

    rect rgb(242,244,248)
    note over R: Aggregates many pattern groups incl. work_item & label
    C->>R: GET /workspaces/{slug}/projects/{id}/work-items/...
    R->>WI: Match new or legacy work-item patterns
    WI->>V: Dispatch to work-item view
    V-->>C: Response
    end

    rect rgb(238,248,242)
    note over R: New label routes
    C->>R: GET /workspaces/{slug}/projects/{id}/labels/...
    R->>L: Match label patterns
    L->>V: Dispatch to label view
    V-->>C: Response
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • anmolsinghbhatia

Poem

A rabbit hopped through URL lanes, so spry,
I planted labels where endpoints lie.
Work-items march, old paths kept in store,
Routes rearranged, I twitch and explore.
A tiny hop — routing refreshed once more. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The description provides a brief summary and an unchecked “Improvement” box but omits required sections from the template—such as screenshots/media, test scenarios, and references—and does not correctly classify the change type, so it fails to align with the repository’s PR description template. Please complete the template by expanding the Description to cover all changes, selecting the appropriate change type checkbox (e.g., Feature), and adding Test Scenarios, References, and any applicable media to fully satisfy the repository’s PR description requirements.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Title Check ✅ Passed The title clearly identifies that the pull request updates the work_item URL definitions to support issues, which corresponds to the primary change of adding new issue-related endpoints and deprecating the old routes. It follows the team’s convention by including the Jira ticket and “feat:” prefix, making it recognizable in the commit history. Although it could be more precise about deprecation and naming conventions, it still directly relates to the main modifications in the URL configuration. Therefore, it adequately summarizes the key change.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat-issue-to-workitem-urls

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
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

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

Copy link
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

This PR introduces new URL patterns for work items as a replacement for the existing issue URLs, while maintaining backward compatibility. The changes rename "issues" to "work-items" in the URL paths and separate label endpoints into their own module.

  • Created new work-item URL patterns that mirror existing issue functionality
  • Separated label endpoints into dedicated label.py module
  • Maintained backward compatibility by combining old and new URL patterns

Reviewed Changes

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

File Description
apps/api/plane/api/urls/workitem.py Renamed from issue.py, added new work-item URL patterns and deprecated old issue patterns
apps/api/plane/api/urls/label.py New file containing label endpoints moved from workitem.py
apps/api/plane/api/urls/init.py Updated imports to use workitem patterns and added label patterns

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/api/plane/api/urls/workitem.py (1)

31-39: Add missing PUT upsert routes for IssueDetailAPIEndpoint
Insert the following before the existing list routes in apps/api/plane/api/urls/workitem.py (once in the “issues/” block at lines 31–39, and once in the “work-items/” block at lines 95–103):

 path(
     "workspaces/<str:slug>/projects/<uuid:project_id>/issues/",
+    IssueDetailAPIEndpoint.as_view(http_method_names=["put"]),
+    name="issue-upsert",
 ),
 path(
     "workspaces/<str:slug>/projects/<uuid:project_id>/issues/",
     IssueListCreateAPIEndpoint.as_view(http_method_names=["get", "post"]),
     name="issue",
 ),
 path(
     "workspaces/<str:slug>/projects/<uuid:project_id>/work-items/",
+    IssueDetailAPIEndpoint.as_view(http_method_names=["put"]),
+    name="workitem-upsert",
 ),
 path(
     "workspaces/<str:slug>/projects/<uuid:project_id>/work-items/",
     IssueListCreateAPIEndpoint.as_view(http_method_names=["get", "post"]),
     name="workitem",
 ),

This ensures the put method in IssueDetailAPIEndpoint is reachable.

🧹 Nitpick comments (3)
apps/api/plane/api/urls/workitem.py (1)

134-143: Consider simplifying attachment paths under work-items.

The segment "issue-attachments" under a "work-items" prefix is semantically mixed. If possible, add a new alias "attachments/" for the new routes while keeping the old ones for back-compat.

Example:

     path(
-        "workspaces/<str:slug>/projects/<uuid:project_id>/work-items/<uuid:issue_id>/issue-attachments/",
+        "workspaces/<str:slug>/projects/<uuid:project_id>/work-items/<uuid:issue_id>/attachments/",
         IssueAttachmentListCreateAPIEndpoint.as_view(http_method_names=["get", "post"]),
-        name="workitem-attachment",
+        name="workitem-attachment",
     ),
     path(
-        "workspaces/<str:slug>/projects/<uuid:project_id>/work-items/<uuid:issue_id>/issue-attachments/<uuid:pk>/",
+        "workspaces/<str:slug>/projects/<uuid:project_id>/work-items/<uuid:issue_id>/attachments/<uuid:pk>/",
         IssueAttachmentDetailAPIEndpoint.as_view(http_method_names=["get", "patch", "delete"]),
-        name="workitem-attachment-detail",
+        name="workitem-attachment-detail",
     ),
apps/api/plane/api/urls/__init__.py (1)

22-22: If you keep duplicate names between old/new, consider ordering.

Placing workitem_patterns before deprecated ones will make reverse() prefer new paths.

Apply:

 urlpatterns = [
     *asset_patterns,
     *project_patterns,
     *state_patterns,
-    *workitem_patterns,
+    *workitem_patterns,
     *cycle_patterns,
     *module_patterns,
     *intake_patterns,
     *member_patterns,
     *user_patterns,
     *label_patterns,
 ]

(If not handled within workitem.py via urlpatterns = new + old.)

apps/api/plane/api/urls/label.py (1)

6-17: Optional: disambiguate route names.

Both routes are named "label". Django can resolve based on provided kwargs, but unique names ("label-list", "label-detail") improve clarity and avoid future ambiguity.

 urlpatterns = [
     path(
         "workspaces/<str:slug>/projects/<uuid:project_id>/labels/",
         LabelListCreateAPIEndpoint.as_view(http_method_names=["get", "post"]),
-        name="label",
+        name="label-list",
     ),
     path(
         "workspaces/<str:slug>/projects/<uuid:project_id>/labels/<uuid:pk>/",
         LabelDetailAPIEndpoint.as_view(http_method_names=["get", "patch", "delete"]),
-        name="label",
+        name="label-detail",
     ),
 ]
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ded3678 and af47785.

📒 Files selected for processing (3)
  • apps/api/plane/api/urls/__init__.py (1 hunks)
  • apps/api/plane/api/urls/label.py (1 hunks)
  • apps/api/plane/api/urls/workitem.py (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
apps/api/plane/api/urls/label.py (1)
apps/api/plane/api/views/issue.py (2)
  • LabelListCreateAPIEndpoint (801-924)
  • LabelDetailAPIEndpoint (927-1033)
apps/api/plane/api/urls/workitem.py (1)
apps/api/plane/api/views/issue.py (11)
  • WorkspaceIssueAPIEndpoint (161-235)
  • IssueListCreateAPIEndpoint (238-481)
  • IssueDetailAPIEndpoint (484-798)
  • IssueLinkListCreateAPIEndpoint (1036-1137)
  • IssueLinkDetailAPIEndpoint (1140-1280)
  • IssueCommentListCreateAPIEndpoint (1283-1436)
  • IssueCommentDetailAPIEndpoint (1439-1608)
  • IssueActivityListAPIEndpoint (1611-1660)
  • IssueActivityDetailAPIEndpoint (1663-1715)
  • IssueAttachmentListCreateAPIEndpoint (1718-1930)
  • IssueAttachmentDetailAPIEndpoint (1933-2134)
🔇 Additional comments (1)
apps/api/plane/api/urls/__init__.py (1)

3-3: Aggregation update looks correct.

Switching to workitem_patterns and appending label_patterns is consistent with the routing refactor. No issues spotted.

Also applies to: 16-16

Copy link
Contributor

@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: 0

🧹 Nitpick comments (1)
apps/api/plane/api/urls/work_item.py (1)

135-142: Clarify attachment route naming for the new work-item API.
The new work-item endpoints still expose issue-attachments/ in the path, which contradicts the “work-items” terminology you’re introducing and can confuse clients consuming the refreshed API surface. Keeping issue-attachments available via the deprecated block is great for backward compatibility, but the new block should present the updated naming so consumers aren’t stuck with legacy terminology.

Apply this diff to align the new routes with the work-item vocabulary:

@@
-        "workspaces/<str:slug>/projects/<uuid:project_id>/work-items/<uuid:issue_id>/issue-attachments/",
+        "workspaces/<str:slug>/projects/<uuid:project_id>/work-items/<uuid:issue_id>/attachments/",
@@
-        "workspaces/<str:slug>/projects/<uuid:project_id>/work-items/<uuid:issue_id>/issue-attachments/<uuid:pk>/",
+        "workspaces/<str:slug>/projects/<uuid:project_id>/work-items/<uuid:issue_id>/attachments/<uuid:pk>/",
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d6a97fe and b493888.

📒 Files selected for processing (2)
  • apps/api/plane/api/urls/__init__.py (1 hunks)
  • apps/api/plane/api/urls/work_item.py (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
apps/api/plane/api/urls/work_item.py (1)
apps/api/plane/api/views/issue.py (11)
  • WorkspaceIssueAPIEndpoint (161-235)
  • IssueListCreateAPIEndpoint (238-481)
  • IssueDetailAPIEndpoint (484-798)
  • IssueLinkListCreateAPIEndpoint (1036-1137)
  • IssueLinkDetailAPIEndpoint (1140-1280)
  • IssueCommentListCreateAPIEndpoint (1283-1436)
  • IssueCommentDetailAPIEndpoint (1439-1608)
  • IssueActivityListAPIEndpoint (1611-1660)
  • IssueActivityDetailAPIEndpoint (1663-1715)
  • IssueAttachmentListCreateAPIEndpoint (1718-1930)
  • IssueAttachmentDetailAPIEndpoint (1933-2134)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript)

Copy link
Contributor

@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: 0

🧹 Nitpick comments (1)
apps/api/plane/api/urls/__init__.py (1)

12-23: Surface deprecation explicitly (headers + docs + tests).

Recommend:

  • Add Deprecation and optional Sunset headers on legacy endpoints.
  • Document migration in API docs/SDKs; note removal date.
  • Add tests ensuring old routes resolve/redirect and names still reverse.

Minimal inline note to prevent future reorder regressions:

 urlpatterns = [
-    *asset_patterns,
+    # NOTE: URL order is significant—keep specific sub-resources ahead of any generic catch-alls.
+    *asset_patterns,
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b493888 and 5e2678f.

📒 Files selected for processing (1)
  • apps/api/plane/api/urls/__init__.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (3)
apps/api/plane/api/urls/__init__.py (3)

4-4: LGTM: label routes inclusion.

Bringing label_patterns in and aggregating them here looks good.

Also applies to: 16-16


6-8: No generic or catch-all URL patterns detected; route order change is safe.

Verified that the project, state, and module URL modules contain no <path:…> converters or wildcard * in re_path, so moving their groups earlier poses no shadowing risk.


10-10: Backward compatibility confirmed: legacy issue URLs remain available. old_url_patterns in work_item.py (with names like “issue”, “issue-search”, etc.) are merged into work_item_patterns and included in init.py’s urlpatterns, so all /issues/* routes and URL names continue to resolve.

@sriramveeraghanta sriramveeraghanta marked this pull request as draft September 29, 2025 19:58
@sriramveeraghanta sriramveeraghanta marked this pull request as ready for review September 29, 2025 20:25
@sriramveeraghanta sriramveeraghanta changed the title feat: updated work item urls with issues. [WEB-5050] feat: updated work item urls with issues. Sep 30, 2025
@makeplane
Copy link

makeplane bot commented Sep 30, 2025

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

@dheeru0198 dheeru0198 merged commit 992457e into preview Sep 30, 2025
7 checks passed
@dheeru0198 dheeru0198 deleted the feat-issue-to-workitem-urls branch September 30, 2025 12:17
zy1000 pushed a commit to zy1000/plane that referenced this pull request Oct 1, 2025
* feat: updated work item urls with issues.

* chore: updated urls names

* chore: rename file

* chore: code refactor for url ordering

* fix: renamed issue-atachments to attachments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants