Skip to content

Deduplicate Worker Deployments within a "single" Page#11110

Open
Shivs11 wants to merge 4 commits into
mainfrom
shivam/com-208-list-worker-deployment-dedup
Open

Deduplicate Worker Deployments within a "single" Page#11110
Shivs11 wants to merge 4 commits into
mainfrom
shivam/com-208-list-worker-deployment-dedup

Conversation

@Shivs11

@Shivs11 Shivs11 commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

  • deduplicate Worker Deployment summaries by deployment name within each fetched Visibility page
  • retain the record with the newest workflow start time while preserving the page's first-occurrence ordering
  • keep Visibility pagination state and next-page tokens unchanged
  • cover Continue-As-New, missing-memo, delete-and-recreate, unrelated-deployment, and page-boundary behavior

Root cause

Worker Deployment creation can immediately Continue-As-New, and delete-and-recreate starts another run with the same deployment identity. Because Visibility updates are eventually consistent, the successor start can be visible before the predecessor close update. ListWorkerDeployments previously converted every returned execution into a summary, so overlapping running records in the same Visibility page appeared as duplicate deployments.

This change post-processes only the fetched page. It does not add cross-page state or alter Worker Deployment workflow behavior.

Testing

  • added unit tests that mock visibility to return duplicate data which verifies if the added logic works or not

Note

Low Risk
Read-path-only change to list summarization with bounded per-page logic; deployment workflow behavior and pagination contracts are unchanged.

Overview
ListWorkerDeployments no longer emits one summary per Visibility row when the same deployment appears multiple times on a page (e.g. Continue-As-New or delete/recreate while Visibility is eventually consistent).

After each Visibility fetch, results are post-processed by collapseDuplicateDeploymentSummaries: rows are keyed by deployment name, the run with the latest execution start time wins, and the output keeps the first-seen slot ordering for that page. Next-page tokens are unchanged; dedup does not span pages.

Unit tests mock Visibility to cover newest-run wins (including memo-not-yet-written), mixed deployments on one page, and duplicates split across pages.

Reviewed by Cursor Bugbot for commit 093a07b. Bugbot is set up for automated code reviews on this repo. Configure here.

@Shivs11 Shivs11 changed the title [COM-208] Deduplicate Worker Deployments within Visibility pages Deduplicate Worker Deployments within a "single" Page Jul 16, 2026
@Shivs11
Shivs11 marked this pull request as ready for review July 16, 2026 14:55
@Shivs11
Shivs11 requested a review from a team as a code owner July 16, 2026 14:55
Shivs11 and others added 3 commits July 16, 2026 11:05
- Rename workerDeploymentSummariesFromVisibilityPage ->
  collapseDuplicateDeploymentSummaries to lead with the dedup intent.
- Use a pointer-valued map so the winning record is mutated in place,
  removing the value-copy write-back footgun.
- Add flow comments explaining why duplicate RUNNING records exist
  (immediate CaN + eventually-consistent Visibility), why we key on
  deployment name and tiebreak on raw execution start time, and how the
  slot index preserves first-occurrence ordering.
- Rename the three tests to be behavior-first and add nolint directives
  for the v0.31 GetCurrentVersion deprecation (matching workflow.go).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant