Skip to content

Add "exposed" operation for system nexus endpoint#736

Open
spkane31 wants to merge 17 commits intomasterfrom
spk/signal-with-start
Open

Add "exposed" operation for system nexus endpoint#736
spkane31 wants to merge 17 commits intomasterfrom
spk/signal-with-start

Conversation

@spkane31
Copy link
Copy Markdown
Contributor

@spkane31 spkane31 commented Mar 18, 2026

What changed?
Add nexusannotations/v1 package to define service operations as exposed for Nexus handlers.

A sample of a code generator that takes use of this command is here

Why?
Enables the system nexus endpoint work in server repo

Breaking changes
NA

Server PR
NA

@spkane31 spkane31 requested review from a team as code owners March 18, 2026 21:41
// (-- api-linter: core::0136::prepositions=disabled
// aip.dev/not-precedent: "With" is used to indicate combined operation. --)
rpc SignalWithStartWorkflowExecution (SignalWithStartWorkflowExecutionRequest) returns (SignalWithStartWorkflowExecutionResponse) {
option (nexus.v1.operation).tags = "exposed";
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For reviewer: this tag can be used by our code generation tool to generate Nexus handler interfaces.

Copy link
Copy Markdown
Contributor

@lina-temporal lina-temporal left a comment

Choose a reason for hiding this comment

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

I like the annotation approach here, I think that even with the downside of a few of the fields being irrelevant in Nexus operation context, it's still the best option for maintainability and adoption across our APIs. Think we're still in discussion on the nature of the codegen, but this part LGTM.

Copy link
Copy Markdown
Member

@bergundy bergundy left a comment

Choose a reason for hiding this comment

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

We have some questions to answer before we can merge this.


import "google/protobuf/descriptor.proto";

option go_package = "github.com/bergundy/nexus-proto-annotations/go/nexus/v1";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The package name here would be different depending on the verdict of where we would want to put these annotations. I don't think we should reference anything in my personal repo.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also note that the annotations already exist in the referenced GH repo, I had to inline them here because the package name nexus was conflicting and confusing our protoc generation pipeline.

@spkane31 spkane31 requested a review from bergundy March 25, 2026 22:21
Copy link
Copy Markdown
Member

@bergundy bergundy left a comment

Choose a reason for hiding this comment

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

Approved, but let's make sure this is at minimum prototyped in the UI and SDK before merging.

go install github.com/bufbuild/buf/cmd/buf@v1.27.0

##### Sync external proto dependencies #####
sync-nexus-annotations:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why don't we have the same make target for google? Seems like we can sync both. But probably don't sync google as part of this PR if there are any changes there, better to do that separately.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should go in nexus-rpc-gen eventually but it's okay if it starts out in this repo.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm fine with what you have here because it gets the job done but the task was to add a proper tool that anybody can use, not something that is specific to our API repo.

continue
}
opOpts := proto.GetExtension(opts, nexusannotationsv1.E_Operation).(*nexusannotationsv1.OperationOptions)
if !slices.Contains(opOpts.GetTags(), "exposed") {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See what https://github.com/bergundy/protoc-gen-go-nexus did here, don't hardcode exposed in the tool, it should be passed as include and exclude tag arguments.

Comment on lines +53 to +56
if err := writeFile(gen, "nexus/temporal-json-schema-models-nexusrpc.yaml", nexusDoc); err != nil {
return err
}
return writeFile(gen, "nexus/temporal-proto-models-nexusrpc.yaml", langsDoc)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These paths needs to be parameters, not hardcoded.

//
// e.g. message "SignalWithStartWorkflowExecutionRequest"
// → "../openapi/openapiv3.yaml#/components/schemas/SignalWithStartWorkflowExecutionRequest"
func openAPIRef(msg protoreflect.MessageDescriptor) string {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

When you write a proper protoc plugin that is reusable, you wouldn't be able to rely on openapi schemas being available in these paths.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've duplicated this code into a draft PR in nexus-rpc/nexus-rpc-gen while we sort out that story: nexus-rpc/nexus-rpc-gen#36

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.

3 participants