[SILO-1158] chore: add context for project in relations API#8860
[SILO-1158] chore: add context for project in relations API#8860Saurabhkmr98 wants to merge 2 commits intopreviewfrom
Conversation
|
Linked to Plane Work Item(s) This comment was auto-generated by Plane |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe issue relations aggregation was moved from DB-level array aggregation to manual per-relation iteration with deduplication. The API response shape for relations changed from UUID lists to objects with Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/api/plane/api/views/issue.py`:
- Around line 2291-2323: The API changed: list_work_item_relations now returns
relation refs ({project_id, issue_id}) but the serializer and web consumer still
expect flat UUID lists and issue objects; update
apps/api/plane/api/serializers/issue.py to document the new shape (replace the
ListField(UUIDField()) relation fields with a ListField of a dict/nested
serializer containing "project_id" and "issue_id") so the OpenAPI contract
matches list_work_item_relations, and update the consumer in
apps/web/core/store/issue/issue-details/relation.store.ts (the code that
currently iterates and calls addIssue(item) around lines 115-133) to either
extract and pass the correct issue id (item.issue_id) to addIssue or adapt
addIssue to accept the {project_id, issue_id} ref; make the serializer and the
web store consistent with list_work_item_relations across all relation fields
(blocking, blocked_by, duplicate, relates_to, start_after, start_before,
finish_after, finish_before).
🪄 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: 6bf17114-9b1c-4ece-bb20-9e3d7d964eb0
📒 Files selected for processing (1)
apps/api/plane/api/views/issue.py
| "blocking": [ | ||
| "550e8400-e29b-41d4-a716-446655440000", | ||
| "550e8400-e29b-41d4-a716-446655440001", | ||
| { | ||
| "project_id": "550e8400-e29b-41d4-a716-446655440010", | ||
| "issue_id": "550e8400-e29b-41d4-a716-446655440000", | ||
| }, | ||
| { | ||
| "project_id": "550e8400-e29b-41d4-a716-446655440010", | ||
| "issue_id": "550e8400-e29b-41d4-a716-446655440001", | ||
| }, | ||
| ], | ||
| "blocked_by": [ | ||
| { | ||
| "project_id": "550e8400-e29b-41d4-a716-446655440011", | ||
| "issue_id": "550e8400-e29b-41d4-a716-446655440002", | ||
| }, | ||
| ], | ||
| "blocked_by": ["550e8400-e29b-41d4-a716-446655440002"], | ||
| "duplicate": [], | ||
| "relates_to": ["550e8400-e29b-41d4-a716-446655440003"], | ||
| "relates_to": [ | ||
| { | ||
| "project_id": "550e8400-e29b-41d4-a716-446655440010", | ||
| "issue_id": "550e8400-e29b-41d4-a716-446655440003", | ||
| }, | ||
| ], | ||
| "start_after": [], | ||
| "start_before": ["550e8400-e29b-41d4-a716-446655440004"], | ||
| "start_before": [ | ||
| { | ||
| "project_id": "550e8400-e29b-41d4-a716-446655440012", | ||
| "issue_id": "550e8400-e29b-41d4-a716-446655440004", | ||
| }, | ||
| ], | ||
| "finish_after": [], | ||
| "finish_before": [], | ||
| }, |
There was a problem hiding this comment.
Propagate this response-shape change end-to-end.
list_work_item_relations now returns relation refs ({project_id, issue_id}), but apps/api/plane/api/serializers/issue.py still documents these fields as ListField(UUIDField()), and apps/web/core/store/issue/issue-details/relation.store.ts:115-133 still consumes issue.id and passes each item into addIssue(). As-is, this ships the wrong OpenAPI contract and will break the current relations UI unless the web consumer/service is updated in the same PR or the old id-based shape is preserved.
Also applies to: 2337-2413
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/api/plane/api/views/issue.py` around lines 2291 - 2323, The API changed:
list_work_item_relations now returns relation refs ({project_id, issue_id}) but
the serializer and web consumer still expect flat UUID lists and issue objects;
update apps/api/plane/api/serializers/issue.py to document the new shape
(replace the ListField(UUIDField()) relation fields with a ListField of a
dict/nested serializer containing "project_id" and "issue_id") so the OpenAPI
contract matches list_work_item_relations, and update the consumer in
apps/web/core/store/issue/issue-details/relation.store.ts (the code that
currently iterates and calls addIssue(item) around lines 115-133) to either
extract and pass the correct issue id (item.issue_id) to addIssue or adapt
addIssue to accept the {project_id, issue_id} ref; make the serializer and the
web store consistent with list_work_item_relations across all relation fields
(blocking, blocked_by, duplicate, relates_to, start_after, start_before,
finish_after, finish_before).
Description
GETendpoint to return{project_id, issue_id}objects instead of flat UUID arrays, enabling consumers to identify which project each related work item belongs to.aggregate+ArrayAggquery with a.values()query that fetches each relation row with its associated project IDs, then builds the response in Python with proper deduplication for symmetric relation types (duplicate,relates_to).ArrayAgg,ArrayField,Coalesce,UUIDField) and updated the OpenAPI example to reflect the new response shape.Response format change
Before:
{ "blocking": ["<issue_uuid>", "<issue_uuid>"], "blocked_by": ["<issue_uuid>"], ... }After:
{ "blocking": [ {"project_id": "<project_uuid>", "issue_id": "<issue_uuid>"}, {"project_id": "<project_uuid>", "issue_id": "<issue_uuid>"} ], "blocked_by": [ {"project_id": "<project_uuid>", "issue_id": "<issue_uuid>"} ], ... }Type of Change
Summary by CodeRabbit