Normalize CLI error-message casing (Usage:/usage:/bare) after clap adoption #179
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
After the clap adoption (#175, cycles 0098/0099), the aura CLI's error-message
casing is mixed:
Usage:(capital) — emitted by clap itself on parse errors, and by thebuilt-in
runbranch (run_args_from).usage:(lowercase) — preserved aura messages in several dispatchhandlers (
run_data_from,dispatch_runblueprint-branch,dispatch_runs,dispatch_mc) andgraph introspect.usageprefix) — the sweep/walkforward usage closures and everyaura-specific refusal (
R-evaluator harness,requires >= 1 --axis,no recorded geometry, etc.).Task
Normalize the casing to a single house style (recommend clap's capitalized
Usage:for consistency with the parser it now wraps).Constraints
Cosmetic only — no behaviour change. Several
.contains()test pins constrainthe strings: the capital/lowercase
Usage/usageword-boundary is pinned atcli_run.rs(run_with_trailing_token, no_args -> capital; mc_rejects_real_flag-> lowercase), and the aura-specific message substrings are pinned throughout.
A normalization pass must update those pins in lockstep.
Deferred deliberately from #175 iterations 1-2: high pin-churn, zero functional
gain. Low priority; strike if not worth the churn.
Design reconciliation (specify)
Spec: 0101-normalize-cli-usage-casing. This issue's body names the target style but leaves four scope forks open; this comment records their resolution.
Fork: house-style shape → every hand-rolled usage line normalizes to
Usage: aura <verb> ...(capital prefix, program name included), keeping the existingaura:stderr convention — final stderr shapeaura: Usage: aura <verb> ....Basis: derived — the issue names clap as the yardstick ("recommend clap's capitalized Usage: for consistency with the parser it now wraps") and cites the built-in run branch (
run_args_from) as the already-conforming site; both clap's own output and that exemplar include the program name (Usage: aura run ...), so the verb-only lines (sweep ...,mc ...) normalize to the exemplar's shape rather than surviving as a second style.Fork: bare usage closures → included. The four prefix-less usage closures (sweep/walkforward, blueprint and built-in branches each) gain the same
Usage: auraprefix.Basis: derived — the issue's own inventory lists "bare (no usage prefix)" as one of the three inconsistent states the task normalizes; leaving them bare would keep two styles alive.
Fork: non-usage refusal texts → untouched. Aura-specific diagnostics (e.g. "no recorded geometry ...", "requires >= 1 --axis ...", the generalize refusals, the cost-flag refusal) keep their current bytes.
Basis: derived — a refusal is a diagnostic, not a usage line; the house style's own reference (clap) separates the diagnostic (
error: ...) from the grammar block (Usage: ...), so prefixing a refusal withUsage:would mislabel it, and the issue's task sentence names only the usage-prefix casing as the normalization target.Fork: duplicated run-blueprint usage literal (the
run_data_fromliteral and its verbatim inline copy indispatch_run) → both copies normalized identically; no de-duplication refactor.Basis: derived — the cycle's contract is "Cosmetic only — no behaviour change"; extracting a shared constant is a code refactor outside that contract.
Test pins move in lockstep, as this issue's Constraints section mandates: exactly one pin is casing-sensitive to this change (the mc built-in usage assertion pinning lowercase
usage) and flips to the capital; the remaining pins assert verbs/flags/exit codes and are casing-neutral (verified against the test suite's assertions).Design settled — ready for spec production.
Autonomous spec sign-off (grounding-check PASS)
Spec 0101-normalize-cli-usage-casing was signed autonomously; no human signed. The signature is the independent grounding-check reviewer's PASS: every load-bearing assumption about current behaviour is ratified by a currently-green test — the mc built-in usage assertion as the sole lowercase-casing pin, the two capital-
Usagepins and their out-of-scope producers (the built-in run branch and clap itself), the verb/flag pins that survive the prefix insertion, the graph-introspect exit-code-only pin, and the usage=2/runtime=1 exit-code partition. All ten "before" literals were byte-verified at their cited sites.The scope decisions in force (house-style shape
Usage: aura <verb> ..., inclusion of the four bare closures, exclusion of refusal diagnostics, no de-dup refactor of the duplicated run-blueprint literal) are recorded in the comment titled "Design reconciliation (specify)" on this issue.Spec signed — ready for implementation planning.
Implementation-phase decision (spec deviation, recorded)
The landed change matches the spec 0101-normalize-cli-usage-casing normative table byte-for-byte (10 literal edits, 1 pin flip). One deviation from the spec's acceptance wording is kept deliberately:
The end-to-end coverage phase added three tests to the CLI integration suite: (1) the built-in sweep/walkforward usage lines must lead with
aura: Usage: aura <verb>, (2) the built-in mc usage must name the program in BOTH|-separated grammar alternatives, (3) the blueprint-branch mc usage must readaura: Usage: aura mc <blueprint.json>.Basis: derived — the spec's premise "the existing suite already pins the touched surface" turned out to overstate: the pre-existing pins check only the verb token / a single
Usageoccurrence, so a regression re-barening the closures or dropping the second mc alternative's program name would have passed them (each new test's doc-comment names the exact gap). The acceptance line's intent — no silent rewrites of existing assertions — is honored: no pre-existing assertion byte changed beyond the one mandated lockstep pin flip; the three tests are purely additive.Verification at landing: full workspace suite green (rc=0; the CLI integration target now 133 tests), clippy -D warnings clean, literal grep gates exact (zero lowercase
usage:literals; 11Usage: aurasource lines = 10 edited + 1 pre-conforming), smoke run prints the house-style line and exits 2.