Skip to content

Nexus Standalone: Poll#9780

Merged
stephanos merged 10 commits intofeature/nexus-standalonefrom
nexus-standalone-poll
Apr 6, 2026
Merged

Nexus Standalone: Poll#9780
stephanos merged 10 commits intofeature/nexus-standalonefrom
nexus-standalone-poll

Conversation

@stephanos
Copy link
Copy Markdown
Contributor

@stephanos stephanos commented Apr 2, 2026

What changed?

Add polling support via PollNexusOperationExecution and DescribeNexusOperationExecution.

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

@stephanos stephanos force-pushed the nexus-standalone-poll branch 18 times, most recently from 2f7e5d1 to 32a04db Compare April 2, 2026 16:55
enums[i] = T(values.Get(i).Number())
}
return enums
}
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.

seems generally useful for exhaustiveness checks in tests

@stephanos stephanos force-pushed the nexus-standalone-poll branch 5 times, most recently from f3da566 to 46661ef Compare April 2, 2026 18:12
@stephanos stephanos force-pushed the feature/nexus-standalone branch from c6a4fe7 to 172314b Compare April 2, 2026 18:22
@stephanos stephanos force-pushed the nexus-standalone-poll branch 3 times, most recently from 40e5047 to aacc175 Compare April 2, 2026 19:33
func TestDescribeStandaloneNexusOperation(t *testing.T) {
t.Parallel()

t.Run("EmptyRunID", func(t *testing.T) {
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.

merged this one into StartAndDescribe above

@stephanos stephanos force-pushed the nexus-standalone-poll branch from aacc175 to 31b0dce Compare April 2, 2026 19:53
@stephanos stephanos force-pushed the nexus-standalone-poll branch 2 times, most recently from 191dbbc to 6c867b4 Compare April 2, 2026 21:26
@stephanos stephanos force-pushed the nexus-standalone-poll branch from 6c867b4 to d027a3e Compare April 2, 2026 21:27
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.

My comments are very minimal. I'm approving but please address before merging.


var LongPollTimeout = dynamicconfig.NewNamespaceDurationSetting(
"nexusoperation.longPollTimeout",
20*time.Second,
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.

We were having discussions on slack for making this default to one minute. Please take note and adjust as we settle the discussion. Not blocking the PR.

var LongPollTimeout = dynamicconfig.NewNamespaceDurationSetting(
"nexusoperation.longPollTimeout",
20*time.Second,
`Timeout for nexus operation long-poll requests.`,
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 think this is the maximum timeout if the context deadline is longer, no?

Comment on lines +108 to +113
if errors.Is(err, chasm.ErrMalformedComponentRef) {
return nil, false, serviceerror.NewInvalidArgument("invalid long poll token")
}
if errors.Is(err, chasm.ErrInvalidComponentRef) {
return nil, false, serviceerror.NewInvalidArgument("long poll token does not match execution")
}
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 saw this copied from the SAA implementation and wondering if we need this translation just for nicer errors strings or if there's a way to use the chasm predefined errors directly, e.g., by having more informative error messages on them.

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'm filing a ticket for this to unblock the merge; giving me more time to hash out a better solution with SAA crew.

case enumspb.NEXUS_OPERATION_WAIT_STAGE_CLOSED:
return o.isClosed()
default:
return false
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.

You should validate these wait stages in the frontend and put a comment here that these are the only ones supported.

The frontend should return an invalid argument error instead of false so if a new client with a new API definition that has another variant here can know that they are running against a server that is too old.

resp.Outcome = &workflowservice.PollNexusOperationExecutionResponse_Result{
Result: successful.GetResult(),
}
} else if failure := outcome.GetFailed().GetFailure(); failure != nil {
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.

We won't always have the response in the outcome field, sometimes we need to get it from the last attempt failure.

This is relevant for describe too. You can see the SAA code for reference.

return serviceerror.NewInvalidArgumentf("operation_id exceeds length limit. Length=%d Limit=%d",
len(req.GetOperationId()), config.MaxIDLengthLimit())
}
if len(req.GetLongPollToken()) > 0 && req.GetRunId() == "" {
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.

We should probably validate the long poll token just in case. That's missing in the SAA validator too.

OperationId: "does-not-exist",
})
var notFound *serviceerror.NotFound
s.ErrorAs(err, &notFound)
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.

Can you also assert that the error message is user friendly? For example does it say nexus operation not found?

s.ErrorAs(err, &notFound)
})

t.Run("WrongRunID", func(t *testing.T) {
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.

Redundant IMHO, you're testing CHASM at this point.

Comment on lines +1315 to +1332
name: "NonExistentOperationID",
request: &workflowservice.PollNexusOperationExecutionRequest{
Namespace: s.Namespace().String(),
OperationId: "non-existent-op",
RunId: startResp.RunId,
WaitStage: enumspb.NEXUS_OPERATION_WAIT_STAGE_CLOSED,
},
expectedErr: notFoundErr,
},
{
name: "NonExistentRunID",
request: &workflowservice.PollNexusOperationExecutionRequest{
Namespace: s.Namespace().String(),
OperationId: "test-op",
RunId: "11111111-2222-3333-4444-555555555555",
WaitStage: enumspb.NEXUS_OPERATION_WAIT_STAGE_CLOSED,
},
expectedErr: notFoundErr,
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 two cases are redundant, the library code doesn't care why an execution is not found, that's the framework's job.

@stephanos stephanos merged commit a4f682a into feature/nexus-standalone Apr 6, 2026
45 checks passed
@stephanos stephanos deleted the nexus-standalone-poll branch April 6, 2026 21:42
stephanos added a commit that referenced this pull request Apr 6, 2026
Add polling support via PollNexusOperationExecution and
DescribeNexusOperationExecution.

- [ ] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [x] added new unit test(s)
- [x] added new functional test(s)
stephanos added a commit that referenced this pull request Apr 6, 2026
Add polling support via PollNexusOperationExecution and
DescribeNexusOperationExecution.

- [ ] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [x] added new unit test(s)
- [x] added new functional test(s)
stephanos added a commit that referenced this pull request Apr 6, 2026
Add polling support via PollNexusOperationExecution and
DescribeNexusOperationExecution.

- [ ] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [x] added new unit test(s)
- [x] added new functional test(s)
stephanos added a commit that referenced this pull request Apr 7, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
stephanos added a commit that referenced this pull request Apr 7, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
stephanos added a commit that referenced this pull request Apr 7, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
stephanos added a commit that referenced this pull request Apr 7, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
stephanos added a commit that referenced this pull request Apr 7, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
stephanos added a commit that referenced this pull request Apr 8, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
stephanos added a commit that referenced this pull request Apr 8, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
stephanos added a commit that referenced this pull request Apr 9, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
stephanos added a commit that referenced this pull request Apr 9, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
stephanos added a commit that referenced this pull request Apr 9, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
stephanos added a commit that referenced this pull request Apr 9, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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