fix: merge method-level #[MethodRetry] into activity/workflow retry options - #783
Open
xepozz wants to merge 2 commits into
Open
fix: merge method-level #[MethodRetry] into activity/workflow retry options#783xepozz wants to merge 2 commits into
xepozz wants to merge 2 commits into
Conversation
…ions The mergeWith() guard on ActivityOptions, LocalActivityOptions, ChildWorkflowOptions and WorkflowOptions was inverted: it only ran the merge when retryOptions was still at its default (null), where null?->mergeWith() collapsed to null, and skipped the merge whenever the user had set retry options. As a result #[MethodRetry] was ignored when RetryOptions were present and lost (or fatal on WorkflowOptions) when they were absent. Delegate precedence to RetryOptions::mergeWith(), which already keeps user-set fields and fills defaults from the attribute, and fall back to a fresh RetryOptions when none is set. Closes #777
The PossiblyNullReference on WorkflowOptions::mergeWith is no longer raised now that the null-safe fallback (?? RetryOptions::new()) replaced the unguarded $self->retryOptions->mergeWith() call, so the baseline entry became an UnusedBaselineEntry error on the 8.3 static-analysis job.
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.
What was changed
Fixed
mergeWith()onActivityOptions,LocalActivityOptions,ChildWorkflowOptionsandWorkflowOptionsso a method-level#[MethodRetry]attribute is actually merged into the stub's retry options.The guard was inverted (
$this->diff->isPresent(...)is true only whenretryOptionsis still at its defaultnull):RetryOptionswere set — the merge was skipped and#[MethodRetry]was ignored;null?->mergeWith()collapsed tonulland the attribute was lost (a fatalCall to a member function mergeWith() on nullonWorkflowOptions, which had no null-safe call).Now the merge always runs when a
MethodRetryis present, delegating field-level precedence toRetryOptions::mergeWith()(user-set fields win, defaults are filled from the attribute) and falling back to a freshRetryOptionswhen none is set.Why?
Restores the documented
MethodRetrybehaviour — "ifRetryOptionsare present onActivityOptions/ChildWorkflowOptionsthe fields that are not default take precedence over parameters of this attribute" — and matches sdk-go/sdk-java/sdk-typescript. Fixes #777.Checklist
Closes [Bug] ActivityOptions does not correctly merge RetryOptions with method-level #[MethodRetry] #777
How was this tested:
Added unit tests for
mergeWith()covering all four option classes (tests/Unit/DTO/*OptionsTestCase.php): defaultRetryOptionsfilled from the attribute,RetryOptionscreated when unset, user-set fields kept while unset ones are filled, andmergeWith(null)is a no-op. Written first as failing tests, then fixed. FullUnitsuite green (1163 tests).No.