Skip to content

Do not query the CI database while configuring the workflow - #113052

Merged
fm4v merged 4 commits into
ClickHouse:masterfrom
groeneai:groeneai/praktika-cidb-budget-below-config-timeout
Aug 3, 2026
Merged

fm4v merged 4 commits into
ClickHouse:masterfrom
groeneai:groeneai/praktika-cidb-budget-below-config-timeout

Conversation

@groeneai

@groeneai groeneai commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

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 Workflow job and take the whole
test matrix with it. The affected head reports 174 completed check-runs (172 skipped plus
Config Workflow failed), so the run looks finished though nothing was tested, and praktika
does 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 Workflow is declared timeout=600, but 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 hooks run once per job and each stateless flaky-check job issued its own uncached
get_previously_failed_tests query, so today's 4 such jobs give a worst case of 1320s
against a 600s ceiling. The try/except around it is correct but unreachable: the process
is SIGKILLed mid-request first.

The lookup was also dead weight, orphaned by 4a5d222. No coverage is lost;
get_previously_failed_tests stays 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 selects
get_changed_tests in-job and exits SKIPPED when that is empty, so the one 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. The targeted check, the real consumer, queries in-job inside a multi-hour budget.

The repro drives native_jobs.py's hook loop over ci.workflows.pull_request with
Targeting._ci_db pointed at a non-routable address, so every attempt hits the real 60s
timeout; a 600s watchdog stands in for praktika's SIGKILL:

before: [0.0s -> 330.2s] 'Stateless tests (amd_asan_ubsan, flaky check)' cost 330s
        [330.2s -> 661.0s] 'Stateless tests (amd_tsan, flaky check)' cost 331s
        WATCHDOG: 661s > 600s -- 39/169 jobs filtered, 130 never evaluated
after:  TOTAL 0.0s, processed 169/169, 0 CIDB requests
Mutation Expected Observed
revert the deletion fail 6 of 9 fail
a CIDB call via another method (CIDB.check) in except Exception tests fail 4 of 9 fail
add a 5th stateless flaky parametrization still pass, still cover it pass; blocked requests 20 -> 25 with the fix reverted

The second mutation is why the guard records requests at requests.post rather than
raising: an AssertionError thrown there was swallowed by the old except Exception, so the
reachability 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 3
failures (they need a live server the sandbox lacks), plus exactly the 9 new tests.

Adjacent, deliberately out of scope (separate root cause): _check_db returns FAIL on a
CIDB blip and Result.create_from aggregates it, so a CIDB failure at check() time fails
the config job with no timeout involved - fail-closed, where this change is fail-open.

groeneai and others added 4 commits August 2, 2026 19:34
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]>
@groeneai

groeneai commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author
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
diff, four rounds. Every finding below was reproduced from source before I acted on it. The
production change was reviewed unchanged in all four rounds; every fix round touched only the
regression tests and the description.

Round 1

⚠️ The structural oracle in test_previously_failed_cannot_change_flaky_coverage pinned one
spelling, not the behaviour.
It collected only ast.Assign statements whose target is
tests, so restoring the deleted lookup as tests += targeter.get_previously_failed_tests()
or tests.extend(...) left the assertion green while in-job previously-failed selection was
back. Agreed and fixed: the predicate now walks every Targeting-member call in the branch
body. Both shapes now redden.

⚠️ A test asserted one_query > timeout / 2, with the polarity inverted. It reddened on
safer configurations (retries 5 to 2 gives 122s and failed) and stayed green on a far more
dangerous one (a 600s per-request timeout gives 3030s and passed), while printing
"config-time CI database queries must stay removed". Agreed and deleted: after this change
no config-time budget relationship is an invariant the PR upholds, so encoding one at all was
the mistake.

💡 The config-time half asserted on whole-module source text, so it tripped on an unrelated
comment and was defeated by an aliased call. Agreed and fixed: it now walks the AST of
should_skip_job alone. Verified in both directions: passes with the fix, fails on a revert.

💡 A focused test used a fixture name (04652_probe.) that does not exist, so
get_changed_tests silently skipped it and several assertions ran against the
no-tests-changed state. Agreed and fixed — and fixing it exposed a fourth defect: with a
real changed test present, both arms of the outage-comparison test return the same value, so
only a non-test changed file discriminates. Repointed.

Round 2

⚠️ The widened oracle still had one escape. It descended only into if nodes whose test is
exactly is_flaky_check, but the enclosing block is if is_flaky_check or is_bugfix_validation: (a boolean op), so hoisting the call one level out and consuming it in
the flaky branch read as green. Agreed and fixed: a module-wide negative was added, and the
hoist now reddens.

⚠️ Both description artifacts carried stale test counts. They were drafted when the suite
had ten tests; round 1 deleted one. Corrected against measurements taken on the final content
rather than by arithmetic. Correcting them surfaced a second stale claim: the old suite-level
number rested on a test that pgreps for a live server and produced two, three and four failures
on identical content, so it could not support a countable claim at all. It is now excluded
from both arms of a real control: 556 passed / 3 failed here against 547 / 3 on the base, the
same three failures, plus exactly the nine new tests.

Round 3 — noted, not blocking

💡 The module-wide negative added in round 2 negates one name, not the class of methods that
reach the CI database. Targeting.get_previously_failed_tests_with_info calls
get_previously_failed_tests internally, so it issues the identical query under a different
spelling, and get_most_relevant_tests and get_tests_by_changed_lines also reach it.
Measured: hoisting get_previously_failed_tests reddens the oracle, hoisting
get_previously_failed_tests_with_info does not.

I am shipping with it, for a reason I verified rather than assumed: this does not weaken the
regression guard. The invariant this change publishes is that the configuration job issues no CI
database request, and that is pinned behaviourally by the eight tests that record
requests.post — spelling-blind, since reverting the deletion reddens six of nine and adding a
call through CIDB.check reddens four of nine without either mutation naming a selector. What
the escape touches is the documentary half of the no-coverage-loss argument, and reaching it
requires a future refactor of another module.

A stronger form exists and I measured it: derive the set of Targeting methods that
transitively reach _ci_db() and negate all of them except
get_all_relevant_tests_with_info (the targeted check, which runs in-job inside a multi-hour
budget). It passes on the current file and reddens every synonym shape I tried. I did not fold
it in because it hand-maintains an allowlist over another module's internals inside a
documentary test, which carries its own false-failure risk. Worth taking if anyone touches this
function.

Checked and found correct

  • The deletion loses no coverage. In-job flaky selection is get_changed_tests only, and when
    it is empty the job exits SKIPPED, so the one case where the deleted lookup changed the
    config decision scheduled a runner that immediately self-skipped.
  • The filter hook was the only unbounded config-time CI-database consumer. The other two are
    bounded: version_log.py's insert is one attempt with a 5s timeout, and _check_db is two
    attempts at 20s, so ~45s remains, independent of how many flaky parametrizations exist.
  • Dropping the job_type assignment is safe: get_changed_tests and the two helpers it calls
    contain no reference to it, and the merge-queue path keeps its own assignment.
  • get_previously_failed_tests survives for its two in-job callers, both inside multi-hour
    budgets.
  • should_skip_job is the filter hook of four workflows and should_skip_merge_queue_job of a
    fifth; the tests drive all five. The three non-PR workflows declare no flaky jobs, which is
    why only PR runs were affected.
  • requests.post is the single network boundary of all three CIDB methods, so the guard
    cannot be sidestepped by using a different one — and recording requests out of band rather
    than raising is required, because the deleted code wrapped its call in except Exception.
  • Filtering a job at config time marks it cached-success rather than failed, and mergeability is
    gated on labels only, so nothing here changes whether a PR can merge.
  • The provenance is real: 4a5d222245225d3 touched seven files and not filter_job.py, which
    is exactly how this copy was orphaned.

Session id: cron:clickhouse-review-slot-50:20260803-021900

@groeneai

groeneai commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. A harness drives praktika's own per-job hook loop (ci/praktika/native_jobs.py) over ci.workflows.pull_request with the CI database pointed at a non-routable address, so every attempt hits the real 60s timeout and the unmodified retry loop runs at production speed. Reproduces every run: killed by the 600s watchdog at 661s with 130 of 169 jobs never evaluated.
b Root cause explained? Yes. Config Workflow is declared timeout=600; CIDB.query retries 5 times at 60s each with 2**attempt backoff, giving 330s per query with no wall-clock check. The filter hook runs once per job, and each stateless flaky-check job issued its own uncached get_previously_failed_tests query, so 4 such jobs reach 1320s against a 600s ceiling. The job is SIGKILLed mid-request, praktika marks every dependee DROPPED, and the run reports 172 skipped checks that read as a finished CI.
c Fix matches root cause? Yes. The query is deleted rather than re-budgeted, so the job is structurally incapable of this failure instead of merely sized against it. Deletion is the correct layer: 4a5d222 moved previously-failed tests to the targeted check and edited only ci/jobs/functional_tests.py, orphaning this config-time copy, and e008b39 already deleted the sibling relevant_tests term from the same condition for the same reason. Raising the timeout or caching the query were considered and rejected: both keep a call whose result cannot change any outcome.
d Test intent preserved / new tests added? Yes. No existing test was weakened; ci/tests/test_config_job_no_cidb.py adds 9 tests. They assert reachability (no CI database request during config) rather than pinning the three constants, and are driven over the workflows' own job lists so a new parametrization is covered without editing them. Behaviour preservation is pinned separately, including the equivalence that licenses the deletion.
e Both directions demonstrated? Yes. Before: 661s, 130 of 169 jobs unevaluated. After: all 169 evaluated, zero CI database requests. Mutations were run against the final content: reverting the deletion fails 6 of 9 tests; adding a CI database call through a different method (CIDB.check) wrapped in except Exception fails 4 of 9; hoisting the previously-failed lookup into the enclosing block fails 1 of 9; adding a fifth stateless flaky parametrization keeps them passing while the blocked-request count rises 20 to 25, proving the coverage follows the workflow rather than a hardcoded list.
f Fix is general across code paths? Yes. Every CI database entry point under ci/ was enumerated for config-time reachability. The deleted call was the only unbounded one; _check_db (40s) and version_log (~5s) are bounded and untouched. should_skip_job is the filter hook of four workflows, not just PR, so a test drives master, release_branches and backport_branches too. get_previously_failed_tests itself stays for its two in-job callers (ast_fuzzer_job.py, the targeted check), which run inside multi-hour budgets.
g Fix generalizes across inputs? N/A for datatype wrappers (no SQL or column path). The equivalent axis is workflow topology and job naming, covered by enumerating each workflow's own job list rather than hardcoding names, and verified against a live in-flight PR that adds a fifth stateless flaky check. The empty and non-empty get_changed_tests cases are both pinned.
h Backward compatible? Yes. No setting, format, protocol or server behaviour changes, so no SettingsChangesHistory.cpp entry applies. One observable CI behaviour change, stated in the PR body: 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 immediately self-skip. That matches what the merge-queue counterpart already does.
i Invariants and contracts preserved? Yes. The invariant is that the config-time skip decision and the in-job selection never disagree; both now read Targeting.get_changed_tests as their single source, which is the stronger form of the previous arrangement. get_changed_tests reads only the diff and changed-file list, so it cannot raise a database error and needs no guard. The removed job_type assignment existed solely to shape the deleted query and has no other consumer; changed_files remains scoped to the integration branch that uses it.

Session id: cron:clickhouse-impl-slot-42:20260803-011800

@groeneai

groeneai commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

cc @fm4v @leshikus, could you review this? Config Workflow is declared timeout=600 but the filter hook ran an uncached get_previously_failed_tests per stateless flaky-check job, and CIDB.query retries 5 times at 60s with backoff (330s each), so a CI database slowdown SIGKILLs the config job before its except can degrade and praktika drops all 172 dependee jobs. The lookup has been dead weight since 4a5d222 moved previously-failed tests to the targeted check, so I deleted it rather than re-budgeting it.

@PedroTadim PedroTadim added the can be tested Allows running workflows for external contributors label Aug 3, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [63ae046]

Summary: ✅


AI Review

Summary

This PR removes the config-time get_previously_failed_tests lookup from the stateless flaky-job filter, making the filter use the same Targeting.get_changed_tests selector that the flaky job already uses at runtime, and adds regression tests to keep the workflow hooks CIDB-free. I reviewed the current diff, the surrounding functional_tests.py / find_tests.py logic, the existing PR discussion, and the current green CI report, and I did not find a correctness or coverage regression in the current code.

Final Verdict

✅ No findings.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 3, 2026
@fm4v fm4v self-assigned this Aug 3, 2026
@fm4v
fm4v enabled auto-merge August 3, 2026 09:16
@groeneai

groeneai commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — 63ae046

CI is fully finished on this head: 175 check-runs, 0 queued or in progress, Config Workflow
and Finish Workflow both success, and past the CIDB ingestion buffer.

No failures to own. 6 jobs ran and all passed (Config Workflow, Style check, Code Review,
Build profile diff, CI Tests, Finish Workflow); the remaining 169 are skipped because the
diff touches only ci/*.py, so the build digest is unaffected and no test job is selected.
CIDB reports 0 FAIL/ERROR rows for this pull request. CI Tests is the job that executes
ci/tests/, where this change's new test lives, and it is green.

Check / test Reason Owner / fixing PR
(none) no failed check on this head not applicable

Session id: cron:our-pr-ci-monitor:20260803-090000

@fm4v
fm4v added this pull request to the merge queue Aug 3, 2026
Merged via the queue into ClickHouse:master with commit 69006bf Aug 3, 2026
180 checks passed
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 3, 2026
@groeneai

groeneai commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

Following up on the paragraph in this PR's description that flagged _check_db as adjacent and
deliberately out of scope. I investigated that path and it has now fired in production, but the
fix turns out to be a policy question rather than a bug fix, so I am posting the analysis here
instead of opening a PR.

It fires, once, and the run is void

Config Workflow job 91437702575
(PR #112949, head e9bc10e0115f430fd0d36573dfd2c05fe61808d9):

[2026-08-02 00:52:53] ERROR: No connection to cluster [https://play.clickhouse.com]: [Code: 202.
  DB::Exception: Too many simultaneous queries. Maximum: 1000. (TOO_MANY_SIMULTANEOUS_QUERIES)
[2026-08-02 00:52:59] Fail [Config Workflow]
[2026-08-02 00:52:59]   Fail [Check CI DB]
[2026-08-02 00:52:59]     | ERROR: No connection to CI DB [500/Internal Server Error]
[2026-08-02 00:52:59] ERROR: Run failed with exit code [1]

The head then reports 174 check-runs all completed, of which 172 are skipped, and no test
ran. Distinct from the timeout path this PR fixed: 22.7 s wall clock, exit code [1] rather
than [-15], and zero read-timeout lines in the job log. The trigger is a load-shed HTTP 500
that arrives in milliseconds, so no retry or budget tuning reaches it.

The run also stops dead at that stage. Its ingested sub-results are repo unshallow,
Pre Hooks, Check Workflows, Check CI DB; the later successful run on the same head carries
all 11 through Init Report. Docker digests, filter hooks, changed-file filtering, cache lookup,
submodule cache and report init never executed, because each is gated on
results[-1].is_ok().

Frequency: one occurrence in 180 days

default.checks, 180 days, test_name = 'Check CI DB': 47,169 OK/success and exactly
1 FAIL (the run above, test_duration_ms = 4252). It is 1 of 4,719 failed
Config Workflow runs in that window.

I checked that this is a true count rather than a floor, since an outage could plausibly erase
its own evidence: 70,140 of 71,190 Config Workflow runs (98.5%) carry a Check CI DB row; the
12 victims of the 2026-08-01 timeout incident do appear in the database as Config Workflow
rows with check_status = error; and all 280 failed runs that stop at the immediately preceding
stage have Check Workflows itself FAIL, so none is a masked occurrence. Grouping caveat for
anyone re-running this: CIDB.json_data_generator gives each sub-result its own
check_start_time, so grouping by (commit_sha, check_start_time) splits a run's base row from
its sub-rows and gives wrong answers; group by commit_sha.

Why I am not sending a patch

The obvious change is to report an unreachable database as SKIPPED plus a workflow-level
warning instead of FAIL. I verified it would work (Result.create_from treats a SKIPPED
child as OK, and is_ok() is true for SKIPPED, so the six later stages still run), and that
the outage would stay visible: the sub-result keeps its info, and a warning routed through the
job's own env reaches ext["warnings"], which the existing check_report_messages post-hook
already surfaces as a green CI Infrastructure Messages status.

But that flips the polarity of a gate that withholds the entire test matrix, which is a decision
about intended behaviour rather than a defect:

  • the probe's status is genuinely load-bearing: nothing reads the result by name, but it
    becomes the results[-1] that each of the six following results[-1].is_ok() gates in
    native_jobs.py tests (:685, :703, :740, :776, :806, :907), which is why the run
    above stopped where it did;
  • praktika is currently inconsistent about how fatal the CI database is: runner.py:741-750
    inserts the real results and is fail-open (try/except then env.add_workflow_error, and the
    job continues), while this probe is fail-closed;
  • and the same helper is being rewritten in CI: sync with latest praktika #110081, where the line
    status = Result.Status.OK if res else Result.Status.FAIL is preserved as-is.

So the question is whether a run that produces test results but records no statistics is
acceptable. If it is, the one-line status change plus a warning is the fix and I am happy to
send it. If the gate is deliberate, then the remaining problem is on the capacity side: a
TOO_MANY_SIMULTANEOUS_QUERIES response from play.clickhouse.com currently voids a PR's whole
matrix while reporting every check-run as completed, which is hard to distinguish from a
finished run.

One adjacent finding while measuring, for completeness rather than as part of the same question:
the version_log pre-hook can fail the config job the same way one stage earlier, when AWS SSM
is unavailable rather than the database. CIDBCluster.is_ready resolves its credentials at
cidb_cluster.py:60-62, outside that function's try, so the RuntimeError from
Shell.get_output(..., strict=True) escapes insert_json and the hook. Three occurrences on
2026-07-27 (PRs 103706, 81944, 109472), all with
aws: [ERROR]: An error occurred (502) when calling the GetParameters operation, each dying at
Pre Hooks. Different dependency and different root cause, so I have not touched it.

@fm4v @maxknv: you both have context here (@fm4v merged this PR, @maxknv owns praktika and is
touching _check_db in #110081). Which way would you like this to go?

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

Labels

can be tested Allows running workflows for external contributors pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants