Skip to content

[Brook] Added the writer calls as a client-only WIT interface. - #33

Closed
moetemp wants to merge 2 commits into
moe/brook/v4/s16-stream-resourcefrom
moe/brook/v4/s17-writer-wit
Closed

moetemp wants to merge 2 commits into
moe/brook/v4/s16-stream-resourcefrom
moe/brook/v4/s17-writer-wit

Conversation

@moetemp

@moetemp moetemp commented Oct 22, 2026

Copy link
Copy Markdown
Owner

What changed?

This PR adds the crate's writer extension calls to the IDL as an internal WIT interface, crates/streams/nexus/stream-writer.wit.

stream-writer maps by @nexus.proto to the extension.proto messages of OpenWriter, WriteRecords, CloseWriter and CloseWriters. open-writer returns own<writer>, a resource whose only constructor field is writer-id, with write-records (the answer has the first and the last offset) and close. The epoch and the sequence stay in the crate.

The interface is marked @nexus.client-only and has no endpoint. Its doc lines say it isn't a Temporal API and that no server serves it. So nexgen generates only a caller and a Writer class for Activities and clients, over an extension-call transport, and nothing on the Workflow or System Nexus path.

It is a second file in its own package, temporal:streams, which uses the Stream service types. In sdk-python, the Stream bindings are imported while temporalio.contrib.streams initializes. The writer models reference temporalio.contrib.streams.proto.v1.extension_pb2, which can't be reached at that point. A separate file gives the writer its own generated package, which the facade imports once the package is loaded.

tests/wit.rs checks the 100-column rule for both files, the client-only marker and the four operation names.

Why?

Decision S87: the Activity and client handles wrap two generated resources, Stream and Writer, so the writer surface comes from the IDL too. Open for Tim: nexgen describing an in-process call surface, not only Nexus operations.

How did you test it?

cargo test --test wit in crates/streams, and cargo fmt --all --check. With moetemp/nexgen#45, the generated sdk-python writer package passes pyright with 0 errors. Over an extension-style transport, it opened a writer, wrote one Record and closed it against a fake extension.

git fetch origin moe/brook/v4/s17-writer-wit && git checkout FETCH_HEAD
cd crates/streams && cargo test --test wit

Stacked on #32 (moe/brook/v4/s16-stream-resource).

@moetemp

moetemp commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

Closing as stale. This layer is folded into the v5 tip, #41, 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