Skip to content

Conversation

@vamsikrishnamathala
Copy link
Member

@vamsikrishnamathala vamsikrishnamathala commented Jan 12, 2026

Description

This update fixes the persistence issue for Projects sort_order.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

Test Scenarios

References

Summary by CodeRabbit

  • Bug Fixes
    • Improved project list ordering so sort preferences are now derived from the correct user-specific settings, producing more accurate and consistent project ordering in listings.

✏️ Tip: You can customize this high-level summary in your review settings.

@vamsikrishnamathala vamsikrishnamathala self-assigned this Jan 12, 2026
@vamsikrishnamathala vamsikrishnamathala added the 🐛bug Something isn't working label Jan 12, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 12, 2026

📝 Walkthrough

Walkthrough

The project list/list_detail views now derive sort_order from ProjectUserProperty instead of ProjectMember, changing the filter from member=self.request.user to user=self.request.user and removing the is_active=True condition; this alters which records are annotated for ordering.

Changes

Cohort / File(s) Summary
Project List View Sort Query
apps/api/plane/app/views/project/base.py
Replaced ProjectMember subquery with ProjectUserProperty; changed filter key from member=self.request.user to user=self.request.user; removed is_active=True from the subquery filters.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A query hops to new ground today,
ProjectUserProperty leads the way,
Sorting seeks a different light,
Active flags tucked out of sight—
New order bounces, soft and gay. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: fixing the project sort order issue, with specific reference to the ticket number [WEB-5899].
Description check ✅ Passed The description covers the main purpose (sort_order persistence fix) and includes the required Type of Change section, but lacks test scenarios, screenshots, and linked references.

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

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e609fc4 and b2585f0.

📒 Files selected for processing (1)
  • apps/api/plane/app/views/project/base.py
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: vamsikrishnamathala
Repo: makeplane/plane PR: 8530
File: apps/api/plane/app/views/project/base.py:139-143
Timestamp: 2026-01-12T10:11:42.184Z
Learning: In `apps/api/plane/app/views/project/base.py`, the `list()` method intentionally reads `sort_order` from `ProjectUserProperty` for the sidebar project list, while `get_queryset()` reads from `ProjectMember` for other endpoints. Sort order updates for the sidebar happen exclusively through the `ProjectUserDisplayPropertyEndpoint` at `/workspaces/<slug>/projects/<project_id>/user-properties/`, not through the general project update methods.
</add_learning>

<!-- <review_comment_addressed>
📚 Learning: 2026-01-12T10:11:42.184Z
Learnt from: vamsikrishnamathala
Repo: makeplane/plane PR: 8530
File: apps/api/plane/app/views/project/base.py:139-143
Timestamp: 2026-01-12T10:11:42.184Z
Learning: In `apps/api/plane/app/views/project/base.py`, the `list()` method intentionally reads `sort_order` from `ProjectUserProperty` for the sidebar project list, while `get_queryset()` reads from `ProjectMember` for other endpoints. Sort order updates for the sidebar happen exclusively through the `ProjectUserDisplayPropertyEndpoint` at `/workspaces/<slug>/projects/<project_id>/user-properties/`, not through the general project update methods.
</add_learning>

<!-- <review_comment_addressed>

Applied to files:

  • apps/api/plane/app/views/project/base.py
📚 Learning: 2025-12-23T14:18:32.899Z
Learnt from: dheeru0198
Repo: makeplane/plane PR: 8339
File: apps/api/plane/db/models/api.py:35-35
Timestamp: 2025-12-23T14:18:32.899Z
Learning: Django REST Framework rate limit strings are flexible: only the first character of the time unit matters. Acceptable formats include: "60/s", "60/sec", "60/second" (all equivalent), "60/m", "60/min", "60/minute" (all equivalent), "60/h", "60/hr", "60/hour" (all equivalent), and "60/d", "60/day" (all equivalent). Abbreviations like "min" are valid and do not need to be changed to "minute". Apply this guidance to any Python files in the project that configure DRF throttling rules.

Applied to files:

  • apps/api/plane/app/views/project/base.py
🧬 Code graph analysis (1)
apps/api/plane/app/views/project/base.py (1)
apps/api/plane/db/models/project.py (1)
  • ProjectUserProperty (336-367)
⏰ 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 (2)
apps/api/plane/app/views/project/base.py (2)

49-53: LGTM!

The change to read sort_order from ProjectUserProperty instead of ProjectMember aligns with where sort order updates are persisted (via ProjectUserDisplayPropertyEndpoint). The filter field change from member to user correctly matches the ProjectUserProperty model definition. Based on learnings, this is the correct data source for the sidebar project list.


138-142: LGTM!

This change is consistent with the get_queryset() modification and correctly reads sort_order from ProjectUserProperty where it is persisted. Based on learnings, this is the intended data source for the sidebar project list.


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.

@makeplane
Copy link

makeplane bot commented Jan 12, 2026

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

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 (2)
apps/api/plane/app/views/project/base.py (2)

48-54: Update get_queryset() to use ProjectUserProperty for consistency.

This subquery still uses ProjectMember for sort_order, but the list() method (lines 139-143) now uses ProjectUserProperty. This inconsistency means list_detail() and retrieve() will return different sort orders than list().

Suggested fix to align with the `list()` method
     def get_queryset(self):
-        sort_order = ProjectMember.objects.filter(
-            member=self.request.user,
+        sort_order = ProjectUserProperty.objects.filter(
+            user=self.request.user,
             project_id=OuterRef("pk"),
             workspace__slug=self.kwargs.get("slug"),
-            is_active=True,
         ).values("sort_order")

456-477: Write path still targets ProjectMember, creating a data inconsistency.

This endpoint writes sort_order to ProjectMember (line 473), but the list() method now reads from ProjectUserProperty. User sort order changes won't be reflected in the project list.

Consider updating this to write to ProjectUserProperty instead, or verify that a separate mechanism syncs or writes to ProjectUserProperty.

🤖 Fix all issues with AI agents
In @apps/api/plane/app/views/project/base.py:
- Around line 139-143: list() currently reads sort_order from
ProjectUserProperty but get_queryset() and the update path
(ProjectUserViewsEndpoint.post()) still use ProjectMember, causing inconsistent
read/write behavior; change get_queryset() to annotate/query using
ProjectUserProperty (same OuterRef usage as in list()) so
list_detail()/retrieve() see the same sort_order, and modify
ProjectUserViewsEndpoint.post() to persist updates to
ProjectUserProperty.sort_order instead of ProjectMember (create or update the
ProjectUserProperty row for the user/project/workspace combination). Ensure you
reference and update the ProjectUserProperty model whenever reading or writing
sort_order so all endpoints use the same source of truth.
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8399f64 and e609fc4.

📒 Files selected for processing (1)
  • apps/api/plane/app/views/project/base.py
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-12-23T14:18:32.899Z
Learnt from: dheeru0198
Repo: makeplane/plane PR: 8339
File: apps/api/plane/db/models/api.py:35-35
Timestamp: 2025-12-23T14:18:32.899Z
Learning: Django REST Framework rate limit strings are flexible: only the first character of the time unit matters. Acceptable formats include: "60/s", "60/sec", "60/second" (all equivalent), "60/m", "60/min", "60/minute" (all equivalent), "60/h", "60/hr", "60/hour" (all equivalent), and "60/d", "60/day" (all equivalent). Abbreviations like "min" are valid and do not need to be changed to "minute". Apply this guidance to any Python files in the project that configure DRF throttling rules.

Applied to files:

  • apps/api/plane/app/views/project/base.py
🧬 Code graph analysis (1)
apps/api/plane/app/views/project/base.py (1)
apps/api/plane/db/models/project.py (1)
  • ProjectUserProperty (336-367)
⏰ 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). (4)
  • GitHub Check: check:types
  • GitHub Check: check:lint
  • GitHub Check: Lint API
  • GitHub Check: Analyze (javascript)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants