Skip to content

Conversation

@stephanos
Copy link
Contributor

@stephanos stephanos commented Jan 22, 2026

What changed?

  • Added workflow command handler registry to CHASM's workflow library.
  • Integrated CHASM's workflow library into workflow completion handler.

Why?

Migrating Nexus from HSM to CHASM.

How did you test it?

Tests will be ported over once actual command handler implementations are added.

@stephanos stephanos changed the title CHASM workflow command handler for Nexus CHASM workflow command handler for Nexus [WiP] Jan 22, 2026
@stephanos stephanos force-pushed the nexus-chasm-commands branch 12 times, most recently from 0225b74 to 15b2305 Compare January 22, 2026 18:19
return []*chasm.RegistrableComponent{
chasm.NewRegistrableComponent[*Operation]("operation"),
chasm.NewRegistrableComponent[*Operation]("cancellation"),
chasm.NewRegistrableComponent[*Cancellation]("cancellation"),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right?

@stephanos stephanos force-pushed the nexus-chasm-commands branch 4 times, most recently from 5521052 to 125a6f1 Compare January 22, 2026 18:27
@stephanos stephanos changed the base branch from main to nexus/hsm-to-chasm-migration January 22, 2026 18:27
@stephanos stephanos force-pushed the nexus-chasm-commands branch 3 times, most recently from 3d0f476 to cfe0179 Compare January 22, 2026 18:49
Callbacks chasm.Map[string, *callback.Callback]

// Operations map is used to store the nexus operations for the workflow.
Operations chasm.Map[string, *nexusoperation.Operation]
Copy link
Contributor Author

@stephanos stephanos Jan 22, 2026

Choose a reason for hiding this comment

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

Not used yet, but demonstrates why command registry and types need to live in submodule. If they didn't there'd be an import cycle. Having this already ensures this design will work.

@stephanos stephanos force-pushed the nexus-chasm-commands branch 5 times, most recently from ceadf56 to 69632f8 Compare January 22, 2026 19:32

// FailWorkflowTaskError is an error that can be returned from a [CommandHandler] to fail the current workflow task and
// optionally terminate the entire workflow.
type FailWorkflowTaskError struct {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moving this to CHASM now to break up import cycle.

}

// CommandValidator is a helper for validating workflow commands.
type CommandValidator interface {
Copy link
Contributor Author

@stephanos stephanos Jan 22, 2026

Choose a reason for hiding this comment

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

Moved to CHASM, too. More from this package might be moved in follow-up PRs.

@stephanos stephanos force-pushed the nexus-chasm-commands branch 10 times, most recently from 49c85f6 to 3dca870 Compare January 22, 2026 20:36
// Logger returns a logger tagged with execution key and other chasm framework internal information.
Logger() log.Logger
// Library returns a registered library by name.
Library(name string) (Library, bool)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to add this to be able to access the Workflow library to get the command registry. Let me know if this is in line with the CHASM design!

@stephanos stephanos force-pushed the nexus-chasm-commands branch 4 times, most recently from bf830b5 to b6d0074 Compare January 22, 2026 20:48
@stephanos stephanos requested a review from Copilot January 22, 2026 20:50
ctx chasm.MutableContext,
msPointer chasm.MSPointer,
) *Workflow {
lib, ok := ctx.Library(chasm.WorkflowLibraryName)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's fair to assume that this is always registered.

@stephanos stephanos changed the title CHASM workflow command handler for Nexus [WiP] CHASM workflow command handler for Nexus Jan 22, 2026
@stephanos stephanos marked this pull request as ready for review January 22, 2026 20:58
@stephanos stephanos requested review from a team as code owners January 22, 2026 20:58

This comment was marked as resolved.

@stephanos stephanos force-pushed the nexus-chasm-commands branch from b6d0074 to 920f1f3 Compare January 22, 2026 21:11
) error {
// TODO: Implement CHASM nexus operation cancellation
return serviceerror.NewUnimplemented("CHASM nexus operation cancellation not yet implemented")
}
Copy link
Contributor Author

@stephanos stephanos Jan 22, 2026

Choose a reason for hiding this comment

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

My understanding is that we also want to support standalone Nexus operations, and this here might tie this module to workflows too tightly - so we could move all this into chasm/lib/nexusoperation/nexusworkflow (now or later) to make that distinction clearer.

@stephanos stephanos requested review from gow and pdoerner January 22, 2026 21:15
deps.Config,
)
}),
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copilot suggested moving the initialization from Nexus' fx to here; which made sense to me because of standalone Nexus operations. Having said that, this is also awkward in scenarios like Matching where there is no Nexus (hence the optional deps). Happy to discuss!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(new thought; could move this bit and the command code both into chasm/lib/nexusoperation/nexusworkflow together)

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