Repository navigation
Conversation
A transient CIDB slowdown could kill the `Config Workflow` job and take the whole test matrix with it. The affected head reported 174 completed check-runs - 172 of them `skipped` plus `Config Workflow` failed - so the run looked finished while nothing had actually been tested, and praktika does not re-run a completed-failed run. On 2026-08-01 one 6-minute CIDB blip voided 54 of my open PRs plus at least 3 from other contributors. `Config Workflow` is declared `timeout=600`. `CIDB.query` retries 5 times with a 60s per-request timeout and exponential backoff, so one query can take 5 * 60 + (2 + 4 + 8 + 16) = 330s, and nothing in the retry loop consults the wall clock. The filter hooks run once per job, and each stateless flaky-check job made its own uncached `get_previously_failed_tests` query, so 4 such jobs in the PR workflow give a worst case of 1320s against a 600s ceiling. The existing `try/except` around the lookup was correct but unreachable: the process is SIGKILLed mid-request before the handler can run. The lookup was dead weight regardless. 4a5d222 moved previously-failed tests from the flaky check to the targeted check but only edited `ci/jobs/functional_tests.py`, leaving this config-time copy orphaned. The flaky check selects `get_changed_tests` in-job and exits SKIPPED when that is empty, so the only case where previously-failed flipped the config decision scheduled a job that immediately self-skipped - the same reason e008b39 deleted the sibling `relevant_tests` term from this condition. Coverage is unchanged; the targeted check, which actually consumes previously-failed data, issues its own query in-job inside a multi-hour budget. `get_previously_failed_tests` itself stays for its two in-job callers. Removing it leaves config-time CIDB work at ~45s worst case, independent of how many flaky-check parametrizations exist. The one observable behaviour change: a PR with no changed stateless tests but previous failures now skips the flaky job at config time instead of scheduling a runner that would self-skip, matching what the merge-queue counterpart already does. The new tests assert reachability rather than pinning the constants, driven over the workflows' own job lists so a new parametrization is covered automatically. They record attempted requests at `requests.post` instead of raising, because an assertion thrown there was swallowed by the `except Exception` and passed against the very code it had to reject.
Review of the previous commit found three defects in the new test file. The production fix is unchanged; only ci/tests/test_config_job_no_cidb.py is touched. 1. test_previously_failed_cannot_change_flaky_coverage was tautological: it patched Targeting.get_changed_tests, then asserted that same patched callable returned []. No production code sat between the patch and the assertion, so it could not fail under any implementation, while its docstring claimed to carry the PR's central coverage argument. It now asserts the argument structurally over the AST of functional_tests.py: the is_flaky_check branch that picks the test list must pick it from get_changed_tests, and the hook must reference the same selector and no CIDB-backed one. The AST is matched rather than the text because is_flaky_check also gates an unrelated worker-count branch. 2. test_cidb_worst_case_budget_exceeds_the_config_job_timeout asserted one_query > timeout / 2, the inverse of the intended invariant. Measured, it reddened when the CIDB budget shrank (retries 5 -> 2 gives 122s and failed) and stayed green when the per-request timeout grew (60 -> 600 gives 3030s and passed), so it flagged safer configurations and passed far more dangerous ones. Deleted: after the fix there is no config-time CIDB call, so no budget relationship is an invariant this change upholds. The arithmetic stays in the module docstring and the previous commit message. 3. CHANGED_TEST named a file that does not exist. get_changed_tests skips paths failing Path(fpath).exists(), so every default-fixture test drove the selector with an empty selection and never traversed the changed-tests branch. It now names a file present in the tree, and the non-empty arm is asserted rather than incidental. The same defect made the outage comparison inert; its fixture now names a non-test file, which is the only state where a previously-failed lookup could change a decision and therefore the only state where the reachable and unreachable arms can differ. Mutation results, all measured: reverting the production hunk reddens 6 of 9 (was 5 of 10); lowering CIDB retries 5 -> 2 reddens nothing; raising the per-request timeout 60 -> 600 reddens nothing; pointing the fixture at a non-existent path reddens 2; repointing the in-job flaky selector at get_previously_failed_tests reddens the coverage test.
Review of the previous commit found that the test carrying this PR's
no-coverage-loss argument stayed green when the deleted lookup was reinstated.
The production fix is unchanged; only ci/tests/test_config_job_no_cidb.py is
touched.
test_previously_failed_cannot_change_flaky_coverage matched only a direct
"tests = <obj>.<method>()" assignment in the body of an is_flaky_check branch,
so two natural reinstatements of in-job previously-failed selection passed it:
"tests += targeter.get_previously_failed_tests()" and
"tests.extend(targeter.get_previously_failed_tests())". Both restore exactly the
coverage shape the test claims to pin, and both were measured to leave the
collected selector set at {get_changed_tests}. The predicate now walks the whole
branch body and keeps every attribute call whose name is a member of Targeting,
which rejects both mutations. The Targeting membership filter is required: an
unwalked-but-unfiltered scan collects join and append from the same branch on
the unmodified file, so the equality assertion would fail on correct code.
The config-time half of the same test asserted a substring over the whole
module's source, which trips on an unrelated comment mention and is defeated by
an aliased call. It now parses should_skip_job, the hook this PR changed, and
requires get_changed_tests among its attribute calls and
get_previously_failed_tests absent. Verified that reverting the production hunk
still reddens that specific assertion.
Also replaces a stubbed selector's leftover "04652_probe." literal, a name the
previous commit removed because no such test exists, with the CHANGED_TEST_NAME
constant the rest of the file uses.
Co-Authored-By: Claude Fable 5 <[email protected]>
The in-job half of test_previously_failed_cannot_change_flaky_coverage walked
only `ast.If` nodes whose test is `ast.Name('is_flaky_check')`, but the real
enclosing block in ci/jobs/functional_tests.py is
`if is_flaky_check or is_bugfix_validation:` - an `ast.BoolOp`. Hoisting the
previously-failed lookup one level out and consuming its result inside the
flaky branch therefore stayed green.
Add a shape-independent module-wide negative next to the existing positive
assertion: `get_previously_failed_tests` must not appear among the module's
Targeting-member attribute calls at all. This closes the whole class rather
than one more spelling. It stays satisfiable because the targeted check reaches
those tests via `get_all_relevant_tests_with_info`, not via a direct call.
Measured on this content: the hoist mutation reddens exactly this test
(1 failed / 8 passed) where it previously passed 9 of 9; the `+=`, `.extend`
and selector-swap mutations still redden it; reverting the filter_job.py hunk
still reddens 6 of 9; baseline 9 passed.
Co-Authored-By: Claude Fable 5 <[email protected]>
Internal second-model review (4 rounds, all findings resolved)Before publishing I ran an independent cold review plus a second-model review pass on this Round 1
💡 The config-time half asserted on whole-module source text, so it tripped on an unrelated 💡 A focused test used a fixture name ( Round 2
Round 3 — noted, not blocking💡 The module-wide negative added in round 2 negates one name, not the class of methods that I am shipping with it, for a reason I verified rather than assumed: this does not weaken the A stronger form exists and I measured it: derive the set of Checked and found correct
Session id: cron:clickhouse-review-slot-50:20260803-021900 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-42:20260803-011800 |
|
cc @fm4v @leshikus, could you review this? |
|
Workflow [PR], commit [63ae046] Summary: ✅ AI ReviewSummaryThis PR removes the config-time Final Verdict✅ No findings. |
CI finish ledger — 63ae046CI is fully finished on this head: 175 check-runs, 0 queued or in progress, No failures to own. 6 jobs ran and all passed (
Session id: cron:our-pr-ci-monitor:20260803-090000 |
|
Following up on the paragraph in this PR's description that flagged It fires, once, and the run is void
The head then reports 174 check-runs all The run also stops dead at that stage. Its ingested sub-results are Frequency: one occurrence in 180 days
I checked that this is a true count rather than a floor, since an outage could plausibly erase Why I am not sending a patchThe obvious change is to report an unreachable database as But that flips the polarity of a gate that withholds the entire test matrix, which is a decision
So the question is whether a run that produces test results but records no statistics is One adjacent finding while measuring, for completeness rather than as part of the same question: @fm4v @maxknv: you both have context here (@fm4v merged this PR, @maxknv owns praktika and is |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
A transient CI database slowdown could kill the
Config Workflowjob and take the wholetest matrix with it. The affected head reports 174 completed check-runs (172
skippedplusConfig Workflowfailed), so the run looks finished though nothing was tested, and praktikadoes not re-run a completed-failed run. One 6-minute CIDB blip on 2026-08-01 voided 54 of my
open PRs and at least 3 from other contributors; none recovered.
Config Workflowis declaredtimeout=600, butCIDB.queryretries 5 times with a 60sper-request timeout and exponential backoff, so one query can take
5 * 60 + (2 + 4 + 8 + 16) = 330s, and nothing in the retry loop consults the wall clock.The hooks run once per job and each stateless flaky-check job issued its own uncached
get_previously_failed_testsquery, so today's 4 such jobs give a worst case of 1320sagainst a 600s ceiling. The
try/exceptaround it is correct but unreachable: the processis SIGKILLed mid-request first.
The lookup was also dead weight, orphaned by 4a5d222. No coverage is lost;
get_previously_failed_testsstays for its two in-job callers.Config-time CIDB work drops to ~45s worst case, independent of how many flaky-check
parametrizations exist. One observable behaviour change: a PR with no changed stateless
tests but previous failures now skips the flaky job at config time rather than scheduling a
runner that would self-skip, matching the merge-queue counterpart.
Validated by driving praktika's per-job hook loop with CIDB blackholed: before, killed at
661s with 130 of 169 jobs unevaluated; after, all 169 evaluated, no CIDB request.
Why no coverage is lost, and reproduction / mutation evidence
4a5d222 moved previously-failed tests to the targeted check but edited only
ci/jobs/functional_tests.py, orphaning this config-time copy. The flaky check selectsget_changed_testsin-job and exits SKIPPED when that is empty, so the one case wherepreviously-failed flipped the config decision scheduled a job that immediately self-skipped
relevant_teststerm from thiscondition. The targeted check, the real consumer, queries in-job inside a multi-hour budget.
The repro drives
native_jobs.py's hook loop overci.workflows.pull_requestwithTargeting._ci_dbpointed at a non-routable address, so every attempt hits the real 60stimeout; a 600s watchdog stands in for praktika's SIGKILL:
CIDB.check) inexcept ExceptionThe second mutation is why the guard records requests at
requests.postrather thanraising: an
AssertionErrorthrown there was swallowed by the oldexcept Exception, so thereachability tests passed against the code they had to reject. The third was run against
#112358's head (5 flaky checks, pre-fix worst case 1650s).
Full
ci/tests/: 556 passed / 3 failed, against 547 / 3 on the pristine base - the same 3failures (they need a live server the sandbox lacks), plus exactly the 9 new tests.
Adjacent, deliberately out of scope (separate root cause):
_check_dbreturnsFAILon aCIDB blip and
Result.create_fromaggregates it, so a CIDB failure atcheck()time failsthe config job with no timeout involved - fail-closed, where this change is fail-open.