Skip to content

feat(flaky): auto-prune, Java wiring, live rerun smoke - #83

Merged
CMaintz merged 2 commits into
mainfrom
feat/flaky-followons
Oct 9, 2026
Merged

CMaintz merged 2 commits into
mainfrom
feat/flaky-followons

Conversation

@CMaintz

@CMaintz CMaintz commented Oct 9, 2026

Copy link
Copy Markdown
Owner

Builds the three pending follow-ons from docs/designs/flake-triager.md's own "Not yet" list.

What's here

  • Auto-prune (foundry-flaky prune <baseline> [--min-green M], default M=10): re-arms quarantined tests gone stable. gate now appends a per-run pass/fail line for each quarantined test that ran to .foundry/flaky-streaks.jsonl (best-effort; never changes the exit code). prune removes any id with ≥ M trailing consecutive greens — a single fail resets the streak. Removal-only, so ruleset-guard's snooze kind passes a prune label-free.
  • Java wiring (docs(overview): recommend PR-only gate triggers (§13) #2): parse_report accepts a directory of JUnit XML (Gradle's build/test-results/test/TEST-*.xml, merged); mise/java.toml gains the Java test:flaky task + the ./gradlew test --tests "{test}" classify recipe.
  • Live rerun smoke (docs(preset): collaboration.md — branch hygiene for parallel sessions #1): tests/test_foundry_flaky.py drives the real subprocess rerun loop with a synthetic flipping command and a spaced id (proving the {test} quoting contract), plus parse / gate / streak / prune coverage. Full tests/: 39 pass.

Reviewer caveats

  • Pre-push-fed. The green-streak accrues only where gate runs against the baseline — i.e. once a consumer folds test:flaky into test. /ship runs gate; CI contributes to a streak only if .foundry/ is cached across runs. Not automatic — documented.
  • Runner-filter semantics untested. Only the generic {test} subprocess contract is verified; vitest -t / gradlew --tests behavior against a real suite is still unverified (no JVM/node project here).
  • Safety fixes from review: prune reports (never auto-removes) stale quarantines (renamed/deleted tests that can never reach the threshold); writes the baseline LF to avoid a Windows phantom-CRLF diff (consumers carry flaky-baseline.json text eol=lf); the Java task clears stale XML before the run so || true can't gate green on a prior run's results.
  • Parameterized Gradle ids (method[1]) only glob-match --tests and don't round-trip — noted in the task, not engineered for.

Independent of #81 (arch adoption); both branch off the same origin/main.

Build the three pending flake-triager follow-ons from the spec's Not-yet list:

- Auto-prune: new 'prune' mode re-arms quarantined tests gone stable. gate now
  appends a per-run pass/fail line per quarantined test that ran to
  .foundry/flaky-streaks.jsonl (best-effort, never alters the exit code); prune
  <baseline> [--min-green M] removes ids with >= M trailing consecutive greens (a
  fail resets). Removal-only, so the snooze guard passes a prune label-free. Fed by
  pre-push /ship (persistent .foundry/); CI needs .foundry/ cached to contribute.

- Java wiring: parse_report now accepts a DIRECTORY of JUnit XML (Gradle's
  build/test-results/test/TEST-*.xml), merged; mise/java.toml gains the Java
  test:flaky task + the gradlew --tests classify recipe (globs the report dir, fails
  if empty; notes parameterized bracket ids don't round-trip).

- Live rerun smoke: tests/test_foundry_flaky.py (16 cases) drives the real
  subprocess rerun loop with a synthetic flipping command and a spaced id (proving
  the {test} quoting contract), plus parse/gate/streak/prune coverage. Runner-filter
  semantics (vitest -t, gradlew --tests) remain unverified - documented.

Design doc updated (Implemented/Not-yet + the honest caveats). Full tests/: 36 pass.
…le XML

- prune reports quarantined ids never seen in the streak log as 'stale' (renamed/
  deleted/never-run dead debt) for human review, without auto-removing them.
- prune writes flaky-baseline.json with newline="\n" so a Windows-run prune can't
  emit a phantom CRLF diff on a committed ratchet file; consumers carry
  flaky-baseline.json text eol=lf (documented).
- java test:flaky rm -rf build/test-results/test before gradlew: '|| true' swallows a
  compile failure, and Gradle leaves per-class XML behind, so stale results could
  otherwise pass the glob and gate green. Also hoist 'import glob'; fix designs/ ->
  docs/designs/ drift in my comment; design-doc caveats (streak accrues only once
  test:flaky is folded into test). tests/: 39 pass (3 new).
@CMaintz
CMaintz merged commit d2fd8c9 into main Oct 9, 2026
6 checks passed
@CMaintz
CMaintz deleted the feat/flaky-followons branch October 9, 2026 16:15
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