Temper.History.Reader (temper v0.1.0)

Copy Markdown View Source

Boundary module that reads history files back into records.

Globs .temper/history-*.jsonl (one file per test partition, per the partitioned-CI design) and decodes each line via Temper.History.Codec. Imperfect input never crashes a read: corrupt lines (truncated CI cache tails, editor accidents) and well-formed lines this version does not interpret (suite summaries, future schema versions) are counted and skipped.

Summary

Types

The outcome of a read: decoded records in file order, the files that were actually read, counters for skipped lines, and any matches that could not be read at all (directories, files removed mid-read).

Functions

The default glob covering every partition's history file.

Reads every history file matching glob into records.

Types

result()

@type result() :: %{
  records: [Temper.Record.t()],
  files: [Path.t()],
  corrupt: non_neg_integer(),
  skipped: non_neg_integer(),
  unreadable: [Path.t()]
}

The outcome of a read: decoded records in file order, the files that were actually read, counters for skipped lines, and any matches that could not be read at all (directories, files removed mid-read).

Functions

default_glob()

@spec default_glob() :: Path.t()

The default glob covering every partition's history file.

read(glob \\ ".temper/history-*.jsonl")

@spec read(Path.t()) :: result()

Reads every history file matching glob into records.

Defaults to ".temper/history-*.jsonl". Files are read in sorted order; blank lines are ignored. Nothing about imperfect input raises: undecodable lines are counted (:corrupt for malformed content, :skipped for valid lines that are not test outcomes, such as suite summaries and future schema versions), and matches that cannot be read at all — a directory caught by the glob, a file deleted between matching and opening — land in :unreadable while every other file's records survive.