Skip to content

[Brook] Wrote Activity and client Records through the generated Writer. - #355

Closed
moetemp wants to merge 3 commits into
moe/brook/v4/p28-stream-resourcefrom
moe/brook/v4/p29-writer-resource
Closed

moetemp wants to merge 3 commits into
moe/brook/v4/p28-stream-resourcefrom
moe/brook/v4/p29-writer-resource

Conversation

@moetemp

@moetemp moetemp commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

This PR writes Activity and client Records through the Writer resource that nexgen generates from the crate's stream-writer.wit (S87).

What changed?

The crate pin moves to s17 ef17adf7, and NEX_GEN_REVISION to n8 204b566e. scripts/_wit/stream-writer.wit is the crate's copy, and scripts/gen_stream_service.py generates a second package, temporalio.contrib.streams.writer_system, with StreamWriterClient and Writer. It is a separate package because its models import the contrib protos, and the facade imports it lazily for the same reason. The vendored stream_service.proto takes the crate's API options, and its _pb2 is regenerated.

StreamWriter opens a generated Writer and calls write_records and close on it. The generated client runs each Record body through the user's converter and codec, so the facade no longer encodes bodies. The extension transport carries OpenWriter, WriteRecords and CloseWriter, and sets namespace only on a request that has the field. The internal StreamBackend protocol is down to service and writers, and the Local Activity pre-flush calls the plugin's extension backend directly. p30 (#357, S108) removes that pre-flush, because Workflow writes become Local Activities there. The hand-built open_writer, write_records and close_writer calls are gone. writer_system gets the same lint excludes as the generated system package.

The public API, tests and examples are unchanged.

Why?

S87: the writer calls are in the IDL, so Activity and client handles wrap two generated resources, Stream and Writer, and less of the facade is hand-written.

How did you test it?

pytest tests/contrib/streams, including the examples, on the memory Store and on a scratch redis-server, against the stock dev server. poe lint passes.

  • Unit Tests
  • Staging
  • End to End Tests

@moetemp

moetemp commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

Closing as stale. This layer is folded into the v5 tip, #365, and the upstream review uses a fresh series instead. Plan: https://www.notion.so/4048fc567738814990b7c796ac28fe3f

@moetemp moetemp closed this Oct 25, 2026
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.

1 participant