Skip to content

Conversation

@alexshtin
Copy link
Contributor

@alexshtin alexshtin commented Mar 27, 2025

What changed?

CHASM: deserialize ChasmNode into tree node value. This is only first version with few TODOs to be resolved soon.

Why?

CHASM worksream.

How did you test it?

Added unit tests.

Potential risks

No risks.

Documentation

No.

Is hotfix candidate?

No.

@alexshtin alexshtin requested a review from a team as a code owner March 27, 2025 17:33
@alexshtin alexshtin requested a review from yycptt March 27, 2025 17:59
switch genericTypePrefix(fieldT) {
case chasmFieldTypePrefix:
if childNode, found := n.children[fieldN]; found {
// TODO: support chasm.Field[interface], type should go from registry
Copy link
Member

Choose a reason for hiding this comment

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

My thinking is deserialize is dumb and always deserialize to a concrete value and cache it in the value field. The conversion to Interface can be done inside chasm.Field[Interface].Get() implementation.

Either approach works for me and your's is probably cleaner and I'd like to see how Field.Get() is implemented.
I guess what I want to avoid though is duplicated decoding. If the decoded value is already available, then just return it, because for both component and data there's only one underlying *Struct type.

@alexshtin alexshtin enabled auto-merge (squash) March 29, 2025 00:07
@alexshtin alexshtin merged commit f6d43e9 into temporalio:main Mar 29, 2025
49 checks passed
@alexshtin alexshtin deleted the feature/chasm-deserialize branch March 29, 2025 01: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.

2 participants