fix: return 204 instead of 500 for repeated module-issue deletes - #9910
Conversation
- `module_issue.first()` returns None when the link is already gone, so reading `.module.name` raised AttributeError and the API returned 500. - Look up the link once with select_related, and return 204 without queuing an activity if it doesn't exist. - Add contract tests for deleting a missing link (204, no activity) and an existing link (removed, activity carries the module name).
|
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 configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe module–issue deletion endpoint now returns HTTP 204 when the association is missing. For an existing association, it uses the loaded module name in the deletion activity. Contract tests cover both cases. ChangesModule–issue deletion
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to Repeated deletion is expected to return 204 without creating activity. No merge-blocking risk is established; proceed with normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change makes repeated deletes succeed without creating a second activity. The existing access check and link scope remain in place, and no new security concern was established. Some downstream and failure behavior remains unverified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 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.
Copilot review overview
🟢 Approval recommended
The focused fix correctly addresses the failure and includes appropriate regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes idempotent module-issue deletion by returning 204 when the link no longer exists.
Changes:
- Reuses one related-object lookup and skips activity creation for missing links.
- Adds contract tests for existing and missing links.
| File | Description |
|---|---|
apps/api/plane/app/views/module/issue.py |
Handles repeated deletion safely. |
apps/api/plane/tests/contract/app/test_module_issue_destroy_app.py |
Covers deletion behavior and activity dispatch. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Description
Deleting a work item from a module when that link is already gone returned 500.
ModuleIssueViewSet.destroyreadmodule_issue.first().module.name, andfirst()isNoneon a repeated delete, which raisedAttributeError.select_related("module").module.activity.deletedactivity.Type of Change
Screenshots and Media (if applicable)
Test Scenarios
DELETE /api/workspaces/{slug}/projects/{project_id}/modules/{module_id}/issues/{issue_id}/when the work item is not in the module returns 204 and does not queue an activity.ModuleIssuerow, and the activity payload includes the module name.docker compose -f docker-compose-test.yml run --rm api-tests pytest plane/tests/contract/app/test_module_issue_destroy_app.pyReferences
🤖 Generated with Claude Code
Summary by CodeRabbit