Skip to content

test(enrichment): expire the delivery budget deterministically in the #24554 tests - #24566

Merged
Git-on-my-level merged 2 commits into
mainfrom
lane/enrichhang-clock
Nov 4, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
lane/enrichhang-clock

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Why

#24554 (merged at 052a59f) turned main red. The slow guardrail tests/unit/test_real_clock_budget_ratchet.py::test_no_new_tiny_real_clock_budgets fails in run 41757772369, job "Backend unit guardrails". Two new tests in tests/unit/test_enrichment_route.py set ENRICHMENT_DELIVERY_BUDGET_SECONDS=0.2, which is a real-clock budget a loaded runner can race.

What

  • The two budget tests no longer shrink the budget. They keep the production 300 s and assert that the route waits on exactly that value.
  • They replace the route module's asyncio.wait_for with a stand-in that expires the budget as soon as the stubbed callback is running. This is ratchet fix 1: the stub expires the budget. The "lease still held" and "re-armed under a fresh wake" assertions therefore no longer depend on scheduler timing.
  • Production code, the production budget and the allowlist are unchanged.

Verification

  • bin/omi-heavy run -- backend/test.sh with BACKEND_UNIT_TEST_FILE_LIST=tests/unit/test_enrichment_route.py: 56 passed.
  • BACKEND_PYTEST_MARK_EXPR=slow on tests/unit/test_real_clock_budget_ratchet.py: 11 passed, including test_no_new_tiny_real_clock_budgets.
    • The local fast-lane CPU-time guard flags the scan itself, at 1.74 s against a 1 s limit. That guard applies to fast-lane tests; this file runs in the slow-guardrail lane.
  • Deploy: none (test-only).

Failure-Class: none

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

…24554 tests

test_real_clock_budget_ratchet::test_no_new_tiny_real_clock_budgets went red on main (run 41757772369):
the two budget tests set ENRICHMENT_DELIVERY_BUDGET_SECONDS=0.2 and raced a real clock. They now keep the
production 300s budget and replace the route's budget wait with one that expires as soon as the callback
is running (ratchet fix 1: the stub expires the budget), so the lease-held and re-arm assertions no longer
depend on scheduler timing. No allowlist entry; production code unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 1 file

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

…running

Luna r1 P2: an ignored running.wait(10) result could simulate the timeout before the callback ran.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit 5cd9a3c into main Nov 4, 2026
59 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/enrichhang-clock branch November 4, 2026 03:03
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