Skip to content

Conversation

@Shivs11
Copy link
Member

@Shivs11 Shivs11 commented Oct 27, 2025

What changed?

  • This PR adds revision number mechanics to handle task dispatch inconsistencies that could arise since our versioning API's are becoming eventually-consistent.

Why?

  • Making our versioning API's eventually consistent.

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

  • There are risks but they are gated by a dynamic config.

Note

Introduce revision-number mechanics for task dispatch and a new per-deployment routing config/user data schema to handle eventual consistency in worker versioning.

  • Worker Versioning (routing/dispatch):
    • Add revision-number to TaskVersionDirective and propagate as task_dispatch_revision_number through Matching → History for WFT/AT start requests.
    • Mutable state stores versioning revision; StartDeploymentTransition now accepts and records it; directive builders include revision.
    • Matching computes and carries taskDispatchRevisionNumber from routing config vs directive and selects target queue accordingly (gated by dynamic config UseRevisionNumberForWorkerVersioning).
  • APIs/Proto:
    • Mark DeploymentVersionData deprecated; add WorkerDeploymentVersionData.
    • Extend Matching SyncDeploymentUserDataRequest with deployment_name, update_routing_config, upsert_versions_data, forget_versions; response adds routing_config_changed.
    • Add new persistence schema: DeploymentData.deployments_data (map) and WorkerDeploymentData{routing_config, versions}.
    • Update Describe/Query paths to read/write both old and new schemas; build IDs surfaced from new schema.
  • Logic helpers:
    • New FindTargetDeploymentVersionAndRevisionNumberForWorkflowID and enhanced CalculateTaskQueueVersioningInfo to reconcile old/new data and return revision numbers.
    • Helpers to clear/unset routing config fields and to remove versions across schemas.
  • Configs:
    • Add dynamic config system.useRevisionNumberForWorkerVersioning and plumb into History/Matching.
  • Tests:
    • Add/extend unit and functional tests for new schema, dispatch revision logic, and propagation; update mocks.
  • Misc:
    • go.mod replace for updated API; generated proto files updated accordingly.

Written by Cursor Bugbot for commit f5a5f6e. This will update automatically on new commits. Configure here.

@Shivs11 Shivs11 requested review from a team as code owners October 31, 2025 03:24
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

…ping only when no other version in any deployment is current/ramping
dst := make([]*deploymentspb.DeploymentVersionData, 0, len(oldVersions))
for _, dv := range oldVersions {
if dv.GetVersion().GetDeploymentName() != req.GetDeploymentName() {
dst = append(dst, dv)
Copy link
Contributor

Choose a reason for hiding this comment

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

need to also add it to tqWorkerDeploymentData.Versions

} else if vd := req.GetUpdateVersionData(); vd != nil {
// [cleanup-public-preview-versioning]
if vd.GetVersion() == nil { // unversioned ramp
if deploymentData.GetUnversionedRampData().GetRoutingUpdateTime().AsTime().After(vd.GetRoutingUpdateTime().AsTime()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

first send the deployment name in the old format then check new format for the deployment name and unset the ramping version and its timestamps

}
changed = true
// only update if the timestamp is more recent
deploymentData.Versions[idx] = vd
Copy link
Contributor

Choose a reason for hiding this comment

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

after doing old stuff, check the new format for the given deployment name and depending on this version being ramping or current, clean up the fields in new format routing config.

deploymentData.Versions = append(deploymentData.Versions, vd)
}
} else if v := req.GetForgetVersion(); v != nil {
// TODO (Shivam): Remove versions from both places.
Copy link
Contributor

Choose a reason for hiding this comment

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

yup need to remove from both places

changed = true
}
for _, buildID := range req.GetForgetVersions() {
delete(tqWorkerDeploymentData.Versions, buildID)
Copy link
Contributor

Choose a reason for hiding this comment

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

need to remove from old format too.

Also, when all versions of the deployment are removed, clean up the whole deployment data from the upper map.

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