Skip to content

Add experimental Stream service messages - #895

Open
moetemp wants to merge 107 commits into
mainfrom
moe/stream-service-messages
Open

moetemp wants to merge 107 commits into
mainfrom
moe/stream-service-messages

Conversation

@moetemp

@moetemp moetemp commented Oct 26, 2026 •

Copy link
Copy Markdown

This PR adds the experimental Stream messages and System Nexus WIT used by SDKs and Stores.

The contract defines Producer attempts, optional fencing, bounded resend protection and ordered opaque offsets. SDK requests include a StreamRef for Store routing. Store requests contain only the Stream id.

Streams have no close operation. Only new batches restart retention. The read contract distinguishes page targets from SDK hard limits.

Checked with buf lint, api-linter, protoc and System Nexus WIT generation.

Reviewer's guide

  1. Start with temporal/api/stream/v1/message.proto and temporal/api/streamservice/v1/request_response.proto. Check Producer identity, bounded resend protection, optional fencing and retention rules.
  2. Compare temporal/api/sdk/v1/stream.proto with the Store requests. SDK routing needs a StreamRef. Stores receive the stream ID, without SDK routing fields.
  3. Review nexus/stream-service.wit against those messages. Check opaque offset types, read page targets and the absence of a close operation. WIT generation must reproduce the checked-in contract. The Python create transform preserves historical Workflow results through the SDK helper.

The crate, sdk-python and later the server read one copy of these messages. The gRPC service
and its Nexus annotations come with the server.
@moetemp
moetemp requested review from a team October 26, 2026 16:37
@moetemp moetemp changed the title Added the Stream service messages as experimental. feat(brook): add the Stream service messages (as experimental) Oct 26, 2026
@moetemp
moetemp marked this pull request as draft October 26, 2026 16:53
@moetemp
moetemp force-pushed the moe/stream-service-messages branch 3 times, most recently from 482ec01 to 5068d41 Compare October 28, 2026 08:56
moetemp added a commit to moetemp/nexgen that referenced this pull request Oct 28, 2026
The Stream protos are A1's files again, and the runtime proto is K10's, so the sample matches
the crate. `CreateStreamResponse` has no `status` now. The descriptor set and the bindings are
rebuilt with the README's recipe.
moetemp added a commit to moetemp/nexgen that referenced this pull request Oct 29, 2026
The Stream protos are A1's files again, so the sample matches the crate. `CreateStreamResponse`
has no `status` now. The descriptor set and the bindings are rebuilt with the README's recipe.
@moetemp
moetemp force-pushed the moe/stream-service-messages branch from 5068d41 to 44519d8 Compare October 29, 2026 04:06
tconley1428 pushed a commit to temporalio/nexgen that referenced this pull request Oct 29, 2026
The sample takes the part of Brook's WIT that nexgen generates, on the Stream protos of
temporalio/api#895 at 44519d8a. No SDK has those protos, so the sample projects hold their
bindings. The sample is a System Nexus service, so its .NET output builds in its own project. Only
.NET generates the service, since Python and TypeScript panic on the read item's oneof.
The failure gives the close status, so the field only let a caller contradict it. An append with
no sequence gets the next batch number, so a call that has no writer state still works.
The SDKs copy this WIT to generate their Stream Workflow API and client. The Makefile runs
add-message on it, so its records follow the Stream protos. The fork has the directives the WIT
uses, until a nexgen release does.
moetemp added a commit to temporalio/nexgen that referenced this pull request Oct 31, 2026
…io (#311)

### What changed?
This PR moves the stream sample's Python bindings of the Stream protos into a local package, `temporalio_stream_protos/`, that installs them into `temporalio`. Only the sample changes. nexgen and the generated code stay as they are.

- The package adds only the Stream modules under `temporalio/api/`. The sample depends on it through a `uv` `path` source, and `streamprotos/` goes away.
- basedpyright now checks `wit/stream_service`.

### Why?
The Stream protos of `temporalio/api#895` aren't in a released `temporalio` yet. The generated code already imports them from `temporalio.api`, where a release will have them. When it does, the package goes away.

### How did you test it?
Link to a test plan if any -
- [x] Unit Tests
- [ ] Staging
- [ ] End to End Tests

`test_stream_service.py` round-trips each read item kind through the `temporalio.api` classes.
The message now has the name of the read item that it is. A StreamRef field is named ref
everywhere, as on CreateStreamRequest. The field numbers stay, so the wire format is the same.
moetemp added a commit to moetemp/nexgen that referenced this pull request Oct 31, 2026
The stream sample's WIT is the Stream service WIT of the protos PR, with the sample's own
definition, and its protos and bindings are those of the PR. The sample gains the
`withdraw_run` helper that the WIT's sources call.
moetemp added a commit to moetemp/nexgen that referenced this pull request Nov 3, 2026
The stream sample's WIT is the Stream service WIT of the protos PR, with the sample's own
definition, and its protos and bindings are those of the PR. The sample gains the
`withdraw_run` helper that the WIT's sources call.
moetemp added a commit to temporalio/nexgen that referenced this pull request Nov 3, 2026
This was referenced Nov 27, 2026
// `last_offset` from a describe and reads after it.
// (-- api-linter: core::0140::prepositions=disabled
// aip.dev/not-precedent: "from" marks the start of a range of offsets. --)
bytes from_offset = 2;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be called after_offset given that this is an exclusive range.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair. Changed both request types to after_offset in 46e3f3c.

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.

4 participants