Repository navigation
Quarantine: every test has a state and a next step - #669
Merged
Merged
Conversation
A quarantined test was left with one button and nothing happening. Now it leaves by itself once its runs prove it healthy (20 clean passes in a row on more than one pull request or branch, over two hours), a cause its runs disprove is marked out of date, automatic fixes go to the longest quarantined first and try again after a fix that did not hold, a person's fix request is no longer dropped as a duplicate of its own mark, and a test can be removed by a pull request the team approves and CoderHelm never merges. The weekly number of automatic fixes is a team setting, unchanged at 2.
# Conflicts: # docs/incidents.md # services/worker/src/passes/incidents/mod.rs
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 quarantined end-to-end test was a dead end: a team's quarantined tests sat there for days, some for weeks, each with one button (release) and nothing happening. This makes quarantine a place a test passes through. Every quarantined test has a state and a next step, CoderHelm works the oldest first, a test that proved healthy leaves by itself, and a test can be removed by a pull request the team approves.
Why a quarantined test with no fix pull request sat there, from the code as it was:
failed, excluded the test from automatic fixes for good.reproducingand queued the request; the worker read that mark as a fix already under way and dropped the request. The mark then blocked every later request and every automatic fix.fixingoropenedforever.Changes
Leaving quarantine by itself (
common/src/e2e/quarantine.rs, applied indetect::apply_runas each run is recorded and in the sweep)detect::RATE_MIN_RUNS, the runs the flaky rule needs before it judges a rate, and the repeat runs a fix must hold for (BURN_IN_RUNS; a test asserts they are equal)detect::BROKEN_MIN_SHAS, the broken rule's "more than one commit"FLIPS_FOR_FLAKY,RATE_WINDOW_DAYS,RESOLVE_DAYSdetect::decide), so the flips that put it there do not quarantine it again on its next run. A new flake quarantines it again by the existing rule, and that is counted as a bounce.A cause the history disproves
detect::BROKEN_WINDOW, since such a cause fails every run while it lasts) or 20 for any other, on more than one pull request or branch.Every row has a state and a next step
quarantine(state, headline, link to the pull request or the run, the earlier attempt that did not hold, why CoderHelm has not fixed it by itself, the actions that can be taken, progress toward leaving), plusunstable,release,removal,removedandauto_fix.GET /api/testsandGET /api/tests/:idaddauto_fixes(the week's count per repository) and fill in what only the whole list knows: the cap, or the test's place in line. Quarantined rows are read from their records when the quarantine list is asked for, since what a row says can change with the date.POST /api/tests/:id/fixworks for any quarantined or flaky test with no fix in flight, and again after a fix that did not hold.Removing a test
POST /api/tests/:id/remove(same permission as fix) starts a run on ticketE2E-RM-<test id>that deletes the one test case (the file only when it is the file's only test) and what only it used: page objects, fixtures, helpers, test data, test map entries, specs and docs that list it. It keeps the suite green and changes no application code.description::save: how long it was quarantined, its 30-day history, fix attempts and why they ended, the recorded cause, and which healthy tests still cover the same file or tag, or that none does and what is lost.no_mergefor that pull request before its description is written, whatever the team's on-approve setting.FIXED_DAYS), two fixes that did not hold, another healthy test covers the same file or tag, no fix in flight, not passing its way out, and no removal proposed before. One per repository per sweep, counted against the weekly number. A declined proposal is never made again.test_fix::for_run), which refuse a deleted test.The sweep (
worker/src/passes/quarantine_work.rs, called from the existingReviewRemindertick, at most once an hour per team)settings_index), written when settings are saved and rebuilt from one filtered scan a day, so teams that saved settings before this are found without a manual step.quarantine::settlechanges nothing the second time, and a record is written only when it or what its row says changed.Shared files touched
services/worker/src/main.rs: the sweep call in theReviewReminderarm.services/worker/src/passes/mod.rs:pub mod quarantine_work,E2E-RM-inis_internal_ticket.services/worker/src/clients/github.rs:close_issue.services/worker/src/passes/test_fix.rs: removal tickets skip the fix evidence.services/gateway/src/main.rs,permissions.rs: theremoveroute under thetestscapability.services/gateway/src/routes/run_trigger.rs: a removal run links to its test.services/worker/src/passes/incidents/mod.rs,docs/incidents.md: caseaw.No change to
docs/api/openapi.json: the/api/testsroutes are not in the public document, and the two public CI routes keep their shape.Cost
Verification
cargo fmt --check --all,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace: all pass locally.common::e2e::quarantinetests: progress and release (the 35-pass case, one branch only, a burst inside two hours, passes before the quarantine or a merged fix), the bounce case and the quiet week, cause staleness at 10 and 20, a merged fix that fails again, every hold reason with its line, each row state with its link and actions, ordering, the cap line and week boundaries, request guards, removal evidence, the proposal rule, the ticket and the description section, and the merged-removal record.detecttest: a released test is not quarantined again by its old flips, and is by new ones.description::save.aw_quarantine_dead_end: the team's scenario replayed throughapply_run,standing,auto_fix_order,overlayand the removal rule, including that no combination of fix and removal state leaves a row without a link or an action.no_mergefor it, and a full removal run by the agent are covered by unit tests of their decisions only.