Skip to content

test: fix flaky bulk-job CI by raising poll timeout to 300s#19

Draft
brendancsmith wants to merge 3 commits into
mainfrom
tests/fix-flaky-bulkjob-timeout
Draft

test: fix flaky bulk-job CI by raising poll timeout to 300s#19
brendancsmith wants to merge 3 commits into
mainfrom
tests/fix-flaky-bulkjob-timeout

Conversation

@brendancsmith

Copy link
Copy Markdown
Owner

Problem

The enhance bulk-job functional tests (tests/functional/clients/test_enhance_client.py) fail intermittently in CI — test_bulkjob_status reports "Bulk job status check did not complete in time", which cascades into every downstream bulk-job assertion (test_bulkjob_results, test_single_bulkjob_result, test_bulkjob_coverage_report, test_bulkjob_stop).

Root cause: these tests hit the live Diffbot API by design — VCR cassettes are gitignored and record_mode="new_episodes" records fresh every run. The 60s poll ceiling in test_bulkjob_status and test_bulkjob_coverage_report is often too short for Diffbot to finish the job, so the poll times out. This is why a matrix leg can pass on 3.12 while failing on 3.11.

Change

  • Raise both bulk-job poll timeouts from 60s → 300s, giving the job room to complete.
  • Document in cassettes/.gitignore that live functional tests are intentional and cassettes must not be committed to force deterministic CI.

Verification

CI on this PR runs the functional suite against the live API — the check here is the verification that the 300s timeout resolves the flakiness.

The enhance bulk-job functional tests hit the live Diffbot API (cassettes
are gitignored, so record_mode="new_episodes" records fresh every run).
A 60s poll ceiling in test_bulkjob_status and test_bulkjob_coverage_report
is often too short for Diffbot to finish the job, causing a timeout that
cascades into every downstream bulk-job assertion.

Raise both poll timeouts to 300s to give the job room to complete.
Explain in the cassettes .gitignore that the functional suite runs against
the live Diffbot API by design, so cassettes must not be committed to force
deterministic CI. Prevents a future contributor from "fixing" bulk-job
flakiness by pinning recordings instead of the poll timeout.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

The bulkjob_coverage_report poll only checked TIMEOUT after a non-error
response, so while the report was still generating (repeated 400s) the
loop could run past the 300s ceiling until the CI job itself timed out.
A non-400 ClientResponseError was also swallowed, spinning the loop with
no sleep and no visible failure.

Check the elapsed time at the top of every iteration so the timeout
applies uniformly, and re-raise any non-400 error instead of retrying.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GFjHh9GV3WyGspDxB2rbLc
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