Skip to content

Latest commit

 

History

History

corpus

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

The corpus — how mandible stays fixed once it's fixed

This directory holds frozen captures of real tools' help output, paired with the parse mandible is expected to produce from them. It is the project's regression ratchet: once a tool is confirmed working, no future grammar change may silently break it, because the exact bytes that worked are here and CI re-parses them on every PR.

If you found a tool that mandible renders badly, this is where your contribution goes — and you can contribute it without writing any Rust.

What the corpus is, and is not

  • It is test data only. The mandible binary never reads this directory; nothing here changes what any user sees at runtime. The only thing that fixes a tool for users is a grammar change in mandible-extract.
  • It is therefore not the per-tool knowledge the project's core invariant forbids (see CONTRIBUTING.md, "The invariant"). A corpus entry is a fact about a failure; the parser may never consult it, key on it, or special-case the tool it names. Runtime per-tool overrides remain user-local (~/.config/mandible/overrides/) and are never committed here.
  • A fixture cannot go stale in the way vendored catalogs did. It asserts "given these frozen bytes, the parser produces this tree" — a statement about the parser, true forever. When a tool's help changes in a new version, that's a new sibling fixture, not an update to the old one.

Layout

corpus/<tool>/<version>/
  meta.toml         # the contract, and the map from argv to capture files
  help.txt          # a raw capture, byte-exact — named by meta.toml's
                    # [[capture]], not by a fixed convention (see below)
  help.stderr.txt   # that capture's stderr, only when non-empty
  expected.snap     # the CommandNode tree snapshot (plain YAML — see below)
  expected.screen   # the detail pane's page for every parsed node, as plain text

<version> is the tool's own reported version (git --version → 2.43). If a version bump produced byte-identical help output, skip the new directory.

meta.toml: the contract vs. the snapshot

Each entry has a descriptive half and a normative half, and the distinction is what makes the ratchet work:

  • expected.snap is descriptive: the current exact parse, as plain YAML — mandible_core::to_snapshot run through serde_yaml, nothing more. It may change in any PR that changes the grammar; cargo xtask corpus --bless rewrites it to match a fresh extraction, and reviewing that diff is the review artifact. (Not cargo insta — a CLI binary can't drive insta's review workflow sanely, since it assumes a test binary with dynamic per-test snapshot paths. xtask corpus does a plain file compare instead, with --bless as insta's review equivalent.)

  • meta.toml is normative: the promises that may never silently weaken. cargo xtask corpus fails, naming the tool and exactly which promise broke, if a change violates them. Weakening one is allowed only by editing this file — an explicit, reviewable act.

  • expected.screen is the other half of the same record: the detail pane's page for every parsed node of the tree, drawn by the TUI's own renderer as plain text, one === <node path> === section per node. It is drawn at a fixed size (pane text width 76, which a 160-column terminal gives the pane, wrapping on, Unicode glyphs, the whole page, no window chrome), so a change that only alters how a page is drawn shows up in the diff and fails cargo xtask corpus until it is blessed. --bless rewrites it together with expected.snap; a missing file fails a checking run.

--bless is a human assertion of correctness, not a mechanical accept. It rewrites expected.snap and expected.screen to match whatever the parser just produced — it does not check that production against anything, and a clean cargo xtask corpus run afterward only proves the snapshot now matches itself, never that either one is right. Running --bless and committing the diff without reading it is indistinguishable, to every later reader and to CI, from asserting the new tree is correct. Before you run it, read the raw capture and the resulting tree side by side — every flag's description against the line it came from, every subcommand against the heading that named it — and only bless once you can say the tree is what the raw text actually says. corpus/lsof/4.95.0 is the fixture that proves what skipping this costs: it was committed green (--bless, then [xfail] removed) by blessing a parse where a three-column options table had been read as one column, so roughly three quarters of its "described" flags carried another flag's description instead of their own — a snapshot that matched itself perfectly and was still wrong. It is [xfail] again now, specifically because that review did not happen the first time.

# Who blessed this fixture's expected.snap — required on every fixture.
# See "Human vs. agent: `[bless] provenance`" below.
[bless]
provenance = "agent"

[tool]
name = "git"
version = "2.43.0"
platform = "ubuntu-24.04"            # where captured
captured_with = "mandible 0.2.2"     # capture tooling version

# One entry per probe a tier actually sends. A generic-parser tool needs one
# (its root `--help`); cobra needs two per node (`""` and `-` each return
# different halves — subcommands vs. flags, spec Appendix A [M-*]); a tool
# with subcommand fixtures needs one entry per captured node. `argv` is the
# full command line, argv[0] included, exactly as a contributor would type
# it — but note the runner strips argv[0] before matching: the replay seam
# (`mandible_extract::exec::Transcript`) keys on `InertArgv::args()`, which
# is the real argument vector a tier sends and *excludes* the tool name.
# `["git", "--help"]` here therefore matches a tier's `--help` probe, and
# `["git", "commit", "--help"]` matches its `commit --help` probe.
[[capture]]
argv = ["git", "--help"]
stdout = "help.txt"
stderr = "help.stderr.txt"           # optional, omit when empty
exit_code = 0                        # optional, defaults to 0

[contract]
expected_framework = "generic"       # from `mandible --doctor git`; the
                                     # detected Framework's name, or
                                     # "generic" when Tier A′ found none
min_status = "ok"                    # floor: ok > incomplete > low-confidence
                                     # > verbatim > no-tier ("suspicious"
                                     # meets no floor)
min_subcommands = 20                 # coarse floor, not an exact count
must_usage_forms_min = 2             # coarse floor on root.usage, the same
                                     # shape as min_subcommands but for a
                                     # multi-invocation-form tool (lvm2's
                                     # own emitter)
must_contain_flags = ["--paginate"]  # optional spot-checks, root flags only
must_contain_positionals = ["pid"]   # same, for root positional operands —
                                     # matched on the operand's name, which
                                     # is what a user actually types. A
                                     # trailing `...` ("file...") also
                                     # requires the operand to be
                                     # repeatable: `[file...]` with the
                                     # dots glued loses the marker today
                                     # while `[file ...]` keeps it, and no
                                     # other field states the difference
must_contain_modifiers = ["a", "U"]  # same, for the single-letter modifiers
                                     # a tool documents in a modifier table
                                     # (`ar`'s `[a]`, `[U]`). Bare letters,
                                     # no brackets; case is significant,
                                     # since `[u]` and `[U]` are different
                                     # modifiers on the tools that have them

# A negative claim: root flag spellings the tree must NOT carry.
# Everything above says "the parser dropped something real"; this says
# "the parser invented something". See "Stating that a flag does not
# exist" below for exactly what it does and does not assert.
must_not_contain_flags = ["--------------------------------"]

# The positional mirror of the above: root positional names the tree must
# NOT carry. See "Stating that a positional does not exist" below.
must_not_contain_positionals = ["ID"]

# The group-label mirror of the above: no root flag's own group may START
# WITH one of these spellings. See "Stating that a flag group is not an
# invocation line" below.
must_not_contain_flag_group_prefixes = ["lvcreate", "Lvcreate"]

# A root flag's own group must equal this text exactly, keyed by the
# flag's own spelling — or, when the value is the empty string, the flag
# must carry no group at all. See "A flag's own group" below.
[contract.must_flag_group]
"--mirrorlog" = "Create a raid1 or mirror LV."

# The other negative shape: spellings that really exist and must NOT
# resolve to the same entity. Guards the alias-run fold specifically. See
# "Stating that two flags did not fuse" below.
must_keep_separate = [["-w", "-X"], ["-C", "-CC"]]

# A flag must own the named choice values, so a choices block that
# attached to the wrong flag is checkable instead of only visible in a
# snapshot diff. Matched the way `must_contain_flags` matches; the flag
# must exist and its choices must include every value listed.
[contract.must_attach_choices]
"--warnings" = ["gnu", "obsolete", "portability"]

# A flag must NOT carry the named choice values. Every root flag with that
# spelling is checked. Vacuous when the flag or the root is absent.
[contract.must_not_attach_choices]
"--warnings" = ["slice"]

# A flag's rendered description must contain this text — substring match
# after collapsing runs of whitespace on both sides to a single space
# (descriptions wrap), case-sensitive. Makes description recovery
# checkable instead of guarded only by the snapshot.
[contract.must_describe]
"--target" = "the triple to build for"

# Same idea, for a subcommand's own flags — keyed by its path (space-
# separated, tool's own name excluded), since `must_contain_flags` alone
# can only ever assert what a tool publishes at its *root*. Requires a
# `[[capture]]` for that subcommand's own `--help`/`-h`.
[contract.must_contain_flags_by_path]
restore = ["--source", "--staged"]

# The same for a node's own positional operands, keyed by path. Matched on
# the operand's name as the parser stores it, exactly as
# `must_contain_positionals` does, so a trailing `...` also requires the
# operand to be repeatable. The root is the empty path `""`. Requires a
# `[[capture]]` for that subcommand's own `--help`.
[contract.must_contain_positionals_by_path]
restore = ["pathspec..."]

# A root flag's value placeholder must contain this text, keyed by the
# flag's own spelling. Substring match after collapsing whitespace, the
# same rule `must_describe` uses, and satisfied when *any* entity carrying
# that spelling matches — a tool can document one spelling on two rows
# (`vim`'s `-r` and `-r (with file name)`), and a first-match rule would
# report the wrong one. The gap it closes: a value spec that lost a token
# (`-V[N][fname]` read as `-V` plus `N`) leaves every other field intact,
# so nothing but the snapshot could see it.
[contract.must_value_name]
"-V" = "fname"

# A subcommand's own display spelling, keyed by path the same way
# `must_contain_flags_by_path` is. `ar`'s `r` row displays as `r[ab][f][u]`
# even though the parsed node's own name is bare `r`.
[contract.must_display_name]
r = "r[ab][f][u]"

# The modifier letters a subcommand accepts, keyed by path the same way.
# `ar`'s `r` row accepts `a`, `b`, `f` and `u`.
[contract.must_accept_modifiers]
r = ["a", "b", "f", "u"]

# Which dimensions of the tree a human actually verified before blessing
# this fixture. Optional; see "What `--bless` does and does not assert"
# below for the values and why an absent field means *no* scope, never
# every scope.
verdict_scope = ["flags", "subcommands"]

[xfail]                              # present only while the bug is unfixed
broken = true
reason = "command groups under flush-left headings are dropped; renders verbatim"
issue = "https://github.com/<org>/<repo>/issues/NNN"  # optional

Stating that a flag does not exist: must_not_contain_flags

Every other [contract] field is a positive claim — it names something the real tool really has, and fails when the parser drops it. That covers the omission half of what can go wrong and none of the invention half: a parser that reads a table ruler, a decorator, or a stray line of punctuation as an option produces a flag nobody can point at, because there is no field whose job is to say "this must not be here."

must_not_contain_flags is that field, and corpus/mariadb-check/2.7.4 is the instance it was built for. That tool's Variables (--variable-name=value) defaults table opens with a header ruler, and the parser emits a flag whose long name is that ruler. The tool has no such option.

It is matched exactly the way must_contain_flags is, negated: --foo asserts no root flag has the long name foo, -x asserts none has the short name x, a bare word is matched against the long name verbatim. Write the spelling as it would be typed. What it deliberately does not claim, so a fixture author never asserts more than they looked at:

  • Nothing about the raw capture. This is a statement about the parsed tree only. The mariadb ruler occurs literally in help.txt and must go on occurring there — the capture is byte-exact. (This is also why the existence oracle cannot catch this defect: its question is "does this spelling occur in the raw text", and here it correctly answers yes.)
  • Nothing about the other spelling. --foo says nothing about a short -f, and -x says nothing about any long name.
  • Nothing below the root. Root flags only, the same scope must_contain_flags has. A subcommand inventing a flag would need a by-path analogue; this field does not quietly cover it.

A fixture that produces no root at all satisfies this vacuously and is not reported — the one asymmetry with the positive fields, which a missing tree trivially breaks. Dropping an entry is a weakening exactly as dropping a must_contain_flags entry is, and --baseline-dir reports it as one.

Stating that a positional does not exist: must_not_contain_positionals

The positional mirror of must_not_contain_flags, built for corpus/caffeinate/26.6.2 (issue #135): its usage line's -w takes the value Process ID, and the unfixed parser split that value at its own space, leaving Process as the value name and inventing a positional spelled ID. Nothing before this field could state that caffeinate has no such positional.

must_not_contain_positionals = ["ID"]

Matched exactly the way must_contain_positionals is, negated: a bare name asserts no root positional carries that exact name, and a trailing ... still requires repeatability for the match to count (so it plays no part in a negative claim, which never fires on a repeatable operand sharing the bare name). Root only, the same scope every other positional field has. Claims nothing about the raw capture — ID still occurs there, inside -w's own value spec, and the existence oracle is correctly silent on this defect for the same reason it is on the mariadb ruler. A fixture that produces no root at all satisfies this vacuously and is not reported, the same asymmetry must_not_contain_flags has.

Stating that a subcommand has no such positional: must_not_contain_positionals_by_path

The by-path form of must_not_contain_positionals, keyed by the same space-separated subcommand path as must_contain_positionals_by_path. git log's usage block lists git show [<options>] <object>... as a second form, and object... is not an operand of git log.

[contract.must_not_contain_positionals_by_path]
log = ["object..."]

A path that resolves to no node satisfies the claim vacuously.

Stating that usage text carries text it must not: must_not_contain_usage_text

must_not_contain_flags says a spelling was invented. It says nothing about the usage block itself carrying text that does not belong there — makeconv's tab-indented description sentence, which has no terminating period, folds straight into the usage line with no heading, no flag and no positional to name it (docs/shapes.md S-135). Nothing but a byte-exact snapshot diff could see that until now.

must_not_contain_usage_text = ["read .ucm codepage mapping files"]

Every entry of root.usage is checked for this text as a verbatim substring — no whitespace collapsing, unlike must_describe, since a folded usage line is already one physical string. A fixture that produces no root satisfies this vacuously, the same reasoning must_not_contain_flags uses. Dropping an entry is a weakening exactly as dropping a must_not_contain_flags entry is.

Stating that the root description carries text it must not: must_not_describe_root

must_not_describe only ever checks a flag's own description. Nothing before this field could say the root's own description is contaminated — Xvfb's leading option-rejection diagnostic (Unrecognized option: --help) used to fuse into the root description alongside its whole eighty-row option table (docs/shapes.md S-162).

must_not_describe_root = ["Unrecognized option"]

Every listed string is checked as a substring of root.description, whitespace-collapsed to a single space on both sides, must_describe's own rule. cargo xtask corpus fails when any listed text is still present, naming it. Satisfied vacuously by a tree with no root or no description at all, the same reasoning must_not_contain_flags uses.

Stating that the root description carries text: must_describe_root

The positive mirror of must_not_describe_root, built for corpus/jinfo/17.0.20: the <no option> row describes the bare invocation and belongs in the root description.

must_describe_root = ["to print both VM flags and system properties"]

Every listed string must occur in root.description, whitespace-collapsed on both sides, must_describe's own rule. A fixture that produces no root fails.

Stating that a flag group is not an invocation line: must_not_contain_flag_group_prefixes

must_not_contain_flags and must_not_contain_usage_text say nothing about a flag's own group label carrying invented structure. lvm2's own --help (lvcreate, lvconvert, vgchange, ...) writes one invocation form per stanza: a prose sentence, then the form's own usage line, then its option rows. The unfixed parser reads a later form's usage line itself as a section heading and files that form's rows under it ("Lvcreate -m|--mirrors Number -L|--size Size[m|UNIT] VG"), instead of the prose sentence directly above it (docs/shapes.md S-137). Nothing before this field could state that a group is the tool's own invocation prefix rather than a human-written label.

must_not_contain_flag_group_prefixes = ["lvcreate", "Lvcreate"]

Every root flag's group, when set, is checked against every listed spelling with str::starts_with — verbatim, no whitespace collapsing. Root only, the same scope every other flag-shaped field has. A fixture that produces no root, or whose flags carry no group at all, satisfies this vacuously and is not reported, the same reasoning must_not_contain_flags uses.

A flag's own group: must_flag_group

The positive half of the field above: a root flag's own group must equal specific text, keyed by the flag's own spelling (matched the way must_contain_flags matches). lvcreate's --mirrorlog must sit in the group "Create a raid1 or mirror LV.", the prose sentence its own invocation form carries.

[contract.must_flag_group]
"--mirrorlog" = "Create a raid1 or mirror LV."
"--size" = ""

The expected text is matched against Flag::group exactly — no substring, no whitespace collapsing, the same rule must_display_name uses for a label — except the empty string "", which instead asserts the flag carries no group at all (a grammar that declines to invent one, per its own reasoned choice, is exactly as checkable as one that does). cargo xtask corpus fails when the named flag is absent, or when no matching entity carries the expected group, naming what was expected and every group it found instead. A fixture that produces no root fails this exactly as it fails must_display_name.

Stating that two flags did not fuse: must_keep_separate

must_not_contain_flags catches invention. It says nothing about a different failure mode: two real, distinct flags read correctly on their own, then wrongly merged onto one multi-spelling entity. An earlier alias-run fold did exactly this — it merged rows on description equality and fused unrelated flags together — and had to be reverted, because nothing said the fold was not allowed to do that.

must_keep_separate is that field: a list of spelling groups, each naming spellings that must resolve to distinct entities.

must_keep_separate = [["-w", "-X"], ["-C", "-CC"]]

Each inner list is checked independently. cargo xtask corpus fails, naming the group and which of its spellings collapsed together, when two or more spellings in one group resolve to the same entity. Matched exactly the way must_contain_flags is, root flags only — the same scope every other flag-shaped field has.

This is a negative claim, the same shape as must_not_contain_flags, and follows it for the missing-root case: "these spellings never fused" holds vacuously of a tree with no flags at all, so a fixture that produces no root satisfies it and is not reported.

must_keep_separate_by_path is the same claim for a subcommand's own flags, keyed by the subcommand's path (space-separated, no tool name). A path that resolves to no node fails by name.

[contract.must_keep_separate_by_path]
create = [["-n", "--table"]]

A flag must own its choices: must_attach_choices

--format's choice values belong to --format, not to whichever flag happens to sit next to it in the source. A choices block that attaches to the wrong flag produces a tree that looks complete — the values are somewhere — and only a snapshot diff, read carefully, would ever say so.

[contract.must_attach_choices]
"--warnings" = ["gnu", "obsolete", "portability"]

The named flag, matched the way must_contain_flags matches, must exist and its Entity::choices must include every value listed. This is a positive claim: cargo xtask corpus fails when the flag is absent, or when any listed value is not among the choices attached to it, naming either the missing flag or the missing values. A fixture that produces no root fails this exactly as it fails must_contain_flags.

[contract.must_not_attach_choices] is its negative twin: it names values that no root flag of that spelling may carry, so a block that overran into another section's flag fails by name. A tree with no root, or no such flag, satisfies it vacuously.

A flag's description says what it should: must_describe

A flag can carry a description and still carry the wrong one — text recovered from the wrong line, or from a neighboring row. Nothing but a byte-exact snapshot diff caught that until now (issue #102 item 5).

[contract.must_describe]
"--target" = "the triple to build for"

The named flag's rendered description must contain this text as a substring. Both sides are compared after collapsing runs of whitespace to a single space, because a real description wraps and a fixture author's TOML value may not wrap the same way; the match itself is case-sensitive. cargo xtask corpus fails when the flag is absent, or when the description does not contain the text, naming what was expected and what the description actually is (truncated to a readable length). A fixture that produces no root fails this exactly as it fails must_contain_flags.

A positional's description says what it should: must_describe_positional

must_describe walks only root.flags(), so nothing could assert a positional's own description the way invoke-rc.d documents action right under its usage line — until now (docs/shapes.md S-127).

[contract.must_describe_positional]
"action" = "Initscript action. Known actions are"

The named positional, matched on Entity::primary_name, root only, must exist and its rendered description must contain this text as a substring (same whitespace-collapsing comparison must_describe uses). cargo xtask corpus fails when the positional is absent, or when its description does not contain the text. A fixture that produces no root fails this exactly as it fails must_contain_positionals.

A subcommand's operand text, by path: must_describe_positional_by_path

must_describe_positional reads the root only. These three fields state the same claims for any node, keyed by its path and then the operand's primary_name; the text comparison collapses whitespace as above.

[contract.must_describe_positional_by_path]
"macsec" = { ID = "128-bit hex string" }

[contract.must_not_describe_positional_by_path]
"macsec" = { ID = ":=" }

[contract.must_attach_positional_choices_by_path]
"l2tp" = { L2SPEC = ["none", "default"] }

The first requires the operand to exist and its description to contain the text; the second requires the description not to contain it (a missing operand passes); the third requires each named choice among the operand's values.

A subcommand's own source spelling: must_display_name

A command-table row can document a subcommand together with the modifiers it accepts glued onto the same row (ar's r[ab][f][u]), and the shape test that recognizes the command name rejects the bracketed form outright (spec §7 Tier B rule 3) — the node's own name is the bare letter, r. The commands pane still shows the row as the tool printed it, in CommandNode::display_name (docs/design.md §16, "a node whose help repeats an ancestor's renders parsed, not repeated").

[contract.must_display_name]
r = "r[ab][f][u]"

Keyed by path the same way must_contain_flags_by_path is. The named node's display_name, or its bare name when display_name is unset, must equal this text exactly. cargo xtask corpus fails when no node exists at the path, or when the spelling differs, naming both. A fixture that produces no root fails this exactly as it fails must_contain_flags_by_path.

A subcommand's own accepted modifiers: must_accept_modifiers

The same command-table row documents which single-letter modifiers that subcommand accepts (ar's r[ab][f][u] accepts a, b, f, u), recovered into CommandNode::accepted_modifiers. must_contain_modifiers only ever asserts the root's own modifier list; nothing asserted a subcommand's own accepted set until now.

[contract.must_accept_modifiers]
r = ["a", "b", "f", "u"]

Keyed by path the same way must_contain_flags_by_path is. Every listed letter must be in the named node's accepted_modifiers; cargo xtask corpus fails naming whichever letters are missing. A path with no entry here asserts nothing about its modifiers, positive or negative — a subcommand documented with no modifiers at all (ar's d, p, s) needs no entry. A fixture that produces no root fails this exactly as it fails must_contain_flags_by_path.

A subcommand's own description: must_describe_subcommand

must_describe walks only root.flags(), so nothing before this field could assert a subcommand's own rendered description the way nix's nix help - show help about nix or a particular subcommand documents one, keyed by path the way must_contain_flags_by_path is (docs/shapes.md S-143).

[contract.must_describe_subcommand]
help = "show help about nix or a particular subcommand"

The named node's CommandNode::summary must contain this text as a substring, matched the way must_describe matches: whitespace collapsed to a single space on both sides, case-sensitive. cargo xtask corpus fails when no node exists at the path, or when the summary does not contain the text, naming what was expected and what the summary actually is. A fixture that produces no root fails this exactly as it fails must_contain_flags_by_path.

A subcommand's usage lines: must_contain_usage_by_path

Each listed text must be a substring of one of the node's usage entries (whitespace collapsed), keyed by path the way must_contain_flags_by_path is (docs/shapes.md S-211). A path with no node fails.

[contract.must_contain_usage_by_path]
install = ["corepack install", "<-g,--global> [--cache-only]"]

A subcommand's own group: must_subcommand_group

The subcommand mirror of must_flag_group: a subcommand's own CommandNode::group must equal specific text, keyed by path the way must_contain_flags_by_path is. nix's own command table groups every subcommand under a ... commands: label (docs/shapes.md S-143), and nothing before this field could check which label a subcommand actually landed under.

[contract.must_subcommand_group]
help = "Help commands:"
build = "Main commands:"

The expected text is matched against CommandNode::group exactly — no substring, no whitespace collapsing, must_flag_group's own reasoning — except the empty string, which instead asserts the node carries no group at all. cargo xtask corpus fails when no node exists at the path, or when no matching group is found, naming what was expected and what the node actually carries. A fixture that produces no root fails this exactly as it fails must_display_name.

Stating that a description carries text it must not: must_not_describe

must_describe's substring check cannot say a description is contaminated: an unheaded example block folding onto a flag's real description (corpus/nfsslower-bpfcc/0.29.1) still contains the real text, so the positive check still passes. must_not_describe is the negative half, the same shape must_not_contain_flags is for invented flags.

[contract.must_not_describe]
"-p" = "trace pid 121 only"

The named flag's rendered description must NOT contain this text as a substring, matched the way must_describe matches. Satisfied vacuously when the flag is absent or the fixture produces no root, the same reasoning must_not_contain_flags uses.

Stating that a value name carries text it must not: must_not_value_name

must_value_name's substring check cannot say a placeholder is duplicated: pvdisplay's --configreport reads its choices straight off a docopt bracket row's own trailing |-list, and the same list also survives as value_name, so the rendered screen prints it twice (docs/shapes.md S-130). must_value_name still passes, since the placeholder does contain the text it names; nothing said it must not carry more.

[contract.must_not_value_name]
"--configreport" = "log|vg|lv|pv|pvseg|seg"

The named flag's value_name must NOT contain this text as a substring, matched the way must_value_name matches: every entity carrying that spelling is checked, substring comparison after collapsing whitespace on both sides. Satisfied vacuously when the flag is absent or the fixture produces no root, the same reasoning must_not_describe uses.

A value name after the real app's own root refill: must_value_names_after_root_refill

must_value_name is satisfied by any entity carrying the spelling, on the raw, unrefilled tree — which is exactly why it cannot see a same-spelling merge bucket's own defect (docs/shapes.md S-147). A flag whose several invocation forms each name their own value reaches the raw tree once per form, each form still its own entity, each already naming its own value: the positive claim passes trivially before any fold has even happened. The loss only exists once the same node is folded, and every running session folds it: mandible::background::Warmer::submit_root_fill always merges the already-extracted root against a fresh reprobe as soon as the TUI opens, and Runner::fill_node's own contract ("existing is always included as a candidate") is what pools every same-spelling entity into one bucket for mandible_core::merge::merge_entity_bucket to fold.

[contract.must_value_names_after_root_refill]
"-help" = ["topic"]

cargo xtask corpus simulates that exact refill — merge_nodes over two clones of this fixture's own root, the same "existing plus a fresh reprobe of the same source" shape fill_node always produces — and checks the named flag's merged value_name for every listed substring (matched the way must_value_name matches: substring, both sides whitespace-collapsed). cargo xtask corpus fails when the flag is absent from the refilled tree, or when the merged value name is missing any listed substring, naming what was expected and what survived instead. A fixture that produces no root fails this exactly as it fails must_value_name.

A refill keeps rows of one document apart, so a flag documented once per invocation form keeps one row per form. The check passes when every listed substring appears in the value_name of some row carrying the spelling. lvcreate's --type lists one value per form.

Choices after the real app's own root refill: must_choices_after_root_refill

The choices twin of must_value_names_after_root_refill. A bracket row such as --type raid1|mirror carries its list on its own row, and must_attach_choices finds only the first row with the spelling.

[contract.must_choices_after_root_refill]
"--type" = ["raid1", "mirror"]

cargo xtask corpus simulates the same refill and passes when one single row carries every listed value (exact name, no substring). It fails when the flag is absent from the refilled tree or no row carries them all, naming the choices each row held. A fixture that produces no root fails this exactly as it fails must_attach_choices.

Every fixture that is not [xfail] also gets one unlisted check: merging its root with itself must reproduce the root as a snapshot. A failure names the first changed snapshot line.

Exactly one row under a heading: must_one_row_in_group

[contract.must_one_row_in_group]
"generic raw video demuxer AVOptions:" = ["-framerate"]
"" = ["--"]

Keyed by group label ("" is no group), each spelling must have exactly one row under it, in the parse and after the refill simulation. It fails on zero rows too. See docs/shapes.md S-187.

Text drawn on one line: must_draw

[contract]
must_draw = ["-Z<type>", "-c, +<cmd>"]

Each entry must appear inside one line of the pages the pane draws for the tree, whitespace collapsed. It holds what the tree cannot say, such as how a value joins its flag. See docs/shapes.md S-261.

What --bless does and does not assert: verdict_scope

--bless freezes the entire tree into expected.snap — node summaries, flag descriptions, usage lines, all of it — regardless of which parts of that tree a human actually read before running it. That gap is exactly what the lsof cautionary tale above cost: a snapshot that matched itself perfectly while three quarters of its flag descriptions were wrong, because the person who blessed it never looked.

[contract]'s verdict_scope makes the claim a bless makes machine- readable instead of leaving it to a prose comment (or worse, to nothing). It is a list of which dimensions of the tree were actually looked at by a human before this fixture was blessed:

  • "flags" — the flag list (names, short/long spellings) was checked against the raw capture.
  • "subcommands" — the subcommand tree was checked against the raw capture.
  • "descriptions" — flag and node prose was checked against the raw capture (corpus/README.md's full bless workflow, "every flag's description against the line it came from").
  • "usage" — usage/synopsis lines were checked.

An absent verdict_scope means no scope is claimed — never "every dimension." A blessed expected.snap freezes every field whether or not a human read it, so treating silence as "everything verified" would let the exact overclaim this field exists to prevent survive by omission. This is deliberately the conservative reading: it is always safe to add a truthful claim later, never safe to have quietly claimed one that wasn't made. Most fixtures in this corpus (everything captured before this field existed, and the hand-authored git/tar seed fixtures, which went through the full bless workflow but never had the claim recorded) are unscoped for exactly this reason — that does not mean they weren't reviewed, only that the review's scope isn't machine-readable for them.

xtask corpus --show <fixture> prints a fixture's scope alongside its raw capture and parsed tree; a checking run's per-fixture line adds a verdict_scope: ... note when one is set; the --format markdown transition report carries a scope column so a reviewer scanning a green run can see, without opening meta.toml, which rows have unreviewed prose. check_contract never reads this field — it is a record of what a human checked by eye, not itself a check.

The 36 audit-seed2 fixtures promoted from the seed-2 human audit (git show c9bfe76) all carry verdict_scope = ["flags", "subcommands"], matching that audit's own declared scope: the reviewer judged flag and subcommand accuracy only, and never looked at prose.

Human vs. agent: [bless] provenance

verdict_scope records what a human reviewed. It has no complement: nothing records which fixtures were blessed by an agent with no human eyes on them at all, which is most of this corpus — the AGENTS.md measurement at v0.3.1 found only 3 of 23 newly-passing fixtures carried a human verdict_scope; the other 20 were agent-blessed trees the suite then guarded against changing, not against being wrong. [bless] provenance makes that complement machine-readable instead of leaving it to be inferred from whether verdict_scope happens to be set.

It is a required top-level table, present on every fixture:

[bless]
provenance = "agent"

Three values:

  • "human" — a human ran the bless that produced the current expected.snap bytes. No fixture in this corpus carries this value today, and that is the field's first finding rather than an oversight: every expected.snap here was written by a --bless run inside a commit carrying a Co-Authored-By: Claude trailer, including the git/tar seed fixtures, whose current snapshots were re-blessed by later grammar-fix commits. The value exists so a human bless has somewhere to be recorded when one happens.
  • "agent-then-human" — the snapshot bytes are agent-authored, and a human has reviewed this fixture's tree and left a verdict_scope recording what they checked. It deliberately does not assert an ordering: a grammar fix landing after the human's review may have re-blessed bytes that human never saw, so this is strictly weaker than "human" and must never be read as "the current tree was human-verified". What it does assert is that a human looked at this fixture at some point and said so.
  • "agent" — an agent blessed it and no human has left a review record. The conservative default, and the only value xtask audit fixtures ever writes. It is also the value for a fixture with a verdict_scope but no expected.snap at all (mariadb-check/2.7.4, still [xfail]): nothing has been blessed there, so there is no bless to attribute.

An agent always writes "agent" here, and only a human may flip it to "human" or "agent-then-human". This is the mirror of the rule verdict_scope already carries ("an agent must never claim verdict_scope") extended to the blessing act itself: an agent judging its own bless as human-verified would defeat the field before it recorded anything. The conservative default exists for the same reason verdict_scope's absence means "no scope claimed" rather than "every scope" — it is always safe to upgrade a truthful claim later, never safe to have quietly overclaimed one.

cargo xtask corpus's summary line splits its ok count by this field — 71 ok (0 human, 39 agent-then-human, 32 agent) — specifically so "N ok" can never be read as "N human-verified"; xtask corpus --show <fixture> prints the value alongside scope, and the --format markdown report carries it as its own provenance column next to scope.

Lifecycle rules, enforced by cargo xtask corpus:

  • xfail → passing: allowed in any PR. This is the good direction.
  • passing → xfail, or weakening any [contract] field: only via an explicit edit to meta.toml, justified in the PR description.
  • A fixture, once merged, is never deleted because it became inconvenient. It may be deleted if the capture itself was wrong (mis-captured, wrong tool).
  • Strict xfail, both directions. A fixture marked [xfail] whose snapshot and every [contract] field now pass fails the run — that means the bug got fixed and the fixture is stale; promote it (remove [xfail], keep expected.snap). A fixture marked [xfail] that still fails some check is fine and does not fail the run — that's the expected, documented-broken state. Both directions are checked on every run, not just the "did it get fixed" one: it's equally a bug if a fixture claims to be broken but every check quietly passes.

Contributing a fixture: the workflow

You found a tool that parses badly. The steps:

  1. Diagnose: run mandible --doctor <tool>. Note the detected framework and tier status — this goes in meta.toml and the issue.

  2. Capture the raw output the same way mandible probes it (sanitized env, both streams). Until mandible capture ships (see Status below):

    $ TERM=dumb NO_COLOR=1 COLUMNS=100 LC_ALL=C.UTF-8 \
        <tool> --help > help.txt 2> help.stderr.txt

    Delete help.stderr.txt if empty (and leave it out of meta.toml's [[capture]] entry — stderr is optional there for exactly this case). Do the same for any subcommand that demonstrates the problem, with its own [[capture]] entry naming its own argv and files.

  3. Review your capture for private data. Help output can embed your hostname, username, or paths. mandible's own probes mask sandbox paths back to $HOME-style variables; a manual capture has no such protection — read the file before you commit it.

  4. Write meta.toml with [[capture]] (mapping the argv you ran to the files you captured), [xfail] describing what's wrong, and a required [bless] table. You do not need to produce expected.snap — a fixture marked broken has no expected tree yet — but [bless] provenance is still required: an agent writes provenance = "agent" here always (see "Human vs. agent" above); a human contributor may write "human" only once they've actually blessed the tree themselves.

  5. Open a PR containing only the fixture. CI confirms the parser really does fail on it (an xfail that passes is flagged — the bug may already be fixed). A maintainer merges it: the bug is now an executable, reproducible backlog entry instead of a prose report.

  6. Optionally, fix it — in the same PR or a later one, by you or anyone: improve the grammar (never add per-tool logic), remove [xfail], fill in [contract], run cargo xtask corpus --bless to accept the new snapshot, and set [bless] provenance ("agent" unless a human is doing this bless and reviewing the tree themselves, in which case "human"). cargo xtask corpus (without --bless) enforces that every other fixture stays green — that is the entire point. A fix that breaks another fixture will be named, and the tension goes to review instead of shipping. Note the order: --bless skips every [xfail] fixture (it names each one it skipped), so remove [xfail] before blessing. The strict-xfail check on a plain run tells you when a fixture is stale and ready to promote.

Fixture-only PRs (step 5) need no Rust and are near-trivially mergeable. Grammar PRs (step 6) are held to CONTRIBUTING.md's full bar.

Which frameworks exist

Parsing is keyed by the framework that generated the help text, never by tool name. The authoritative list is the match in mandible-extract/src/help_text/profile.rs plus the fingerprints in mandible-extract/src/framework/; mandible --doctor <tool> reports what was detected for your tool. A tool detected as nothing is parsed by the generic layout engine (expected_framework = "generic") — that is normal and most hand-rolled tools live there. If you believe a tool's framework should be detected and isn't, say so in the fixture's xfail reason; fingerprint regressions are gated on expected_framework exactly like parse regressions.

Size and hygiene

  • Captures are text, typically a few KiB. Anything over 256 KiB needs a justification in the PR (some tools are genuinely huge; curl --help all is legitimate).
  • Deduplicate hash-identical captures across versions. Many tools change their version string without changing a byte of their help text, and a second copy of the same bytes buys nothing while adding a file every future reader has to check against the first. Two fixtures may reference one capture; two copies of one capture is waste.
  • Never commit a binary. If a fixture concerns artifact fingerprinting (detection from the compiled binary rather than its output), record the extracted marker strings in meta.toml, not the executable.
  • Captures are byte-exact: no re-wrapping, no trailing-whitespace cleanup, no editor "fixing" the file. The mess is the test — the repo's root .gitattributes marks everything under corpus/ as -text specifically so Git's own CRLF/whitespace normalization can't be the thing that quietly "fixes" it.

Running the suite

$ cargo run -p xtask -- corpus            # check every fixture, exit non-zero on any regression
$ cargo run -p xtask -- corpus --bless    # rewrite expected.snap to match a fresh extraction
$ cargo run -p xtask -- corpus --dir some/other/corpus   # point at a different corpus root
$ cargo run -p xtask -- corpus --baseline-dir /tmp/corpus-at-main   # also flag weakened [contract]s

--baseline-dir diffs every fixture's [contract] against a second, plain corpus directory and prints a prominent CONTRACT WEAKENED: <fixture> <field> line for each field that got weaker (lowered min_status/min_subcommands, a dropped must_contain_flags/must_contain_flags_by_path/ must_contain_positionals/must_not_contain_flags/must_keep_separate/ must_attach_choices/must_accept_modifiers entry, a removed must_describe/must_display_name entry, a fixture newly marked [xfail], or a fixture missing entirely) — reported, never must_contain_positionals/must_not_contain_flags/must_not_contain_usage_text/must_keep_separate/ must_attach_choices entry, a removed must_describe entry, a fixture newly marked [xfail], or a fixture missing entirely) — reported, never gated, since weakening a contract deliberately is still legal (the lifecycle rules above). This binary has no git access and never will — the workspace-wide no_process_outside_exec test forbids std::process outside mandible-extract/src/exec/, xtask/src included — so --baseline-dir takes a plain directory, never a git ref: populate it however you like (a CI step running git archive <base-ref> corpus | tar -x -C <dir> before invoking xtask corpus is the intended shape). Omit the flag and nothing changes — .github/workflows/ci.yml's corpus job does not pass it yet, so this check does not currently run in CI; wiring that step is open follow-up work, not yet done.

Runs with zero subprocesses: every fixture is replayed through the real tiered extraction pipeline via the Transcript probe (mandible-extract/src/exec/probe.rs), never a live spawn. Per-fixture output names the tool and exactly what broke, e.g.:

git/2.43.0   ok                   (2.9ms)  snapshot: match
tar/1.35     ok                   (6.1ms)  snapshot: match

(A fixture still marked [xfail] reports its unmet promises instead, e.g. xfail (as expected) (1.4ms) contract: must_contain_flags: missing --paginate; snapshot: none yet (legal while [xfail]) — see the [xfail] example above.)

A fixture also fails outright if it parses slower than ~100ms — deliberately coarse, a mechanical net for an accidental O(n²)-in-a-loop bug rather than a gate on ordinary millisecond-scale noise (see AGENTS.md's invariant table for the incident that motivated it), and applied regardless of [xfail] status: a fixture's content may be documented-broken, but a slow parse never is.

Status

The corpus contract above is adopted, and the runner described in "Running the suite" implements it in full: snapshot + [contract] + strict-xfail (both directions) + the parse-time ceiling, over the two seed fixtures — both green (tar: the [M-10] phantom-subcommand war story locked in at zero subcommands; git: promoted from [xfail] once its extract_positionals defects and a related negatable-flag defect were fixed, its restore captures now also exercising [M-16]'s man-page→-h fallback in replay). Still open:

  • mandible capture <tool> — one-command fixture bundle with masking
  • xtask-generated FRAMEWORKS.md table
  • Wiring .github/workflows/ci.yml's corpus job to populate a baseline directory from the PR's base ref and pass --baseline-dir, so CONTRACT WEAKENED actually appears on real PRs — the xtask side (--baseline-dir, contract_weakened_lines) is implemented and tested; the CI step that feeds it a real baseline is not
  • This contract document
  • The xtask corpus runner itself
  • Wiring cargo xtask corpus into CI as a required check (.github/ workflows/ci.yml's corpus job — a hard gate, unlike the PATH sweep, because this runner spawns no subprocesses and reads only frozen bytes: nothing about it can flap)
  • A markdown transition report for CI to post (cargo xtask corpus --format markdown, written to $GITHUB_STEP_SUMMARY) — status, node/flag counts, and named subcommand/flag deltas, never a raw expected.snap diff