Everything babregen knows about a repository comes from three kinds of TOML files below regen/. This page describes them and every check ID the static check can report. It starts with the seven primitives that the records and the IDs are organised by.
The seven primitives
Fowler’s Regenerative Software names seven primitives. Each has a record artefact, a family of check IDs whose prefix is its name, and a command that a reader can run. A test compares the ID column with the families of the table of checks below, and the same table stands at the top of the README:
Table 1: The seven primitives.
primitive
record artefact
IDs
command
intent
[[intent]] of regen/units/<stem>.toml
INTENT01–INTENT02
context (section Intent)
compilation
regen/architecture.toml; unit public and depends_on
COMPILE01–COMPILE08
check
evaluation
evaluation files; unit evaluations, item evaluations
EVAL01–EVAL05
mutate, score
provenance
regen/decisions/<id>.toml; regen/runs/*/run.toml
PROV01–PROV10
context (section Provenance), check
pace
unit pace; [pace] of architecture.toml
PACE01–PACE04
measures (column pace), context (the policy of the pace)
deletion
[[consumers]] of a unit
DELETE01–DELETE03
deletion-test, score, local
compaction
known_cycles; decision status
COMPACT01–COMPACT07
compact
The three file kinds
Definition 1 (Architecture)regen/architecture.toml is the compilation target: the shape every regenerated module must fit into. There is exactly one.
Definition 2 (Unit)regen/units/<stem>.toml describes one regenerable module: what it promises (intent), which tests judge it (evaluations) and who depends on it (consumers). The record does not name the module: the unit is <package>.<stem> (the stem __init__ is the package itself), so core.calc.toml describes samplepkg.core.calc, and the module path follows from that name.
Definition 3 (Decision)regen/decisions/<id>.toml is a provenance record: the driver, the decision, the rejected alternatives, the evidence, the assumptions and a review date. The file stem is the decision id.
Loading is strict. A key that is not listed below, at any level (a unit record, an [[intent]] item, a [[consumers]] entry, a decision record, an [[alternatives]] entry, architecture.toml and its [pace] table), stops the tool with exit code 2; the message names the file, the key and its line, and a similar valid key when there is one. The type of every value is checked as well: a key of type list of str holds an array of strings (not a bare string, not a table), a key of type str holds a string, a date holds a TOML date or an ISO string. A value of another type stops the tool with exit code 2; the message names the file, the key, the line, the type expected and what was found.
Prose fields are folded
A prose field is one paragraph. The loader strips the value and turns every line break, with the blanks and tabs around it, into one space; all other whitespace is kept. A line break is CRLF, a lone CR or a lone LF; U+2028 and U+0085 are no line break for this rule. So a paragraph can be wrapped over several lines in a multi-line string (""") with no backslash at the line ends, with or without one, whatever the indentation and with any of the line ends. A blank line inside a prose field is an error at the line of the key, because a prose field holds one paragraph. Every other text (a name, an id, a reference, a path, an evaluation, a public name, the key of an [allowed] entry) must hold no line break; one that does is an error at the line of the key.
A prose field is for sentences. It is not for code, a table or anything that needs its line breaks, because they fold into spaces. A required text that is empty after stripping is an error (key 'summary' ... is empty) at the line of the key, for a prose field and for a name alike; so is an empty entry of a list of prose and an empty [pace] policy. A key that is absent is “missing”. The table is babregen.spec.FIELDS:
Table 2: The prose fields, read from babregen.spec.FIELDS.
from babregen import specfor kind, fields in spec.FIELDS.items(): names = []for entry in fields:if entry.prose: names.append(entry.key + ("[]"if entry.kind =="texts"else"")) names += [f"{entry.key}.{item.key}"+ ("[]"if item.kind =="texts"else"")for item in entry.itemsif item.prose ]print(f"{kind:13s}", ", ".join(names))
The keys, read from babregen.spec.FIELDS. A key that is not in the table is an error.
Table 3: Keys of regen/architecture.toml, rendered from babregen.spec.FIELDS.
key
required
type
values
meaning
package
yes
str
Name of the top-level package.
source_dir
yes
str
Directory, relative to the repository root, that holds the package.
allowed
yes
table: name to list of str
For every subpackage or top-level module, the subpackages it may import.
pace
no
table
For every pace, the verification a change at that pace needs.
[pace] fast
no
str, prose
The verification a change at pace fast needs.
[pace] medium
no
str, prose
The verification a change at pace medium needs.
[pace] slow
no
str, prose
The verification a change at pace slow needs.
known_cycles
no
list of pairs of str
Accepted import cycles, each a pair of subpackages.
scan_dirs
no
list of str
Directories whose Python files count as consumers.
doc_globs
no
list of str
Glob patterns of documents whose text counts as a consumer.
conventions
no
list of str, prose
Rules every implementation follows.
open_choices
no
list of str, prose
Implementation choices left to the generator.
decisions
no
list of str
Ids of the decision records behind the architecture itself.
source_dir is a directory inside the repository (not absolute, no ..) and is stored normalised, so src/ is src; a package in the root uses ., and an empty value is an error. [allowed] must hold at least one key, and "__init__" stands for the __init__.py of the package. The loader does not require [pace], but PACE03 is an error for every pace that a unit declares and that has no policy there. The defaults of an absent scan_dirs are ["src", "tests", "scripts"], of doc_globs, known_cycles and the other lists [].
units/<stem>.toml
The unit name is <package>.<stem>. The stem is a dotted module name below the package: core.sub.mod.toml is the unit <package>.core.sub.mod. Each part is a Python identifier and none is __init__; the record of a package is named after its directory (core.toml, not core.__init__.toml). Any other stem (a dash, an empty part) is an error that names the file. The module path is derived from the name: <source_dir>/<package>/<a>/<b>/__init__.py if that file exists, else <source_dir>/<package>/<a>/<b>.py, so a package directory wins over a module of the same name. A module outside <source_dir>/<package>/ cannot be a unit. Unit.name and Unit.path are attributes of the loaded unit, not keys.
Table 4: Keys of a unit record, rendered from babregen.spec.FIELDS. A unit without an intent item fails the check (INTENT01).
key
required
type
values
meaning
summary
yes
str, prose
One paragraph of purpose.
pace
no
str
advised: fast, medium, slow
How fast the unit changes; the policy is in architecture.toml.
public
no
list of str
Public names the unit must define (its contract).
depends_on
no
list of str
Modules of the package the unit may import, as module or module.name.
evaluations
no
list of str
Repository-relative paths of the durable evaluation files.
unit_tests
no
list of str
Repository-relative paths of the implementation-coupled tests.
intent
no
array of tables
What must stay true for any implementation, and why.
[[intent]] id
yes
str
Stable identifier of the item, for example LVL-1.
[[intent]] scope
yes
str, prose
Where the requirement applies.
[[intent]] invariant
yes
str, prose
What must remain true, whatever the implementation.
[[intent]] reason
yes
str, prose
Why the invariant matters.
[[intent]] evaluations
no
list of str
Test functions in the evaluation files that check the invariant.
[[intent]] decisions
no
list of str
Ids of the decision records behind the invariant.
consumers
no
array of tables
Something that depends on the unit and would notice its deletion.
[[consumers]] ref
yes
str
A repository-relative path, or free text for an external consumer.
[[consumers]] kind
yes
str
one of code, test, doc, external
code, test or doc (a file here) or external.
[[consumers]] note
no
str, prose
What the consumer relies on.
The loader accepts a missing or other pace and the check reports it (PACE01, PACE02).
An intent item has the three parts of Fowler, Regenerative Software, ch. 3: the scope (where the requirement applies), the invariant (what must remain true) and the reason (why the invariant matters).
decisions/<id>.toml
Table 5: Keys of a decision record, rendered from babregen.spec.FIELDS.
key
required
type
values
meaning
title
yes
str, prose
What was decided, in one line.
date
yes
date
When the decision was taken.
status
no
str
one of active, superseded, expired; default active
active (default), superseded or expired.
driver
yes
str, prose
What forced the decision: an incident, a requirement, a measurement.
decision
yes
str, prose
What was decided, and what it protects.
approved_by
yes
str
Who stands behind the decision.
evidence
no
list of str
References: file:, commit:, KB: or url:.
assumes
no
list of str, prose
Conditions the decision rests on.
review_after
no
date
Date after which the check reports the record as due for review.
alternatives
no
array of tables
Rejected options, kept because negative knowledge is fragile.
[[alternatives]] option
yes
str, prose
What was considered.
[[alternatives]] rejected_because
no
str, prose
Why it lost.
The file stem is the decision id. babregen new-decision accepts an id of lower-case letters and digits with ., - or _ between them, at most 100 characters, that does not end in .toml; the loader reads every stem. Evidence entries start with file: (must exist in the repository), commit: (must be a commit of it), KB: (a knowledge-base entry) or url:. KB: and url: entries are recorded, never resolved: the check does not look at the machine it runs on.
Vocabularies
The values below are read from babregen.spec, so this page cannot drift from the loader. A consumer kind or a decision status outside its vocabulary stops the tool with exit code 2, as does a key of the [pace] table that is not a pace. A pace of a unit outside its vocabulary is the finding PACE02, an error, so check exits with 1.
from babregen import specfor name, values in [ ("pace", spec.PACES), ("consumer kind", spec.CONSUMER_KINDS), ("decision status", spec.DECISION_STATUSES),]:print(f"{name:16s}", ", ".join(values))
pace fast, medium, slow
consumer kind code, test, doc, external
decision status active, superseded, expired
Only the consumer kinds code, test and doc (files in this repository) are checked against the tree. A consumer of kind external has a free-text ref (<repo>:<path> for a file of a downstream repository; a scheduled run or a person is written as plain text) and is not checked, so keep it current when a contract changes.
What counts as a consumer
A Python file under scan_dirs is a consumer of a unit when an import statement names the module, or imports one of its public names through a package that re-exports it. The re-exports are followed to a fixpoint: a package that re-exports a public name from a package that re-exports it from the unit makes its importers consumers too, through any number of packages, and a cycle of re-exports ends the search. A document matched by doc_globs is a consumer when its text names the module, imports its leaf from the parent package or imports a re-exported public name. Attribute access through an imported package (import pkg; pkg.add) and a reference by a string (importlib.import_module) are not detected.
NoteFixed conventions
These are part of the schema and shared between repositories that use the tool:
An evaluation file must be marked pytest.mark.regen: a module-level pytestmark that is, or is a list or tuple that contains, the marker, or the marker as a decorator on every test (there must be a test). The match is syntactic on the name pytest (import pytest as pt and from pytest import mark are not recognised), and a pytestmark assigned inside an if is not seen (EVAL04). It must import only names listed in the unit’s public (EVAL05).
A consumer other than the unit’s own unit_tests and evaluations may use only names listed in the unit’s public: from <unit> import X and <alias>.X for an alias bound by import <unit> [as alias] or from <parent> import <leaf> [as alias] (DELETE03). An alias that a function or comprehension binds again (a parameter, an assignment target and so on) is not the unit inside it. Dunder names, submodules of the unit and import * are ignored, and so are documents. The scan does not see getattr(unit, "_x"), a string annotation, import pkg; pkg.sub.unit._x, an import from a private submodule of a package unit (from pkg.unit.internal import secret) or an alias rebound at module or class level, so none of these is reported.
Files under tests/ are shown as kind test in the deletion report, everything else in Python as code.
The directories .venv, __pycache__, _site, _freeze and reference (the quartodoc output) are never scanned for consumers.
The name of a unit and the path of its module are derived (see the unit table), so no record can disagree with the file it describes, and a stem that names no module (a part __init__, a dash) is refused, so two records cannot name one module.
Check IDs
A finding is rendered as one line, {path}:{line}: {level} {id} {message}, or {path}: {level} {id} {message} when the check cannot tell the line. The level is lower case and nothing is padded. The path is repository-relative and never empty: a finding about a unit record names the record and the line of the key it is about, a finding about code, an evaluation or a consumer names that file, and a finding about a run record names its run.toml. A finding about a name that matches nothing (EVAL03, PROV01, PROV02, COMPILE06, COMPILE08) is placed at the line of that name inside its array, and when a close valid name exists (difflib, cutoff 0.75) the message ends with ; a similar name exists: 'X'; the same holds for an unknown key of a record and for an unknown unit. Errors fail the check; warnings ask for attention and fail it only with --strict. The IDs, their levels and the line format are a stability contract. Each ID has one condition and one level, and the findings come errors first, then in the order architecture, units by name, decisions, run records.
Table 6: Every check ID, its level and the one condition that reports it, grouped by primitive. The table is babregen.checks.CHECKS, the same table that the evaluations and the architecture decision record pin.
ID
level
reported when
intent
INTENT01
error
a unit record declares no intent item
INTENT02
error
an intent item names no evaluation
compilation
COMPILE01
error
a Python file of the package does not parse
COMPILE02
error
a subpackage imports a subpackage that [allowed] does not permit
COMPILE03
error
a subpackage of the package is missing from [allowed]
COMPILE04
error
an import cycle between subpackages is not listed in known_cycles
COMPILE05
error
the module file of a unit does not exist
COMPILE06
error
a name in public is not defined at the top level of the module
COMPILE07
error
the module imports a package module that is not in depends_on
COMPILE08
error
a depends_on entry names no module of the package, or a name its module does not define
evaluation
EVAL01
error
an evaluation file named in evaluations does not exist
EVAL02
error
an evaluation file does not parse
EVAL03
error
an evaluation named by an intent item is not defined in the unit’s evaluation files
EVAL04
error
an evaluation file is not marked pytest.mark.regen: no module-level pytestmark is, or contains, the marker, and not every test carries it as a decorator (or the file has no test)
EVAL05
error
an evaluation file imports a name of the unit that is not in public
provenance
PROV01
error
an intent item cites a decision that does not exist
PROV02
error
architecture.toml cites a decision that does not exist
PROV03
error
file: evidence does not exist in the repository
PROV04
error
commit: evidence is not a commit of the repository (not reported when git is missing)
PROV05
error
evidence has a prefix other than file:, commit:, KB:, url:
PROV06
warning
an active decision is past review_after
PROV07
warning
an intent item cites a decision whose status is not active
PROV08
warning
the newest archived run of the unit judged a different bundle (bundle_sha256)
PROV09
warning
the newest archived run of the unit replaced a different module (module_sha256)
PROV10
warning
a run.toml under regen/runs/ does not parse
pace
PACE01
error
a unit record declares no pace
PACE02
error
a unit’s pace is not fast, medium or slow
PACE03
error
[pace] has no policy for a pace that a unit declares
PACE04
error
a unit lists in depends_on a unit (or a name of it) whose pace is faster than its own
deletion
DELETE01
error
a file depends on the unit but is not declared (consumer, unit_tests or evaluations)
DELETE02
error
a declared consumer of kind code, test or doc does not exist
DELETE03
error
a consumer outside unit_tests and evaluations uses a name of the unit that is not in public
compaction
COMPACT01
warning
[allowed] lists a subpackage that does not exist
COMPACT02
warning
an allowed edge of [allowed] is not used by any import
COMPACT03
warning
a pair in known_cycles is no longer a cycle
COMPACT04
warning
an entry of depends_on is not imported by the module
COMPACT05
warning
a test function in an evaluation file is named by no intent item
COMPACT06
warning
an active decision is cited by no intent item and not by architecture.toml
COMPACT07
warning
a declared consumer of kind code, test or doc no longer references the unit
PROV08 and PROV09 need the run records of the unit; PROV10 belongs to no unit. INTENT02 and EVAL03 use the definition of coverage that babregen measures shows: an intent item is covered if and only if it names at least one evaluation and every evaluation it names is defined in an evaluation file of the unit (a top-level test* function, or a test* method of a Test* class, named TestK::test_k). So the covered items are exactly the items without INTENT02 or EVAL03, for a unit whose module is missing as well. babregen compact prints exactly the COMPACT findings of babregen check, so compaction loses nothing by being a filter.
JSON output
babregen check --format json prints one JSON document on stdout, with an indent of 2 and a trailing newline, and nothing else. The exit codes are those of the text format. The text format is the default and is unchanged. The document has the keys format, summary and findings, in this order:
{"format":1,"summary":{"units":1,"errors":1,"warnings":0},"findings":[{"path":"regen/units/core.calc.toml","line":14,"level":"error","id":"EVAL03","message":"intent C-1: evaluation 'test_ad' not found","suggestion":"test_add"}]}
format is the integer 1. It changes only with the stability contract: a new, a removed or a reordered key, or a changed meaning of a key, needs a breaking commit, a new minor version and a new number. No key is added under the same number.
summary holds the three integers of the summary line.
findings lists the findings in the order of the text output. Each has the six keys path, line, level, id, message and suggestion, in this order. line is null when the check cannot tell the line, suggestion is null when no similar name exists, and message does not repeat the suggestion.
When the records do not load, the exit code is 2 and the document is
{"format":1,"error":{"path":"regen/units/core.calc.toml","line":2,"message":"unknown key 'pase' in a unit record","suggestion":"pace"}}
with path relative to the repository root (the one found upwards or given with --root, not the working directory) where it lies below it and unchanged where it lies outside it, the keys of error in the order path, line, message, suggestion, path and line null for an error that names no file or line (no regen/architecture.toml, an unknown unit), and nothing on stderr. The message is the error without its path, line and suggestion (for a TOML syntax error and a file that is not UTF-8 as well). The JSON is ASCII: every other character is escaped, so that the output does not depend on the encoding of the terminal. An error of the arguments (an unknown option, a missing argument) is not a record error: argparse prints it as text on stderr and exits with 2, also with --format json.
Exit codes and summary lines
Table 7: Exit codes. Exit 2 covers a malformed record (including invalid TOML), an unknown unit, a missing regen/architecture.toml and argparse errors.
command
exit 0
exit 1
exit 2
check
no error (with --strict: no finding)
an error, or a warning with --strict
spec or argument error
deletion-test
the report says Verdict: regenerable
any other verdict
spec, unit or argument error
context, compact, measures, new-unit
success
spec, unit or argument error
mutate
every mutant killed
a mutant survived
spec, unit or argument error, no evaluation file, or evaluations that fail on the unchanged module
score, local
accept/1 accepts the candidate: its evaluations pass (at least one, none failed or errored) and no dependent fails
the candidate is not accepted, a pytest run timed out, or the driver produces no module
spec, unit, option or missing-tool error, a time limit that is not positive and finite
coding, gate (every step)
the step succeeded, or check found no problem
content that was checked fails: a quote, a number, a hash, a chain, or a format or vocabulary error in a file that an agent wrote or that was downloaded from a page
an argument or spec error, a missing file, a step taken out of order, a target file that exists
The summary lines regen check: N units, E errors, W warnings and regen compact: N candidates keep their regen prefix. Messages on standard error start with babregen:.
Run records
babregen score and babregen local write a run.toml per run, into a run directory below regen/runs/ (see Scoring and regeneration for the files of the directory). Its field protocol names the procedure that produced the run: score for babregen score, regeneration for babregen local and canary for babregen local --canary. The decision record that fixes the protocol of a regeneration or canary is protocol_record. A run record is read as babregen writes it and in no other form; the keys that babregen check requires of a run are unit (the stem of the unit record), status (completed), started (YYYY-MM-DDTHH:MM:SSZ) and a table inputs with bundle_sha256 or module_sha256.
from IPython.display import Markdownfrom babregen.judge import RUN_KEYSrows = ["| table | key | protocols | when | meaning |", "|:--|:--|:--|:--|:--|"]rows += [f"| {table} | `{key}` | {', '.join(protocols)} | {when} | {meaning} |"for table, key, protocols, when, meaning in RUN_KEYS]Markdown("\n".join(rows))
Table 8: Every key of a run.toml, by table, for the protocols that write it. The table is babregen.judge.RUN_KEYS, the same table that the tests of the writers and the architecture decision record pin. run is the top level; session and attempt are arrays of tables.
table
key
protocols
when
meaning
run
unit
regeneration, canary, score
always
unit stem
run
protocol
regeneration, canary, score
always
regeneration, canary or score
run
protocol_record
regeneration, canary
always
id of the active decision record that fixes the protocol (--protocol)
run
babregen_version
regeneration, canary, score
always
installed version
run
host
regeneration, canary
always
free label of the machine that made the run (--host), empty if none
run
started
regeneration, canary, score
always
UTC YYYY-MM-DDTHH:MM:SSZ
run
finished
regeneration, canary, score
always
UTC YYYY-MM-DDTHH:MM:SSZ
run
status
regeneration, canary, score
always
completed or aborted
run
abort_reason
regeneration, canary
aborted
the session and the error that ended the run
run
abort_class
regeneration, canary
aborted
network, timeout, http_<code>, bad_json, context, model_mismatch, egress, internal or interrupted
run
report_error
regeneration
report_error
why the gap report is missing: its session failed after the verdict
run
accepted
regeneration, score
completed
verdict of rule
run
rule
regeneration, score
completed
accept/1
base
commit
regeneration, canary, score
always
full 40-hex SHA of the commit judged against
tool
python
regeneration, canary, score
always
version of the scoring interpreter
tool
pytest
regeneration, canary, score
always
version of pytest in it
tool
packages_sha256
regeneration, canary, score
always
SHA-256 of the sorted name==version lines of the scoring interpreter
tool
scoring_timeout_s
regeneration, canary, score
always
seconds each scoring call may take
control
evaluations_passed
regeneration
always
evaluations that passed on the original module at the base
control
evaluations_failed
regeneration
always
evaluations that failed on the original module at the base
control
evaluations_errors
regeneration
always
evaluation errors on the original module at the base
control
dependents_passed
regeneration
always
dependents that passed on the original module at the base
control
dependents_failed
regeneration
always
dependents that failed on the original module at the base
generator
model
regeneration, canary
always
model identifier
generator
model_sha256
regeneration, canary
always
SHA-256 of the model file or of the manifest of a model folder, as given, not verified
generator
context_length
regeneration, canary
always
context length the server loaded the model with
generator
endpoint
regeneration, canary
always
completions URL
generator
harness
regeneration, canary
always
driver and version
generator
reasoning
regeneration, canary
always
reasoning mode
generator
template
regeneration, canary
always
prompt template
generator
max_tokens
regeneration, canary
always
token limit of a code session
generator
report_tokens
regeneration, canary
always
token limit of the report and canary session
generator
session_timeout_s
regeneration, canary
always
seconds a session may take
generator
temperature
regeneration, canary
always
sampling temperature
generator
top_p
regeneration, canary
always
sampling top-p
generator
top_k
regeneration, canary
always
sampling top-k
generator
seed
regeneration, canary
always
seed of the first session
generator
failure_chars
regeneration, canary
always
upper bound, in characters, of the failure summary a repair sees
inputs
bundle_sha256
regeneration, score
always
SHA-256 of the bundle at the base
inputs
module_sha256
regeneration, score
always
SHA-256 of the module at the base
inputs
allowed
regeneration, score
always
the --allow files, as given
inputs
allowed_sha256
regeneration, score
always
their SHA-256 at the base, in the same order
inputs
candidate_sha256
score
always
SHA-256 of the candidate
egress
lsof_period_s
regeneration, canary
always
seconds between two samples
egress
lsof_samples
regeneration, canary
always
samples taken
egress
remotes
regeneration, canary
always
every remote endpoint seen
canary
tools_offered
canary
completed
tools the model was offered
canary
files_before
canary
completed
files of the run directory before the session
canary
files_after
canary
completed
files of the run directory after it
session
n
regeneration, canary
always
position of the session, from 1
session
kind
regeneration, canary
always
generate, repair, report or canary
session
seed
regeneration, canary
always
seed of the session
session
prompt_sha256
regeneration, canary
always
SHA-256 of the rendered prompt
session
prompt_tokens
regeneration, canary
always
tokens in the prompt
session
completion_tokens
regeneration, canary
always
tokens generated
session
finish_reason
regeneration, canary
always
as the server sends it, "" for null
session
seconds
regeneration, canary
always
wall-clock seconds
attempt
n
regeneration, score
always
position of the attempt, from 1
attempt
session
regeneration
always
the session that answered
attempt
wrote_module
regeneration, score
always
whether a module was written and evaluated
attempt
candidate_class
regeneration
unwritten
no_module, truncated, surrogate, unchanged or syntax_error
attempt
candidate_error
regeneration
unwritten
why no module was evaluated
attempt
sha256
regeneration, score
wrote
SHA-256 of the module
attempt
evaluations_passed
regeneration, score
wrote
evaluations that passed
attempt
evaluations_failed
regeneration, score
wrote
evaluations that failed
attempt
evaluations_errors
regeneration, score
wrote
evaluation errors; a timeout is one
final
attempt
regeneration, score
final
the attempt of the final module
final
sha256
regeneration, score
final
SHA-256 of the final module
final
unit_tests_passed
regeneration, score
final
unit tests that passed
final
unit_tests_failed
regeneration, score
final
unit tests that failed
final
unit_tests_errors
regeneration, score
final
unit-test errors
final
dependents_passed
regeneration, score
final
dependents that passed
final
dependents_failed
regeneration, score
final
dependents that failed
The column when says which runs have the key: always (every run of the protocol), aborted or completed (by status), final (a completed run that has a final module), report_error (the gap report failed) and, for an attempt, wrote or unwritten (it wrote a module, or the reply held none). A run that was aborted before its first session has no [[session]] and no [[attempt]]. Every value is a string, an integer, a float, a boolean, a list of these or a table; TOML has no null, so the driver records finish_reason as "" when a model server sends null.
A run that was judged records accepted and the acceptance rule rule (accept/1), one [[attempt]] per try with evaluations_passed, evaluations_failed and evaluations_errors (a timeout is one error), and a [final] table for the final module (the first attempt whose evaluations pass, else the last attempt that wrote a module): attempt, sha256, the unit-test counts and the dependent counts. Unit-test results are recorded for review and never affect accepted. babregen score UNIT <candidate> --base <base.commit> of an archived candidate gives the same counts and the same accepted.
The [inputs] table binds the run to what it judged: bundle_sha256 is the SHA-256 of the bundle that the generator received and module_sha256 that of the module it replaced, both as they are at [base] commit. babregen check parses every run.toml under regen/runs/ once, at any depth. Only a run record that babregen wrote is read for PROV08 and PROV09: its status is exactly "completed" (an aborted run and a record without a status are ignored), its unit equals the record stem of a unit (core.calc, not the dotted module name; a record whose unit names no unit belongs to none), and its [inputs] table holds a bundle_sha256 or a module_sha256 string (a canary holds none). Any other record that parses is ignored without a finding. Among the records of a unit the newest is compared, by its started field, which is read only in the spelling babregen writes, YYYY-MM-DDTHH:MM:SSZ; a record whose started is in another spelling, or absent, still counts but is the oldest, and equal times go by path. PROV08 is reported when its bundle_sha256 differs from the current bundle and PROV09 when its module_sha256 differs from the current module. The verdict of such a run is evidence of its day only. Runs with status = "aborted", runs that record no hash and units without runs are not reported. A run.toml that cannot be parsed is PROV10, once, at its own path, whatever it names, with the line of the TOML error where there is one: it is never skipped silently. run.toml is written by one function that refuses an absent value. All three are warnings, and they are provenance findings, not compaction candidates.
score.toml
babregen mutate UNIT --out FILE writes the result of the mutation analysis. It is format = 1, the first key. The other keys are unit, module (the path of the module, relative to the project root), module_sha256 (the hash of that file, which the mutants were made from), babregen_version, base (the full SHA of HEAD), dirty (whether the working tree, which is what mutate copies and mutates, differed from base), python and pytest (the versions of the interpreter that ran the evaluations), packages_sha256 (the hash of its installed distributions, computed as for [tool] of run.toml), timeout_s, evaluations, baseline_passed, planted and killed, and one [[mutant]] table per mutant with id, line, end_line (the last line of the changed node), operator, original, mutated, diff, killed and detail. original and mutated are cut to 70 characters; diff is not. It is a unified diff with two lines of context between the unparsed original and the mutated module, with the headers --- original and +++ <id>, so it tells two mutants on one line apart. Its line numbers refer to the unparsed text, not to the file; line and end_line refer to the file. mutate needs a git repository with a commit, because it records the base.
The files of the two human steps
babregen coding and babregen gate (see The two human steps) read and write files of thirteen kinds, and the file of babregen mutate --out is one of them. Every file is TOML and starts with format = 1. The reader of babregen.review.formats refuses a file without format, another format number, a key that the table does not hold, a missing required key, a value of the wrong type, a word outside its vocabulary, an empty text where the table does not allow it, a text of white space only, a time stamp that is no date of the calendar and, where a table is required, a table without an entry. The writer writes format first, then the keys in the order of the table, then the arrays of tables, so the same data give the same bytes. A file holds no value that can be computed from the same file or from a rule alone. A value that sums up another file is kept only where check compares it with its source: survivors and drawn of seal.toml, survivors of key.toml, drawn of verdicts.toml, has_report of coding.toml and evaluations_failed and evaluations_total of a proposal.
Table 9: The file kinds of the two human steps, the file each is written to and who writes it. <hash8> is the first eight characters of page_sha256.
The fields of every kind follow, rendered from babregen.review.formats.FIELDS. The column values shows the vocabulary of a word or the pattern that a text must match; blank says that the empty string is allowed. An array of tables is shown as [[name]] with its keys below it. The vocabularies are the codebook coding/1 and the gate gate/1: five categories of a failure, three confidence levels, three answers about the gap report, three verdicts the three stages of a gate and the two stages of a coding. The manifests record the vocabulary they were written with.
coding
key
required
type
values
format
yes
int
babregen_version
yes
text
created
yes
text
matches \d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ
vocabulary
yes
text
one of coding/1
run
yes
array of tables
[[run]] name
yes
text
[[run]] path
yes
text
[[run]] run_sha256
yes
text
matches [0-9a-f]{64}
[[run]] protocol
yes
text
one of score, regeneration
[[run]] unit
yes
text
[[run]] base
yes
text
matches [0-9a-f]{40}
[[run]] final_attempt
no
int
[[run]] has_report
yes
bool
proposal
key
required
type
values
format
yes
int
run
yes
text
proposed_by
yes
text
final_attempt
no
int
category
yes
text
one of missing knowledge, ambiguous knowledge, byte-level pinning, generator error, harness error
confidence
yes
text
one of high, medium, low
dominant_group
yes
int
dominant_cause
yes
text
reason
yes
text
evaluations_failed
yes
int
evaluations_total
yes
int
gap_report
no
text
one of yes, partly, no
gap_report_comment
no
text
quote
no
array of tables
[[quote]] role
yes
text
one of score, records, rebuild, evaluation, gap report
[[quote]] file
yes
text
[[quote]] line
yes
int
[[quote]] text
yes
text
group
yes
array of tables
[[group]] title
yes
text
[[group]] category
yes
text
one of missing knowledge, ambiguous knowledge, byte-level pinning, generator error, harness error
[[group]] evaluations
yes
int
[[group]] tests
yes
list of text
[[group]] expected
yes
text
[[group]] delivered
yes
text
[[group]] records_searched
yes
text
may be blank
[[group]] quote
no
array of tables
[[quote]] role
yes
text
one of score, records, rebuild, evaluation, gap report
[[quote]] file
yes
text
[[quote]] line
yes
int
[[quote]] text
yes
text
proposal-check
key
required
type
values
format
yes
int
run
yes
text
checked_by
yes
text
proposal_sha256
yes
text
matches [0-9a-f]{64}
agrees
yes
bool
category
yes
text
one of missing knowledge, ambiguous knowledge, byte-level pinning, generator error, harness error
comment
yes
text
coding-answers
key
required
type
values
format
yes
int
stage
yes
text
one of own, final
coder
yes
text
page_sha256
yes
text
matches [0-9a-f]{64}
previous_sha256
yes
text
matches [0-9a-f]{64}; may be blank
exported_at
yes
text
matches \d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ
run
yes
array of tables
[[run]] name
yes
text
[[run]] run_sha256
yes
text
matches [0-9a-f]{64}
[[run]] proposal_sha256
no
text
matches [0-9a-f]{64}
[[run]] started_at
yes
text
matches \d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ
[[run]] saved_at
yes
text
matches \d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ
[[run]] category
yes
text
one of missing knowledge, ambiguous knowledge, byte-level pinning, generator error, harness error
[[run]] confidence
yes
text
one of high, medium, low
[[run]] gap_report
no
text
one of yes, partly, no; may be blank
[[run]] reason
yes
text
one line; may be blank
[[run]] note
yes
text
may be blank
mutation
key
required
type
values
format
yes
int
unit
yes
text
module
yes
text
module_sha256
yes
text
matches [0-9a-f]{64}
babregen_version
yes
text
base
yes
text
matches [0-9a-f]{40}
dirty
yes
bool
python
yes
text
pytest
yes
text
packages_sha256
yes
text
matches [0-9a-f]{64}
timeout_s
yes
float
evaluations
yes
list of text
baseline_passed
yes
int
planted
yes
int
killed
yes
int
mutant
no
array of tables
[[mutant]] id
yes
text
[[mutant]] line
yes
int
[[mutant]] end_line
yes
int
[[mutant]] operator
yes
text
[[mutant]] original
yes
text
may be blank
[[mutant]] mutated
yes
text
may be blank
[[mutant]] diff
yes
text
[[mutant]] killed
yes
bool
[[mutant]] detail
yes
text
may be blank
gate
key
required
type
values
format
yes
int
babregen_version
yes
text
created
yes
text
matches \d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ
vocabulary
yes
text
one of gate/1
drawn_rule
yes
text
one of 0 if n == 1 else max(1, (n + 5) // 10)
report
yes
array of tables
[[report]] path
yes
text
[[report]] sha256
yes
text
matches [0-9a-f]{64}
[[report]] unit
yes
text
[[report]] base
yes
text
matches [0-9a-f]{40}
[[report]] planted
yes
int
[[report]] killed
yes
int
survivor
yes
array of tables
[[survivor]] unit
yes
text
[[survivor]] id
yes
text
[[survivor]] module
yes
text
[[survivor]] line
yes
int
[[survivor]] end_line
yes
int
[[survivor]] operator
yes
text
[[survivor]] original
yes
text
may be blank
[[survivor]] mutated
yes
text
may be blank
[[survivor]] diff
yes
text
[[survivor]] excerpt
yes
text
gate-proposals
key
required
type
values
format
yes
int
salt
no
text
matches [0-9a-f]{64}
proposed_by
yes
text
proposal
yes
array of tables
[[proposal]] unit
yes
text
[[proposal]] id
yes
text
[[proposal]] verdict
yes
text
one of gap, output, equivalent
[[proposal]] reason
yes
text
gate-assignment
key
required
type
values
format
yes
int
salt
yes
text
matches [0-9a-f]{64}
assignment
yes
array of tables
[[assignment]] unit
yes
text
[[assignment]] id
yes
text
[[assignment]] verdict
yes
text
one of gap, output, equivalent
gate-shown
key
required
type
values
format
yes
int
salt
yes
text
matches [0-9a-f]{64}
proposal
yes
array of tables
[[proposal]] unit
yes
text
[[proposal]] id
yes
text
[[proposal]] verdict
yes
text
one of gap, output, equivalent
[[proposal]] reason
yes
text
gate-key
key
required
type
values
format
yes
int
salt
yes
text
matches [0-9a-f]{64}
survivors
yes
int
drawn_mutant
no
array of tables
[[drawn_mutant]] unit
yes
text
[[drawn_mutant]] id
yes
text
[[drawn_mutant]] shown_verdict
yes
text
one of gap, output, equivalent
[[drawn_mutant]] shown_reason
yes
text
[[drawn_mutant]] honest_verdict
yes
text
one of gap, output, equivalent
[[drawn_mutant]] honest_reason
yes
text
gate-seal
key
required
type
values
format
yes
int
sealed_at
yes
text
matches \d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ
gate_sha256
yes
text
matches [0-9a-f]{64}
survivors
yes
int
drawn
yes
int
key_sha256
yes
text
matches [0-9a-f]{64}
shown_sha256
yes
text
matches [0-9a-f]{64}
first_sha256
yes
text
matches [0-9a-f]{64}
second_sha256
yes
text
matches [0-9a-f]{64}
assignment_sha256
yes
text
matches [0-9a-f]{64}
gate-rating
key
required
type
values
format
yes
int
stage
yes
text
one of blind, second, third
rater
yes
text
page_sha256
yes
text
matches [0-9a-f]{64}
seal_sha256
yes
text
matches [0-9a-f]{64}
previous_sha256
yes
text
matches [0-9a-f]{64}; may be blank
exported_at
yes
text
matches \d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ
rating
yes
array of tables
[[rating]] unit
yes
text
[[rating]] id
yes
text
[[rating]] verdict
yes
text
one of gap, output, equivalent
[[rating]] reason
yes
text
one line
[[rating]] shown_at
yes
text
matches \d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ
[[rating]] rated_at
yes
text
matches \d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ
[[rating]] proposal_shown
no
text
one of gap, output, equivalent
[[rating]] proposal_honest
no
text
one of gap, output, equivalent
gate-verdicts
key
required
type
values
format
yes
int
rater
yes
text
written_at
yes
text
matches \d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ
verdict
yes
array of tables
[[verdict]] unit
yes
text
[[verdict]] id
yes
text
[[verdict]] verdict
yes
text
one of gap, output, equivalent
[[verdict]] reason
yes
text
[[verdict]] drawn
yes
bool
The failing evaluations of evaluations-<n>.txt
The text file of an evaluation run (evaluations-<n>.txt in a run directory) ends with a block that lists what failed, because run.toml holds only the counts. The block opens with the line babregen: failing evaluations. After it come, in the order printed, the lines FAILED <nodeid> and ERROR <nodeid>, each followed by up to ten crash lines that are indented by four spaces. A reader takes the last such line in the file as the opening of the block, and a file without the line has no failures to read. The pages of the coding show the block as the failing evaluations of a run.
Stability contract
This section states the contract once (ADR 0001, decision 10). It binds from 0.0.1 and is pinned by the test suite. A change to anything listed here needs a breaking commit, a CHANGELOG entry and a new minor version:
the check IDs and their levels;
the line format {path}:{line}: {level} {id} {message} (with ; a similar name exists: 'X' at the end when there is a suggestion) and the summary lines, and the JSON format of check and of its error (format 1; the keys, their order and their meaning as in JSON output);
the exit codes;
babregen.spec.FIELDS, the schema of regen/ (keys, kinds, required keys, vocabularies, prose fields), with the folding rule of Prose fields are folded, and the rule that an unknown key or a value of the wrong type is an error;
the bytes of the context bundle for given records, module, evaluation files and dependency modules: archived runs record the SHA-256 of the bundle they were given (bundle_sha256). Since 0.1.0 the bundle names what a unit may import as modules and names apart. The line - this unit may import: lists the entries of depends_on in the order of the record, a repeated entry once, separated by ;: a whole module as its dotted name (babregen.spec), and the entries that name a definition of one module together as from <module>: <name>, <name>, at the place of the first of them and with the names in the order of the record; it reads nothing inside the package without an entry. The subsection of a definition in “Contracts of dependencies” is headed ### <name> (from <module>), that of a module ### <module>. The bundles of every unit with such an entry changed with 0.1.0, and archived runs of those units report PROV08;
the acceptance rule accept/1;
the Markdown of deletion-test and measures;
the keys of run.toml (babregen.judge.RUN_KEYS), which include babregen_version;
the file of babregen mutate --out as format = 1 (score.toml): the keys and their order, and the form of diff;
the commands babregen coding and babregen gate with their steps and exit codes, and the files of the two human steps as format = 1 (the files of the two human steps): the file kinds, their keys, types and vocabularies, and the order of the keys. babregen coding has two stages, own and final, each with a page (coding-own.html, coding-final.html) and an archived answers file (answers-own.toml, answers-final.toml) of the kind coding-answers, whose stage is own or final; the final answers carry the hash of answers-own.toml as previous_sha256;
the block of failing evaluations of evaluations-<n>.txt (its form);
the rule that a command that writes records only creates a file or appends one complete [[...]] block, and never rewrites existing text;
that babregen explain has an explanation for every check ID and babregen example an example record for each of the three record kinds.
that a page is verifiable with the babregen that built it: page_sha256 covers the wording and the markup of the page. gate.toml and coding.toml record babregen_version; with another version check verifies everything that does not depend on the rendering and prints a note that names the version needed for the page comparison, and page and intake refuse (exit 2).
Not part of the contract: message texts, the texts of explain and example, line numbers and the look of the pages of the two human steps (their markup, style and script). A new key needs a release of its own, because the schema is strict.