Skip to content

[Brook] Added the @nexus.one-way marker with a synchronous Python stub. - #38

Closed
moetemp wants to merge 3 commits into
moe/brook/v3/n2-long-poll-parsingfrom
moe/brook/v3/n3-one-way
Closed

moetemp wants to merge 3 commits into
moe/brook/v3/n2-long-poll-parsingfrom
moe/brook/v3/n3-one-way

Conversation

@moetemp

@moetemp moetemp commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

What changed?

This PR adds @nexus.one-way on WIT operations. In Python, both Workflow stubs (_<op>(request) and the keyword form) become synchronous and return None. Each stub still calls nexus_client.start_operation(...), so the call goes through every outbound interceptor, and then drives the start coroutine once with send(None). When an interceptor takes the call and completes it without suspending, the stub returns. When the start suspends, the stub closes it and raises RuntimeError.

TypeScript and .NET accept the directive and keep their async stubs. The directive is refused with arguments, with @nexus.long-poll, with @nexus.output-transform, or on an operation that returns a resource. Python refuses a one-way operation with generic models or function fields.

Why?

publish is synchronous in Workflow code, and today each facade must start the async stub as a background task. A Brook plugin buffers AppendRecords and CloseStream in its outbound interceptor and returns a done handle, so the start never suspends.

How did you test it?

tests/wit_streaming.rs checks the stub shape and the refusals. The new Python tests fail on #37. I also ran a live check on a dev server with temporalio 1.34.0: a Workflow calls the stub three times with an outbound interceptor that records the call and returns at once, and it completes with three calls taken. Without the interceptor the Workflow Task fails with the stub's message.

git fetch origin moe/brook/v3/n3-one-way && git checkout FETCH_HEAD
cargo test --features advanced --test wit_streaming
cargo validate markdown

Stacked on moe/brook/v3/n0-base, which merges #30 to #35 onto main. The branch merges each of them again when it changes. The only conflict is the union of the tests that #31 and #33 append to tests/generate_python.rs.

  • Unit Tests
  • Staging
  • End to End Tests

The Stream WIT no longer marks any operation one-way, so the parser,
generator, tests, docs and changelog fragment go.
@moetemp

moetemp commented Oct 22, 2026

Copy link
Copy Markdown
Owner Author

Reverted out of the stack. The Stream WIT doesn't use @nexus.one-way.

@moetemp moetemp closed this Oct 22, 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