Skip to main content

Wake backoff deduplication

Source: tests/bdd/features/watcher_backoff.feature

Feature: Wake backoff deduplication
The watcher tracks per-(bead, agent) wake history to prevent repeated
wakes when an agent fails to claim a bead within a cron cycle.

@bdd
Scenario: First wake is allowed
Given a watcher state with no prior wakes
When check_wake_backoff is called for bead "ic-1" and agent "atlas"
Then the result should be True

@bdd
Scenario: Within-backoff wake is skipped
Given a watcher state with no prior wakes
And a wake was recorded for bead "ic-1" and agent "atlas" at time 1000000.0
When check_wake_backoff is called for bead "ic-1" and agent "atlas" at time 1000001.0
Then the result should be False

@bdd
Scenario: Post-backoff wake is allowed
Given a watcher state with no prior wakes
And a wake was recorded for bead "ic-1" and agent "atlas" at time 1000000.0
When check_wake_backoff is called for bead "ic-1" and agent "atlas" at time 1000901.0
Then the result should be True

@bdd
Scenario: Max attempts stops all wakes
Given a watcher state with no prior wakes
And 3 wakes were recorded for bead "ic-1" and agent "atlas" long ago
When check_wake_backoff is called for bead "ic-1" and agent "atlas" at time 9999999.0
Then the result should be False

@bdd
Scenario: GC removes beads that left ready status
Given a watcher state with no prior wakes
And a wake was recorded for bead "ic-1" and agent "atlas" at time 1000000.0
And a wake was recorded for bead "ic-2" and agent "atlas" at time 1000000.0
When gc_wake_backoff is called with ready beads {"ic-2"}
Then bead "ic-1" entries are removed from wake_backoff
And bead "ic-2" entries remain in wake_backoff