Skip to content

[Brook] feat: generate resource classes for WIT resources in all targets - #45

Closed
moetemp wants to merge 67 commits into
moe/brook/v3/n7-long-poll-loopfrom
moe/brook/v3/n8-stream-resource
Closed

moetemp wants to merge 67 commits into
moe/brook/v3/n7-long-poll-loopfrom
moe/brook/v3/n8-stream-resource

Conversation

@moetemp

@moetemp moetemp commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

What changed?

This PR fits nexgen's resources to the Brook Stream and Writer handles. It merges the upstream PRs #48 to #53, #56 and #57. Fork-only:

  • @nexus.client-only, for the Brook writer's in-process call surface.
  • iter_<method> on a Workflow resource for a long poll over offsets.
  • The proto enum module import, until upstream settles proto enum typing.
  • @nexus.doc on the client resource classes.

Why?

Decisions S84 to S87: the Stream and Writer handles come from the IDL, reads are an iterator, handles are immutable values, and the writer is a client-only WIT interface.

How did you test it?

tests/wit_streaming.rs checks the Workflow resource iterator and a client-only service.

A required method parameter after an optional one makes the method keyword-only, lists default to
empty, enum parameters import their proto module, and a required resource field from the response is
checked.
The caller gets iter_<operation>, and a bound resource method gets iter_<method>. No wire type
changes, since a WIT stream cannot cross a Nexus call.
The resource binds from the record's message, the other fields come from the same message,
and the message travels as a wire record named after it.
The caller takes a data_converter, and the payloads and failures inside a proto-backed model go
through its converters and codec, as in Workflow code.
A client-only service gets its caller and resource classes in client.py and no Workflow surface,
for an in-process call surface such as the Stream writer.
@moetemp moetemp changed the title [Brook] Generated Python resource classes for WIT resources with methods. [Brook] Generated resource classes for WIT resources in all targets. Oct 22, 2026
# Conflicts:
#	tests/generate_typescript.rs
#	xtask/src/build_examples.rs
# Conflicts:
#	advanced/samples/dotnet/wit/user-service/Models.cs
#	advanced/samples/dotnet/wit/user-service/Resources.cs
#	advanced/samples/dotnet/wit/user-service/Services.cs
#	advanced/samples/go/userservice/userservice.go
#	advanced/samples/inputs/user-service.wit
#	advanced/samples/python/tests/test_user_service.py
#	advanced/samples/python/wit/user_service/__init__.py
#	advanced/samples/python/wit/user_service/_resources/user.py
#	advanced/samples/python/wit/user_service/models.py
#	advanced/samples/python/wit/user_service/services.py
#	advanced/samples/typescript/tests/user-service.test.ts
#	advanced/samples/typescript/wit/user-service/index.ts
#	advanced/samples/typescript/wit/user-service/models.ts
#	advanced/samples/typescript/wit/user-service/resources.ts
#	advanced/samples/typescript/wit/user-service/services.ts
#	src/generator/python.rs
#	tests/generate_python.rs
# Conflicts:
#	advanced/samples/inputs/examples.toml
# Conflicts:
#	advanced/samples/README.md
#	advanced/samples/inputs/examples.toml
#	xtask/src/build_examples.rs
# Conflicts:
#	advanced/samples/inputs/user-service.wit
@moetemp

moetemp commented Oct 26, 2026

Copy link
Copy Markdown
Owner Author

Closed in favor of the review chain. Its two remaining parts are #57 (the client resource docstrings) and #74 (@nexus.client-only), on top of the rebased [UPSTREAM-*] PRs (plan: Brook: code review and upstream plan). The branch stays, since the superproject's prototype pin 204b566e is on it.

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