Skip to content

chasm(callbacks): create placeholders for chasm callbacks archetype#8473

Merged
spkane31 merged 11 commits intomainfrom
spk/nexus-concurrent-callers
Oct 15, 2025
Merged

chasm(callbacks): create placeholders for chasm callbacks archetype#8473
spkane31 merged 11 commits intomainfrom
spk/nexus-concurrent-callers

Conversation

@spkane31
Copy link
Copy Markdown
Contributor

What changed?

Create the chasm placeholder structs for Callback port from HSM -> CHASM

Why?

Port HSM -> CHASM

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)
  • No testing needed

Potential risks

None, this code is not used yet

@spkane31 spkane31 marked this pull request as ready for review October 13, 2025 16:20
@spkane31 spkane31 requested review from a team as code owners October 13, 2025 16:20
Comment on lines +38 to +39
// The time when the next attempt is scheduled.
google.protobuf.Timestamp next_attempt_schedule_time = 8;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My experience with the CHASM port of Scheduler is that a lot of these next_*_time fields go away, since you no longer need to be able to regenerate tasks based on component state. Feel free to leave it for now till implementation though.

map<string, string> header = 2;
}

message CHASM {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(minor) We ended up going with Chasm as the casing convention 🤷‍♀️ . Happy to revisit that but we may want to do it codebase-wide.

message InvocationTask {
// The base URL for nexus callbacks.
// Will have other meanings as more callback use cases are added.
string destination = 1;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TaskAttributes already has a Destination field, referring to the destination outbound queue, which may overload the term a little; maybe simply url or nexus_url?

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.

changed to url

}

message BackoffTask {
google.protobuf.Timestamp deadline = 1;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Similarly, if you want to simply specify the task's schedule time, you can use TaskAttributes.ScheduledTime (example for Scheduler's backfiller bumping its own task). That said, if this deadline is configurable by dynamic config, you'll probably want to store it on the task (as you have) so that the deadline sticks.

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 will leave this for now and included a note that it might get removed in the future

}

message BackoffTask {
google.protobuf.Timestamp deadline = 1;
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 deadline is part of the task attributes in chasm.

map<string, string> header = 2;
}

message CHASM {
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 isn't needed.

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.

nit: call this file callback.go or even just component.go

}

func (c *Callback) LifecycleState(_ chasm.Context) chasm.LifecycleState {
return chasm.LifecycleStateRunning
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.

Add a TODO here or just implement this. There are specific states in the enum that are obviously not running states.

Comment thread chasm/lib/callbacks/callbacks.go Outdated
}

func (c *Callback) State() *callbackspb.CallbackState {
return c.CallbackState
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 needs to be a comparable, we typically use an enum for this.

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 library (directory and package) should be called callback singular not callbacks plural.

Comment thread chasm/lib/callbacks/config.go Outdated
)

var RequestTimeout = dynamicconfig.NewDestinationDurationSetting(
"chasm.callbacks.request.timeout",
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.

Apply here and everywhere else please.

Suggested change
"chasm.callbacks.request.timeout",
"chasm.callback.request.timeout",

Comment on lines +58 to +69
message Chasm {
// namespace id of the target state machine.
string namespace_id = 1;
// ID of the workflow that the target state machine is attached to.
string workflow_id = 2;
// Run id of said workflow.
string run_id = 3;
// A reference to the component.
repeated string component_path = 4;
// Method to invoke on target component
string method = 5;
}
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.

Don't need this.

// Trigger for when the workflow is closed.
message WorkflowClosed {}

message Trigger {
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 we can probably get rid of this for now, we can add it back when we have more variants if needed.

// The time when the callback was registered.
google.protobuf.Timestamp registration_time = 3;

temporal.server.api.enums.v1.CallbackState state = 4;
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.

Inline the enum in this file please. We may want to call this Status instead of State to disambiguate.

@spkane31 spkane31 enabled auto-merge (squash) October 15, 2025 17:21
@spkane31 spkane31 merged commit 61dcfa7 into main Oct 15, 2025
57 checks passed
@spkane31 spkane31 deleted the spk/nexus-concurrent-callers branch October 15, 2025 18:05
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