mix riddler.corpus (Riddler v0.1.0)

Copy Markdown View Source

Copies the conformance corpus and the JSON schemas out of this repository and into a checkout of riddler_spec, or checks that the copy already there is the one this repository would write.

mix riddler.corpus --to ../riddler_spec
mix riddler.corpus --check

The cases are authored here, beside the code that has to satisfy them, and the copy in the other repository is an artifact. So the task runs every case through this implementation before it writes anything and refuses on the first red case: a corpus copied out of a repository whose own suite it does not describe would hold a second runtime to behavior the reference runtime does not have.

What is written is byte-stable - keys sorted, two spaces of indent, one trailing newline, no timestamp and no commit - so re-emitting an unchanged corpus writes the same bytes and --check reports a real change rather than the passage of time. Each case file gains one key it was not authored with, a generated_by naming the version that emitted it and the file here it came from. The schemas are copied unchanged.

Where it writes

In order: the --to path, then $RIDDLER_SPEC_PATH, then ../riddler_spec. A case file lands at <path>/corpus/<capability>/<name>.json and a schema at <path>/schemas/<name>.schema.json.

Options

  • --check - writes nothing. Compares what would be written against what is there and exits 1 listing every file that is missing or differs. This is the drift check CI runs against a fresh checkout of the corpus repository's default branch.
  • --to PATH - the checkout to write into.
  • --force - write even though the target is a git working tree with uncommitted changes. Without it an emit onto a dirty tree is refused, because the emit overwrites whole files and git is what would otherwise give the work back. --check writes nothing and never refuses.