Skip to content

test(background_tasks): fix two CI flakes in eager outbox and real-Redis invalidation tests - #881

Merged
antosubash merged 2 commits into
mainfrom
fix/issue-865-bg-flakes
Nov 7, 2026
Merged

antosubash merged 2 commits into
mainfrom
fix/issue-865-bg-flakes

Conversation

@antosubash

Copy link
Copy Markdown
Owner

Summary

Closes #865. Two tests changed; no production code.

  • test_eager_publish_from_a_plain_session_is_delivered
    • It now awaits the delivery task with durable_transport.drain(), under a 15 s asyncio.timeout.
    • Before, it polled the outbox table. The test database is one shared in-memory SQLite connection (StaticPool), so each poll's session ran on the same connection as the eager delivery's transaction.
    • The CI failure was a 15 s poll timeout with no delivery error logged.
    • drain() is how the sibling serialization test already waits.
  • test_background_tasks_invalidation_redis.py
    • An autouse fixture raises PUBLISH_TIMEOUT_SECONDS to the 5 s delivery wait.
    • The CI traceback for test_a_second_worker_does_apply_it shows the 1 s publish timeout cancelling the publisher's first connect inside create_connection. The bus logged "Invalidation broadcast failed" and the message was lost.
    • The production timeout stays covered against a mute broker in test_background_tasks_invalidation_degraded.py.

The production side of the second flake is filed as #880. A cold client's first publish can lose an invalidation to the 1 s budget; the TTL floor still limits how stale the cache gets.

Verification

https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4

…dis invalidation tests

The eager test now awaits the delivery task with drain() instead of polling
the shared in-memory SQLite connection. The real-Redis tests give a publish
the delivery wait's budget: in CI the 1 s publish timeout cancelled the
publisher's first connect and the message was lost.

Closes #865

Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-11-07T13:28:40.014920Z f3f0aaa PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying simple-module-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: f3f0aaa
Status: ✅  Deploy successful!
Preview URL: https://da7ce8f2.simple-module-python.pages.dev
Branch Preview URL: https://fix-issue-865-bg-flakes.simple-module-python.pages.dev

View logs

@antosubash
antosubash merged commit dc72198 into main Nov 7, 2026
17 checks passed
@antosubash
antosubash deleted the fix/issue-865-bg-flakes branch November 7, 2026 13:39
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.

test: two background_tasks wait_for timeouts flaked in CI on PR #864

1 participant