mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
## 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] > Adds revision-number semantics to task dispatch/versioning and introduces a new per-deployment TQ user-data schema, updating APIs, persistence, and server logic (DC-gated) with comprehensive tests. > > - **APIs (proto changes)**: > - Add `revision_number` to `taskqueue.v1.TaskVersionDirective` and propagate `task_dispatch_revision_number` in History `Record*TaskStarted` requests. > - Matching `SyncDeploymentUserDataRequest`: new fields `deployment_name`, `update_routing_config`, `upsert_versions_data`, `forget_versions`; response includes `routing_config_changed`. Deprecate old `update_version_data`/`forget_version` oneof. > - Deployment API: add `WorkerDeploymentVersionData`; mark `DeploymentVersionData` deprecated where applicable. > - **Persistence (task queue user data)**: > - Extend `DeploymentData` with `deployments_data` (map of deployment → `WorkerDeploymentData` holding `RoutingConfig` and per-build version data). Deprecate legacy `versions` and `unversioned_ramp_data` fields. > - **Server logic**: > - Matching/History: compute target version using revision numbers; start workflow deployment transitions using revision-aware decisions; support mixed old/new schemas when calculating current/ramping. > - Matching: new helpers to migrate/clean old-format entries, apply routing-config updates atomically, and prevent query blackholes using status. > - Task dispatch carries and records revision number; internal task struct/plumbing updated. > - **Dynamic config**: > - Add `system.useRevisionNumberForWorkerVersioning` (plumbed through History/Matching) to gate new behavior. > - **Tests**: > - Add/expand unit and functional tests covering new schema, routing-config updates, revision-number behavior, and propagation. > - **Misc**: > - Describe/Stats paths updated to read both schemas; minor build/deps update (api-go replace). > > <sup>Written by [Cursor Bugbot]() for commit e84f4845067edbb8f65d2b7bac1f579b620db41c. This will update automatically on new commits. Configure [here]().</sup> --------- Co-authored-by: ShahabT <[email protected]>