Skip to content

feat: quarantine known flakes, webhook notifications and test-tracking docs (P4) - #148

Merged
calvin-archastro merged 8 commits into
mainfrom
feat/quarantine
Oct 16, 2026
Merged

calvin-archastro merged 8 commits into
mainfrom
feat/quarantine

Conversation

@calvin-archastro

@calvin-archastro calvin-archastro commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Merge order: #152 is merged; nothing else first. After merging: deploy aster-srv first, then release aster and bump ASTER_VERSION (see Rollout).

P4 of test tracking: T22 quarantine store and feed, T23 enforcement, T26 webhooks, T25 docs.

Rebased onto #149: quarantine matching uses #149's shard-aware test identity (stream::test_id takes the report's project), so a quarantined test matches on any shard; the guide documents balanced partitions.

What changes

classifier pass ──▶ quarantine (enter / release / expire / broken) ──▶ quarantine_log
      │                                                                   │
      └──▶ webhooks.deliveries (same txn) ──▶ sender, signed, backoff     │
aster (CI) ◀── GET /v1/test-results/quarantine (versioned by log id) ◀────┘
   + aster-quarantine.toml ──▶ target passes "(quarantined: N)" if all 4 conditions hold
  1. Server (T22), at the end of each classifier pass:
    • A test that is not broken enters after definite flakes from 2 runs within 7 days.
    • It leaves after 20 consecutive passes, when it breaks, or after 30 days. After leaving, only later events count toward re-entry.
    • Settings: ASTER_SRV_QUARANTINE_RUNS (0 = off), _RELEASE_PASSES, _DAYS.
    • Every change is logged; the newest log id is the list's version.
    • Also new: GET /v1/test-results/quarantine, tests?state=quarantined, and a real /ui/quarantine page.
  2. Client (T23): with capture on, Aster loads the server list and aster-quarantine.toml at start and prints the list's version and count.
    • The server list is cached in .aster/quarantine.json; the cache is used for up to 24h when the server is down.
    • A failed target passes only if all of these hold:
      • its results are complete;
      • every test whose last attempt failed is quarantined;
      • it exited with its runner's "tests failed" code (ExUnit 2, nextest 100, others 1; never Gradle, Maven or cargo test);
      • ASTER_QUARANTINE is not off.
    • When a target passes this way:
      • its dependents run, and the pass is not cached;
      • each let-through failure gets a ::warning and a step-summary row;
      • the results file marks it "quarantined": true.
  3. Webhooks (T26): ASTER_SRV_WEBHOOKS lists endpoints and the events each receives (test.quarantined|released|expired|broken).
    • Deliveries are recorded in the classifier's transaction (outbox).
    • Each is signed with X-Aster-Signature: sha256=… and retried from 30s, doubling to 6h, then abandoned after 12 attempts.
  4. Docs (T25):
    • New docs/test-tracking.md.
    • Updated: the README's quarantine section, GETTING_STARTED, and the server README (quarantine, webhooks, settings, runbook).
    • Tests parse the documented TOML and JSON examples.

Open choice

The auto-quarantine threshold is still open in the spec. I built the proposal (2 runs) and made it configurable: ASTER_SRV_QUARANTINE_RUNS=1 quarantines after one proven flake, without a release.

Rollout

  1. Merge, then deploy aster-srv. Nothing needs setting; it starts filling the list. Check /ui/quarantine for a day.
    • If the list looks wrong, set ASTER_SRV_QUARANTINE_RUNS=0.
  2. Release aster, then bump firstlanding's ASTER_VERSION. CI then honours the list.
    • ASTER_QUARANTINE=off is the kill switch for a job.
  3. Optional: set ASTER_SRV_WEBHOOKS as a Pulumi secret.

Verification

  • Checks: cargo fmt, clippy -D warnings and cargo doc -D warnings are clean.
  • Server tests against Postgres: all pass, including 10 new ones in tests/quarantine.rs:
    • entry, the 7-day window and the threshold;
    • broken tests are never quarantined, and a quarantined test leaves when it breaks;
    • release and re-entry, and expiry;
    • repository isolation;
    • signed delivery to a local receiver, backoff then abandonment, and unsubscribed endpoints.
  • Client end to end with real go test:
    • quarantined-only failures pass and their dependent runs;
    • mixed failures still fail and say why;
    • the off switch works;
    • a bad file is an error.
  • Unit tests: the conditions, exit codes, repo-file parsing, cache fallback, a fetch from a local server, stream marking and summary labels.
  • Full workspace: all tests pass except the known local dev_services flake.
  • Perf: on the 11.7M-result copy, 2,000 quarantined tests with six days of history take about 1.8s per pass (about 1 ms per test), and entry for 2,000 tests takes under 0.5s.
  • Not done: I did not run this against production or a real ExUnit suite; the ExUnit exit code (2) comes from ExUnit's documented behaviour.

🤖 Generated with Claude Code

@calvin-archastro
calvin-archastro requested a review from a team October 15, 2026 13:41
@calvin-archastro

calvin-archastro commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor Author

ArchDev is watching this pull request. State: watching (cycle 3 of 3 for head fb75912).

when trigger decision result
2026-10-15T13:48:53.823Z review feedback enqueue job_782c44596856f1b636f4f784 published e3f67d7
2026-10-15T14:26:31.855Z review feedback enqueue job_9c8087862028ebeada38cf88 published 06b81ec
2026-10-15T19:30:18.333Z merge conflict enqueue job_bc92db1e40c62b552c756308 cancelled pull request converted to draft

Paused by the no-autofix label or a draft; never resolves reviewer threads. Jobs: job_782c44596856f1b636f4f784, job_9c8087862028ebeada38cf88, job_bc92db1e40c62b552c756308.

@calvin-archastro
calvin-archastro marked this pull request as draft October 15, 2026 19:38
@calvin-archastro
calvin-archastro marked this pull request as ready for review October 15, 2026 19:56
@calvin-archastro
calvin-archastro marked this pull request as draft October 15, 2026 20:35
@calvin-archastro
calvin-archastro marked this pull request as ready for review October 15, 2026 20:43
@calvin-archastro
calvin-archastro marked this pull request as draft October 16, 2026 17:20
calvin-archastro and others added 8 commits October 16, 2026 13:20
…e changes

The classifier now keeps a quarantine list at the end of each pass: a test
that is not broken enters after definite flakes from 2 different runs in 7
days, and leaves after 20 consecutive passes, when it breaks, or after 30
days. A released or expired test is judged only on events after it left.
Every change is logged, and the newest log id is the list's version.

GET /v1/test-results/quarantine serves the list to CI with the upload's
OIDC token, tests?state=quarantined filters by it, and /ui/quarantine shows
it with its recent changes.

ASTER_SRV_WEBHOOKS names endpoints and the events each wants
(test.quarantined, test.released, test.expired, test.broken). The pass
records deliveries in its own transaction; a sender posts them signed with
X-Aster-Signature (HMAC-SHA256) and retries with backoff, so a failing
endpoint never holds up ingest or classification. Retention drops the
quarantine log and deliveries after the retention period.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
With test capture on, Aster loads the quarantine at start: aster-srv's list
(cached in .aster/quarantine.json, which stands in for up to 24 hours when
the server is unreachable) and aster-quarantine.toml, whose entries need a
reason and an expiry date. The line it prints names both and the server
list's version. ASTER_QUARANTINE=off turns it off.

A failed target passes only when, after retries, every failing test is
quarantined, its results are complete, and it exited with its runner's
"tests failed" code (ExUnit 2, nextest 100, pytest/go/jest/vitest/node 1;
never for Gradle, Maven or cargo test, whose code also means a compile
error). Its dependents then run, the pass is not cached, each let-through
test gets a GitHub warning, the result says (quarantined: N), and the
results file marks those attempts quarantined so the step summary lists
them apart from the failures.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Cached targets record no tests, so a quarantined test's streak needs only
test_results and runs, not target_runs. On the 11.7M-result perf copy,
2,000 quarantined tests with six days of history take about 1.8s in one
query (about 1ms each); a realistic list is a few dozen.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…book

docs/test-tracking.md walks the loop from capture per runner through
upload, labels, flake classification and quarantine, with the environment
variables and a GitHub Actions job. The README gets a quarantine section and
GETTING_STARTED points at the guide. The aster-srv README documents the
quarantine rules and feed, webhooks (payloads, signature, retries), the new
settings and a runbook. Tests parse the documented aster-quarantine.toml and
ASTER_SRV_WEBHOOKS examples against a fixture test, so they stay accurate.
The spec's P4 tasks now say what was built.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A replica whose clock is behind the committed watermark would re-derive
test state, quarantine and webhook notifications as of an earlier time,
undoing a break and announcing it again on the next pass. Re-read the
watermark under the lock and skip the window when it is already covered.

Quarantine day arithmetic now uses 24-hour intervals so entry windows and
expiry do not shift by an hour across a DST change in the session zone.
Cached targets store the results they replay, so a release streak built
from test_results alone counted replayed passes. Use the classifier's
final-attempt rule, which skips cached targets, and add a regression test.

Co-Authored-By: Claude Opus <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@calvin-archastro
calvin-archastro marked this pull request as ready for review October 16, 2026 17:36
@calvin-archastro
calvin-archastro merged commit dd9accd into main Oct 16, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant