Skip to content

First-content deadline tests measure private idle time - #1094

Open
zlareb1 wants to merge 1 commit into
mainfrom
fix/search-deadline-fixture-clock
Open

zlareb1 wants to merge 1 commit into
mainfrom
fix/search-deadline-fixture-clock

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 21, 2026

Copy link
Copy Markdown
Member

Related: #998

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry

Not required.

Why

The first-content-leg unit case expects a fake lexical read to finish after 300 ms inside a 400 ms request budget. The budget starts before setup, so unrelated CPU scheduling can consume the margin before either fake read starts. A controlled 120 ms pre-leg clock jump reproduces the assertion that both legs time out; its zero-jump neighbour passes. The original CI scheduling cause is unknown.

The case uses a private event loop whose clock advances only while idle. Fake sleeps, request budgets and elapsed-time assertions share that clock. Production deadline code remains unchanged, and this fixture does not qualify wall-clock latency.

Scope and risk

One existing unit module changes. The private clock applies to the first-content-leg case and its new controls. Every original test body, fake delay, request deadline and assertion remains unchanged. A blocked-leg control still requires an empty partial result and cancellation of both legs. Another control drains and rejects a task left on the private loop.

Module-local facades restore their bindings on exit. The standard clock and asyncio modules remain intact. The fixture relies on the selector loop used by the unit test platform.

Compatibility, rollout and rollback

  • Wire: none.
  • Operator steps: none.
  • Rollback: revert the test-only change; no stored data or generated files change.

Tests

  • Controlled regression: one failure and one passing neighbour before the clock fixture; the same two cases pass after it.
  • .venv/bin/python -m pytest tests/unit/test_code_search_deadline.py -q --override-ini=addopts=: 29 passed.
  • Ruff lint and format checks and git diff --check pass.
  • AST comparison retains all 25 original test bodies and all 74 original assertions.
  • Full hosted CI and a fresh independent whole-diff review remain required.

AI assistance in the code

  • AI-generated: Codex wrote the fixture and controls. The original test bodies, timing inputs, production source and focused results were checked.

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

Checklist

  • Full required hosted CI passes; local checks are limited to this concern.
  • Generated files: not applicable.
  • Migrations: not applicable.
  • Shipped plugin files and versions: not applicable.
  • Frontend: not applicable.
  • Docs and operator steps: not applicable.
  • Repository text contains no private operational details.
  • Commits are signed off.

The fake leg delays and request budget share a private event loop clock. Preserve the original timing inputs and assertions, and require blocked legs to time out and cancel.

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

vercel Bot commented Nov 21, 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 Nov 21, 2026 12:37am 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