Rebased onto the latest fix-tile-wait-budget (which now includes the
merged fix-tile-readiness-check rewrite and Joe Li's independent fix for
the same Celery timelimit tuple-order bug fixed here previously). This
commit re-applies the one fix from the prior local history that wasn't
yet upstream:
take_tiled_screenshot() computed remaining_budget once per tile before
the mandatory scroll-settle sleep (SCROLL_SETTLE_TIMEOUT_MS), then reused
that stale value to cap the chart-readiness wait after the sleep. Since
the settle sleep itself consumes real wall-clock time, this let each tile
overrun the intended budget by up to one settle interval. Recompute
elapsed/remaining_budget after the settle sleep (and re-check for
exhaustion there too, via a small shared closure) before deriving the
readiness-wait timeout; tile_wait_start now anchors both the budget
recompute and the existing per-tile timing measurements.
Also adds the test coverage gap flagged in PR review: a non-None
log_context passed to WebDriverPlaywright.get_screenshot() reaching
take_tiled_screenshot() unchanged was previously untested.
Co-Authored-By: Claude <noreply@anthropic.com>