okami.mom/albedo
git clone https://git.nkp.pet/okami.mom/albedo
8a09b71
main
1//// A warm tick that fires late is dropped only when the cache is probably 2//// gone. The grace is the margin the interval leaves less the ping's 5s 3//// landing time, floored at the scheduler's jitter: the e2e fixture's 3s TTL 4//// leaves 300ms, which a loaded machine overruns, while a real 5m TTL leaves 5//// 25s. E2E cannot make a tick late on demand, so the arithmetic is pinned 6//// here. 7 8import albedo/harness/extensions/warm/extension 9import gleeunit/should 10 11pub fn a_real_ttl_keeps_its_margin_less_the_landing_test () -> Nil { 12// claude's 5m tier: pings every 270s, 30s of margin, 25s of grace 13extension . latest_ms ( 270_000 , 300_000 , 270_000 ) 14|> should . equal ( 295_000 ) 15} 16 17pub fn the_hour_tier_keeps_its_margin_less_the_landing_test () -> Nil { 18// pings every 3240s, 360s of margin, 355s of grace 19extension . latest_ms ( 3_240_000 , 3_600_000 , 3_240_000 ) 20|> should . equal ( 3_595_000 ) 21} 22 23pub fn a_tick_still_inside_the_cache_lifetime_pings_test () -> Nil { 24// 20s late at the 5m tier: the cache lives 10s more, so the ping goes out 25{ 270_000 + 20_000 <= extension . latest_ms ( 270_000 , 300_000 , 270_000 ) } 26|> should . be_true 27} 28 29pub fn a_short_ttl_keeps_the_jitter_floor_test () -> Nil { 30// the fixture's 3s TTL: 2.7s interval, 300ms margin, under the landing time 31extension . latest_ms ( 2700 , 3000 , 2700 ) 32|> should . equal ( 4700 ) 33} 34 35pub fn a_sleeping_machine_is_past_every_grace_test () -> Nil { 36// woken an hour after the 5m tier's tick was due 37{ 270_000 + 3_600_000 > extension . latest_ms ( 270_000 , 300_000 , 270_000 ) } 38|> should . be_true 39}