Loading
test(rate_limit): replace sleep-based TTL assertions with state anchoring
The two TTL invariance tests (\"does not reset the TTL\" on check; \"does not extend the TTL of an existing key\" on peek) both used sleep 1.1 to let Redis's second-resolution TTL clock tick down, then asserted second_ttl < first_ttl. The temporal assertion conflates two things — \"Redis clock moved\" and \"no EXPIRE happened\" — and pays ~1.1s per test. Replace with: pin a distinctive TTL via raw_redis.expire(key, 7) that the rule's period would never produce (60-120), then assert the TTL is still in (1, 7] after the operation under test. A mistaken EXPIRE would have clobbered it back to the rule's period; an unchanged TTL provably means EXPIRE didn't fire. Local suite for evaluator_spec.rb drops from ~2.6s to ~0.4s. Addresses !291 review thread 7e996fa9.