Skip to content

Commit 517801b

Browse files
committed
CI: rework Bugfix Validation per-arch jobs to natural success (drop force_success)
Per @leshikus's review feedback on PR #103541 (#103541 (comment) from 2026-04-26T08:26:25Z): "I vote against forcing the success status; you can report success status without forcing it". This commit keeps the per-arch + final aggregator architecture from the original PR (which @alexey-milovidov approved in #103389 (comment) from 2026-04-25T16:48:15Z) but switches the per-arch jobs from a `force_success=True` flag to a natural OK exit: - Remove `force_success=True` from the four per-arch `Bugfix validation (...)` job configs in `ci/defs/job_configs.py`. - In `ci/jobs/functional_tests.py` and `ci/jobs/integration_test_job.py`, after inverting test result statuses for bugfix validation: - Always call `set_success()` on the result so the per-arch job's GitHub status reflects "ran the test and captured the outcome", not "was the bug validated". - The validation outcome (whether the bug was reproduced) lives in the JSON artifact (`bugfix_validate_result.json`) consumed by the `Bugfix validation (final)` aggregator, which decides the merge-blocking status. - In the integration-test runner, gate the success-overwrite behind `if has_error:` so genuine infrastructure failures (sanitizer assert, OOM, server crash) still propagate as real failures instead of being masked. The aggregator handles that arch as SKIPPED, so the other arch can still validate the bug. - Update comments in `ci/defs/defs.py` and `ci/jobs/bugfix_validation_aggregate.py` to describe the new natural-success contract. No changes to job names, dependencies, artifacts, or the aggregator logic itself — only the mechanism by which per-arch jobs report success. The regenerated `pull_request.yml` is unchanged. CI report: #103541
1 parent b05e00d commit 517801b

5 files changed

Lines changed: 117 additions & 60 deletions

File tree

‎ci/defs/defs.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,10 @@ class JobNames:
369369
BUGFIX_VALIDATE_IT = "Bugfix validation (integration tests)"
370370
BUGFIX_VALIDATE_FT = "Bugfix validation (functional tests)"
371371
# Per-arch bugfix validation: each runs the test on master HEAD and on the PR,
372-
# always reports SUCCESS (force_success=True), and emits a result artifact.
372+
# naturally exits with OK status after capturing the outcome, and emits a result
373+
# artifact. The validation result (whether the bug was reproduced) lives in the
374+
# JSON artifact rather than in the job's GitHub status — see
375+
# `ci/jobs/bugfix_validation_aggregate.py` for how the four artifacts are combined.
373376
BUGFIX_VALIDATE_FT_AMD = "Bugfix validation (functional tests, amd64)"
374377
BUGFIX_VALIDATE_FT_ARM = "Bugfix validation (functional tests, aarch64)"
375378
BUGFIX_VALIDATE_IT_AMD = "Bugfix validation (integration tests, amd64)"

‎ci/defs/job_configs.py‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -554,17 +554,24 @@ class JobConfigs:
554554
# and on the PR. The check is considered to "validate the bug" only when
555555
# the test FAILS on master HEAD AND PASSES on the PR for that arch.
556556
#
557-
# Per-arch jobs are configured with `force_success=True`: they always
558-
# report SUCCESS to GitHub, regardless of whether the bug was validated.
559-
# The actual outcome is written to a small JSON artifact consumed by the
560-
# `Bugfix validation (final)` aggregator job, which decides the final
557+
# Per-arch jobs report a NATURAL success status: the job succeeds as long
558+
# as it runs the test and captures the outcome. Whether the bug was
559+
# validated is a piece of *data* (recorded in a small JSON artifact),
560+
# not a piece of *status*. The `Bugfix validation (final)` aggregator job
561+
# consumes the four per-arch JSON artifacts and decides the merge-blocking
561562
# status: SUCCESS iff at least one arch validated the bug.
562563
#
563564
# Rationale: some bug fixes are architecture-specific (e.g. SSE2/AVX-only
564565
# on x86, NEON-only on aarch64). With a single per-arch check, those PRs
565566
# would always fail Bugfix validation on the "wrong" arch. Splitting into
566567
# per-arch sub-checks plus a final aggregator allows architecture-specific
567568
# fixes to pass when validated on at least one arch.
569+
#
570+
# Note: the per-arch jobs deliberately do NOT use `force_success=True` —
571+
# they exit naturally with status OK after capturing the result, so a
572+
# genuine infrastructure failure (server crash, sanitizer report, docker
573+
# timeout) still propagates as a real failure rather than being silently
574+
# masked.
568575
bugfix_validation_ft_pr_jobs = Job.Config(
569576
name=JobNames.BUGFIX_VALIDATE,
570577
runs_on=None, # set per ParamSet
@@ -581,7 +588,6 @@ class JobConfigs:
581588
],
582589
),
583590
result_name_for_cidb="Tests",
584-
force_success=True,
585591
).parametrize(
586592
Job.ParamSet(
587593
parameter="functional tests, amd64",
@@ -769,15 +775,17 @@ class JobConfigs:
769775
)
770776
# Per-arch Bugfix Validation Check (integration tests). See the rationale
771777
# comment above for `bugfix_validation_ft_pr_jobs`. Each per-arch variant
772-
# always reports SUCCESS and writes its outcome to a JSON artifact; the
773-
# `Bugfix validation (final)` aggregator decides the merge-blocking status.
778+
# naturally exits with status OK after capturing the outcome and writes
779+
# its result to a JSON artifact; the `Bugfix validation (final)`
780+
# aggregator decides the merge-blocking status. As with the FT variant,
781+
# `force_success=True` is deliberately NOT used — genuine infrastructure
782+
# failures still propagate.
774783
bugfix_validation_it_jobs = (
775784
common_integration_test_job_config.set_name(JobNames.BUGFIX_VALIDATE)
776785
.set_command(
777786
"python3 ./ci/jobs/integration_test_job.py --options BugfixValidation"
778787
)
779788
)
780-
bugfix_validation_it_jobs.force_success = True
781789
bugfix_validation_it_jobs = bugfix_validation_it_jobs.parametrize(
782790
Job.ParamSet(
783791
parameter="integration tests, amd64",

‎ci/jobs/bugfix_validation_aggregate.py‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
- `Bugfix validation (integration tests, amd64)`
1010
- `Bugfix validation (integration tests, aarch64)`
1111
12-
Each per-arch sub-check always reports SUCCESS to GitHub
13-
(`force_success=True`) and writes a small JSON artifact describing whether
14-
the new/modified test on that arch validated the bug:
12+
Each per-arch sub-check exits with the natural OK status (no
13+
`force_success=True` flag is used) once it has run the test on master HEAD
14+
and on the PR, captured the inverted result, and written a small JSON
15+
artifact describing whether the new/modified test on that arch validated
16+
the bug:
1517
1618
{
1719
"validated": true | false,
@@ -26,7 +28,10 @@
2628
2729
Artifact-not-found is treated as `validated == false` with a SKIPPED
2830
sub-result, so an aggregator failure cannot be silently masked by the
29-
absence of a per-arch JSON.
31+
absence of a per-arch JSON. Per-arch jobs that genuinely failed (e.g. due
32+
to a sanitizer report or server crash) deliberately do not write the JSON
33+
in that case, so the aggregator naturally falls back to SKIPPED for that
34+
arch and the other arch can still validate the bug.
3035
"""
3136
import json
3237
from pathlib import Path

‎ci/jobs/functional_tests.py‎

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -765,19 +765,30 @@ def start():
765765
has_failure = True
766766
elif r.status == Result.Status.OK:
767767
r.status = Result.Status.FAIL
768-
if not has_failure:
769-
print("Failed to reproduce the bug")
770-
test_result.set_failed().set_info("Failed to reproduce the bug")
768+
769+
# Per-arch bugfix-validation contract:
770+
# The job's *status* reflects "did the test run and produce a result?"
771+
# — NOT "was the bug validated?". The validation outcome is data
772+
# (recorded in the JSON artifact below) that the `Bugfix validation
773+
# (final)` aggregator consumes to decide the merge-blocking status.
774+
#
775+
# We deliberately exit with the natural OK status here (no
776+
# `force_success=True` flag is used at the job level) so that real
777+
# infrastructure errors (server crash, sanitizer assert) still
778+
# propagate as failures.
779+
if has_failure:
780+
test_result.set_info("Bug reproduced on master HEAD; PR validates the fix on this arch")
771781
else:
772-
# For bugfix validation, the expected behavior is:
773-
# - At least one test must fail (bug reproduced)
774-
# - The overall Tests result is treated as success in that case
775-
test_result.set_success()
776-
777-
# Per-arch bugfix-validation jobs always report SUCCESS to GitHub
778-
# (Job.Config.force_success=True). The actual outcome is written to
779-
# this small JSON, which the `Bugfix validation (final)` aggregator
780-
# job consumes as an S3 artifact.
782+
print("Failed to reproduce the bug on this arch")
783+
test_result.set_info(
784+
"Failed to reproduce the bug on this arch; "
785+
"see Bugfix validation (final) aggregator for the merge-blocking decision"
786+
)
787+
test_result.set_success()
788+
789+
# Each per-arch JSON is uploaded as a separate S3 artifact and consumed
790+
# by the `Bugfix validation (final)` aggregator job, which OR's the
791+
# `validated` fields across all four per-arch results.
781792
result_path = Path(temp_dir) / "bugfix_validate_result.json"
782793
try:
783794
arch = "aarch64" if Utils.is_arm() else "amd64"

‎ci/jobs/integration_test_job.py‎

Lines changed: 65 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,44 +1046,74 @@ def main():
10461046
assert (
10471047
is_llvm_coverage is False
10481048
), "Bugfix validation with LLVM coverage is not supported"
1049-
has_failure = False
1050-
for r in R.results:
1051-
# invert statuses
1052-
r.set_label(Result.Label.XFAIL)
1053-
if r.status == Result.Status.FAIL:
1054-
r.status = Result.Status.OK
1055-
has_failure = True
1056-
elif r.status == Result.Status.OK:
1057-
r.status = Result.Status.FAIL
1058-
if not has_failure:
1059-
print("Failed to reproduce the bug")
1060-
R.set_failed()
1061-
R.set_info("Failed to reproduce the bug")
1049+
1050+
# Real infrastructure errors (sanitizer assert, OOM, etc.) are kept
1051+
# as a hard failure of the per-arch job. We do NOT mask them via
1052+
# `set_success()` and we do NOT write the JSON artifact, so the
1053+
# aggregator treats this arch as SKIPPED (validated=false). This
1054+
# keeps `force_success=True` unnecessary at the job-config level
1055+
# while still letting the other arch validate the bug.
1056+
if has_error:
1057+
print(
1058+
"WARN: Skipping bugfix-validation result write due to "
1059+
"infrastructure error; aggregator will treat this arch as "
1060+
"validated=false (SKIPPED)"
1061+
)
10621062
else:
1063+
has_failure = False
1064+
for r in R.results:
1065+
# invert statuses
1066+
r.set_label(Result.Label.XFAIL)
1067+
if r.status == Result.Status.FAIL:
1068+
r.status = Result.Status.OK
1069+
has_failure = True
1070+
elif r.status == Result.Status.OK:
1071+
r.status = Result.Status.FAIL
1072+
1073+
# Per-arch bugfix-validation contract: the job's *status* reflects
1074+
# "did the test run and produce a result?" — NOT "was the bug
1075+
# validated?". The validation outcome is data (recorded in the
1076+
# JSON artifact below) that the `Bugfix validation (final)`
1077+
# aggregator consumes to decide the merge-blocking status.
1078+
#
1079+
# We deliberately set the natural OK status here (no
1080+
# `force_success=True` flag at the job level) so genuine
1081+
# infrastructure failures still propagate as failures (handled
1082+
# by the `if has_error:` branch above).
1083+
if has_failure:
1084+
R.set_info(
1085+
"Bug reproduced on master HEAD; PR validates the fix on this arch"
1086+
)
1087+
else:
1088+
print("Failed to reproduce the bug on this arch")
1089+
R.set_info(
1090+
"Failed to reproduce the bug on this arch; "
1091+
"see Bugfix validation (final) aggregator for the merge-blocking decision"
1092+
)
10631093
R.set_success()
10641094

1065-
# Per-arch bugfix-validation jobs always report SUCCESS to GitHub
1066-
# (Job.Config.force_success=True). The actual outcome is written to
1067-
# this small JSON, which the `Bugfix validation (final)` aggregator
1068-
# job consumes as an S3 artifact.
1069-
result_path = Path(temp_path) / "bugfix_validate_result.json"
1070-
try:
1071-
arch = "aarch64" if Utils.is_arm() else "amd64"
1072-
payload = {
1073-
"validated": bool(has_failure),
1074-
"info": (
1075-
f"Bug reproduced on master HEAD ({arch}) and fixed on PR"
1076-
if has_failure
1077-
else f"Failed to reproduce the bug on master HEAD ({arch})"
1078-
),
1079-
"arch": arch,
1080-
"kind": "integration tests",
1081-
}
1082-
with result_path.open("w") as f:
1083-
json.dump(payload, f)
1084-
print(f"Wrote bugfix-validation result to {result_path}: {payload}")
1085-
except OSError as e:
1086-
print(f"WARN: failed to write {result_path}: {e}")
1095+
# Each per-arch JSON is uploaded as a separate S3 artifact and
1096+
# consumed by the `Bugfix validation (final)` aggregator job,
1097+
# which OR's the `validated` fields across all four per-arch
1098+
# results.
1099+
result_path = Path(temp_path) / "bugfix_validate_result.json"
1100+
try:
1101+
arch = "aarch64" if Utils.is_arm() else "amd64"
1102+
payload = {
1103+
"validated": bool(has_failure),
1104+
"info": (
1105+
f"Bug reproduced on master HEAD ({arch}) and fixed on PR"
1106+
if has_failure
1107+
else f"Failed to reproduce the bug on master HEAD ({arch})"
1108+
),
1109+
"arch": arch,
1110+
"kind": "integration tests",
1111+
}
1112+
with result_path.open("w") as f:
1113+
json.dump(payload, f)
1114+
print(f"Wrote bugfix-validation result to {result_path}: {payload}")
1115+
except OSError as e:
1116+
print(f"WARN: failed to write {result_path}: {e}")
10871117

10881118
force_ok_exit = False
10891119
if is_llvm_coverage and llvm_profdata_cmd:

0 commit comments

Comments
 (0)