-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[Nexus-HSM-CHASM] Migrate cancellation state transitions #9092
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
gow
wants to merge
3
commits into
nexus/hsm-to-chasm-migration
Choose a base branch
from
cg/nexus/3-cancellation
base: nexus/hsm-to-chasm-migration
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gow
commented
Jan 21, 2026
Comment on lines
19
to
52
| var transitionCancellationScheduled = chasm.NewTransition( | ||
| []nexusoperationpb.CancellationStatus{nexusoperationpb.CANCELLATION_STATUS_UNSPECIFIED}, | ||
| nexusoperationpb.CANCELLATION_STATUS_SCHEDULED, | ||
| func(c *Cancellation, ctx chasm.MutableContext, event EventCancellationScheduled) error { | ||
| return serviceerror.NewUnimplemented("unimplemented") | ||
| // Record when cancellation was requested | ||
| c.RequestedTime = timestamppb.New(event.Time) | ||
|
|
||
| // Emit a cancellation task | ||
| ctx.AddTask(c, chasm.TaskAttributes{}, &nexusoperationpb.CancellationTask{ | ||
| Attempt: c.Attempt, | ||
| }) | ||
|
|
||
| return nil | ||
| }, | ||
| ) | ||
|
|
||
| // EventCancellationRescheduled is triggered when cancellation is meant to be rescheduled after backing off from a | ||
| // previous attempt. | ||
| type EventCancellationRescheduled struct { | ||
| } | ||
|
|
||
| var transitionCancellationRescheduled = chasm.NewTransition( | ||
| []nexusoperationpb.CancellationStatus{nexusoperationpb.CANCELLATION_STATUS_BACKING_OFF}, | ||
| nexusoperationpb.CANCELLATION_STATUS_SCHEDULED, | ||
| func(c *Cancellation, ctx chasm.MutableContext, event EventCancellationRescheduled) error { | ||
| return serviceerror.NewUnimplemented("unimplemented") | ||
| // Clear the next attempt schedule time | ||
| c.NextAttemptScheduleTime = nil | ||
|
|
||
| // Emit a cancellation task for the retry | ||
| ctx.AddTask(c, chasm.TaskAttributes{}, &nexusoperationpb.CancellationTask{ | ||
| Attempt: c.Attempt, | ||
| }) | ||
|
|
||
| return nil |
Contributor
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 2 transitions are identical. Can we merge them into one transition definition? (since a transition takes multiple source states)? Would that be idiomatic chasm code?
pdoerner
approved these changes
Jan 21, 2026
Base automatically changed from
cg/nexus/2-cancellation
to
nexus/hsm-to-chasm-migration
January 21, 2026 23:24
6443639 to
90e445e
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changed?
Migrated the cancellation operation state transitions.
Depends on #9082
Why?
Migrating Nexus from HSM to CHASM
How did you test it?
Note
Implements CHASM-based cancellation state transitions and enriches cancellation metadata for retries and auditing.
Scheduled,Rescheduled,AttemptFailed(with backoff/retry viabackoff.RetryPolicy),Failed, andSucceeded, recordingattempt,requested_time,last_attempt_complete_time, and emittingCancellationTask/CancellationBackoffTaskas appropriateproto/v1/operation.protoCancellationStatewithrequested_time,attempt,last_attempt_complete_time,last_attempt_failure,next_attempt_schedule_time, andrequested_event_id; regeneratesoperation.pb.goWritten by Cursor Bugbot for commit cd18837. This will update automatically on new commits. Configure here.