Skip to content

selection-misses: tell a likely flake from a likely miss by cifail's history (#60) - #70

Merged
SebHenn merged 2 commits into
mainfrom
feat/issue-60-miss-history
Oct 27, 2026
Merged

SebHenn merged 2 commits into
mainfrom
feat/issue-60-miss-history

Conversation

@SebHenn

@SebHenn SebHenn commented Oct 27, 2026

Copy link
Copy Markdown
Owner

Closes #60.

Every candidate miss used to be equally suspect, and ruling out a flake was left to the reader, even though cifail records every failing test it analyses.

  • Core: SelectionMisses.WithHistory(misses, rows, repoId, commit) attaches each miss's earlier failures (TestStat, from TestFlakeComputer) and orders the misses with likely misses (no earlier failure) first, then by how often each failed before.
    • Matching is at method level, so a theory's cases count as one test.
    • Rows from the commit under test are excluded, since they're this run, not history.
    • Rows from another repository are excluded. A row recorded without a repo id is kept.
  • CLI: selection-misses now takes the store options (StoreSettings, the same store analyze records into), plus:
    • --commit (default HEAD) and --repo (default the current repo).
    • --no-history.
    • Text shows "failed 4x on 3 day(s) before, last 2026-10-20 - likely flaky", or "- flaky: it failed again after being resolved". --json adds history: {failures, distinctDays, flaky, lastSeen}.
    • A store that can't be opened or read is a warning, never a failed check.
  • Action: passes --commit "$GITHUB_SHA" and appends ", failed Nx on D day(s) before, likely flaky" to each miss. It needs CIFAIL_DB_* for a shared store, which the action already passes into the container. The README says so.

Also fixed here: the Cli test suite hanging locally. CliHarness replaced stdout and stderr but not stdin. A command given no path reads stdin whenever it is redirected, so under a shell that left the test host's stdin pipe open, ReadToEnd() blocked and the suite hung. It happened three times in this session; CI passes /dev/null, so it never hangs there. Each run now gets an empty stdin of its own. Three runs with stdin inherited from that shell all passed.

Tests: a Core test for history, ordering, commit exclusion, repo filtering and arguments, and a CLI test that seeds the store with analyze and checks the text, the JSON and --no-history. Locally Core passes 544/544 and Cli 204/204.

🤖 Generated with Claude Code

SebHenn and others added 2 commits October 27, 2026 17:31
…history (#60)

Each miss is looked up in the store analyze records into. One that failed
before on other commits comes after those that never did, marked with how
often and whether it is flaky; --json has history. The commit under test
(--commit, HEAD by default) is not history, --repo scopes it, --no-history
skips it, and a store that can't be read is a warning. The action passes
GITHUB_SHA and shows the history on each miss.

Also: CliHarness gives each run an empty stdin. A command given no path reads
stdin when redirected, and under a shell that left the test host's pipe open
the suite hung.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SebHenn
SebHenn merged commit 61e487a into main Oct 27, 2026
7 checks passed
@SebHenn
SebHenn deleted the feat/issue-60-miss-history branch October 27, 2026 16:51
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.

selection-misses: tell a likely flake from a likely miss using cifail's own test history

1 participant