Skip to content

Add CHASM Visibility component to CHASM Workflow#10434

Open
rodrigozhou wants to merge 1 commit into
rodrigozhou/chasm-vis-textfrom
rodrigozhou/chasm-wf-vis
Open

Add CHASM Visibility component to CHASM Workflow#10434
rodrigozhou wants to merge 1 commit into
rodrigozhou/chasm-vis-textfrom
rodrigozhou/chasm-wf-vis

Conversation

@rodrigozhou
Copy link
Copy Markdown
Contributor

What changed?

Add CHASM Visibility component to CHASM Workflow

Why?

Support storing custom search attributes and memo in CHASM Workflow.

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)

Potential risks

@rodrigozhou rodrigozhou requested review from a team as code owners May 29, 2026 21:52
@rodrigozhou rodrigozhou force-pushed the rodrigozhou/chasm-wf-vis branch from cbc6ddc to fc07bc7 Compare May 29, 2026 22:07
Copy link
Copy Markdown
Member

@yycptt yycptt left a comment

Choose a reason for hiding this comment

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

PR lgtm but want to understand a bit more on the migration plan. Looks like with this PR we are not doing dual write for custom SA/Memo yet, but workflow will generate both old visibility task and also chasm visibility task?

Comment thread chasm/tree.go
}

// CustomSearchAttributes returns the custom search attributes.
func (w *Workflow) CustomSearchAttributes(ctx chasm.Context) map[string]*commonpb.Payload {
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.

where/how will the following four methods be used?

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.

It will be used in the mutable state. I'll have a PR using those soon.

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.

PR using those functions: #10498


// SearchAttributes returns the predefined search attributes set in the underlying mutable state.
func (w *Workflow) SearchAttributes(ctx chasm.Context) []chasm.SearchAttributeKeyValue {
searchAttributes, err := w.GetPredefinedSearchAttributes()
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 have to deep copy/clone the SAs 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.

We need for backwards compatibility if we need to read search attributes from the mutable state that doesn't contain the metadata type. It's only making a deep copy when necessary, ie., when it doesn't contain the metadata type. Otherwise, it makes a shallow copy.

@awln-temporal
Copy link
Copy Markdown
Contributor

Not related to content of the PR, but what happened to the CODEREVIEWERS requirement?

@yycptt
Copy link
Copy Markdown
Member

yycptt commented Jun 1, 2026

Not related to content of the PR, but what happened to the CODEREVIEWERS requirement?

The PR is not targeting main.

Comment thread chasm/ms_pointer.go
}

// GetPredefinedSearchAttributes retrieves the predefined search attributes from the underlying mutable state.
func (m MSPointer) GetPredefinedSearchAttributes() (map[string]VisibilityValue, error) {
Copy link
Copy Markdown
Contributor

@awln-temporal awln-temporal Jun 1, 2026

Choose a reason for hiding this comment

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

maybe I need more context for this, will predefined search attributes end up getting moved to the Workflow Component's state? I guess I am in general having the same question as Yichao; do visibility tasks end up getting duplicated (MS backed and CHASM backed) in this current implementation?

I guess when I say duplicate here, I mean CHASM visibility tasks end up writing both custom and predefined search attributes, whereas the legacy visibility task only reads mutable state, and writes only predefined search attributes?

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.

also for naming purposes, these predefined search attributes include Predefined and System search attributes right?

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.

Predefined here means really only the predefined search attributes that are stored together with custom search attributes.

At this moment, the idea is that all predefined search attributes are stored in the mutable state, and CHASM Workflow extracts the values from there. Not stored twice.

For custom search attributes, it would be duplicated. More details in a follow up PR. This PR is not really adding any tasks since it doesn't introduce any changes to the CHASM Visibility component.

return ms.executionState
}

func (ms *MutableStateImpl) ExecutionStateUpdated() bool {
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.

what's the purpose of this method?

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.

Execution state is managed in the mutable state currently, and the CHASM Workflow needs to know if the execution state changed to generate CHASM visibility task.

@rodrigozhou rodrigozhou force-pushed the rodrigozhou/chasm-vis-text branch from f53f7e1 to 1322d4b Compare June 2, 2026 23:51
@rodrigozhou rodrigozhou requested review from a team as code owners June 2, 2026 23:51
@rodrigozhou rodrigozhou force-pushed the rodrigozhou/chasm-wf-vis branch from fc07bc7 to c4f86c1 Compare June 2, 2026 23:51
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