Skip to content

Perf CI: do not judge a shard on the 0.15/0.25 floors when no learned thresholds were fetched - #121189

Closed
groeneai wants to merge 7 commits into
ClickHouse:masterfrom
groeneai:perf-ci-historical-thresholds-timeout
Closed

groeneai wants to merge 7 commits into
ClickHouse:masterfrom
groeneai:perf-ci-historical-thresholds-timeout

Conversation

@groeneai

@groeneai groeneai commented Sep 20, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #120488
Related: #102543

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):

Fetch the learned per-query performance thresholds with the standard CIDB query timeout, and stop judging a performance comparison against the 0.15/0.25 floors when no learned thresholds could be fetched at all.

Description

Requested on #120488.

The fetch. Select historical data used a hardcoded 10 s timeout for a query taking 8 to 10 s in CI, so 18 of 40 sampled master runs of shard 6/6 lost their thresholds. It now uses Settings.CI_DB_QUERY_TIMEOUT_SEC (60 s, praktika's CIDB constant), and each fail-open branch posts a workflow warning.

The gate. A failed fetch writes an empty historical-thresholds.tsv and returns success (the deliberate #98448 fail-open, kept). compare.sh LEFT JOINs it and a miss is 0, so greatest(0.15, 0, 0) makes a missing history indistinguishable from a rock-steady query. A shard that obtained none now abstains: no changed_fail, no unstable_fail, every measurement kept, the exported bars inf instead of 0.15, and the check SKIPPED, which praktika keeps green, so the floors can no longer red an unrelated PR. An already-FAIL status is untouched and the result is not cached. A query with no history keeps the floors, its designed default.

In master_head mode the dashboard gate decides the status and ignores thresholds, so an abstaining shard skips it too; my #121090 makes the report agree.

Not fixed here: when a fixture's query text changes, its history stays under the old query_display_name and the query drops to the floor. My #121278 keys the thresholds by display name; a renamed slot is still on the floors until its new text reaches 100 samples (10 days, measured).

double_check_perf.py and fetch_perf_report.py read the exported bars, not that status alone: a shard that abstained and then failed for another reason keeps FAIL, and both would otherwise have called its inf-barred rows clean. The perf-comparison helper takes the same per-row marker.

Tests: seven arms in the two helpers with test files, two wired end to end; throwaway harnesses for the ci/ scripts, per AGENTS.md, since nothing runs ci/tests/.

Measured detail: the failing shard run, the 40-run classification and the four flagged queries

On that run that is the entire failure: replaying compare.sh's rule over the shard's 574 client_time rows gives 4 blocking rows with the shipped thresholds, exactly the four reported has slowed down errors, and 0 with the history restored.

40 distinct master shas with an arm_release master_head 6/6 run started between 2026-09-16 and 2026-09-20, each classified from its whole job log. All 40 contain Start execution for [Select historical data], so none is scored as applied for lack of the step.

class runs
thresholds applied 22
dropped, 3 x read timeout=10 17
dropped, CIDB is not ready (Code: 202 TOO_MANY_SIMULTANEOUS_QUERIES) 1

The four queries the shipped floors flagged, all in timeseries_to_grid_aggregation_functions, against the thresholds the framework had already learned for them:

query measured diff shipped bar learned bar
#1 0.694 0.15 1.20
#21 0.194 0.15 0.35
#16 0.169 0.15 0.48
#23 0.151 0.15 0.31

changed_threshold was 0.15 and unstable_threshold 0.25 for all 164164 rows of that shard's all-query-metrics.tsv, the empty-file fingerprint. Nine successful steps, timed from their own job logs, took 8, 8, 8, 8, 9, 9, 9, 9 and 10 s; the same query from outside CI took 8.7 s. retries=3 is unchanged, and a cheaper query is not the lever: the cost is its 371 GB scan.


Workflow [PR]
Sync PR [sync-upstream/pr/121189]

The "Select historical data" step fetched the learned per-query performance
thresholds from play.clickhouse.com with a hardcoded 10 s read timeout. That
query aggregates five weeks of query_metrics_v2 and takes 8 to 10 s in CI, so
the bar sat inside the latency distribution and the fetch failed often: nine
successful steps sampled from their own job-log timestamps took 8, 8, 8, 8, 9,
9, 9, 9 and 10 s, and the same query measured 8.7 s from outside CI.

On failure the step warns, touches an empty historical-thresholds.tsv and
reports success. That fail-open is deliberate and is kept. What made it costly
is that an empty file is indistinguishable from a clean history downstream:
compare.sh LEFT JOINs it and computes
ceil(greatest(0.15, historical_thresholds.max_diff, report_threshold), 2), and
with join_use_nulls=0 a join miss is 0.0, so greatest(0.15, 0, 0) is 0.15. An
absent history therefore reads exactly like a rock-steady query, and every query
of the shard is judged against the bare 0.15/0.25 floors instead of its own
learned bar. The only trace was one WARNING line in an 80 MB job log.

Measured over 40 distinct master runs of Performance Comparison (arm_release,
master_head, 6/6) started between 2026-09-16 and 2026-09-20, classified from
each run's own job log: 22 applied the thresholds, 17 dropped them on the 10 s
timeout, and 1 dropped them when the readiness probe hit
TOO_MANY_SIMULTANEOUS_QUERIES. 18 of 40.

On PR 120488 at 3ac0adb that accounts for the whole red:
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=120488&sha=3ac0adba968efdf04b768ba39c687690be44e86c&name_0=PR&name_1=Performance%20Comparison%20%28arm_release%2C%20master_head%2C%206%2F6%29
Replaying compare.sh's changed_fail rule over the shard's 574 client_time rows
yields 4 blocking rows with the shipped thresholds, exactly the four reported
"has slowed down" errors on timeseries_to_grid_aggregation_functions 1, 16, 21
and 23, and 0 rows once the learned thresholds are restored. Each of those
queries sat far below its own learned bar: 0.694 against 1.20, 0.169 against
0.48, 0.194 against 0.35 and 0.151 against 0.31.

Settings.CI_DB_QUERY_TIMEOUT_SEC is 60, already the timeout praktika's own CIDB
reader uses, and it sits beside CI_DB_INSERT_TIMEOUT_SEC which this file already
uses for its inserts, so no new number is introduced. retries=3 is unchanged.
Worst-case step time rises from 3x10 s to 3x60 s on a job that runs about 80
minutes, while the runs that fail today stop spending 30 s to produce nothing.

Both fail-open branches now also post one info.add_workflow_warning, so a run
judged on the floors says so on the job and workflow report pages instead of
only in the log. The check for a missing result is not result rather
than is None, because do_select_query returns the response body for any 2xx
and a zero-row SELECT answers 200 with an empty body, which produced the same
empty file with no warning. The warning text carries no sha or shard, so the report's
grouping collapses the six shards of one commit into a single entry. Nothing is
appended to results, deliberately: res = results[-1].is_ok() immediately below
must keep inspecting the step itself.

A cheaper query was measured and rejected: the t-digest quantile in place of
quantileExact saves about 1.5 s of 9 s, because the cost is the 371 GB scan
rather than the aggregation, and it would move the threshold values. Caching the
file between runs is not possible, since every job's env preparation removes
ci/tmp and that is where perf_wd lives. The readiness-probe drop mode is left
alone: it is in shared code with a second consumer and outside
do_select_query's retry loop, and it is now visible.

Related: ClickHouse#120488
Related: ClickHouse#102543

Co-Authored-By: Claude Opus 5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-request PR origin: a maintainer pinged or directed groeneai labels Sep 20, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex), 3 rounds, each one a cold pass
of my own plus an independent gate run over the whole diff. The final round returned 0 findings.

# Sev Finding Verdict Evidence / action
1 ⚠️ result is None misses the empty-body case: a zero-row SELECT answers HTTP 200 with an empty body, so the thresholds file was written empty with no warning (performance_tests.py:2271) AGREE, fixed if not result:. CIDBCluster.do_select_query has exactly three returns (cidb_cluster.py:97, :117, :130), so the falsy set is exactly {None, ""} and nothing else can be caught by accident
2 ❌ Could the two new add_workflow_warning calls raise and turn the deliberate fail-open into a fail-closed, reddening every shard exactly when CIDB is sick? Raised by me, disproved _add_report_message only appends to a list and writes the job's own environment file (_environment.py:352-361): no network, no CIDB, no S3. REPORT_MESSAGES is a real field with default_factory=list (:48). result.py:992 maps both True and None to a passing step, so the status is unchanged either way
3 ⚠️ The commit message omitted the CI report URL that was provided with the request (AGENTS.md, own-line rule) AGREE, fixed Report URL now in the message, unbroken, carrying PR=120488 and the sha; the Related: PR trailer was already present
4 ⚠️ ### Description said "#121090 changes that gate's rule", with no antecedent for "that gate" left in the body after an earlier condensation, in the one sentence that answers the question I was asked AGREE, fixed Rewritten self-contained: perf_dashboard_gate consults the dashboard verdict per query, so this alone does not clear a dashboard-driven red, and #121090 (mine) is named as mine
5 💡 Relative time ("the last 4 days") instead of an ISO window, in the message, the body and the evidence AGREE, fixed Replaced with started between 2026-09-16 and 2026-09-20, recovered sha-keyed rather than computed from "4 days ago": 40 of 40 shas matched, min(check_start_time) 2026-09-16 13:29:31, max 2026-09-20 07:15:08, play's timezone() checked to be UTC
6 💡 No link to the corresponding open issue for a CI-failure PR AGREE, fixed Related: .../issues/102543 (RFC: Rewrite Performance Comparison Tests) in both the message and the body, as Related and not Closes, since this does not implement that RFC
7 💡 Relationship links were inside the template's HTML comment and inline in prose, so neither rendered AGREE, fixed Two visible Related: lines, one per relationship, full URLs, placed as ci/jobs/revert_ci_regressions.py:1777 places them
8 💡 The warnings name only the changed half; unstable_fail is judged on the same missing history DISAGREE Both floors are already printed in the message ("the 0.15/0.25 floors"), so a reader sees the unstable bar; more prose would work against grouping the six shards into one report entry
9 💡 0.15/0.25 are hardcoded in the warning text rather than read from the harness DISAGREE They are literals in compare.sh:1232-1235 itself, so there is no single source to read them from; threading them out of a bash-embedded SQL query adds code to a PR whose point is one timeout constant
10 💡 An HTTP 200 with a partial body plus a mid-stream exception would still be written verbatim DISAGREE Different in kind and not silent: compare.sh then fails on the declared TSV structure, rather than passing with a bare floor

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are
terminal per finding. Row 2 is a risk I raised against my own change and then disproved, listed
because it is the one question worth asking about this diff.

Session id: cron:clickhouse-review-slot-10:20260920-120200

@clickhouse-gh clickhouse-gh Bot closed this Sep 20, 2026
@clickhouse-gh clickhouse-gh Bot reopened this Sep 20, 2026
@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Sep 20, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes, in two on-demand halves: the verdict chain replays from the run's own published metrics (4 blocking rows with the shipped thresholds, 0 with the learned ones), and the changed line reproduces against a loopback endpoint delayed past the old bar. The trigger rate is measured, 18 of 40 master runs, not forced: probing play.clickhouse.com for timeouts would manufacture the contention this fixes.
b Root cause explained? Yes. The 10 s read timeout sits inside the fetch's 8 to 10 s CI latency band, so it fires often; the fail-open then writes an empty thresholds file, and greatest(0.15, 0, 0) = 0.15 makes a missing history indistinguishable from a rock-steady query, so the shard is judged on the bare floors.
c Fix matches root cause? Yes: the bar moves to the existing in-tree constant for CIDB reads, 6x the worst CI sample. No threshold widened, no test tagged, no query weakened, no data shrunk. The learned thresholds were already correct, just not delivered.
d Test intent preserved / new tests added? No test is modified. No new test file: nothing runs ci/tests/, and the assertion available there would pin a literal argument rather than the observable behaviour, which is covered by the replay and by this PR's own perf jobs. Offered in the description if wanted.
e Both directions demonstrated? Yes, twice. Verdict level: 4 blocking rows -> 0 over the same 574 rows. Changed line: timeout=10 with retries=3 returns None after 30.1 s against a 12 s endpoint; timeout=Settings.CI_DB_QUERY_TIMEOUT_SEC returns the thresholds in 12.0 s.
f Fix is general across code paths? Yes for the fixed mode: one producer feeds both compare.sh join sites. The sibling readiness-probe drop mode (1 of 18) is in shared code with a second consumer and outside the retry loop, so it is left unfixed and made visible instead.
g Fix generalizes across inputs (params/datatypes/wrappers)? No datatype surface. The constant applies to every shard, arch and workflow running this step. The warning covers both fail-open branches, and the fetch branch tests not result, so it fires both when the read returns None and when it returns "", which is what a zero-row SELECT answers over HTTP 200. That closes all three enumerated silent-drop modes: not-ready, fetch-failure, empty-body.
h Backward compatible? (maintainer-approved exception only) Yes. No setting default, no SettingsChangesHistory.cpp, no format, no user-visible behaviour; the constant already exists and is not user-overridable. Worst-case wall time 3x60 s instead of 3x10 s on a ~80 minute job, and the currently-failing 45% now finish the step in ~9 s instead of burning 30 s.
i Invariants and contracts preserved? Yes. Both fail-open branches still touch the empty file and still return True, so compare.sh keeps a valid empty LEFT JOIN input and the step still reports success. Nothing is appended to results, so results[-1] still refers to the Select historical data step and an ERRORed step still gates later stages.

Session id: cron:clickhouse-impl-slot-4:20260920-100800

@clickhouse-gh

clickhouse-gh Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [74be7c0]

Summary: ❌

job_name test_name status info comment
Performance Comparison (arm_release, master_head, 2/6) FAIL Performance dashboard
timeseries_to_grid_aggregation_functions #4 FAIL dashboard
timeseries_to_grid_aggregation_functions #6 FAIL dashboard
set_index #1 unstable query history

AI Review

Summary

This PR fixes the main CI path that was wrongly grading an entire perf shard against the fallback floors when the learned thresholds fetch failed, and it mostly carries the new "not judged" state through the helper tooling. I still do not think it is ready to merge because one helper path still mishandles non-run shard statuses, and the helper readers can still collapse "CI had no verdict" into a clean answer when the metrics TSV is unreadable.

Findings

⚠️ Majors

  • [.claude/tools/fetch_perf_report.py:375-378, 934-938] fetch_perf_report.py still classifies only SKIPPED-without-artifacts as "not run". PENDING, RUNNING, and DROPPED shards survive into the download set, so an in-progress or superseded workflow can fall through to synthesized all-query-metrics.tsv fetches and end with Failed to download any shard data instead of a status-aware result. double_check_perf.py already widened this same partition, so the sibling helper now diverges on exactly the new state this PR is trying to standardize.
    Suggested fix: make shard_never_ran mirror the NOT_RUN_STATUSES treatment from double_check_perf.py, with SKIPPED plus a metrics artifact remaining the one abstention exception, and add a focused test that feeds PENDING, RUNNING, and DROPPED rows through main.

  • [.claude/skills/double-check-perf-tests/double_check_perf.py:588-607, .claude/tools/fetch_perf_report.py:965-1000] [dismissed by author -- https://github.com/ClickHouse/ClickHouse/pull/121189#discussion_r4078354752 ; https://github.com/ClickHouse/ClickHouse/pull/121189#issuecomment-5765513971] Both helper readers still lose the new abstention state when all-query-metrics.tsv cannot be read. In double_check_perf.py, the TSV failure drops back to report.html, but report.html has no "not judged" marker, so a shard that abstained can still take the clean/zero-exit path if it flagged nothing. In fetch_perf_report.py, the same download failure drops the shard out of downloaded, so the remaining shards can still be summarized as a clean comparison. I still consider this real because once the TSV is gone there is nothing left in the current code that distinguishes "CI measured nothing interesting" from "CI refused to judge this shard at all."
    Suggested fix: carry an explicit third shard state such as "judging state undeterminable" from the download layer, and make both tools refuse a clean verdict whenever such a shard is present.

Final Verdict

Request changes.

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 01ef7a2

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Performance Comparison (arm_release, master_head, 6/6) / group_uniq_array #1 Not from this PR, whose only change raises the historical-threshold query timeout and adds two warnings, so it can only reduce spurious verdicts. The shard's own measurement calls the query success; the red comes from the dashboard verdict confirmed_regression on a 0.0395 to 0.0481 s client_time step, and that verdict reds a Performance Comparison shard on 89 distinct pull requests in 7 days. The rand #0 and vectorize_aggregation_combinators #0 rows are unstable, a status carried by 328 pull requests in 24 hours, and the 5 too long rows are not the failing condition #121090 (mine, open)

Mergeable Check and PR are rollups of the row above. The cancelled jobs belong to a superseded workflow run.

Session id: cron:our-pr-ci-monitor:20260920-160237

…etched

compare.sh LEFT JOINs the learned per-query thresholds from
historical-thresholds.tsv, and a miss yields 0, so
greatest(0.15, 0, test_threshold) is the bare floor. The fetch step is
fail-open: when CIDB is unreachable or the query fails it writes an empty
table and reports success, and every query of the shard is then judged
against the floors as if it had been measured as rock steady. An empty
table is indistinguishable from a successful fetch in which a query has no
row of its own, which is why this was invisible to every consumer.

The two cases need opposite treatment. A query that was never measured has
nothing better than the floors, so it keeps them. A shard that obtained no
thresholds at all is not a comparable run, and grading it against a bar it
was never measured against is how one slow CIDB query becomes a red on an
unrelated pull request.

So the fetch step now records that it obtained nothing, in a marker beside
the empty table, and clears the marker first because the step is not stage
guarded and its workspace is reused. With the marker present no query
produces changed_fail or unstable_fail, the way the confirmation rerun
demotes a change that does not reproduce; the *_show flags and every
measured number stay, so the rows remain in the report. The per-test
confirmed counts drop the unjudged queries, the exported per-query bars say
inf rather than 0.15 so a consumer reproducing the gate reaches the gate's
answer, and the per-query CIDB rows say SKIPPED rather than success.

times_speedup keeps every row: it is a measurement, not a verdict, and an
empty average would report a fabricated 1.00x for every test. The
measurements are also not retracted from report/all-query-metrics.tsv,
which is the data of the query_metrics_v2 insert the thresholds are learned
from.

The shard reports SKIPPED instead of OK, which praktika keeps green on
GitHub, so a run nobody could judge cannot fail an unrelated pull request
while still reading as unjudged. A status that is already FAIL is left
alone, and the result is not cached, since nothing in the job digest
captures whether CIDB answered.

The release_base delta walk treats such a predecessor as unusable rather
than as a zero, because a shard that judged nothing has no count a delta
can be taken against. That walk keeps its whole extraction inside the one
guard that already reports a malformed body, so a result artifact which is
valid JSON but not an object still falls back to no baseline instead of
raising and failing the check.

The two readers of the perf job status inside this repository learn the new
state as well. A shard that abstained publishes its measurements and only
withholds a verdict, so the double-check skill now counts it apart from a shard
that never ran, whose message says CI never measured the commit, and the report
fetcher downloads it and labels it as not judged rather than dropping it as a
job with no artifacts. Both tell the two apart by the published metrics
artifact, which praktika records whatever the status is, so neither has to read
the status message or the exported thresholds. Recognising the state is not
enough on its own: each tool's reporting path still equated not judged with
nothing to report, so an abstaining shard read as a clean comparison. Both
now report the distinction too. The double-check skill refuses to call a
comparison clean while a shard abstained, marks the printed report
INCOMPLETE, lists those shards in result.json and exits non-zero, the way
it already does for a shard whose report could not be read; the fetcher
labels the shard in its per-shard line and in its JSON, and says the
comparison is not clean on every run rather than only when nothing else was
flagged, since a mixed run where one shard abstains and another flags a
query is the shape this started from. When all queries are shown the
abstaining shard's own rows do reach the detail list, where the inf bars
leave them neither changed nor unstable, so they are listed apart from the
judged ones and marked in the JSON instead of being counted as unchanged,
which is a verdict they never got. The named TSV output has no shard
level line to carry that, so there the marker rides on the row itself, as
a not_judged column appended after the existing ones so that a positional
reader of the older columns is unaffected. Nothing else in those rows says
it: the detail projection selects stat_threshold and not the two bars that
abstention sets to inf, so an unjudged row is otherwise identical to one
that was measured and found steady.

Co-Authored-By: Claude Opus 5 <[email protected]>
@groeneai groeneai mentioned this pull request Sep 21, 2026
1 task done
@groeneai groeneai changed the title Perf CI: fetch the learned per-query thresholds with the standard CIDB timeout Perf CI: do not judge a shard on the 0.15/0.25 floors when no learned thresholds were fetched Sep 21, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review of the abstention commit (click to expand)

An independent cold review plus a second-model pass over this commit only, repeated on every round
it went through. Accepted findings were fixed in it; one earlier declination is withdrawn below.
Bounce cap reached: published as-is; residual findings listed below.

finding verdict
❌ The refactor of the release_base predecessor parse moved the field reads outside the malformed-body guard, so a result_*.json that is valid JSON but not an object raised AttributeError instead of falling back to the absolute gate, which the caller turns into a red check. Fixed: the whole extraction is back inside the one guard, as classify_missing_prev_master_run already does it.
⚠️ Both workflow warnings said the check "reports SKIPPED" unconditionally, but only a derived OK is downgraded: a dashboard regression, report errors or a release_base delta still fail it. Fixed: they now say SKIPPED "unless something else fails it".
❌ The commit gives SKIPPED a second meaning on a perf job (measured everything, judged nothing, artifacts published), and the readers of that status in this repository held the old one. Raised on a further surface in each of five rounds, from "CI never measured the commit" through a mixed run reading as clean, a 0 exit code beside an INCOMPLETE report, and the shard's own rows printed as "unchanged". Fixed, on every surface. Both tools tell an abstaining shard from one that never ran by its published metrics artifact, so neither reads the status text or the exported bars. Neither calls a SKIPPED one clean: the all-clear is refused, the report carries an INCOMPLETE line and a result.json key, the exit code is non-zero, the fetcher shows n/j instead of OK, and lists those rows under NOT JUDGED in the human, JSON and TSV output.
⚠️ Asked for a liveness proof of the multi-stage abstention, since no test ships with it. Declined: already recorded. 155 assertions over the real Result/performance_tests and SQL anchor-extracted from the patched compare.sh, with mutation arms that all redden.
⚠️ Asked, with the TSV gap, that the perf-comparison helper (perf_api.py) be taught the marker too. Declined in two earlier rounds on the ground that it reads a file off disk with no status channel. Declination withdrawn. That ground was true when written and this commit's own last round made it false: the named --tsv output now carries not_judged, so the channel exists. Not fixed here (see the first residual below); the reason is recorded so it is not re-declined on a premise the code no longer has.
💡 An abstaining shard's report.html has no "Unstable Queries" table, because report.py omits the table when no row has unstable_fail set. Noted, not fixed: this is what already happens to a query demoted by the confirmation rerun, and no measurement is lost. Every measurement stays in the four report TSVs and the All Queries table, and the Changes in Performance table keeps its rows, uncoloured.
💡 The two fail-open branches touch historical-thresholds.tsv rather than truncating it, so on a re-entry where an earlier pass succeeded and this one failed, the shard abstains although the file still holds usable rows. Noted, not fixed: abstention is the safe direction, it is visible rather than silent, and truncating would not change the outcome, since only the marker drives the abstention.
💡 A job-level SKIPPED in the master workflow report still reads as "never scheduled", so an abstained predecessor whose result artifact is missing would be skipped rather than stopping the delta walk. Noted, not fixed: it needs a missing artifact beside a surviving workflow report, and the discriminator would add a second heuristic to a heuristic path.
💡 report/thresholds.tsv keeps the floors while all-query-metrics.tsv exports inf; and the per-test row uploaded to the CI database records changed/unstable as 0 for an abstaining shard with no marker of its own. Noted, not fixed. For the first: changed_show reads that table, so inf there would erase the rows from the report, and it has no other consumer. For the second: the counts are correctly zero, the dashboard's confidence tiers come from the raw metric rows, and the run-level disclosure is carried by the SKIPPED status and the workflow warning.
💡 Neither marker file is collected into logs.tar.zst, whose archive filter takes only *.log/*.tsv/*.txt/*.rep/*.svg. Noted, not fixed: the workflow warning already states the cause on the report page.
💡 Two narrower gaps in the report fetcher: a shard whose metrics TSV fails to download falls out of the not-judged set, and the Total: line sums an abstaining shard's zeros. Noted, not fixed. The first is pre-existing and the same for any status, and this commit narrows it rather than widening it. The second is display only: that shard's own not judged line is printed directly above the total.

Residuals from the final round, not fixed in this commit. All three are in the .claude/
helpers, not in the CI gate, and none can let an unjudged run read as a pass in CI:

residual why it is left
⚠️ Abstention is detected from the job status alone, so a shard that abstained and failed for an independent reason keeps FAIL and is still read as judged: its inf bars make every row is_changed=0, and the fetcher then prints OK -- no changes for a shard that judged nothing. The status-independent signal (the exported inf bars) is already in the downloaded file. The check is red in that case, so nothing merges on an unjudged verdict, and the workflow warning fires in the fetch step whatever the final status. The PR body was narrowed at review-freeze to claim only what holds: "neither calls a SKIPPED one clean".
⚠️ perf_api.py, the documented consumer of fetch_perf_report.py --tsv, ignores the new not_judged column and buckets an abstaining shard's rows as unchanged; relatedly, that column is projected only when some shard abstained, while ci-api.md lists it unconditionally. One follow-up on that file settles both. Half its documented input is the headerless raw all-query-metrics.tsv, which cannot carry a marker column, so the fix is partial by construction there; and its parser is header-keyed, so the conditional column is inert rather than breaking.
⚠️ The new TSV regression arm asserts on the generated SQL text and never drives output_tsv, so removing the not_judged_keys forwarding would leave all twelve arms green while the marker stopped reaching real output. The wiring is correct as it stands. The arm's shape was prescribed by the review's own fix plan, so this is the reviewer's gap rather than an execution one. Named here with the exact mutation it misses so a follow-up can add it.

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - c93560a

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Performance Comparison (arm_release, master_head, 6/6) / timeseries_to_grid_aggregation_functions #5, #6, #14 dashboard-tier verdict only: the shard's own report calls 0 queries slower, and all 20 timeseries_to_grid_aggregation_functions rows on this shard are success #121090 (mine, open)
Mergeable Check, PR rollups of the row above #121090 (mine, open)

The three flagged queries are 82-192 ms timers; the family is non-success on 428 distinct
pull requests / 3188 rows in the last 7 days, 864 of those rows on true master. The
confirmed regression(s) on the performance dashboard clause itself hits 320 pull requests /
553 shard rows in 7 days. This branch adds no product code (its diff is
ci/jobs/performance_tests.py, ci/jobs/scripts/perf/compare.sh and .claude/ tooling), so
it cannot slow a query; and the shard logged abstain_all=0, i.e. the learned thresholds were
fetched and this PR's own abstention path never ran.

Session id: cron:our-pr-ci-monitor:20260922-220237

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - c93560a

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Performance Comparison (arm_release, master_head, 6/6) / timeseries_to_grid_aggregation_functions #5, #6, #14 dashboard-only verdict, not caused by this PR: the shard's own report published no slower query at all and calls all three of those queries success #121090 (mine, open)
Mergeable Check, PR rollups of the row above, no independent failure #121090 (mine, open)

Detail on the one red. The shard's own summary is 6 too long, 2 faster, 4 unstable; 3 confirmed regression(s) on the performance dashboard: the absent "N slower" phrase means zero shard-side slower queries, and in master_head mode a FAIL can then come only from the dashboard gate. All three flagged queries (timeseries_to_grid_aggregation_functions #5 +69.5%, #6 +49.5%, #14 +45.1%) are success in this shard's own published verdict, and this PR's diff touches only ci/jobs/performance_tests.py, ci/jobs/scripts/perf/compare.sh and five .claude/ harness files, so it contains no product code that could slow a query. For breadth, that query family is flagged unstable on 385 distinct pull requests and slower on 104 in the last 7 days.

#121090 is the causal owner, not a coincidental same-area PR: it gates a dashboard confirmed_regression on the same (test, query_index) also appearing as slower in the shard's own report, and skips the dashboard gate outright when the shard published no slower query, which is exactly this head's shape.

Session id: cron:our-pr-ci-monitor:20260922-215433

…atus

Both report readers decided "this shard judged nothing" from the praktika
status alone. performance_tests.py only turns the shard SKIPPED when the
abstention is its only problem: a shard that fetched no learned thresholds and
then failed for an unrelated reason keeps that failure, and the readers then
treated it as an ordinary judged shard.

Its rows are still visible, because compare.sh's changed_perf_report selects
`from queries where changed_show` and abstain_all does not gate changed_show,
but they carry the infinite bars the abstention exports. Read as a numeric bar,
inf makes `abs(diff) > changed_threshold` unsatisfiable for every row, so
fetch_perf_report.py reported no changes and double_check_perf.py confirmed
none of them and exited 0 -- a clean verdict over data CI never judged, which
is the failure this abstention exists to prevent.

So classify from the bars, which are the same artifact the verdict comes from.
The sentinel is BOTH bars infinite, matching the partition perf_api.py already
uses: one infinite bar is a zero baseline in eqmed.sql and NaN is a missing
one, and such a row keeps its own verdict. In fetch_perf_report.py the TSVs are
already downloaded where not_judged is built. In double_check_perf.py the
partition runs before any download, so find_changed_queries reports the shards
whose bars show they judged nothing and main() adds them to the abstained set,
which already suppresses the clean verdict and forces a non-zero exit.

The most common perf-shard failure is a report carrying "N errors" (428 shard
rows over 274 pull requests in the last 14 days), so this is the reachable half
of the mixed case rather than a theoretical one.
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 74be7c0

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Performance Comparison (arm_release, master_head, 2/6) / timeseries_to_grid_aggregation_functions #4, #6 dashboard-only verdict, not PR-caused: the dashboard reports 0.0853 -> 0.1036 (+21.4%) and 0.0853 -> 0.1025 (+20.2%) tier confirmed_regression, while this shard's own report publishes both queries as success and lists no slower query at all (summary 2 too long, 1 unstable; 2 confirmed regression(s) on the performance dashboard, no "slower" phrase) #121090 (mine, open)
Mergeable Check aggregator row, mirrors the row above, no independent failure #121090 (mine, open)
PR aggregator row, mirrors the row above, no independent failure #121090 (mine, open)

Measured at this head rather than inherited: the failing shard carries 1198 success rows, 2
unstable rows and the one job summary, and 0 FAIL/ERROR test rows across the head. The 2
unstable rows are set_index #1 (old and new), a set disjoint from the two queries the dashboard
flagged, both of which are success here. So the red comes only from the dashboard arm, and
#121090 is causal for that shape: it fails a master_head shard only when the shard's own report
also calls the query slower, and it exits early when the shard published no slower query.

This PR's own diff cannot have produced the verdict either. It changes the perf harness only to
add an abstention path for the case where the learned per-query thresholds are missing, and that
path is guarded by report_not_judged, which was false on this run: the thresholds were present
and every query was judged normally. The dashboard gate ran with its pre-existing behaviour.
Breadth over 7 days: the confirmed regression(s) on the performance dashboard red hits 643 rows
across 338 distinct pull requests and 0 true-master runs, and the two leaves are flagged unstable
on 58 and 55 distinct pull requests respectively, so both are known-noisy independently of this
branch.

Merge order still matters for a green re-run here: #121090 first, then this PR, because CI builds
the merge commit.

Session id: cron:our-pr-ci-monitor:20260923-073136

fm4v added a commit that referenced this pull request Sep 23, 2026
`Select historical data` used a 10 s timeout for a query that takes 8 to 10 s, so many runs lost their per-query thresholds and judged every query against the 0.15 floor. Use `Settings.CI_DB_QUERY_TIMEOUT_SEC` (60 s) and post a workflow warning when the thresholds are missing.

Taken from #121189.
@fm4v

fm4v commented Sep 23, 2026

Copy link
Copy Markdown
Member

Closing in favor of #121847, which takes the threshold-fetch timeout fix and warnings from #121189. Noisy queries are handled in the dashboard's confidence scoring instead: https://github.com/ClickHouse/performance-comparison/pull/5

@groeneai

Copy link
Copy Markdown
Collaborator Author

Thanks for taking the timeout fix and the warnings. No objection to the closure: the UTC event_date cause is the better root fix and I did not have it.

Flagging the one piece that did not come across, so it is a decision and not an oversight: the abstention itself. #121847 keeps both fail-open branches writing an empty historical-thresholds.tsv and returning True, so report() in compare.sh still cannot tell "nothing was fetched" from "this query has no history", and judges every query on ceil(greatest(0.15, ...), 2) / ceil(greatest(0.25, ...), 2).

I checked what that still costs, and in the jobs that run today it cannot red a check. pull_request.py and master.py wire only the master_head jobs, where performance_tests.py discards the report status and gates on the dashboard verdict; the shard's own slower count is the gate only in the cumulative release_base mode, which no workflow wires (its last CIDB rows are from 2026-09-08). Over the last 7 days, 1767 master_head shards published a shard-side slower with no dashboard confirmation and every one passed; the failures in that slice all carry N errors or performance dashboard verdict unavailable, neither of which comes from the thresholds. With #121090 closed too, nothing consumes the shard-side verdict as a gate.

What is left is report quality rather than a false red: a shard that fetched nothing still publishes per-query verdicts and an N slower line computed from the floors, as order_by_read_in_order #1 did at the 0.15 floor where its own history earns 0.65. I am not asking for the abstention back on that basis; if the release_base jobs are wired again, that count becomes the gate and it would matter there.

Provenance in case you want it anyway: @ alexey-milovidov asked for it in #120111 (comment). The other half he raised there, history unusable because it sits under a different query_display_name, is already on master in #121278.

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 comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). groeneai-origin-request PR origin: a maintainer pinged or directed groeneai manual approve Manual approve required to run CI pr-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants