Skip to content

feat: let a support helper implement a resource method with @nexus.helper - #118

Draft
moetemp wants to merge 3 commits into
moe/up/stream-sample-workflow-writesfrom
moe/up/helper-resource-method
Draft

moetemp wants to merge 3 commits into
moe/up/stream-sample-workflow-writesfrom
moe/up/helper-resource-method

Conversation

@moetemp

@moetemp moetemp commented Nov 14, 2026

Copy link
Copy Markdown
Owner

What changed?

This PR adds @nexus.helper, which lets a helper of the support package implement a resource method.

/// @nexus.function signature="record-predicate"
type read-predicate = placeholder;

/// @nexus.helper python="take_stream"
take: func(timeout: duration, until: option<read-predicate>) -> stream-read;
  • The method binds no operation. Its generated body calls the helper with the resource and the method's parameters.
  • A parameter can be a function of the caller. Its alias uses @nexus.function, and the function stays in the process. A signature function is no longer an operation.
  • A record that only helper methods reach never goes on the wire. So it is a plain model, and it can hold proto-backed records.
  • targets limits a helper method to one target. Only Python takes a helper, and the other languages leave the method out.
  • The stream sample gets take and filter on both Stream classes.

Why?

The Stream API needs methods that are not one wire operation. A take reads many pages in one call and stops at a predicate of the caller. The SDK's support package does that work, and nexgen couldn't generate a method for it.

How did you test it?

cargo validate passes. The stream tests check that each Stream has the methods, that each passes its arguments to its helper, and that a typed use type-checks. A fixture checks the error for @nexus.helper together with @nexus.operation.

Link to a test plan if any -

  • Unit Tests
  • Staging
  • End to End Tests

moetemp and others added 3 commits November 14, 2026 01:29
Stream reads that span many pages need a method that no single operation implements. A helper
method binds no operation, can take a callable of the caller, and only Python makes it.
Client and Workflow code get the same typed reads that stop on a predicate. The support package
gets test doubles, so the tests check what each method passes to its helper.
Authors need the directive, its function arguments and the rule for records that only helper
methods reach. The architecture note covers the backing check that skips those records.

Co-authored-by: Tim Conley <timothy.conley@temporal.io>
@moetemp
moetemp added this pull request to stack #120 November 14, 2026 09:00
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