Skip to content

Make heartbeat retry metrics test deterministic - #2767

Open
yuandrew wants to merge 1 commit into
mainfrom
fix/deterministic-heartbeat-retries
Open

yuandrew wants to merge 1 commit into
mainfrom
fix/deterministic-heartbeat-retries

Conversation

@yuandrew

@yuandrew yuandrew commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

What was changed

Make heartbeat retry metrics test deterministic by adding a interceptor that waits for activity retries to complete before completing the activity. The exact retry and failure assertions have been preserved.

Supercedes #2759

Why?

Test flake

Checklist

  1. Closes

  2. How was this tested:

  1. Any docs updates needed?

Note

Low Risk
Integration test-only change; no production SDK behavior is modified.

Overview
Makes TestLongRunningActivityWithHBAndGrpcRetries deterministic by controlling when the activity finishes relative to heartbeat gRPC retries and metrics.

The test stops the suite worker and dials a dedicated client with a unary interceptor on RecordActivityTaskHeartbeat that signals completion (including retries) on a buffered channel. A custom LongRunningHeartbeat activity sends a fixed number of heartbeats and blocks on that channel after each RecordHeartbeat, so no further heartbeats run while a batched RPC is outstanding and the workflow cannot complete until retries and their metrics have finished. Traffic-controller failures and metric assertions are unchanged, with operation names and expected retry counts pulled into named constants (heartbeatOperation, retryCount, etc.).

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

@yuandrew
yuandrew requested a review from a team as a code owner October 10, 2026 13:04
@yuandrew yuandrew added the skip-changelog PR changes do not require changelog updates label Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog PR changes do not require changelog updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant