Skip to content

CHASM: improve support for implementing Terminate method#9351

Draft
yycptt wants to merge 2 commits intotemporalio:mainfrom
yycptt:chasm-terminate
Draft

CHASM: improve support for implementing Terminate method#9351
yycptt wants to merge 2 commits intotemporalio:mainfrom
yycptt:chasm-terminate

Conversation

@yycptt
Copy link
Member

@yycptt yycptt commented Feb 19, 2026

What changed?

  • Define TerminableComponent and RootComponent interface
  • Make metrics handler available through chasm context
  • Add support for passing key value pairs with chasm context similar to context.Context
  • Add support for specifying key values pairs that will always be available in the Context when a component is accessed.
  • Add requestID to TerminateComponentRequest

Why?

  • Improve support for library authors to implement the Terminate method.

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)
  • WIP

registry *Registry,
) (bool, error) {
return validator.Validate(
augmentContextForComponent(ctx, component, registry),
Copy link
Member Author

Choose a reason for hiding this comment

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

we can do the same thing for registered tasks as well.

// This is useful for propagating values needed for those processing logic but are not avaiable via the
// component's struct definition, such as configurations.
func WithContextValue(
keyVals map[any]any,
Copy link
Member Author

Choose a reason for hiding this comment

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

since the keyVals are the same across component instances, we don't really need to use context.Context.Value() to implement this which adds overhead. The chasmContext.Value() method can just check the registry for a key. The semantic will be different from context.Context though.

@yycptt yycptt requested a review from bergundy February 19, 2026 02:03
@yycptt yycptt requested a review from awln-temporal February 19, 2026 02:03
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

Comments