Skip to content

Document replay-safe Workflow APIs per SDK - #5054

Merged
lennessyy merged 5 commits into
mainfrom
sdk-workflow-determinism-sections
Aug 7, 2026
Merged

Document replay-safe Workflow APIs per SDK#5054
lennessyy merged 5 commits into
mainfrom
sdk-workflow-determinism-sections

Conversation

@lennessyy

@lennessyy lennessyy commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Adds a heading per topic under the Workflow logic requirements section of each SDK's Workflow basics page, so readers can find the replay-safe alternative for what they need. Python already had this structure; PHP is unchanged.

What changed

SDK Change
Ruby Adds Logging, Random numbers and UUIDs, Current time, and Detecting replay. The page previously listed only what Workflows can't do, with no replacement APIs.
.NET Adds the same four sections. Workflow.NewGuid() was undocumented and Workflow.Random appeared only in an analyzer-suppression note.
Go Adds the same four sections above the existing construct-mapping list. Go has no built-in seeded random or UUID helper, so that section shows the Side Effect approach.
Java Adds the same four sections, and points the existing "non-deterministic functions" bullet at the new one. The page named UUID.randomUUID() as forbidden without naming Workflow.randomUUID().
TypeScript Rewrites Random numbers and UUIDs to lead with the SDK's own uuid4() rather than the uuid npm package.

Verification

Each documented API was exercised by a Workflow per language run against temporal server start-dev, then the recorded history was replayed through that SDK's replayer. All five passed, replay included.

Java methods link to the Workflow class page rather than per-method anchors: javadoc.io/doc/.../latest/ serves a JS shell with no resolvable anchors, and the /static/ variant that has them requires a pinned version that would go stale.

┆Attachments: EDU-6904 Document replay-safe Workflow APIs per SDK

Add a heading per topic under the Workflow logic requirements section so
readers can find the replay-safe alternative for what they need.

- Ruby and .NET: add Logging, Random/UUIDs, Current time, and Detecting
  replay sections. Neither page previously named any replacement API.
- Go: add the same four sections. Go has no built-in seeded random or
  UUID helper, so that section shows the Side Effect approach.
- Java: add the same four sections, and point the existing
  "non-deterministic functions" bullet at the new one.
- TypeScript: lead the Random/UUIDs section with the SDK's own uuid4()
  instead of the uuid npm package.

Each documented API was run against a dev server and its history replayed
through the SDK replayer.
@lennessyy
lennessyy requested a review from a team as a code owner August 6, 2026 21:13
@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
temporal-documentation Ready Ready Preview Aug 7, 2026 5:27pm

Request Review

@lennessyy lennessyy left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

no need to have bad examples here. we should remove the bad example from python as well

var value = Workflow.Random.Next(1, 100);
var uniqueId = Workflow.NewGuid();

// Bad - different result on every replay

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No need to include bad references

Comment thread docs/develop/java/workflows/basics.mdx Outdated
int value = Workflow.newRandom().nextInt(100);
UUID uniqueId = Workflow.randomUUID();

// Bad - different result on every replay

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ditto

Show only the recommended API. Also removes the pre-existing bad example
from the Python page.
is false instead. That is false during read-only operations like Queries and Update validators. This is what the SDK's
built-in logger and tracing interceptors use internally.

### .NET Task Determinism

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.

📝 [vale] reported by reviewdog 🐶
[Temporal.Headings] '.NET Task Determinism' should use sentence-style capitalization.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

📖 Docs PR preview links

Workflow.isReplaying() is deprecated in favor of the unsafe package
method, which also matches the other SDKs.
@lennessyy
lennessyy enabled auto-merge (squash) August 7, 2026 17:25
@lennessyy
lennessyy merged commit 3896154 into main Aug 7, 2026
15 checks passed
@lennessyy
lennessyy deleted the sdk-workflow-determinism-sections branch August 7, 2026 17:27
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.

2 participants