Repository navigation
A failing test is fixed from its evidence, or not changed at all - #928
Merged
Merged
Conversation
A run fixing a failing or flaky end-to-end test reproduces the failure first, names one class from a closed set (app bug, test bug, test data or environment, timing race, CI infrastructure, third party) and puts the fix where the class says. Runs that never reached the page are not counted as failures. Without a reproduction there is no code change: the run gathers more evidence or quarantines the test with an owner, reason, ticket and expiry. Banned changes are read from the diff: fixed sleeps, raised timeouts, retries, polls, loosened assertions, skips, broadened selectors, a test-only change for an app bug, and any change for a cause outside the code. The description names the cause with its trace lines and the pass rates. Repeat runs are sized by the measured failure rate. A sibling failure joins the open run, and a failure after the merge reopens the same run.
…oof is judged by the evidence - The post-merge watch reads each default-branch run through fix_evidence::watch_result: a run that failed as a whole (bad_run) or in which the test never ran (no attempt, or every attempt skipped or interrupted) is not reached, so it neither reopens the fix nor counts towards holding it, the way history_measure already counts the history. - The repeat proof's routes feed the evidence: their tally is a fix_evidence::Measure, the repeat count comes from the failure rate measured before the fix (measured_repeats into proof_routes::repeat_count, in ready_gate and the owed proof), and the verdict is fix_evidence::proof. - The incident case is renamed xe_test_fix_from_evidence, since xd is taken.
nambok
force-pushed
the
test-fix-from-evidence
branch
from
December 1, 2026 03:07
d354eb9 to
8d3811b
Compare
coderhelm
Bot
dismissed
their stale review
December 1, 2026 03:12
Superseded by CoderHelm's latest review
coderhelm
Bot
dismissed
their stale review
December 1, 2026 03:13
Superseded by CoderHelm's latest review
Contributor
|
🟡 Post-merge health check: deploy cancelled: the deploy for
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A run that fixes a failing or flaky end-to-end test now works from evidence, or changes nothing. It reproduces the failure first, names one class from a closed set, and puts the fix where that class says. Changes that hide a failure are refused on the diff. The fix is proven with as many runs as the test's measured failure rate needs. Each failure gets one run, and that run is reopened if the test fails again after the merge.
Before this, a fix pull request could open on a cause its own run called inferred. A wait could go into a page object for a cause outside the test. A sandbox whose network refused the site counted as the test failing every run. Every proof was twenty runs, whatever the rate.
Changes
common::e2e::fix_evidence(new, pure, tested):next_stepreturns fix, gather more evidence (for example "run 39 more with traces kept"), or quarantine with a reason.FailureClassis one of app bug, test bug, test data or environment, timing race, CI infrastructure or third party. Each class says where its fix may go.class_problemschecks the class against the evidence:trace_problemsrequires at least one quoted trace line to appear word for word in the failing run's report.first_badandbisect_nextfind the last commit the test passed on.judge_diff): a fixed sleep, a raised timeout, added retries, a poll, a loosened or removed assertion, a skip, and a selector that matches more than before (broadened_selectorsis new). Also refused: a test-only change for an app bug, and any code change for a cause outside the code. A timeout or poll stands only for a timing race, and a broadened selector only for a test bug, and only with aJustify <kind>:line that quotes one of the diagnosis's trace lines. A sleep and retries never stand.Diagnosis::from_notesreadsClass:,Root cause:,Trace:,Cause in:andWhy this fixes it:from the fixing agent's notes.cause_sectionwrites Root cause, Class, Evidence, Why this fixes it, and Pass rate before and after.repeats_forreturns n = ln(1 - 0.95) / ln(1 - rate), with a floor of 10 and a cap of 300. That is 29 runs at 10%, 59 at 5% and 299 at 1%.proofholds a result to the head that failed and the target that failed. The proof routes run the repeats; this module only says how many and judges the result.attachsends a new occurrence of the same test, or of a sibling test in the same spec with the same signature, to the open run.Watchreads the next default-branch runs (as many as the rate before the fix needs, at most 50). A failure returnsReopenwith the new evidence.watch_resultreads each run the way the history is counted: a run that failed as a whole, or in which the test didn't run (skipped, interrupted or absent), neither reopens the fix nor counts towards holding it.Measure, its repeat count comes from the failure rate measured before the fix (measured_repeatsintoproof_routes::repeat_count, in the ready gate and the owed proof), and its verdict isproof.QuarantineTermsgives a quarantine an owner, a reason, a ticket and an expiry (14 days by default, at most 30).keep_termsfills them in for any quarantine that has none.Fix pipeline (
worker::passes::test_fix):check_and_fixstops before any fix round when the failure isn't reproduced. The run ends saying how the failure was seen and what comes next. When the next step is quarantine, the test is quarantined with its terms (e2e::quarantine_for_fix).Evidence::reproductionandEvidence::ci_rateread the evidence already gathered. A reopened run reads its failure again instead of reusing what it stored before the merge.Tests pass (
worker::passes::e2e):runs_needed). Twenty is now the minimum, not the only count.start_watch,watch_merged). A failure after the merge reopens the same run throughcontinuation_run_id.Quarantine as a state:
Care).quarantine_terms(owner, reason, ticket, since, expires_at, expired) andwatch.owner,ticketanddays, and clears the terms when a test is released or pinned.Incident case
xe_test_fix_from_evidenceand its page. It replays an invented bookstore suite once per class:It also checks that the pipeline still calls each decision at its place.
The proof routes (preview, staging, the app started in the sandbox, CI) and the sandbox's egress belong to separate work. This change uses their interface and doesn't duplicate it: it hands them the test and
repeats_for(rate).runs, and judges what they return withproof.Verification
From
services/:cargo fmt --all --checkrustfmt --check --edition 2021 worker/src/passes/incidents/*.rscargo clippy -p common -p worker -p gateway --all-targets -- -D warningscargo test -p common -p worker -p gateway.github/scripts/brand_spelling.pyand.github/scripts/domain_examples.py