Skip to content

[Nexus] Migrate event definition tests from HSM to CHASM#9597

Merged
gow merged 14 commits intonexus/hsm-to-chasm-migrationfrom
cg/nexus/history_events_registry_4
Mar 26, 2026
Merged

[Nexus] Migrate event definition tests from HSM to CHASM#9597
gow merged 14 commits intonexus/hsm-to-chasm-migrationfrom
cg/nexus/history_events_registry_4

Conversation

@gow
Copy link
Copy Markdown
Contributor

@gow gow commented Mar 20, 2026

What changed?

Migrating all the event definition's Apply() method from HSM to CHASM. Also migrated unit tests.

Why?

HSM to CHASM migration

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)

Note

Medium Risk
Changes Nexus operation lifecycle handling by moving scheduling/cancellation and terminal event application into CHASM event definitions and adjusting state transition semantics; regressions could affect operation task emission, cancellation timing, and cleanup during replay/reset.

Overview
Implements CHASM-based Nexus operation event Apply() handlers: scheduled/cancel-requested/started now create or update the in-memory operation component (including spawning/scheduling a cancellation child once an operation token exists), and terminal events (completed/failed/canceled/timed-out) transition the operation then remove it from the workflow.

Refactors workflow Nexus operation storage to be keyed by ScheduledEventId (int64), simplifies command handlers to only emit history events (letting event definitions create/update components), and expands cancellation/operation state machines with concrete task emission and retry/backoff metadata. Updates chasm.Transition.Apply to run transition logic before mutating state (enabling source-state inspection) and adds new CHASM-focused unit tests for the migrated event definitions and updated transition behavior.

Written by Cursor Bugbot for commit c0f4e55. This will update automatically on new commits. Configure here.

@gow gow requested review from a team as code owners March 20, 2026 05:05
@gow gow force-pushed the cg/nexus/history_events_registry_4 branch from 56ab33a to 4f251ef Compare March 20, 2026 05:07
@gow gow force-pushed the cg/nexus/history_events_registry_3 branch from 28694e4 to 2d24633 Compare March 23, 2026 22:15
Base automatically changed from cg/nexus/history_events_registry_3 to nexus/hsm-to-chasm-migration March 24, 2026 03:36
@gow gow force-pushed the nexus/hsm-to-chasm-migration branch from f30fdd3 to 52e97cd Compare March 24, 2026 03:45
@gow gow requested review from a team as code owners March 24, 2026 03:45
@gow gow force-pushed the nexus/hsm-to-chasm-migration branch from 52e97cd to 447bbda Compare March 24, 2026 06:06
@gow gow force-pushed the cg/nexus/history_events_registry_4 branch from 4f251ef to 8a4616e Compare March 24, 2026 06:06
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

@gow gow force-pushed the cg/nexus/history_events_registry_4 branch from 8a4616e to 9c03b67 Compare March 24, 2026 06:14
@gow gow requested review from bergundy and stephanos March 24, 2026 06:15
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.

This looks mostly good to me.

key := strconv.FormatInt(scheduledEventID, 10)
field, ok := wf.Operations[key]
if !ok {
return nil, "", fmt.Errorf("nexus operation not found for scheduled event ID %d", scheduledEventID)
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 be a not found service error or something else that we can safely handle.

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.

Done.

scheduledEventID int64,
) (*nexusoperation.Operation, string, error) {
key := strconv.FormatInt(scheduledEventID, 10)
field, ok := wf.Operations[key]
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.

Operations should be a map of int64 to Operation, no need to do this formatting.

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.

Done.

attrs := event.GetNexusOperationScheduledEventAttributes()

scheduledTime := event.GetEventTime()
if scheduledTime == 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.

Is this ever going to be nil?

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 don't think so. except maybe in some tests where we hand construct events. This check is not needed removed it.

return chasmworkflow.ErrEventNotCherryPickable
}

// CancelRequestedEventDefinition
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 like having docstrings on every exported member but this doesn't really do anything.

}

cancellation, ok := op.Cancellation.TryGet(ctx)
if !ok {
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 never expected because how would a cancelation request be submitted without a cancelation state machine?

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 added this just defensively. But could this happen in the event of data corruption?

}

if err := nexusoperation.TransitionStarted.Apply(op, ctx, nexusoperation.EventStarted{
OperationToken: attrs.GetOperationToken(),
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're going to need to store the links here for standalone.

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.

Added a TODO

return err
}

if err := nexusoperation.TransitionSucceeded.Apply(op, ctx, nexusoperation.EventSucceeded{}); err != 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're going to need more information here for standalone but we can handle that later.

}

// getOperation looks up a Nexus operation from the workflow by its scheduled event ID.
func getOperation(
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 wouldn't need this function if we used a map of int64 to Operation as I've mentioned before to represent the operations in the workflow.

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.

Done.

}

func TestCancelRequestCompletedEventDefinitionApply(t *testing.T) {
t.Run("transitions cancellation to succeeded", 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.

Do we need a separate subtest here?

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.

No. Removed it (here and in few other tests)

nexusoperationpb.CANCELLATION_STATUS_BACKING_OFF,
func(c *Cancellation, ctx chasm.MutableContext, event EventCancellationAttemptFailed) error {
return serviceerror.NewUnimplemented("unimplemented")
// TODO: implement backing off logic similar to operation's transitionAttemptFailed
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 the TODO?

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.

Was thinking of doing it along with cancellation executors.
Migrated it from HSM

@gow gow force-pushed the nexus/hsm-to-chasm-migration branch from 447bbda to 3bd0557 Compare March 25, 2026 21:10
@gow gow force-pushed the cg/nexus/history_events_registry_4 branch from d14344b to 18f14c3 Compare March 25, 2026 21:11
@gow gow force-pushed the nexus/hsm-to-chasm-migration branch from 3bd0557 to 66234d5 Compare March 26, 2026 06:09
@gow gow requested a review from a team as a code owner March 26, 2026 06:09
@gow gow force-pushed the cg/nexus/history_events_registry_4 branch from 18f14c3 to c0f4e55 Compare March 26, 2026 06:11
@gow gow merged commit 7c63225 into nexus/hsm-to-chasm-migration Mar 26, 2026
47 checks passed
@gow gow deleted the cg/nexus/history_events_registry_4 branch March 26, 2026 16:59
gow added a commit that referenced this pull request Mar 27, 2026
## What changed?
Migrating all the event definition's `Apply()` method from HSM to CHASM.
Also migrated unit tests.

## Why?
HSM to CHASM migration

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes Nexus operation lifecycle handling by moving
scheduling/cancellation and terminal event application into CHASM event
definitions and adjusting state transition semantics; regressions could
affect operation task emission, cancellation timing, and cleanup during
replay/reset.
> 
> **Overview**
> Implements CHASM-based Nexus operation event `Apply()` handlers:
scheduled/cancel-requested/started now create or update the in-memory
operation component (including spawning/scheduling a cancellation child
once an operation token exists), and terminal events
(completed/failed/canceled/timed-out) transition the operation then
remove it from the workflow.
> 
> Refactors workflow Nexus operation storage to be keyed by
`ScheduledEventId` (`int64`), simplifies command handlers to only emit
history events (letting event definitions create/update components), and
expands cancellation/operation state machines with concrete task
emission and retry/backoff metadata. Updates `chasm.Transition.Apply` to
run transition logic before mutating state (enabling source-state
inspection) and adds new CHASM-focused unit tests for the migrated event
definitions and updated transition behavior.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c0f4e55. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
gow added a commit that referenced this pull request Mar 27, 2026
## What changed?
Migrating all the event definition's `Apply()` method from HSM to CHASM.
Also migrated unit tests.

## Why?
HSM to CHASM migration

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes Nexus operation lifecycle handling by moving
scheduling/cancellation and terminal event application into CHASM event
definitions and adjusting state transition semantics; regressions could
affect operation task emission, cancellation timing, and cleanup during
replay/reset.
> 
> **Overview**
> Implements CHASM-based Nexus operation event `Apply()` handlers:
scheduled/cancel-requested/started now create or update the in-memory
operation component (including spawning/scheduling a cancellation child
once an operation token exists), and terminal events
(completed/failed/canceled/timed-out) transition the operation then
remove it from the workflow.
> 
> Refactors workflow Nexus operation storage to be keyed by
`ScheduledEventId` (`int64`), simplifies command handlers to only emit
history events (letting event definitions create/update components), and
expands cancellation/operation state machines with concrete task
emission and retry/backoff metadata. Updates `chasm.Transition.Apply` to
run transition logic before mutating state (enabling source-state
inspection) and adds new CHASM-focused unit tests for the migrated event
definitions and updated transition behavior.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c0f4e55. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
gow added a commit that referenced this pull request Mar 30, 2026
## What changed?
Migrating all the event definition's `Apply()` method from HSM to CHASM.
Also migrated unit tests.

## Why?
HSM to CHASM migration

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes Nexus operation lifecycle handling by moving
scheduling/cancellation and terminal event application into CHASM event
definitions and adjusting state transition semantics; regressions could
affect operation task emission, cancellation timing, and cleanup during
replay/reset.
> 
> **Overview**
> Implements CHASM-based Nexus operation event `Apply()` handlers:
scheduled/cancel-requested/started now create or update the in-memory
operation component (including spawning/scheduling a cancellation child
once an operation token exists), and terminal events
(completed/failed/canceled/timed-out) transition the operation then
remove it from the workflow.
> 
> Refactors workflow Nexus operation storage to be keyed by
`ScheduledEventId` (`int64`), simplifies command handlers to only emit
history events (letting event definitions create/update components), and
expands cancellation/operation state machines with concrete task
emission and retry/backoff metadata. Updates `chasm.Transition.Apply` to
run transition logic before mutating state (enabling source-state
inspection) and adds new CHASM-focused unit tests for the migrated event
definitions and updated transition behavior.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c0f4e55. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
gow added a commit that referenced this pull request Apr 1, 2026
## What changed?
Migrating all the event definition's `Apply()` method from HSM to CHASM.
Also migrated unit tests.

## Why?
HSM to CHASM migration

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes Nexus operation lifecycle handling by moving
scheduling/cancellation and terminal event application into CHASM event
definitions and adjusting state transition semantics; regressions could
affect operation task emission, cancellation timing, and cleanup during
replay/reset.
> 
> **Overview**
> Implements CHASM-based Nexus operation event `Apply()` handlers:
scheduled/cancel-requested/started now create or update the in-memory
operation component (including spawning/scheduling a cancellation child
once an operation token exists), and terminal events
(completed/failed/canceled/timed-out) transition the operation then
remove it from the workflow.
> 
> Refactors workflow Nexus operation storage to be keyed by
`ScheduledEventId` (`int64`), simplifies command handlers to only emit
history events (letting event definitions create/update components), and
expands cancellation/operation state machines with concrete task
emission and retry/backoff metadata. Updates `chasm.Transition.Apply` to
run transition logic before mutating state (enabling source-state
inspection) and adds new CHASM-focused unit tests for the migrated event
definitions and updated transition behavior.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c0f4e55. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
gow added a commit that referenced this pull request Apr 3, 2026
## What changed?
Migrating all the event definition's `Apply()` method from HSM to CHASM.
Also migrated unit tests.

## Why?
HSM to CHASM migration

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes Nexus operation lifecycle handling by moving
scheduling/cancellation and terminal event application into CHASM event
definitions and adjusting state transition semantics; regressions could
affect operation task emission, cancellation timing, and cleanup during
replay/reset.
> 
> **Overview**
> Implements CHASM-based Nexus operation event `Apply()` handlers:
scheduled/cancel-requested/started now create or update the in-memory
operation component (including spawning/scheduling a cancellation child
once an operation token exists), and terminal events
(completed/failed/canceled/timed-out) transition the operation then
remove it from the workflow.
> 
> Refactors workflow Nexus operation storage to be keyed by
`ScheduledEventId` (`int64`), simplifies command handlers to only emit
history events (letting event definitions create/update components), and
expands cancellation/operation state machines with concrete task
emission and retry/backoff metadata. Updates `chasm.Transition.Apply` to
run transition logic before mutating state (enabling source-state
inspection) and adds new CHASM-focused unit tests for the migrated event
definitions and updated transition behavior.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c0f4e55. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
bergundy pushed a commit to bergundy/temporal that referenced this pull request Apr 7, 2026
…9597)

## What changed?
Migrating all the event definition's `Apply()` method from HSM to CHASM.
Also migrated unit tests.

## Why?
HSM to CHASM migration

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes Nexus operation lifecycle handling by moving
scheduling/cancellation and terminal event application into CHASM event
definitions and adjusting state transition semantics; regressions could
affect operation task emission, cancellation timing, and cleanup during
replay/reset.
> 
> **Overview**
> Implements CHASM-based Nexus operation event `Apply()` handlers:
scheduled/cancel-requested/started now create or update the in-memory
operation component (including spawning/scheduling a cancellation child
once an operation token exists), and terminal events
(completed/failed/canceled/timed-out) transition the operation then
remove it from the workflow.
> 
> Refactors workflow Nexus operation storage to be keyed by
`ScheduledEventId` (`int64`), simplifies command handlers to only emit
history events (letting event definitions create/update components), and
expands cancellation/operation state machines with concrete task
emission and retry/backoff metadata. Updates `chasm.Transition.Apply` to
run transition logic before mutating state (enabling source-state
inspection) and adds new CHASM-focused unit tests for the migrated event
definitions and updated transition behavior.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c0f4e55. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
bergundy pushed a commit to bergundy/temporal that referenced this pull request Apr 7, 2026
…9597)

## What changed?
Migrating all the event definition's `Apply()` method from HSM to CHASM.
Also migrated unit tests.

## Why?
HSM to CHASM migration

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes Nexus operation lifecycle handling by moving
scheduling/cancellation and terminal event application into CHASM event
definitions and adjusting state transition semantics; regressions could
affect operation task emission, cancellation timing, and cleanup during
replay/reset.
> 
> **Overview**
> Implements CHASM-based Nexus operation event `Apply()` handlers:
scheduled/cancel-requested/started now create or update the in-memory
operation component (including spawning/scheduling a cancellation child
once an operation token exists), and terminal events
(completed/failed/canceled/timed-out) transition the operation then
remove it from the workflow.
> 
> Refactors workflow Nexus operation storage to be keyed by
`ScheduledEventId` (`int64`), simplifies command handlers to only emit
history events (letting event definitions create/update components), and
expands cancellation/operation state machines with concrete task
emission and retry/backoff metadata. Updates `chasm.Transition.Apply` to
run transition logic before mutating state (enabling source-state
inspection) and adds new CHASM-focused unit tests for the migrated event
definitions and updated transition behavior.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c0f4e55. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
bergundy pushed a commit that referenced this pull request Apr 8, 2026
## What changed?
Migrating all the event definition's `Apply()` method from HSM to CHASM.
Also migrated unit tests.

## Why?
HSM to CHASM migration

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes Nexus operation lifecycle handling by moving
scheduling/cancellation and terminal event application into CHASM event
definitions and adjusting state transition semantics; regressions could
affect operation task emission, cancellation timing, and cleanup during
replay/reset.
> 
> **Overview**
> Implements CHASM-based Nexus operation event `Apply()` handlers:
scheduled/cancel-requested/started now create or update the in-memory
operation component (including spawning/scheduling a cancellation child
once an operation token exists), and terminal events
(completed/failed/canceled/timed-out) transition the operation then
remove it from the workflow.
> 
> Refactors workflow Nexus operation storage to be keyed by
`ScheduledEventId` (`int64`), simplifies command handlers to only emit
history events (letting event definitions create/update components), and
expands cancellation/operation state machines with concrete task
emission and retry/backoff metadata. Updates `chasm.Transition.Apply` to
run transition logic before mutating state (enabling source-state
inspection) and adds new CHASM-focused unit tests for the migrated event
definitions and updated transition behavior.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c0f4e55. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
bergundy pushed a commit that referenced this pull request Apr 9, 2026
## What changed?
Migrating all the event definition's `Apply()` method from HSM to CHASM.
Also migrated unit tests.

## Why?
HSM to CHASM migration

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes Nexus operation lifecycle handling by moving
scheduling/cancellation and terminal event application into CHASM event
definitions and adjusting state transition semantics; regressions could
affect operation task emission, cancellation timing, and cleanup during
replay/reset.
> 
> **Overview**
> Implements CHASM-based Nexus operation event `Apply()` handlers:
scheduled/cancel-requested/started now create or update the in-memory
operation component (including spawning/scheduling a cancellation child
once an operation token exists), and terminal events
(completed/failed/canceled/timed-out) transition the operation then
remove it from the workflow.
> 
> Refactors workflow Nexus operation storage to be keyed by
`ScheduledEventId` (`int64`), simplifies command handlers to only emit
history events (letting event definitions create/update components), and
expands cancellation/operation state machines with concrete task
emission and retry/backoff metadata. Updates `chasm.Transition.Apply` to
run transition logic before mutating state (enabling source-state
inspection) and adds new CHASM-focused unit tests for the migrated event
definitions and updated transition behavior.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c0f4e55. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
bergundy pushed a commit that referenced this pull request Apr 9, 2026
## What changed?
Migrating all the event definition's `Apply()` method from HSM to CHASM.
Also migrated unit tests.

## Why?
HSM to CHASM migration

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes Nexus operation lifecycle handling by moving
scheduling/cancellation and terminal event application into CHASM event
definitions and adjusting state transition semantics; regressions could
affect operation task emission, cancellation timing, and cleanup during
replay/reset.
> 
> **Overview**
> Implements CHASM-based Nexus operation event `Apply()` handlers:
scheduled/cancel-requested/started now create or update the in-memory
operation component (including spawning/scheduling a cancellation child
once an operation token exists), and terminal events
(completed/failed/canceled/timed-out) transition the operation then
remove it from the workflow.
> 
> Refactors workflow Nexus operation storage to be keyed by
`ScheduledEventId` (`int64`), simplifies command handlers to only emit
history events (letting event definitions create/update components), and
expands cancellation/operation state machines with concrete task
emission and retry/backoff metadata. Updates `chasm.Transition.Apply` to
run transition logic before mutating state (enabling source-state
inspection) and adds new CHASM-focused unit tests for the migrated event
definitions and updated transition behavior.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c0f4e55. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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