Skip to content

feat: add Stream Stores - #2186

Open
moetemp wants to merge 7 commits into
moe/streams-generated-codefrom
moe/streams-stores
Open

moetemp wants to merge 7 commits into
moe/streams-generated-codefrom
moe/streams-stores

Conversation

@moetemp

@moetemp moetemp commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

What was changed

This PR adds StreamStore, StreamConfig, StreamError, MemoryStreamStore and
BufferedAppender. It also adds Producer helpers and uses UTC in ActivityEnvironment.

Why?

Applications register Stores in StreamConfig. Store names must stay stable, so the
configuration validates unique names without keeping a second registry.
This layer needs no Core change and can merge after
#2128.

Reviewer's guide

  1. Read temporalio/client/_stream_store.py for the Store contract and configuration checks.
  2. Check temporalio/testing/_stream_store.py for the memory Store.
  3. Read temporalio/contrib/streams/_appender.py for buffered writes and Producer scope.

Checklist

  • Run Python lint and focused Store and appender tests.
  • Add one changelog fragment.

@moetemp
moetemp added this pull request to stack #2189 December 2, 2026 22:49
@moetemp moetemp added the skip-changelog PR changes do not require changelog updates label Dec 2, 2026
@moetemp
moetemp marked this pull request as ready for review December 2, 2026 22:59
@moetemp
moetemp requested a review from a team as a code owner December 2, 2026 22:59
@moetemp
moetemp force-pushed the moe/streams-stores branch from bf635e6 to bba27f4 Compare December 3, 2026 08:49
@moetemp
moetemp removed this pull request from stack #2189 December 3, 2026 09:00
@moetemp
moetemp added this pull request to stack #2202 December 3, 2026 09:00
`datetime.fromtimestamp(0)` reads the local time zone, so on a host west
of UTC the default times of `ActivityEnvironment` fall before 1970. SDK
Core and the client both refuse a Stream append whose Producer has an
attempt time before 1970.
A Store is the service that keeps the Records of a Stream. The contract
says what client, Activity and Workflow calls need from a Store, and
`StreamConfig` registers the Stores of a client and its Workers.
Tests and local runs need a Store with no other service. The memory
Store keeps its Streams in plain Python data and applies the rules of
`StreamStore` in their order, so it also shows what a Store does.
An Activity that appends each model token pays one Store call for each
token. The appender batches them with one write in flight, and stops at
the first failed batch so that a reader sees no gap. `current_producer`
and `as_producer` let resumed Activity work write as its first Producer.
Store names are required to stay stable. A second registry is not
needed to protect against changing them.
@moetemp
moetemp force-pushed the moe/streams-stores branch from bba27f4 to 356c694 Compare December 3, 2026 09:58

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog PR changes do not require changelog updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant