Skip to content

first program in python fix - #487

Open
angelazhou32 wants to merge 1 commit into
mainfrom
first-program-in-python-retry-fix
Open

first program in python fix#487
angelazhou32 wants to merge 1 commit into
mainfrom
first-program-in-python-retry-fix

Conversation

@angelazhou32

Copy link
Copy Markdown
Contributor

In the Python first-program tutorial, the full workflows.py code sample near the top of the page was out of sync with the actual template repo.

Specifically, the snippet still showed:

  • maximum_attempts=3 in the RetryPolicy — the repo no longer sets maximum_attempts at all
  • An outdated deposit/refund error-handling block (raise deposit_err misplaced inside the try, and raise refund_error without exception chaining).

@angelazhou32
angelazhou32 requested a review from a team as a code owner September 2, 2026 16:42
@vercel

vercel Bot commented Sep 2, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
temporal-learning Ready Ready Preview Sep 2, 2026 4:42pm UTC

Request Review

raise refund_error from deposit_err

# Re-raise deposit error if refund was successful
raise deposit_err

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.

I'm not sure on the logic here. We want to raise an error even when the refund was successful? What would the consequences of that be?

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.

It's the saga/compensation pattern. If the deposit permanently fails, the transfer didn't happen; the refund just undoes the withdrawal so the accounts end up consistent. Re-raising deposit_err reports that the transfer failed, even though we cleaned up.

Consequence: the Workflow ends in a Failed state and the caller gets the deposit error, so it knows the transfer didn't go through. If we didn't raise and returned success instead, the caller would think the money moved when it was actually refunded

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