fix(api): allow re-adding an issue to a cycle after removing it#361
fix(api): allow re-adding an issue to a cycle after removing it#361cavidelizade wants to merge 1 commit into
Conversation
RemoveCycleIssue soft-deletes the link, but cycle_issues has a plain UNIQUE (cycle_id, issue_id) that ignores deleted_at, so a later AddCycleIssue collided with the surviving row and 500'd. The complete-cycle transfer hit the same wall when the target cycle previously held the issue. Add upsertCycleIssue, which revives the soft-deleted row instead of inserting a duplicate (mirrors how states and members already handle this), and route both AddCycleIssue and the transfer through it. Covered by a test that adds, removes and re-adds an issue. Closes Devlaner#334 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 2 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 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 |
Summary
Removing an issue from a cycle and then adding it back threw a 500, and the issue could never be re-added to that cycle.
Linked issues
Closes #334
Type of change
fix:)Surface
apps/api/)What changed
CycleIssuesoft-deletes, butcycle_issueshas a plainUNIQUE (cycle_id, issue_id)that ignoresdeleted_at, so a re-add collided with the surviving row. The complete-cycle transfer hit the same wall when the target cycle previously held the issue.Added
upsertCycleIssue, which revives the soft-deleted row instead of inserting a duplicate (the same approach states and workspace/project members already use), and routed bothAddCycleIssueand the transfer loop through it.Test plan
go build,go vet,go test ./...green, including the newTestCycleIssueReAddAfterRemove(add, remove, re-add)Why not a migration
Reviving on write fixes both future removes and any rows already soft-deleted, without a data migration and without changing the soft-delete semantics elsewhere.
AI assistance
Claude Code (Opus 4.8), commits carry aCo-Authored-By:trailer