[GIT-221] fix(cycle): guard against no end_date when archiving cycle#9200
[GIT-221] fix(cycle): guard against no end_date when archiving cycle#9200Rahulcheryala wants to merge 1 commit into
Conversation
|
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 (2)
📝 WalkthroughWalkthroughTwo cycle archive endpoints are updated to safely validate whether a cycle can be archived when its ChangesCycle Archive End Date Validation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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 |
|
Linked to Plane Work Item(s) This comment was auto-generated by Plane |
Description
Archiving a cycle with no end date caused a
TypeErrorbecauseend_datewas compared directly totimezone.now()without a null check. Added an explicitNoneguard so cycles without an end date are treated as incomplete and return a400instead of crashing with a500.cycle.end_date >= timezone.now()raisesTypeError: '>=' not supported between instances of 'NoneType' and 'datetime.datetime'whenend_dateis not set.Added
cycle.end_date is Nonecheck before the comparison in both archive endpoints:plane/api/views/cycle.pyType of Change
Screenshots and Media (if applicable)
Before:

After:

Test Scenarios
Create a cycle without start and end dates and make API call to archive the cycle, expected response status code is 400 and message is
References
Fixes #9169
Summary by CodeRabbit