mix surfex.failures (Surfex v0.13.0)

Copy Markdown View Source

Each test's pass/fail history, from .surfex/transitions.log (§17): every run where its result flipped, with a class saying what differed from the run with the opposite result before it, and the judgements recorded on it.

mix surfex.failures                 # every test that ever failed
mix surfex.failures "test:MyApp.CartTest: totals"
mix surfex.failures --json          # the same, for a tool or an agent

The classes are mechanical, and they're evidence for a judgement, not one:

  • nondeterministic: the test and every piece of code it reaches were at the same versions on both sides of the flip, shown without rerunning anything. It's a flake, or a change no version holds: a file the test reads, the environment, or code the scanner doesn't reach.
  • test changed / code changed: the test's version differed, or the named code's.
  • recurred: a failure with the same digest came back after a fail→pass that changed the test or its code: a fix that didn't hold.
  • new: a first flip with nothing to compare against (the evidence went with a clean build); unknown the same, after earlier flips.

A renamed test's history follows it: an id no longer scanned whose last version is exactly one scanned test's version is that test's history (§14).

Record a judgement on a test's latest transition, or the one --at names:

mix surfex.failures --judge "test:MyApp.CartTest: totals" \
  --note "flake: the cart ETS table was shared; fixed by a table per test"

A judgement is its own committed line (.surfex/failure_judgements.log) and never edits a transition. The task is advisory: it never fails on what it finds.

A CI job writes its run's transitions to an artifact (SURFEX_TRANSITIONS_OUT=PATH) rather than the checkout. --merge PATH (once per file) reads such files into the report; --ingest PATH appends their lines the project doesn't have yet to .surfex/transitions.log, once, for you to commit:

mix surfex.failures --merge ci-transitions.log
mix surfex.failures --ingest ci-transitions.log