Skip to content

feat: add replay-safe UUID, time, and random helpers - #674

Closed
zhongkechen wants to merge 1 commit into
codex/extension-operation-refactorfrom
discussion-545-replay-safe-values
Closed

feat: add replay-safe UUID, time, and random helpers#674
zhongkechen wants to merge 1 commit into
codex/extension-operation-refactorfrom
discussion-545-replay-safe-values

Conversation

@zhongkechen

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

#545

Stacked on #607, which introduces the extension operations SPI. This PR is intentionally based on
codex/extension-operation-refactor and should be retargeted to main after #607 merges.

Description

  • Add DurableReplaySafeValueOperation, a context-free built-in extension family implemented through
    ExtensionContext and ExtensionOperation.
  • Add synchronous and asynchronous helpers for checkpointed UUIDs, current Instant values, and pseudorandom
    double values.
  • Provide stable default operation names (uuid, now, and random) and overloads for caller-provided names.
  • Record the helpers as STEP operations with descriptive UUID, Now, and Random subtypes.
  • Preserve normal STEP retry and delivery semantics through the extension SPI.
  • Document the API and add unit and replay integration coverage.

Demo/Screenshots

import static software.amazon.lambda.durable.operation.DurableReplaySafeValueOperation.now;
import static software.amazon.lambda.durable.operation.DurableReplaySafeValueOperation.random;
import static software.amazon.lambda.durable.operation.DurableReplaySafeValueOperation.uuid;

var requestId = uuid("request-id");
var createdAt = now("created-at");
var sample = random("sample");

Each value is generated once and returned from its checkpoint on replay.

Checklist

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

Testing

Unit Tests

Yes. Added DurableReplaySafeValueOperationTest and updated facade API coverage.

  • mvn -pl sdk -Dtest=DurableReplaySafeValueOperationTest,DurableOperationFacadeTest test
  • Full SDK suite: 1,263 tests passed

Integration Tests

Yes. Added ReplaySafeValueIntegrationTest, which forces a replay and verifies that the returned UUID, Instant, and
random value match their stored STEP results.

  • Focused replay integration test passed
  • Full testing-utility suite: 14 tests passed
  • Full SDK integration suite: 431 tests passed

Examples

The extension author documentation now includes a complete usage example. A separate deployed example was not added
because the helpers are direct value-returning operations and the replay behavior is covered by the local integration
test.

Additional validation:

  • mvn spotless:check
  • mvn -pl sdk -DskipTests package

@zhongkechen
zhongkechen temporarily deployed to ai-pr-review-runtime September 1, 2026 04:23 — with GitHub Actions Inactive
@zhongkechen
zhongkechen temporarily deployed to ai-pr-review-runtime September 1, 2026 04:24 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Codex AI review

No actionable findings. Residual risk is low: completed-operation replay is covered, but tests were not executed under the required read-only review constraints.

Reviewed commit 5bcb2e0fd600a2003315dc31fa8f559306f68643. Workflow run

@zhongkechen
zhongkechen marked this pull request as draft September 2, 2026 18:11
@zhongkechen
zhongkechen marked this pull request as ready for review September 3, 2026 17:18
@zhongkechen
zhongkechen marked this pull request as draft September 3, 2026 17:18
@zhongkechen zhongkechen closed this Sep 3, 2026
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.

1 participant