[OP-19965] Fix 500 when initializing an occurrence on a draft recurring meeting template - #24772
Open
jtauschl wants to merge 1 commit into
Open
[OP-19965] Fix 500 when initializing an occurrence on a draft recurring meeting template#24772jtauschl wants to merge 1 commit into
jtauschl wants to merge 1 commit into
Conversation
…template
InitOccurrenceService#draft_template_failure returned only a message
with no errors:, which crashed the API layer's
ErrorBase.create_and_merge_errors(call.errors) with an ArgumentError
("expected at least one error") when it tried to build a MultipleErrors
response from an empty error list. Every recurring meeting's template is
in draft state right after creation, so initializing its first occurrence
before moving the template out of draft always hit this 500 instead of a
clean 422.
Populate the recurring meeting's own errors object before returning
failure, matching the errors: shape used elsewhere in this service and
across the codebase.
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
recheck |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a recurring-meeting API failure mode where initializing an occurrence on a draft meeting series template produced a 500 due to an empty ServiceResult#errors, ensuring the API layer can consistently build a validation error response (422) instead.
Changes:
- Populate
InitOccurrenceServicefailure results for draft templates with a non-emptyerrorsobject (viarecurring_meeting.errors). - Add a regression spec asserting the draft-template failure path returns non-empty
service_result.errors.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| modules/meeting/app/services/recurring_meetings/init_occurrence_service.rb | Ensures the draft-template failure path returns a failure result with populated errors so API error merging works. |
| modules/meeting/spec/services/recurring_meetings/init_occurrence_service_spec.rb | Adds regression coverage ensuring the draft-template failure returns non-empty errors suitable for the API layer. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket
https://community.openproject.org/wp/OP-19965
Summary
InitOccurrenceService#draft_template_failurereturned only a message with noerrors:, which crashed the API layer'sErrorBase.create_and_merge_errors(call.errors)with anArgumentError("expected at least one error") when it tried to build aMultipleErrorsresponse from an empty error list. Every recurring meeting's template is in draft state right after creation, so initializing its first occurrence before moving the template out of draft always hit this 500 instead of a clean 422.Change
Populate the recurring meeting's own errors object before returning failure, matching the
errors:shape used elsewhere in this service and across the codebase.Test plan
service_result.errorsis non-empty on the draft-template path, alongside the existingmessage/resultexpectations