Repository navigation
Publish a failing job step's cause to CIDB, not just the failure count - #115526
alexey-milovidov merged 15 commits into
Conversation
When a praktika job dies in a result node that is not the one named by result_name_for_cidb, CIDB receives one row whose entire test_context_raw is "Failures: N/M" and zero test rows. json_data_generator emits the job row with test_context_raw = result.info, plus one row per child of the single node _get_sub_result_with_test_cases matches by exact name, so a failing sibling of that node is visited by neither loop and its info is dropped during row generation. The job row does not compensate, because result.info there is the count-only fallback Result._add_job_summary_to_info writes while info is empty. The cause is then readable only from job.log, so no test-name-keyed and no signature-keyed CIDB query can see this class of failure, including anti-join scans that require test_name != ''. Every Stateless job sets result_name_for_cidb="Tests" while Install ClickHouse, Start ClickHouse Server, Collect coverage and Collect logs are its siblings. 30d on public CIDB: 22 master jobs, 498 jobs total, 39 distinct checks. On master commit b03544a the failing Start ClickHouse Server node carried 301 lines while CIDB got 13 bytes. Append "<name>: <info>" for each failing direct child that reaches no other row, after the existing text so the old value stays a strict prefix. Child rows are deliberately unchanged: a test_name='Install ClickHouse' row would enter per-test statistics and every flaky-rate aggregation. Direct children only, because Result.results has no cardinality bound. No second truncation, because Result.from_commands_run already caps each payload at 300 lines. Skip a child whose info is already contained in the job's own text. Two real routes need this: ci/jobs/fast_test.py copies the Tests node's info onto the root without clearing it while the named node is never in its own published set, and Result.create_from(with_info_from_results=True) already lifts child info in this same "<name>: <info>" shape under a result_name_for_cidb that matches no child. Without the check the summary is duplicated on every ordinary Fast test failure. Not addressed here: Keeper Stress names a result_name_for_cidb no child carries, so its cases reach no row and their parent's own info is empty. That is a different root cause in different files, and this change is a verified no-op there. Co-Authored-By: Claude Opus 5 <[email protected]>
Two coverage gaps in the tests added by the previous commit. Each survived a
mutation of ci/praktika/cidb.py that left all 13 arms green, so a later refactor
could have narrowed the behaviour without CI noticing. No behaviour change: the
generator already handles both shapes correctly, only the tests were missing.
Narrowing the collector's predicate from not r.is_ok() to r.is_failure() was
silent, because every positive arm used FAIL while is_ok() is {OK, SKIPPED,
XFAIL} and is_failure() is {FAIL, XPASS}, so only ERROR distinguishes them.
ci/jobs/performance_tests.py appends a direct Download datasets child with
status=ERROR and populated info under result_name_for_cidb="Tests", so the ERROR
half is the production shape, not a hypothetical. Parametrize the primary arm
over FAIL and ERROR rather than duplicating the fixture; the count fallback in
Result._add_job_summary_to_info uses the same predicate, so the job summary is
Failures: 1/3 for both.
Adding the selected node's own id to published_ids was also silent. The node
_get_sub_result_with_test_cases returns is never in its own published set, since
that set holds its children, and this asymmetry is what makes the node's own
info reach a row at all. Both existing arms that give it a non-empty info also
copy that text onto the root, so the containment clause suppressed the append
and the published_ids clause was never exercised on the container. The new arm
gives the root a different string, as ci/jobs/performance_tests.py does when it
builds Tests through Result.from_commands_run while the root carries the report
message, and asserts the whole context by equality so ordering and the prefix
property are pinned too.
Both mutations now fail exactly one arm each, the five byte-identity negative
controls and the two duplication guards stay green under all five mutations, and
the arm count rises from 13 to 15 pytest items.
Also state the empty-info arm's docstring as the invariant it checks instead of
attributing a status and a field to a node that has neither.
Co-Authored-By: Claude Opus 5 <[email protected]>
The large-payload arm asserted that a big diagnostic is appended verbatim, but its fixture was 300 lines and 2945 chars while a real master payload is 301 lines and ~26 KB. Result.from_commands_run truncates to a leading marker plus the last 300 lines, so 301 is the ceiling, and the cause sits in the tail. A line clip at 300 and a byte clip at 4 KiB both left the suite green. The fixture now matches production on both axes and the arm asserts the line count and the byte size explicitly, so either clip reddens it.
The large-payload arm covered only the default truncation branch of Result.from_commands_run, which emits a marker plus the last 300 lines. Its error-centered branch wraps 300 retained lines in both a leading and a trailing marker, so it can emit 302 lines and the cause need not be last. A 301-line clip of the appended diagnostic therefore left the whole suite green, leaving the verbatim-append contract unpinned exactly at its real boundary. Parametrize the arm over both real shapes, each asserting its own line count, and add a fixture built the way the error-centered branch builds its output. A sweep of every error index over log lengths 301 to 5000 confirms 302 is the ceiling, so this pins the boundary rather than another sample value. The tail assertion becomes a containment check because the trailing truncation marker, not the cause, is last in that shape; exact equality still pins every byte. No change to ci/praktika/cidb.py.
Internal second-model review: 3 majors agreed and fixed over 3 rounds, final round cleanFour independent cold reviewer sessions plus four automated review passes ran against this diff ❌ Agreed and fixed1. The 2. The published-row-set clause was unpinned. Adding the selected node to its own published set 3. The large-payload arm could not detect truncation. Its fixture was 300 lines / 2.9 KB, while Each of the three predicate clauses, and the absence of a cap, is now covered by a mutation that 💡 Noted, not blockingThe A 30-day census total moves with the window (497 to 505 across six independent measurements). The Verified beyond the fixturesRe-checked at source level and against real master report JSON: the hoisted selector call is pure |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-review-slot-8:20260819-230208 |
|
Workflow [PR], commit [5c52c5e] Summary: ✅ AI ReviewSummaryThis PR moves the failed-step cause into Findings
Final VerdictChanges requested: the new stateless digest invariant still needs the same selection-input coverage for targeted integration jobs. LLVM Coverage Report |
|
cc @maxknv, could you review this? A praktika job that dies in a step outside the node named by |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Compile time of recompiled translation units6 translation units recompiled, 4 s compile time in total, 6 of them have a recent master baseline. |
|
@groeneai In result.py, instead of just 'Failures: N/M,' generate a line of failed step and trim the line if too long. drop your change in cidb.py |
…ures A job's summary line carried only "Failures: N/M". When a job died in a step outside the node named by result_name_for_cidb - Install ClickHouse, Start ClickHouse Server, Checkout Submodules - that count was the only text anywhere in the job's own info, so the cause reached neither CIDB's job-level row, nor the report page, nor the GitHub issue body. It survived only inside job.log. Each failing direct child is now named after the count line, so the summary identifies what broke. The count line stays first and keeps its exact old text, so readers and queries written against it keep matching. Move the fix here from ci/praktika/cidb.py as requested in review: this is the one site that produces the deficient string, and fixing it lifts every surface that renders a job summary rather than CIDB alone. The summary is written only while info is empty, which is precisely the affected class: functional_tests.py lifts the Tests node's text into the job info at the end of its test stage, and that stage is gated on the earlier stages succeeding, so a job that died before it leaves info empty. That same guard keeps the two shapes that copy a child's info onto the root (fast_test.py, performance_tests.py) from doubling their own text. from_commands_run already caps a step's info at 300 lines, and it puts the cause near the front in its error-centered branch but at the very tail in its default branch. A one-ended trim would drop the cause in one of the two, so _trim_step_info keeps both ends, and its bound sits above the widest shape that function emits so an ordinary step log is named whole. Tests: 16 items covering the affected shape, both real payload branches, both trim directions, the count-line prefix, and the SKIPPED and empty-info boundaries. Ten mutations, one per property, each reddens the suite.
A job whose direct children are test cases (a pytest job with no CIDB selector) publishes a row per case already, so naming every failure repeated those payloads in the job row and grew it with the failure count: 40 failing cases produced a 120 KB job row. Name at most the first few, which is enough to identify a job that died in one of its steps - the case that has no other carrier - and leaves the row bounded. Measured 120405 -> 9042 bytes. Also strengthen two test properties that were satisfiable while broken: the large-payload arms now assert exact equality with the named step rather than marker presence, so lowering the trim bound reddens them, and a new arm drives the real publisher so losing the summary's wiring into the job row cannot stay green.
The end-to-end arm pre-applied the private formatter, so deleting the production call from complete_job left the suite green. It now calls complete_job itself, and a mutation removing that call reddens.
from_commands_run bounds a step's line count but not its line length, so its error-centered excerpt can put 50 long context lines ahead of the cause. With 406-character lines the cause began at character 20449, inside the span the two-ended trim removes, so the summary dropped the very error it publishes. Anchor the kept tail on the first marker when there is one. Also name a failing selected node's own info: CIDB publishes that node's children, never the node itself, so its command log otherwise reaches no row.
|
Done in Two things I measured while doing it:
One boundary for you to rule on: when the job info is already non-empty this site does nothing, so a later failing |
The job summary that gets published to CIDB is built by `Result.complete_job` in `ci/praktika/result.py` — this pull request moves the failing-step cause into exactly that summary. `find_tests.py` already lists `ci/praktika/cidb.py` in `_STATELESS_HARNESS_PATHS` so that a change to the reporting path reruns the deterministic smoke tests, but it did not list `result.py`, which now carries the behavior. Add it, so a change to what a functional-test run reports is treated as a harness change rather than being ignored by test selection. Addresses the AI review's second required action. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`Result.from_commands_run` centers its excerpt on the first line matching `: error:` or `: warning:`, but `_trim_step_info` re-anchored the kept tail on `: error:` only. A warning-centered payload whose context lines are long enough to push the marker past the retained head therefore lost the only diagnostic the summary was trying to preserve. Measured on the pre-fix tree through the real chain (`from_commands_run` into `_add_job_summary_to_info`): with a 400-line payload of 880-character lines and the marker on line 100, the `: error:` shape keeps its cause in the job summary and the `: warning:` shape, otherwise identical, does not. Both keep it now. Blast radius, 15 `_trim_step_info` shapes compared by sha256 before and after: only the four whose earliest marker at or after the midpoint is a `: warning:` in the dropped span change. Short lines, unmarked lines and every `: error:` placement stay byte-identical. Reported by clickhouse-gh[bot] on ClickHouse#115526.
`2d058e2e200f` added `ci/praktika/result.py` to `_STATELESS_HARNESS_PATHS` in `ci/jobs/scripts/find_tests.py`, but that list is read inside the job, while the decision to run the job at all is made earlier from the job digest. `common_ft_job_config.digest_config.include_paths` named neither `ci/praktika/result.py` nor `ci/jobs/scripts/find_tests.py`, so `_filter_unaffected_jobs` skipped the stateless lanes as "not affected" before `find_tests.py` was ever imported, and the new entry could not fire on exactly the change it was added for. Replaying `Job.Config.is_affected_by` on `common_ft_job_config` with the changed-file sets confirms it: `['ci/praktika/result.py']` and `['ci/jobs/scripts/find_tests.py']` both returned `False` before this commit and both return `True` after it. `find_tests.py` selects which tests the job runs and `Result.complete_job` builds the summary the job publishes, so both are genuine runner inputs of this job. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
leshikus
left a comment
There was a problem hiding this comment.
PR adds more information to a summary and is generally good;
- changes like this should be merged to public;
- better to have common utility for log trimming and reuse it (add to a helper); maybe as a separate pr;
- while usability matters, it is better to leave usability to human, there are plenty of developer requests which are not yet answered, and implementing a random improvement is not a top priority - and your pr description does not mention particular stakeholders;
|
Thanks for the review. 1) Agreed, and that is where it is: this PR is on 2) You are right, and it is wider than my diff. They differ on every axis a shared helper needs: unit (lines vs characters), which end survives (one vs both), anchor (first marker vs none). So: a separate PR, as you suggest. I have not opened one, for your point 3: nobody asked for it. If you want it, say which shape should win and I will do it. The one cheap piece that touches nothing shared is reusing the existing banner wording instead of adding a sixth, which I can push here. 3) Fixed in the description, which now names the requesters: @ maxknv specified this shape on this thread ("in result.py ... generate a line of failed step and trim the line if too long"), @ alexey-milovidov approved it and pushed |
`Targeting._STATELESS_HARNESS_PATHS` lists `ci/praktika/cidb.py`, but `common_ft_job_config.digest_config.include_paths` did not, so `common_ft_job_config.is_affected_by(['ci/praktika/cidb.py'])` was `False` and `_filter_unaffected_jobs` skipped the job before `find_tests.py` could add the deterministic smoke tests — the same unreachable-entry problem that `2dc83d2d117e` fixed for `result.py` and `find_tests.py`. Settled in favour of adding rather than removing the harness-list entry: `find_tests.py` imports both `CIDB` and `Info`, and `get_all_relevant_tests_with_info` — called from `functional_tests.py` for the targeted and selected arms — runs its selection queries through `CIDB.query`, so a change to either module can change which tests the job runs. That is the criterion that already put `find_tests.py` in the digest, so `ci/praktika/info.py` is added alongside `ci/praktika/cidb.py`. The five remaining entries of `_STATELESS_HARNESS_PATHS` that the digest still does not cover (`.github/workflows/pull_request.yml`, `ci/defs/job_configs.py`, the two workflow hooks and `ci/workflows/pull_request.py`) are deliberately left out: they drive job orchestration and the job itself never reads them. Replaying `Job.Config.is_affected_by` on `common_ft_job_config` now returns `True` for `ci/praktika/cidb.py` and `ci/praktika/info.py`, and still `False` for `ci/workflows/pull_request.py` and for ordinary sources. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`_trim_step_info` re-anchored its kept tail with `line.find(marker, half)`. `str.find` only reports occurrences that start at or after its start index, so a marker that begins in the last characters of the head was never found: the tail then came from the end of the line, and the message the marker introduces, the only diagnostic a job-level row carries, fell in the span the helper drops. Measured on a4c88b4, a `: error:` starting 3 characters before the midpoint leaves no cause text in the output at all; a marker that ends exactly at the boundary loses its message whole. Both markers, and the same through `_add_job_summary_to_info`. The search now starts `MARKER_CONTEXT` characters before the boundary, and the head stops where the kept tail begins, so a marker the boundary splits is kept in one piece instead of being cut across the inserted notice. Of a 28-shape battery against a4c88b4, 19 shapes are byte-identical, the 4 marker-at-the-boundary shapes gain their cause, and 5 shift the kept window because the first marker now anchors it. The reported trimmed count stays exact: the kept head and tail never overlap.
| # belong here for the same reason. The other CI-level entries of | ||
| # `_STATELESS_HARNESS_PATHS` stay out: they drive job orchestration | ||
| # and the job itself never reads them. | ||
| "./ci/praktika/cidb.py", |
There was a problem hiding this comment.
integration_test_targeted_pr_jobs still has the same unreachable-entry gap this hunk fixes for the stateless lanes. ci/jobs/integration_test_job.py:1756-1757 calls Targeting.get_all_relevant_tests_with_info(), but common_integration_test_job_config (ci/defs/job_configs.py:257-268) still omits ci/jobs/scripts/find_tests.py, ci/praktika/cidb.py, and ci/praktika/info.py. On the current head:
JobConfigs.integration_test_targeted_pr_jobs[0].is_affected_by(['ci/jobs/scripts/find_tests.py']) == False
JobConfigs.integration_test_targeted_pr_jobs[0].is_affected_by(['ci/praktika/cidb.py']) == False
JobConfigs.integration_test_targeted_pr_jobs[0].is_affected_by(['ci/praktika/info.py']) == FalseSo a PR that changes targeted integration-test selection can still be filtered out in _filter_unaffected_jobs before the targeted lane imports those modules. Please give the targeted integration jobs a digest that tracks the same selection inputs, either by extending common_integration_test_job_config or by splitting out a targeted-only digest.
There was a problem hiding this comment.
Verified on the live head 5c52c5e4246b5. The three booleans reproduce exactly as reported, and the stateless counterpart confirms the asymmetry:
Integration tests (amd_asan_ubsan, targeted): find_tests.py=False cidb.py=False info.py=False
Stateless tests (arm_asan_ubsan, targeted): find_tests.py=True cidb.py=True info.py=True
Two corrections to the scope, both widening it.
The gap is not targeted-only, so the split-out targeted digest would under-cover. ci/jobs/integration_test_job.py imports both modules at file scope (find_tests.Targeting at :12, praktika.info.Info at :20), and the regular sharded arm, explicitly not the targeted one (total_batches > 1 and not is_flaky_check and not is_targeted_check and not is_bugfix_validation, :1821), calls Targeting.is_functional_test_file / is_integration_test_file / is_ci_job_script at :1830-1838 to decide whether to exit SKIPPED (:1843). So find_tests.py and info.py are inputs to every integration job, not only to targeted. Of the two options, only extending common_integration_test_job_config covers that; a targeted-only digest would leave the shards' own skip decision untracked.
Price, since the shared config is then the one that has to move. 37 of the 168 jobs in the PR workflow share this digest. Over the last 6 months of master (41,854 non-merge commits), 194 of them would newly wake those 37 jobs. For comparison, the stateless entries already on this branch cost 181 commits across 33 jobs, so this is the same order of magnitude rather than a new class of cost.
Against that, the measured frequency of the harm is low: of the 210 commits touching the three paths, 2 edited integration-only selection code and 1 of those woke no integration job, and 1 edited the skip classifiers above while touching covered paths anyway. Roughly one occurrence in 6 months.
I have not pushed it. common_integration_test_job_config is untouched by this pull request (its only ci/defs/job_configs.py change is the stateless block), so the omission is pre-existing master rather than something this diff introduces, and the call is a capacity decision on the 37 integration jobs. The patch is the three entries plus the matching comment, the same shape as the stateless block. I will push it here if that is wanted, or leave it out of an approved diff.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
When a job dies in a step outside the node named by
result_name_for_cidb(Install ClickHouse,Start ClickHouse Server), the job's own info is justFailures: N/M, so the cause reaches no CIDBrow, report page or issue body and survives only in
job.log. 152 failing master job instances landin this shape over 30d; at
b03544a19bcthe failingStart ClickHouse Servernode carried 301 linesand CIDB got 13 bytes (report).
Asked for on this thread by @ maxknv ("in result.py ... generate a line of failed step and trim the
line if too long",
comment) and by
@ alexey-milovidov, who approved it and pushed
2d058e2e200fand2dc83d2d117ehere himself. Theconsumer is master-CI triage off CIDB, where those 152 instances show no cause.
_add_job_summary_to_infonow names each failing direct child after the count line, which staysfirst and unchanged so queries against it keep matching. Doing it here rather than in
cidb.pyliftsevery surface that renders a job summary, per review.
Two measured bounds.
from_commands_runputs the cause near the front in one branch and at the tailin the other, so the trim keeps both ends, anchored on the first
: error:or: warning:. A jobwhose children are test cases already publishes a row per case, so naming all of them grew this row
with the failure count (40 cases gave 120 KB); at most the first few are named.
Not addressed (predates this change): a job whose info is already non-empty when the summary runs, so
a later
Collect logsfailure still publishes no cause.Keeper Stressnaming aresult_name_for_cidbno child carries is likewise unchanged.Validation: both payload branches, both trim directions, both anchors, the per-shape bound and the
real publisher path, on both sides of the change; the pinning test was deleted in 7428aec.
Workflow [PR]
Sync PR [sync-upstream/pr/115526]
Version info
26.10.1.369-master(included in26.10and later)