Skip to content

Use workflow init from samples - #143

Open
drewhoskins-temporal wants to merge 6 commits into
mainfrom
drewhoskins_workflow_init
Open

Use workflow init from samples#143
drewhoskins-temporal wants to merge 6 commits into
mainfrom
drewhoskins_workflow_init

Conversation

@drewhoskins-temporal

Copy link
Copy Markdown
Contributor

What was changed

Workflow Init is a brand new feature.
Let's show people best practices for each sample that uses a signal or update handler and receives workflow arguments.

Why?

These changes make sure these workflows are initialized before signal or update handlers are run.

Checklist

  1. Closes

  2. How was this tested:

Automated:
poetry run pytest workflow_test.py
Manual:
Follow instructions in
bedrock/entity/README.md
and
message_passing/safe_message_handlers/README.md

  1. Any docs updates needed?

Comment thread pyproject.toml Outdated

@cretz cretz 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.

LGTM, holding approval until tagged release of SDK is made

brianstrauch and others added 2 commits July 29, 2026 20:40
Resolve conflicts in favor of main:
- ClusterManagerWorkflow already adopted @workflow.init on main.
- The message_passing/introduction comment this branch fixed no longer
  exists after that sample was refactored.
- poetry.lock/pyproject.toml: the repo moved from poetry to uv, and the
  temporary local-path SDK dependency is unnecessary now that workflow
  init is in a released SDK.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Workflow init lets a workflow's constructor receive the workflow arguments
and run before any signal, query, or update handler. EntityBedrockWorkflow
takes arguments and has signal handlers that mutate the same state those
arguments initialize, so it should demonstrate the best practice.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@brianstrauch
brianstrauch requested a review from a team as a code owner July 30, 2026 03:43
@brianstrauch

brianstrauch commented Jul 30, 2026

Copy link
Copy Markdown
Member

Status update: I've brought this branch up to date with main (merge, no force-push, so the original commits are intact).

Most of this PR landed through other paths while it sat, so the diff is now a single file.

Already on main:

Dropped:

  • poetry.lock — deleted from the repo in Migrate to uv #170 (migrate to uv).
  • pyproject.toml — this was only the temporary temporalio = { path = "../sdk-python" } local-path dep, which was never meant to merge.

Remaining: @workflow.init on EntityBedrockWorkflow (bedrock/entity/workflows.py, +10/-6). It takes workflow arguments and has signal handlers that mutate the same state those arguments initialize, so it's a good fit for the pattern.

Verified with ruff, mypy, and an end-to-end run against the time-skipping test environment with a stubbed Bedrock activity, sending a signal alongside a pre-populated prompt_queue to confirm the constructor's params are applied before the signal is handled. Note there are no automated tests covering the bedrock samples, so that check was manual.

Note the PR description above is now stale — it describes the broader multi-sample scope and references poetry run pytest.

@brianstrauch
brianstrauch enabled auto-merge (squash) July 30, 2026 03:46
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