Skip to content

[Brook K13] Added the Workflow write calls of the Local Activities. - #223

Closed
moetemp wants to merge 1 commit into
moe/brook/review/streams-k12-scopesfrom
moe/brook/review/streams-k13-workflow-writes
Closed

moetemp wants to merge 1 commit into
moe/brook/review/streams-k12-scopesfrom
moe/brook/review/streams-k13-workflow-writes

Conversation

@moetemp

@moetemp moetemp commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

What changed?

This PR adds the Workflow write calls, the bodies of the append Local Activity and the close Activity of Workflow code. Workflow code still builds each request, and never calls the crate.

  • WorkflowAppend writes as the Producer of a Workflow write, at attempt 1, so the attempts in one Workflow Task send the same batches. The runtime keeps the batches until the Store has them, so a retry in this process resends the same bytes after a random codec. Lang can then send no records.
  • When the codec grew the merged Records past the Store's limits (4 MiB a batch, 1.5 MiB a Record), each publish goes in a batch of its own. A publish that the Store refuses alone as TOO_LARGE gets a StreamFailure, and the others get their last offsets. Any other refusal fails the call. A lasting one drops the kept batches.
  • The first batch that the Store takes carries withdraw_run, so a first publish refused as TOO_LARGE doesn't skip the withdrawal.
  • WorkflowAppendPending tells lang whether the runtime keeps the batches, so lang can skip the codec. The kept batches go past 64 MiB, oldest first.
  • WorkflowClose closes as wf:<run id>, the run that scheduled the close, and only a Stream that the Activity's Workflow owns.

Depends on #222 (K12). Review lane is the Rust reviewers.
Part of the Brook review series.

Why?

sdk-python's _writes.py holds the resend cache, the split and the close Producer today. Each SDK needs the same rules, and only the codec call is tied to the language.

How did you test it?

cargo fmt, cargo clippy -- -D warnings (with and without features), cargo test -p temporalio-streams --all-features and cargo doc pass at this commit. The Workflow write suite runs on the memory Store here, and on Redis in R4 (temporal-community/sdk-streams#4).

@moetemp moetemp added the skip-changelog Changelog entry rides another PR label Oct 28, 2026
@moetemp
moetemp force-pushed the moe/brook/review/streams-k13-workflow-writes branch from 1bd0d50 to e6a73aa Compare October 28, 2026 18:45
@moetemp
moetemp force-pushed the moe/brook/review/streams-k12-scopes branch from eb14f46 to 061873d Compare October 28, 2026 18:45
@moetemp
moetemp marked this pull request as draft October 28, 2026 21:55
@moetemp
moetemp force-pushed the moe/brook/review/streams-k12-scopes branch from 061873d to 55b88d8 Compare October 28, 2026 22:42
@moetemp
moetemp force-pushed the moe/brook/review/streams-k13-workflow-writes branch from e6a73aa to 109eda2 Compare October 28, 2026 22:42
@moetemp
moetemp force-pushed the moe/brook/review/streams-k12-scopes branch from 55b88d8 to b98e0f1 Compare October 29, 2026 04:06
@moetemp
moetemp force-pushed the moe/brook/review/streams-k13-workflow-writes branch 2 times, most recently from 112c437 to 750716b Compare October 29, 2026 08:37
@moetemp
moetemp force-pushed the moe/brook/review/streams-k12-scopes branch from b98e0f1 to 3ccfc8c Compare October 29, 2026 08:37
@moetemp
moetemp force-pushed the moe/brook/review/streams-k13-workflow-writes branch from 750716b to f891bac Compare October 29, 2026 09:17
The append Local Activity keeps its batches until the Store has them, so a retry resends the same bytes after a random codec. Each SDK then keeps only the codec call around `WorkflowAppend` and `WorkflowClose`.
@moetemp
moetemp force-pushed the moe/brook/review/streams-k13-workflow-writes branch from f891bac to 88ce46f Compare October 29, 2026 10:03
@moetemp
moetemp force-pushed the moe/brook/review/streams-k12-scopes branch from 8d224d8 to 70943ca Compare October 29, 2026 10:03
@moetemp

moetemp commented Oct 30, 2026

Copy link
Copy Markdown
Owner Author

Parked. Nothing calls these runtime methods yet, since sdk-python does this work in Python. The branch stays, and this layer comes back with its first caller, for example a TypeScript or .NET port or Rust read handles.

@moetemp moetemp closed this Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Changelog entry rides another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant