Skip to content

Sync the Saga pattern's Go, Python, and Java samples with Snipsync - #5879

Open
Duncanma wants to merge 1 commit into
mainfrom
duncan/saga-pattern-all-languages
Open

Duncanma wants to merge 1 commit into
mainfrom
duncan/saga-pattern-all-languages

Conversation

@Duncanma

@Duncanma Duncanma commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

What changed

The Saga pattern page's Go, Python, and Java tabs now come from tested samples in documentation-sdk-code-examples, like the TypeScript tab already did. The TypeScript snippet is resynced too.

  • The samples register a compensation before each step, run compensations in reverse order, keep going when one fails, and still compensate after the Workflow is canceled. Each SDK uses its own mechanism for that: workflow.NewDisconnectedContext (Go), catching asyncio.CancelledError (Python), Workflow.newDetachedCancellationScope with Saga.Options.setContinueWithError(true) (Java), and CancellationScope.nonCancellable (TypeScript).
  • The SDK comparison prose and the cancellation best practice now describe that behavior.
  • The inline Go sample, which had no Activity options and couldn't run, is gone.

Design-patterns Snipsync coverage goes from 26 to 161 lines.

Blocked on

temporalio/documentation-sdk-code-examples#320, which adds the samples, unit tests, runner manifests, and CI jobs. This PR stays a draft until that merges. The snippets were synced from that PR's branch, with source links rewritten to blob/main, so they resolve once it merges.

Checks

  • yarn build passes.
  • vale --config .vale-ci.ini is clean on the changed file.
  • yarn check:snipsync-markers passes.

The Go, Python, and Java tabs now come from tested samples in
documentation-sdk-code-examples (design-patterns/saga in each sandbox),
alongside the TypeScript tab that already did. The samples run
compensations after cancellation and keep going when one fails, so the
prose that compares the SDKs and the cancellation best practice now
describe that. The inline Go sample, which had no Activity options and
couldn't run, is gone.
@vercel

vercel Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
temporal-documentation Ready Ready Preview Dec 3, 2026 7:59pm UTC

Request Review

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Snipsync coverage

SDK code lines in docs/ that come from Snipsync: 62.7% → 63.0% (+0.3 pts), 26,678 of 42,357 lines.

Section Snipsync lines Inline lines Snipsync % Change
design-patterns 26 → 161 7,808 → 7,675 0.3% → 2.1% +1.8 pts
All sections

All languages: 53.9% (27,545 of 51,075 lines).

Section Snipsync lines Inline lines Snipsync %
design-patterns 161 7,675 2.1%
develop/python 5,748 536 91.5%
develop/java 4,639 49 99.0%
guides 34 4,446 0.8%
develop/go 4,384 93 97.9%
develop/typescript 3,757 313 92.3%
develop/dotnet 3,029 7 99.8%
develop/rust 1,571 0 100.0%
develop/php 1,394 0 100.0%
develop/ruby 1,302 2 99.8%
develop 484 606 44.4%
production-deployment 116 746 13.5%
encyclopedia 0 837 0.0%
develop/worker-performance 48 177 21.3%
cloud 0 127 0.0%
references 0 48 0.0%
best-practices 11 17 39.3%
Language Snipsync lines Inline lines Snipsync %
Python 5,926 6,513 47.6%
Go 4,568 3,155 59.1%
Java 4,771 2,554 65.1%
TypeScript 3,933 2,777 58.6%
C# 3,104 464 87.0%
Rust 1,609 31 98.1%
Ruby 1,373 161 89.5%
PHP 1,394 24 98.3%
Snipsync origin Lines
temporalio/documentation-sdk-code-examples 21,387
temporalio/samples-python 2,821
temporalio/samples-typescript 743
temporalio/samples-dotnet 655
temporalio/features 464
temporalio/samples-go 413
temporalio/samples-java 184
temporalio/reference-app-orders-go 11

Compared with 3cddf4f. Counts non-blank lines in fenced code blocks and <CodeSnippet> elements tagged with an SDK language. Hand-written code isn't compiled anywhere; code Snipsync pulls from a sample repository is built in that repository's CI. See UTILITIES.md.

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

📖 Docs PR preview links

@Duncanma
Duncanma marked this pull request as ready for review December 3, 2026 20:11
@Duncanma
Duncanma requested a review from a team as a code owner December 3, 2026 20:11
Copilot AI balanced review requested due to automatic review settings December 3, 2026 20:11

Copilot AI left a comment

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.

🟡 Changes recommended

The Solution section still says to register compensations after each step completes, contradicting the new before-execution rule and potentially leaving partial side effects uncompensated.

1 open issue
What changed in this PR

Updates the Saga pattern documentation to use Snipsync-managed samples across all four SDK tabs.

Changes:

  • Replaces inline Go, Python, and Java examples with synced samples and refreshes TypeScript.
  • Updates guidance on compensation ordering, failure handling, and cancellation.
File Description
docs/​design-patterns/​saga-pattern.mdx Syncs SDK examples and revises compensation guidance.

Review effort: Balanced


The following examples show how each SDK implements the Saga pattern.
Each language uses a different mechanism to register and execute compensations, but the core principle is the same: register a compensation before or after each step, and run all compensations in reverse order on failure.
Each language uses a different mechanism to register and execute compensations, but the core principle is the same: register a compensation before each step, and run all compensations in reverse order on failure.

This branch was successfully deployed

1 active deployment
Preview — f8d50781 Deployed Dec 3, 2026 by vercel[bot]
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