Skip to content

Conversation

@yuandrew
Copy link
Contributor

@yuandrew yuandrew commented Nov 24, 2025

What was changed

Only allow worker heartbeating interval to be between 1s and 60s

Also changed heartbeat test to account for if host_cpu_usage is so low it rounds down to 0.0.

Why?

Checklist

  1. Closes

  2. How was this tested:

  1. Any docs updates needed?

Note

Adds builder validation to enforce heartbeat_interval between 1s and 60s and updates integration tests to use 1s heartbeats with adjusted timings/assertions.

  • Core:
    • RuntimeOptions now uses builder validation to enforce heartbeat_interval in [1s, 60s] and derives Default (default remains Some(60s)) in crates/sdk-core/src/lib.rs.
  • Tests:
    • Update integration tests in crates/sdk-core/tests/integ_tests/worker_heartbeat_tests.rs to use heartbeat_interval(Some(Duration::from_secs(1))) instead of 100ms.
    • Increase sleeps/time thresholds (e.g., 150ms→1500ms, 200ms→2000ms, sleep 200ms→2s) and bump some activity start_to_close_timeout values (1s→5s).
    • Relax host usage assertions from nonzero to >= 0.

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

@yuandrew yuandrew requested a review from a team as a code owner November 24, 2025 17:19
assert_ne!(host_info.current_host_cpu_usage, 0.0);
assert_ne!(host_info.current_host_mem_usage, 0.0);
assert!(host_info.current_host_cpu_usage >= 0.0);
assert!(host_info.current_host_mem_usage >= 0.0);
Copy link

Choose a reason for hiding this comment

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

Bug: Test assertions weakened for CPU and memory usage

The assertions for current_host_cpu_usage and current_host_mem_usage were changed from verifying non-zero values to only checking non-negative values. This weakens the test significantly because it no longer validates that host metrics are actually being collected and reported, only that they aren't negative, which provides minimal value and could allow bugs in metrics collection to go undetected.

Fix in Cursor Fix in Web

@yuandrew yuandrew merged commit 45b1d7e into temporalio:master Nov 25, 2025
33 of 35 checks passed
@yuandrew yuandrew deleted the enforce_heartbeat_interval_bounds branch November 25, 2025 17:20
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.

2 participants