Skip to content

The streaming retirement test uses the private request clock - #2112

Open
zlareb1 wants to merge 1 commit into
mainfrom
maintenance/stream-retirement-test-clock
Open

zlareb1 wants to merge 1 commit into
mainfrom
maintenance/stream-retirement-test-clock

Conversation

@zlareb1

@zlareb1 zlareb1 commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Related: #2099

Changelog category

  • CI Fix or Improvement

Changelog entry

None.

Why

The streaming retirement test waits half a second for the response body to start. A delayed event-loop turn can expire that watchdog before the body signals entry. Failed unit job

Scope and risk

Run the streaming test on the same private clock used by the retirement cancellation test. The clock advances when the event loop waits for work. The test still checks that retirement refuses while either the stream or its background cleanup is active, and the blocked-wait control checks the half-second deadline.

Compatibility, rollout and rollback

  • Wire and operator steps: none.
  • Rollback: revert the test fixture change.

Tests

  • A 600 ms pause on the event-loop turn after the first watchdog was armed reproduced the timeout at body_entered.wait() on the failed merge, its base and clean main. The same probe passed with this patch.
  • LOOM_ENV_FILE= .venv/bin/python -m pytest -q tests/unit/test_cell_retirement.py -k 'stream_and_response or request_clock or production_child_task or websocket_lifetime' passed.
  • make lint, make typecheck and Ruff formatting passed. The full format gate passed when tested with the dashboard assertion repair in Format the assistant source-link assertion #2107. Clean main still fails that Biome check.
  • The full retirement test file passed 30 tests locally. Four host-identity tests need Linux process metadata.

AI assistance in the code

  • AI-generated with Codex. Reproduced the failed wait and checked that the private clock kept the blocked-wait control bounded.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Focused tests, lint and type checks pass. The format result is recorded above.
  • Generated files, migrations, plugins and frontend assets are out of scope.
  • The commit is signed off.

Note

Low Risk
Test-only change; no production code or runtime behavior.

Overview
Stabilizes test_stream_and_response_background_cleanup_remain_counted by scoping asyncio to the function loop and activating the shared _request_clock fixture—the same setup already used by the production child-task cancellation and request-clock bounded-wait tests.

The test still asserts that retirement stays blocked while the stream body or BackgroundTask cleanup is active; only time progression is driven by the manual clock when the loop blocks in select, so the 0.5s wait_for on body_entered no longer flakes when CI delivers a slow event-loop turn.

Reviewed by Cursor Bugbot for commit 083965a. Bugbot is set up for automated code reviews on this repo. Configure here.

A delayed event-loop turn can expire the entry watchdog before the body handler runs. Advance the test clock only while the loop waits for work.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
@vercel

vercel Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loom-docs Ready Ready Preview Dec 3, 2026 10:40pm UTC
loom-telemetry Ready Ready Preview Dec 3, 2026 10:40pm UTC

Request Review

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant