Skip to content

feat(plugin): Add result accessor to OperationEndInfo - #596

Merged
wangyb-A merged 5 commits into
mainfrom
feat/plugin-operation-end-result
Aug 14, 2026
Merged

feat(plugin): Add result accessor to OperationEndInfo#596
wangyb-A merged 5 commits into
mainfrom
feat/plugin-operation-end-result

Conversation

@ayushiahjolia

Copy link
Copy Markdown
Contributor

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

#579

Description

OperationEndInfo exposed error() for failed operations but had no way for plugins to access the serialized result of successful operations.

  • Added String result field to the OperationEndInfo record
  • Added extractResult(Operation) in PluginInfoConverter that pulls the serialized result from the operation's type-specific details (stepDetails, callbackDetails, chainedInvokeDetails, contextDetails)

Demo/Screenshots

N/A

Checklist

  • I have filled out every section of the PR template
  • I have thoroughly tested this change

Testing

Unit Tests

Have unit tests been written for these changes? Added

Integration Tests

Have integration tests been written for these changes? Added

Examples

Has a new example been added for the change? (if applicable) N/A

@ayushiahjolia
ayushiahjolia marked this pull request as ready for review August 5, 2026 23:51
@ayushiahjolia
ayushiahjolia requested a review from a team August 5, 2026 23:51
@ayushiahjolia
ayushiahjolia enabled auto-merge (squash) August 5, 2026 23:51
@ayushiahjolia
ayushiahjolia marked this pull request as draft August 5, 2026 23:53
auto-merge was automatically disabled August 5, 2026 23:53

Pull request was converted to draft

@ayushiahjolia
ayushiahjolia force-pushed the feat/plugin-operation-end-result branch from 70c49fd to 85d282c Compare August 5, 2026 23:55
@ayushiahjolia
ayushiahjolia marked this pull request as ready for review August 5, 2026 23:57
@ayushiahjolia
ayushiahjolia enabled auto-merge (squash) August 5, 2026 23:57
Comment thread sdk/src/main/java/software/amazon/lambda/durable/plugin/OperationEndInfo.java Outdated
@ayushiahjolia
ayushiahjolia disabled auto-merge August 6, 2026 17:27
@ayushiahjolia
ayushiahjolia force-pushed the feat/plugin-operation-end-result branch from 85d282c to f22bf2e Compare August 6, 2026 17:48
@ayushiahjolia
ayushiahjolia force-pushed the feat/plugin-operation-end-result branch from f22bf2e to fdbfe49 Compare August 6, 2026 17:49
@ayushiahjolia
ayushiahjolia enabled auto-merge (squash) August 6, 2026 17:49
@ayushiahjolia
ayushiahjolia marked this pull request as draft August 12, 2026 20:42
auto-merge was automatically disabled August 12, 2026 20:42

Pull request was converted to draft

Resolves the OperationEndInfo conflict against the preview-marking change
in #620, which replaced the record-level '@deprecated This is a preview
API' javadoc with @experimental on the individual record components.

The new result component now carries @experimental, matching error on
the same record and executionInput/executionResult on the invocation
records added in #622.
@wangyb-A
wangyb-A deployed to ai-pr-review August 13, 2026 19:09 — with GitHub Actions Active
@wangyb-A
wangyb-A temporarily deployed to ai-pr-review-runtime August 13, 2026 19:09 — with GitHub Actions Inactive
@wangyb-A
wangyb-A temporarily deployed to ai-pr-review-runtime August 13, 2026 19:09 — with GitHub Actions Inactive
Comment thread sdk/src/main/java/software/amazon/lambda/durable/plugin/OperationEndInfo.java Outdated
Comment thread sdk/src/main/java/software/amazon/lambda/durable/plugin/PluginInfoConverter.java Outdated
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

…he old arity

Review feedback on the result accessor:

- Only a SUCCEEDED operation reports a result. A wait-for-condition is
  checkpointed as STEP and reuses stepDetails().result() to carry its
  intermediate check-loop state between attempts, so a failed one could
  surface that state as its result, contradicting the documented
  null-on-failure contract. Verified: without the guard the new test
  reports {"polls":2} for a FAILED operation.
- Override toString() to omit result. Records render every component, so
  plugins that log the info object whole would have begun emitting
  customer payloads (possibly secrets or personal data). Output is
  otherwise unchanged; matches the invocation records from #622.
- Add a constructor at the previous 11-argument arity delegating with a
  null result, so existing callers keep compiling and linking.
- Cover the CHAINED_INVOKE, CALLBACK, and CONTEXT extraction branches,
  which had no direct test.
@wangyb-A
wangyb-A deployed to ai-pr-review August 13, 2026 19:24 — with GitHub Actions Active
@wangyb-A
wangyb-A temporarily deployed to ai-pr-review-runtime August 13, 2026 19:25 — with GitHub Actions Inactive
@wangyb-A
wangyb-A had a problem deploying to ai-pr-review-runtime August 13, 2026 19:25 — with GitHub Actions Failure
@github-actions

This comment has been minimized.

@wangyb-A
wangyb-A force-pushed the feat/plugin-operation-end-result branch from 2b91878 to 36eae1a Compare August 13, 2026 19:48
@wangyb-A
wangyb-A deployed to ai-pr-review August 13, 2026 19:52 — with GitHub Actions Active
@wangyb-A
wangyb-A temporarily deployed to ai-pr-review-runtime August 13, 2026 19:53 — with GitHub Actions Inactive
@wangyb-A
wangyb-A temporarily deployed to ai-pr-review-runtime August 13, 2026 19:53 — with GitHub Actions Inactive
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@wangyb-A
wangyb-A marked this pull request as ready for review August 13, 2026 20:28
@wangyb-A
wangyb-A temporarily deployed to ai-pr-review-runtime August 13, 2026 20:28 — with GitHub Actions Inactive
@wangyb-A
wangyb-A had a problem deploying to ai-pr-review-runtime August 13, 2026 20:28 — with GitHub Actions Failure
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen temporarily deployed to ai-pr-review-runtime August 14, 2026 18:41 — with GitHub Actions Inactive
@zhongkechen
zhongkechen temporarily deployed to ai-pr-review-runtime August 14, 2026 18:41 — with GitHub Actions Inactive
: null;
case CONTEXT ->
operation.contextDetails() != null ? operation.contextDetails().result() : null;
default -> null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nonblocking. This default branch makes it harder to catch when we are adding new primitives.

@wangyb-A
wangyb-A merged commit 24ca337 into main Aug 14, 2026
27 checks passed
@wangyb-A
wangyb-A deleted the feat/plugin-operation-end-result branch August 14, 2026 18:46
Comment on lines +82 to +83
if (operation == null || operation.type() == null || operation.status() != OperationStatus.SUCCEEDED) {
return null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex AI review

[P2] Preserve results for virtual operations. Successful virtual child contexts, including flat map/parallel branches, call fireOnOperationEnd(null, ...) after already serializing their result; non-checkpointed empty maps also pass null. This guard therefore reports result() == null despite a successful result. Thread the serialized value through the operation-end conversion when no backend Operation exists, and add flat-branch and empty-map integration coverage.

@github-actions

Copy link
Copy Markdown

Codex AI review

One correctness gap remains in result propagation for successful virtual operations.

Reviewed commit 9117b0e3bc35cb5329c6ec254ba560f56a1183b9. Workflow run

@github-actions

Copy link
Copy Markdown

Claude AI review

No blocking findings. This PR cleanly adds a result accessor to OperationEndInfo and an extractResult(Operation) helper in PluginInfoConverter.

Verified as correct:

  • extractResult logic — Type switch (STEP/CHAINED_INVOKE/CALLBACK/CONTEXT, default → null) is correct; every branch null-guards its details accessor and operation == null is handled (needed since MapOperation/ChildContextOperation fire onOperationEnd(null, …)). The status() != SUCCEEDED guard correctly prevents a FAILED wait-for-condition — checkpointed as STEP and reusing stepDetails().result() for intermediate poll state — from surfacing that state as a result.
  • API compatibility — The retained 11-arg constructor delegates to the canonical 12-arg one with result = null; existing callers keep compiling. No production new OperationEndInfo(...) sites break.
  • Replay — On replay of completed ops, the checkpointed result is surfaced with isReplay = true, so plugins can distinguish. Intended.
  • Payload safety — The custom toString() deliberately omits result to avoid leaking customer payloads into logs (asserted by a test); equals/hashCode retain it without emitting the value.
  • Tests — Comprehensive unit coverage (per-type extraction, failed-WFC guard, no-result WAIT, compat constructor, toString redaction) plus an integration test asserting the serialized step output.

Minor, non-blocking nit (not filed inline): the new javadoc at sdk/src/main/java/software/amazon/lambda/durable/plugin/PluginInfoConverter.java:77 references {@link OperationType#STEP} but only OperationStatus was imported. With <doclint>none</doclint> this neither fails the build nor warns — it just renders as a non-hyperlinked reference. Optionally import OperationType or drop the {@link}.

Residual test risk: low. The added tests cover the extraction matrix and the redaction/compat behavior end-to-end.

Reviewed commit 9117b0e3bc35cb5329c6ec254ba560f56a1183b9. Workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants