Skip to content

Conversation

@yycptt
Copy link
Member

@yycptt yycptt commented Nov 24, 2025

What changed?

  • Use archetypeID everywhere in history service and pass them to persistence

Why?

  • Required to separate ID space work.

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)

}

archetypeID := mutableState.ChasmTree().ArchetypeID()
if archetypeID != chasm.WorkflowArchetypeID {
Copy link
Contributor

Choose a reason for hiding this comment

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

Will it have backward compatibility issue? i.e. for some old workflow which dose not have archetype? And do we need any logic to prevent other Archetype not call this func or return early?

Copy link
Member Author

Choose a reason for hiding this comment

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

Will it have backward compatibility issue?

No there shouldn't be compatibility issue. An empty chasm tree will also return workflow archetypeID.

do we need any logic to prevent other Archetype not call this func or return early?

There's a check early in the function to return error when version history is empty, which applies to all non workflow archetypes.

Comment on lines 261 to 263
// Should be called business_id, but to maintain backward compatibility
// with old type definition used in migration workflows.
string workflow_id = 1;
Copy link
Member

Choose a reason for hiding this comment

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

Not sure sure why we can't call this business ID. Can you explain?

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 used to return commonpb.WorkflowExecution in activity result, which is encoded by the default dataconverter via protojson, so can't directly change the field name...

I can do string business_id = 1 [json_name = "workflowId"]; though, I believe that's still compatible. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

I changed it to string business_id = 1 [json_name = "workflowId"]

Comment on lines 181 to 182
tag.ArchetypeID(c.archetypeID),
tag.NewUInt32("actual-archetype-id", actualArchetypeID),
Copy link
Member

Choose a reason for hiding this comment

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

My concern with these logs is that they're going to be very hard to reason about. Ideally we would resolve the archetype names before logging and emitting other operational information such as metrics and internal errors.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated the logic to do a best effort convert to archetype names.

ArchetypeId: chasm.UnspecifiedArchetypeID,
}

nsDivisionPayload, ok := e.SearchAttributes.IndexedFields[sadefs.TemporalNamespaceDivision]
Copy link
Member

Choose a reason for hiding this comment

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

Is this ensured to not be nil?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated to use GetIndexedFields() and performs nil check on the map.


// TODO: More tests here...

// TODO: add a test to make sure workflow can run successfully when chasm is enabled.
Copy link
Member

Choose a reason for hiding this comment

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

That's technically already covered by the callback tests.

@yycptt
Copy link
Member Author

yycptt commented Nov 25, 2025

Also requires: #8704

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