fix(e2e): poll for both spend rows before asserting the cache-hit contract (#34968)

The cache-hit and paid rows for the two driver calls flush from different
pods on independent update_spend timers, so waiting only for the cache-hit
row can return a half-arrived result set where the paid-row assertion then
fails on an empty list. Requiring both row kinds in the poll predicate lets
the existing deadline absorb the slower flush without weakening any assertion
This commit is contained in:
ryan-crabbe-berri 2026-07-28 11:21:36 -07:00 committed by GitHub
parent b930e2fc2b
commit 01ffd1296b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -230,7 +230,9 @@ def test_cache_hit_is_zero_cost_and_suffixed(
_ = unwrap(client.chat(scoped_key, "gemini-2.5-flash", prompt, max_tokens=16))
rows = client.poll_logs_for_key(
scoped_key, predicate=lambda rs: any(r.cache_hit == "True" for r in rs)
scoped_key,
predicate=lambda rs: any(r.cache_hit == "True" for r in rs)
and any(r.cache_hit != "True" for r in rs),
)
cache_row = _require_row(
rows,