Skip to content

test: deflake request queue fetch-and-handle integration tests#991

Open
vdusek wants to merge 1 commit into
masterfrom
test/deflake-rq-fetch-and-handle
Open

test: deflake request queue fetch-and-handle integration tests#991
vdusek wants to merge 1 commit into
masterfrom
test/deflake-rq-fetch-and-handle

Conversation

@vdusek

@vdusek vdusek commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

test_add_and_fetch_requests[single] (and its siblings test_add_requests_in_batches and test_add_non_unique_requests_in_batch) intermittently failed in CI on queue_operation_info.was_already_handled is False.

The Apify request queue has at-least-once delivery. A request can occasionally be fetched again before the platform propagates its handled state, so mark_request_as_handled reports was_already_handled=True (the state before the update) on the duplicate. The single-mode client already does best-effort local dedup and documents this as a low-probability race and API propagation delay, so the queue contract is at-least-once, not exactly-once.

These tests asserted exactly-once delivery on every mark. They now count only first-time handles (if not was_already_handled), which keeps the handled_request_count == desired_request_count invariant while tolerating the occasional duplicate. See #808.

The Apify request queue has at-least-once delivery, so mark_request_as_handled can occasionally report was_already_handled=True when a request is fetched again before its handled state propagates. Count only first-time handles instead of asserting every mark is the first.
@vdusek vdusek added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels Jun 16, 2026
@vdusek vdusek self-assigned this Jun 16, 2026
@github-actions github-actions Bot added this to the 143rd sprint - Tooling team milestone Jun 16, 2026
@github-actions github-actions Bot added the tested Temporary label used only programatically for some analytics. label Jun 16, 2026
@vdusek vdusek requested a review from Pijukatel June 16, 2026 09:47
@vdusek vdusek marked this pull request as ready for review June 16, 2026 09:48
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.32%. Comparing base (e8cda0a) to head (2b72228).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #991      +/-   ##
==========================================
- Coverage   90.35%   90.32%   -0.04%     
==========================================
  Files          49       49              
  Lines        3089     3089              
==========================================
- Hits         2791     2790       -1     
- Misses        298      299       +1     
Flag Coverage Δ
e2e 36.22% <ø> (ø)
integration 57.42% <ø> (-0.04%) ⬇️
unit 78.92% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants