Repository navigation
Conversation
moetemp
force-pushed
the
moe/brook/review/streams-k12-scopes
branch
from
October 28, 2026 18:45
eb14f46 to
061873d
Compare
moetemp
marked this pull request as draft
October 28, 2026 21:55
moetemp
force-pushed
the
moe/brook/review/streams-k12-scopes
branch
from
October 28, 2026 22:42
061873d to
55b88d8
Compare
moetemp
force-pushed
the
moe/brook/review/streams-k11-static-calls
branch
from
October 29, 2026 04:06
6306039 to
aa401f9
Compare
moetemp
force-pushed
the
moe/brook/review/streams-k12-scopes
branch
from
October 29, 2026 04:06
55b88d8 to
b98e0f1
Compare
moetemp
force-pushed
the
moe/brook/review/streams-k11-static-calls
branch
from
October 29, 2026 08:37
aa401f9 to
df49f36
Compare
moetemp
force-pushed
the
moe/brook/review/streams-k12-scopes
branch
from
October 29, 2026 08:37
b98e0f1 to
3ccfc8c
Compare
moetemp
force-pushed
the
moe/brook/review/streams-k11-static-calls
branch
from
October 29, 2026 09:17
df49f36 to
cc13519
Compare
moetemp
force-pushed
the
moe/brook/review/streams-k12-scopes
branch
from
October 29, 2026 09:17
3ccfc8c to
8d224d8
Compare
A scope keeps the Producer of one Activity attempt or client and its writers, so lang keeps only an id. `Shutdown` closes every scope and writer for the backend shutdown.
moetemp
force-pushed
the
moe/brook/review/streams-k11-static-calls
branch
from
October 29, 2026 10:03
cc13519 to
ce11ed4
Compare
moetemp
force-pushed
the
moe/brook/review/streams-k12-scopes
branch
from
October 29, 2026 10:03
8d224d8 to
70943ca
Compare
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed?
This PR adds Producer scopes. A scope is the Producer of one Activity attempt or one client, with one writer for each Stream, so lang keeps only a scope id.
OpenActivityScopederives the Producer from the attempt'sActivityContext. From attempt 2, it opens a writer on each Stream in the attempt's arguments, so the attempt withdraws the earlier attempts' Records even if it writes nothing.OpenClientScopeisclient:<identity>:<key>at epoch 1, with a key from the runtime's random key and a counter. With a name it isclient:<name>at the given epoch. A forked Python child builds a new runtime, so it gets a new key with no fork hook.Publishopens the scope's writer on first use and writes.CloseStreamAscloses that writer and then the Stream, as the scope's Producer. An Activity scope refuses it withNOT_OWNERand calls no Store.CloseScopecloses the writers and reports a failed one in its answer.FreeScopedrops a scope with no wait, for a finalizer.OpenActivityScopeorCloseScopereleases the writers that the scope holds.CloseWritersandShutdownrelease lang's only, since another Worker of the client may still use a scope's writer, and a scope releases its own when it ends. A lateFreeWriterfrom lang takes no scope handle.Shutdowncloses one scope at a time. A dropped one puts back the scope that it was closing, and the nextShutdownends it. While it runs, theFreemethods still work, so lang can end a buffer whose pump is gone. After it, onlyShutdown, the static methods and theFreemethods run, and theFreemethods do nothing. A scope or writer that opens during it is freed and refused.CloseStreamAsholds the Stream's open lock while it ends the writer, so a concurrent first publish can't share that writer.Flaky, the fault-injecting memory Store of the writer suite, moves to the suites' support module for the scope tests.Depends on #221 (K11). Review lane is the Rust reviewers.
Part of the Brook review series.
Why?
The Activity interceptors of sdk-python, and later of TypeScript and .NET, then fill one
ActivityContextand keep one id. The Producer rule, the attempt-start withdrawal and the writer table live here once.How did you test it?
cargo fmt,cargo clippy -- -D warnings(with and without features),cargo test -p temporalio-streams --all-featuresandcargo docpass at this commit. The scope suite runs on the memory Store here, and on Redis in R4 (temporal-community/sdk-streams#4).