GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — docs(spec): reframe the rendering corpus around the fleet, not one CLI · jdx/usage@a378716

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • conformance/src
    • render.rs
    • tables.rs
  • corpus/render
    • 01-flag-values.json
    • 03-sections.json
    • README.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎conformance/src/render.rs‎

Copy file name to clipboardExpand all lines: conformance/src/render.rs
+15-10Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,23 @@
66
//! emitter's help table), and three implementations of a rendering rule drift exactly the way
77
//! three implementations of a parsing rule do.
88
//!
9-
//! # Why this exists beside the mise fixture
9+
//! # Why this exists beside the fleet gate
1010
//!
11-
//! `benches/gate/tests/help.rs` compares every one of mise's 211 commands against usage-lib,
12-
//! byte for byte, and it is the check that decides whether an adopter's help output changes.
13-
//! What it cannot do is cover a shape mise does not use. A flag whose *value* is optional is
14-
//! one: every flag value mise declares is required and undefaulted, so `[--opt [n]]` rendered
15-
//! as `[--opt <n>]` for as long as usage-argv existed and the 211-command comparison passed
16-
//! throughout.
11+
//! `benches/gate/tests/help.rs` and `fleet.rs` beside it render every command of mise and the
12+
//! six other jdx CLIs and compare each page against usage-lib byte for byte. That is the check
13+
//! that decides whether an adopter's help output changes, and no hand-written corpus will match
14+
//! it for scale.
1715
//!
18-
//! So the two are complements. The fixture answers "does a real CLI still render the same",
19-
//! at a scale no hand-written case reaches. The corpus answers "does every shape a spec can
20-
//! declare render the same", including the ones no single CLI happens to contain.
16+
//! What it cannot do is cover a shape no CLI in the fleet uses. Across all 809 value-taking
17+
//! flags in the fleet, three of the four "must the flag be given" against "must its value be
18+
//! given" pairings appear and the fourth appears nowhere; nor does a flag whose value carries a
19+
//! default, which relaxes the value's brackets by another route. The fleet was one CLI until
20+
//! #972, and widening it found three bugs at once — so the lesson is not that seven is enough,
21+
//! it is that a fixture only asks about the vocabulary its CLIs happen to use.
22+
//!
23+
//! So the two are complements. The gate answers "do real CLIs still render the same", at a scale
24+
//! no hand-written case reaches. This answers "does every shape a spec can declare render the
25+
//! same", including the ones no CLI in the fleet contains.
2126
//!
2227
//! # Scope
2328
//!
Collapse file

‎conformance/src/tables.rs‎

Copy file name to clipboardExpand all lines: conformance/src/tables.rs
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,12 @@ fn flag_meta<'a>(
273273
help: opt(&f.help),
274274
long_help: opt(&f.help_long),
275275
value_name: arg.map(|a| leak(&a.name)),
276-
// The value's own bracket bit, folded with the value's own default the way usage-lib
277-
// folds a positional's — a default declared on the *flag* is a different statement and
278-
// stays in `default` below.
279-
value_required: arg.is_none_or(|a| a.required && a.default.is_empty()),
276+
// The value's own bracket bit, which is not the flag's — usage-lib renders a flag from
277+
// two independent `required` bits and a spec can write either without the other. Folded
278+
// with the value's own default the way usage-lib folds a positional's, so
279+
// `arg "<n>" default="4"` inside a flag reads as optional; a default declared on the
280+
// *flag* is a different statement and stays in `default` below.
281+
value_optional: arg.is_some_and(|a| !a.required || !a.default.is_empty()),
280282
env: opt(&f.env),
281283
default: strs(&f.default),
282284
choices: arg
Collapse file

‎corpus/render/01-flag-values.json‎

Copy file name to clipboardExpand all lines: corpus/render/01-flag-values.json
+28-10Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,78 @@
11
{
22
"section": "flag-values",
3-
"about": "A flag and its value each carry brackets, and the two are decided separately. The flag's say whether the flag may be left out; the value's say whether a value must follow it. A spec can write either without the other, so there are four pairings and no CLI is likely to contain all four — mise contains exactly one, which is how `[--opt [n]]` rendered as `[--opt <n>]` in usage-argv while a 211-command comparison against usage-lib passed.",
3+
"about": "A flag and its value each carry brackets, and the two are decided separately. The flag's say whether the flag may be left out; the value's say whether a value must follow it. A spec can write either without the other, so there are four pairings — and across all 809 value-taking flags in mise and the fleet, three appear and `<--jobs [n]>` appears nowhere, as does a value carrying a `default`. `[--opt [n]]` was itself rendered `[--opt <n>]` until #969, and pitchfork is the only reason that was visible; the two rows still at zero have nothing but these vectors holding them.",
44
"vectors": [
55
{
66
"id": "flag-optional-value-required",
77
"doc": "The ordinary pairing: the flag may be left out, and a value must follow it if it is not.",
88
"spec": "name \"ex\"\nbin \"ex\"\nflag \"--tool <TOOL>\" help=\"Which tool\"\n",
9-
"expect": { "usage": "ex [--tool <TOOL>]" }
9+
"expect": {
10+
"usage": "ex [--tool <TOOL>]"
11+
}
1012
},
1113
{
1214
"id": "flag-required-value-required",
1315
"doc": "Both required. The only pairing mise's spec contains.",
1416
"spec": "name \"ex\"\nbin \"ex\"\nflag \"--v <n>\" required=#true help=\"How loud\"\n",
15-
"expect": { "usage": "ex <--v <n>>" }
17+
"expect": {
18+
"usage": "ex <--v <n>>"
19+
}
1620
},
1721
{
1822
"id": "flag-optional-value-optional",
1923
"doc": "A value declared `[n]` is square-bracketed, independently of the flag's own brackets.",
2024
"spec": "name \"ex\"\nbin \"ex\"\nflag \"--opt [n]\" help=\"A number, or not\"\n",
21-
"expect": { "usage": "ex [--opt [n]]" }
25+
"expect": {
26+
"usage": "ex [--opt [n]]"
27+
}
2228
},
2329
{
2430
"id": "flag-required-value-defaulted",
2531
"doc": "A default on the flag's `arg` node relaxes the value's brackets and leaves the flag's alone.",
2632
"spec": "name \"ex\"\nbin \"ex\"\nflag \"--jobs <n>\" required=#true help=\"How many\" {\n arg \"<n>\" default=\"4\"\n}\n",
27-
"expect": { "usage": "ex <--jobs [n]>" }
33+
"expect": {
34+
"usage": "ex <--jobs [n]>"
35+
}
2836
},
2937
{
3038
"id": "flag-default-on-the-flag",
3139
"doc": "The same default written on the flag instead relaxes the other pair: the flag becomes optional and the value stays angled.",
3240
"spec": "name \"ex\"\nbin \"ex\"\nflag \"--jobs <n>\" default=\"4\" help=\"How many\"\n",
33-
"expect": { "usage": "ex [--jobs <n>]" }
41+
"expect": {
42+
"usage": "ex [--jobs <n>]"
43+
}
3444
},
3545
{
3646
"id": "flag-value-variadic-optional",
3747
"doc": "The ellipsis belongs to the value and sits outside its brackets, whichever pair they are.",
3848
"spec": "name \"ex\"\nbin \"ex\"\nflag \"--inc [pattern]...\" help=\"Patterns to include\"\n",
39-
"expect": { "usage": "ex [--inc [pattern]…]" }
49+
"expect": {
50+
"usage": "ex [--inc [pattern]…]"
51+
}
4052
},
4153
{
4254
"id": "flag-value-variadic-required",
4355
"doc": "A required variadic value, with the flag required too.",
4456
"spec": "name \"ex\"\nbin \"ex\"\nflag \"--inc <pattern>...\" required=#true help=\"Patterns to include\"\n",
45-
"expect": { "usage": "ex <--inc <pattern>…>" }
57+
"expect": {
58+
"usage": "ex <--inc <pattern>…>"
59+
}
4660
},
4761
{
4862
"id": "flag-repeatable-with-optional-value",
4963
"doc": "A repeatable flag's own ellipsis follows the spellings, before the value — so a repeatable flag taking an optional value shows both.",
5064
"spec": "name \"ex\"\nbin \"ex\"\nflag \"--jobs [n]\" var=#true required=#true help=\"How many\"\n",
51-
"expect": { "usage": "ex <--jobs… [n]>" }
65+
"expect": {
66+
"usage": "ex <--jobs… [n]>"
67+
}
5268
},
5369
{
5470
"id": "flag-value-named-differently",
5571
"doc": "The value's placeholder is the `arg` node's name, not the flag's; a flag whose spellings do not imply its declared name says the name first.",
5672
"spec": "name \"ex\"\nbin \"ex\"\nflag \"jobs: -j [n]\" help=\"How many\"\n",
57-
"expect": { "usage": "ex [jobs: -j [n]]" }
73+
"expect": {
74+
"usage": "ex [jobs: -j [n]]"
75+
}
5876
},
5977
{
6078
"id": "flag-value-optional-on-the-page",
Collapse file

‎corpus/render/03-sections.json‎

Copy file name to clipboardExpand all lines: corpus/render/03-sections.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@
337337
]
338338
},
339339
"reference": {
340-
"diverges": "usage-lib's help renderer ignores a declared `usage` and writes the generated line; its manpage renderer honours it (`lib/src/docs/manpage/renderer.rs`). usage-argv honours it on the root page, which is what #965 added it for. Recorded rather than fixed here because it is the reference that needs changing, not the expectation."
340+
"diverges": "usage-lib's help renderer ignores a declared `usage` and writes the generated line; its manpage renderer honours it (`lib/src/docs/manpage/renderer.rs`). usage-argv honours it on the root page, which is what #965 added it for. The fleet gate cannot see this even though six of its seven CLIs declare one, because `xtask gen-shadow` does not carry the node into the shadow it generates — so each shadow's `Spec::usage` is `None` and both sides render the generated line. Recorded rather than fixed here because it is the reference that needs changing, not the expectation."
341341
}
342342
}
343343
]
Collapse file

‎corpus/render/README.md‎

Copy file name to clipboardExpand all lines: corpus/render/README.md
+35-20Lines changed: 35 additions & 20 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,43 @@ these without reimplementing a test format. If you are rendering help from a usa
1111
Go, in JavaScript, or as a second Rust implementation — this directory is the definition of
1212
correct.
1313

14-
## Why this exists beside the mise fixture
14+
## Why this exists beside the fleet gate
1515

1616
`benches/gate/tests/help.rs` renders all 211 of mise's commands with `usage-argv` and compares
17-
each page against usage-lib byte for byte. That is the check that decides whether an adopter's
18-
help output changes, and no hand-written corpus will ever match it for scale.
19-
20-
What it cannot do is cover a shape mise does not use. A flag whose _value_ is optional is one:
21-
every flag value mise declares is required and undefaulted, so the fixture runs entirely
22-
through the one combination where the two implementations happen to agree. `[--opt [n]]`
23-
rendered as `[--opt <n>]` for as long as `usage-argv` existed, and the 211-command comparison
24-
passed the whole time.
25-
26-
So the two are complements, and the split is worth stating plainly:
27-
28-
| | asks | covers |
29-
| ---------------- | ---------------------------------------------------- | ---------------------------------- |
30-
| the mise fixture | does a real CLI still render the same? | one CLI, exhaustively |
31-
| this corpus | does every shape a spec can declare render the same? | every shape, one command at a time |
32-
33-
A rule that only one of them can catch belongs in whichever one catches it. In practice that
34-
means: if you fix a rendering bug, the regression test goes _here_ unless mise already
35-
exercises the shape.
17+
each page against usage-lib byte for byte; `fleet.rs` beside it does the same for the other six
18+
jdx CLIs. Together they are the check that decides whether an adopter's help output changes, and
19+
no hand-written corpus will match them for scale.
20+
21+
What they cannot do is cover a shape no CLI in the fleet uses. The fleet was one CLI until #972,
22+
and widening it found three bugs in a week — the version banner, an optional flag value, a
23+
description ending in a break. That is the argument for this corpus rather than against it:
24+
seven real CLIs still leave gaps, and the gaps are not exotic.
25+
26+
Flag values are the worked example. There are four pairings of "must the flag be given" against
27+
"must its value be given", and across all 809 value-taking flags in mise and the fleet:
28+
29+
| pairing | in the fleet |
30+
| -------------------------------------------------------- | ---------------------------- |
31+
| `[--tool <TOOL>]` optional flag, required value | 796 |
32+
| `<--v <n>>` both required | 8 |
33+
| `[--opt [n]]` both optional | 5, all in pitchfork and aube |
34+
| `<--jobs [n]>` required flag, optional value | **0** |
35+
| a value carrying a `default`, which relaxes its brackets | **0** |
36+
37+
The third row is what #969 fixed, and pitchfork is the only reason it was visible. The last two
38+
rows are shapes a spec can declare that nothing in the fleet does — so nothing but a written-down
39+
case will hold them.
40+
41+
So the two are complements:
42+
43+
| | asks | covers |
44+
| -------------- | ---------------------------------------------------- | ---------------------------------- |
45+
| the fleet gate | do seven real CLIs still render the same? | those CLIs, exhaustively |
46+
| this corpus | does every shape a spec can declare render the same? | every shape, one command at a time |
47+
48+
A rule that only one of them can catch belongs in whichever one catches it. In practice: if you
49+
fix a rendering bug, the regression test goes _here_ unless a fleet CLI already exercises the
50+
shape — and if one does, add it there instead, where it is checked at scale.
3651

3752
## Format
3853

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.