Files
cleveragents-core/features/memory_service_clock_wait.feature
HAL9000 0a5afc43c3 chore: fix CI pipeline flakiness by stabilizing test fixtures and assertions
Replace four time.sleep(0.01) timestamp guards in
memory_service_coverage_steps.py with a deterministic
_wait_for_clock_advance() helper that busy-waits on the monotonic
clock until the UTC clock actually advances past the recorded
before timestamp, bounded by a 2-second deadline.

Also introduce memory_service_clock_wait.feature and its step
definitions to verify the helper raises AssertionError on deadline
exceeded and returns normally once the clock advances.

Closes #9963
2026-06-14 17:15:04 -04:00

26 lines
1.2 KiB
Gherkin

Feature: Memory service clock-advance guard determinism
As a CleverAgents developer
I want the _wait_for_clock_advance() helper to behave deterministically
So that entity-tracking tests never produce spurious timestamp failures on fast CI runners
# This feature verifies the monotonic busy-wait helper introduced in
# features/steps/memory_service_coverage_steps.py to replace the four
# bare time.sleep(0.01) guards that caused intermittent timestamp failures
# on heavily-loaded CI runners (issue #9963).
#
# The helper spins on the monotonic clock until the UTC clock has advanced
# past the supplied `before` timestamp, raising AssertionError if the
# deadline is exceeded.
@mock_only
Scenario: Clock-advance guard raises AssertionError when deadline is exceeded
Given a zero-second clock-advance deadline
When I invoke the clock-advance guard with a future timestamp
Then an AssertionError should be raised mentioning the deadline
@mock_only
Scenario: Clock-advance guard returns successfully once the clock advances
Given the UTC clock will advance on the next check
When I invoke the clock-advance guard with the current timestamp
Then the guard should return without raising