feat(plugin): add user function outcome enum - #640
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| * | ||
| * @deprecated Use {@link #toUserFunctionEndInfo(UserFunctionStartInfo, UserFunctionOutcome, Throwable)}. | ||
| */ | ||
| @Deprecated(forRemoval = false) |
There was a problem hiding this comment.
Do we need to keep this? Plugin is in preview mode.
| * @deprecated Use {@link #UserFunctionEndInfo(String, String, String, String, String, Instant, Instant, boolean, | ||
| * Integer, UserFunctionOutcome, Throwable)} so incomplete executions are distinguishable from failures. | ||
| */ | ||
| public UserFunctionEndInfo( |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
This comment has been minimized.
This comment has been minimized.
Codex AI reviewOne release-blocking compatibility issue found. New outcome paths are tested, but prior-version plugin ABI compatibility is not. Reviewed commit |
| boolean isReplayingChildren, | ||
| Integer attempt, | ||
| boolean succeeded, | ||
| UserFunctionOutcome outcome, |
There was a problem hiding this comment.
Claude AI review
Replacing the boolean succeeded record component with UserFunctionOutcome outcome removes the auto-generated public succeeded() accessor and changes the canonical constructor signature, with no deprecated shim. This is a source- and binary-incompatible change to a public plugin type: any third-party DurableExecutionPlugin that reads info.succeeded() (or constructs UserFunctionEndInfo with the boolean) will fail to compile/link against the new SDK. This directly contradicts the PR description's claim that "deprecated boolean constructor and accessor adapters preserve compatibility for existing plugin implementations" — no such adapters are present in the diff.
Concrete fix: if compatibility is required, add back a @Deprecated boolean succeeded() method (return outcome == UserFunctionOutcome.SUCCEEDED;, preserving the old semantics where suspension/failure are both false) and a @Deprecated boolean-based constructor that delegates to the enum one. If the break is intentional, remove the compatibility claim from the description and call out the breaking change in the migration notes.
Claude AI reviewThis change replaces One issue: the PR removes the public Residual test risk is low: there is no direct assertion that a Reviewed commit |
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue Link, if available
Closes #636
Description
Replace the boolean user-function completion flag with
UserFunctionOutcome, which hasSUCCEEDED,FAILED, andINCOMPLETEvalues.User functions now report
INCOMPLETEwhen durable execution suspends. Normal returns reportSUCCEEDED, and thrown failures reportFAILED. Deprecated boolean constructor and accessor adapters preserve compatibility for existing plugin implementations.The OTel plugins treat incomplete functions as a neutral outcome: the attempt span remains
UNSET, records theINCOMPLETEattribute, and does not record the internal suspension exception. Conformance handlers and the plugin example now consume the enum directly.Demo/Screenshots
Not applicable. This change updates the Java plugin API and lifecycle event behavior.
Checklist
Testing
mvn clean installResult: 1,803 tests passed with 0 failures and 0 errors. The 31 skipped tests are existing cloud-only example tests.
Unit Tests
Yes. Added converter coverage for all three outcomes and OTel tests that verify incomplete attempts remain neutral and do not record the suspension exception.
Integration Tests
Yes. Updated plugin integration tests to verify successful, failed, retried, and suspended user-function outcomes. Suspension, including a
CompletionException-wrapped suspension, now assertsINCOMPLETEand exposes the unwrapped error.Examples
Updated the existing plugin example to log
outcome. No new example was needed.