Skip to content

feat: allow a result record to hold a resource in an own<T> field - #280

Merged
tconley1428 merged 6 commits into
mainfrom
moe/up/result-record-holds-resource-2
Oct 26, 2026
Merged

tconley1428 merged 6 commits into
mainfrom
moe/up/result-record-holds-resource-2

Conversation

@moetemp

@moetemp moetemp commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What changed?

This PR lets an operation return a proto-backed record that holds a resource in an own<T> field, beside the other fields of the same message. Python, TypeScript, .NET and Go generate it. Java refuses it, as it refuses every proto-backed model.

The change is in the second commit, d31e11fb. The first commit makes the stream-service sample's create-stream return create-stream-result { stream, created }, which main can't generate. The third regenerates the workflow-handle .NET models, which fail cargo validate on main today. It also holds #282, which adds a stream-status enum to that create result.

Why?

A create often answers with a handle and with facts about the create, such as whether it made a new stream. An own<T> result alone drops those facts.

How did you test it?

The stream-service goldens cover Python, TypeScript and .NET. Go and the System Nexus path have no golden for a holder record yet. A fixture checks that a holder record needs @nexus.proto. cargo validate passes.


/// @nexus.endpoint "temporal-system" go="__temporal_system" python="__temporal_system"
/// @nexus.service-name "temporal.example.v1.WorkflowRunService"
interface workflow-run-service {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I know I have bad names for existing samples, but we should start naming these based on what we're actually validating. This one being... proto backed records with resources?

Today's compiler can't generate this shape, so this commit has only the WIT.
A create often answers with a handle and with facts about the create, such as whether it made a new object. An own<T> result alone dropped those facts.
The name now says what the sample checks. The WIT keeps its workflow run domain.
@moetemp
moetemp force-pushed the moe/up/result-record-holds-resource-2 branch from f702dac to ffe6ab6 Compare October 26, 2026 19:56
…#282)

The stream service answers a create with the stream's status. Today's compiler plans the proto-backed enum, so the sample needs no compiler change.
Its create-stream returns a proto-backed record that holds the stream, next to created.
@tconley1428
tconley1428 merged commit 68cc857 into main Oct 26, 2026
5 checks passed
@tconley1428
tconley1428 deleted the moe/up/result-record-holds-resource-2 branch October 26, 2026 22:19
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.

2 participants