Repository navigation
Make integration flaky check finish within its time budget (best effort) - #107453
Conversation
The `Integration tests (amd_asan_ubsan, flaky)` job timed out and reported a red failure with 0 results on PR #105171, which mechanically touches ~24 integration test modules. The flaky check runs every changed module under `-n 3 --dist=each` (544 test items x 3 workers) and was killed before it could produce a report. Root cause: the soft `FLAKY_CHECK_TIME_LIMIT` was 90 min, measured from `main` (~91.5 min from the job clock). A lone integration job is cancelled by an external ceiling at ~80-90 min from job start, so the graceful xdist `--session-timeout` and the subprocess hard-kill backstop (which still collects partial results) never fired - the whole process was killed first, leaving an empty result that surfaced as a failure rather than a best-effort partial report. A ~19 min hang on `test_storage_delta` made it worse. Changes to `ci/jobs/integration_test_job.py`: - Lower `FLAKY_CHECK_TIME_LIMIT` from 90 to 45 min, matching the functional flaky check, so the internal timeout/backstop fires and a report is produced well before the external cancellation. Worst-case wall-clock is now ~66 min. - Add `MAX_FLAKY_CHECK_MODULES` (10): when a PR changes more modules than fit the budget, run a deterministic sorted subset and skip the rest on a best-effort basis. The skipped modules are reported as `SKIPPED` entries so the reduced coverage is explicit, not silent. - When no results are collected within the budget, report `SKIPPED` instead of letting an empty result default to `ERROR` and block the PR. CI report: https://github.com/ClickHouse/ClickHouse/actions/runs/27483289227/job/81298702498 PR: #105171 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Workflow [PR], commit [3748267] Summary: ✅ AI ReviewSummaryThis PR makes the integration flaky check best-effort within a bounded time budget: it caps the number of changed integration modules run in one flaky job, lowers the flaky time budget, reports capped modules as Missing context / blind spots
Final VerdictStatus: ✅ Approve No code changes are required from this review. The remaining validation is CI completion / an environment with |
… on timeout The integration flaky/targeted check reports an empty pytest run as a best-effort `SKIPPED` so a fully time-limited run does not block the PR. As written, `empty_best_effort` treated *every* empty result as expected budget exhaustion. But `Result.from_pytest_run` also returns an `ERROR` with an empty `results` list when pytest fails to produce output for an unrelated reason (it crashes before writing `pytest_parallel.jsonl`, or exits with a plugin/internal error and no test rows). Because flaky and targeted checks deliberately do not set `has_error`, such a real harness failure was being forced to `SKIPPED` and the job reported green. Carry an explicit `timed_out` signal out of `run_pytest_and_collect_results`, set when the graceful xdist `--session-timeout` marker is found or when the hard subprocess backstop (`Shell.run` `timeout`) kills pytest, and only downgrade an empty flaky/targeted result to `SKIPPED` when a timeout was actually observed. Empty results without a timeout fall through to `create_from`'s default `ERROR`. Add `ci/tests/test_integration_flaky_empty_result.py` covering the decision truth table and the end-to-end status (timeout-empty -> SKIPPED, non-timeout-empty -> ERROR). Addresses the AI review on #107453 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Addressed the AI review (
Added |
#107453 ("Make integration flaky check finish within its time budget") carries the canonical version of this logic and was refined in review to distinguish an expected timeout from a real harness failure. Bring that version into this PR so the two do not diverge. Replace the previous `empty_best_effort = is_flaky_check and not test_results` heuristic with the timeout-gated approach from #107453: - `run_pytest_and_collect_results` now returns an explicit `timed_out` flag, set when the graceful xdist `--session-timeout` marker is found or when the hard subprocess backstop (`Shell.run` `timeout`) kills pytest before it finishes (a completed run always returns under `timeout`). - A flaky/targeted check that produced no results is downgraded to `SKIPPED` (via the new `is_empty_best_effort_skip` helper) *only* when a timeout was actually observed. An empty result without a timeout - pytest crashed before writing `pytest_parallel.jsonl`, or exited with a plugin/internal error and no test rows - falls through to `create_from`'s default `ERROR` and stays red. Add `ci/tests/test_integration_flaky_empty_result.py` (from #107453) covering the decision truth table and the end-to-end status (timeout-empty -> `SKIPPED`, non-timeout-empty -> `ERROR`). The dead `from more_itertools import tail` import that #107453 still has is intentionally not brought over: the local `tail` shadows it and `ruff` `F811` (enabled by this PR) flags it - it was removed here in 408f1c3. Related: #107453 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…d entries The empty-result status decision in `ci/jobs/integration_test_job.py` used `bool(test_results)` *after* the best-effort scope cap (`MAX_FLAKY_CHECK_MODULES`) had already appended synthetic `SKIPPED` entries for the dropped modules. In a scope-capped flaky run where the selected modules produced no pytest rows, `test_results` was therefore non-empty even though pytest produced nothing, so: - a timeout-empty run collapsed to a green top-level status instead of the intended best-effort `SKIPPED`, and - a non-timeout empty run (a real harness failure) reported green instead of `ERROR`, masking the failure. Capture `pytest_has_results` before appending the synthetic skipped-module entries and use it for both `is_empty_best_effort_skip` and `empty_harness_failure`. Because the synthetic `SKIPPED` rows make `test_results` non-empty, `create_from` no longer defaults the empty set to `ERROR`, so the harness-failure status is now forced explicitly. Add `test_capped_empty_timeout_run_reports_skipped` and `test_capped_empty_non_timeout_run_reports_error` covering the capped path: selected pytest results empty plus a synthetic skipped module, for both `timed_out=True` (top-level `SKIPPED`) and `timed_out=False` (top-level `ERROR`). Addresses the AI review on #107453 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Addressed the follow-up AI review (capped-path empty-result status) in The empty-result decision previously used
Now Added focused coverage for the capped path in |
The
Integration tests (amd_asan_ubsan, flaky)job can time out and report a red failure with 0 results when a PR touches many integration test modules. It runs every changed module under-n 3 --dist=each(e.g. 544 test items × 3 workers on #105171), and the softFLAKY_CHECK_TIME_LIMIT(90 min, measured frommain) sat above the external ~80-90 min ceiling at which a lone integration job is cancelled. So the graceful xdist--session-timeoutand the subprocess hard-kill backstop (which still collects partial results) never fired — the whole process was killed first, leaving an empty result that surfaced as a failure instead of a best-effort partial report.Changes to
ci/jobs/integration_test_job.py:FLAKY_CHECK_TIME_LIMITfrom 90 to 45 min (matching the functional flaky check inci/jobs/functional_tests.py) so the internal timeout/backstop fires and a report is produced well before the external cancellation. Worst-case wall-clock is now ~66 min.MAX_FLAKY_CHECK_MODULES(10): run a deterministic sorted subset when a PR changes more modules than fit the budget, and report the rest asSKIPPEDso the reduced coverage is explicit, not silent.SKIPPEDinstead ofERRORwhen no results are collected within the budget, so a fully time-limited run does not block the PR.Surfaced by the flaky check on #105171: https://github.com/ClickHouse/ClickHouse/actions/runs/27483289227/job/81298702498
Related: #105171
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Version info
26.6.1.944