Skip to content

fix(runtime): extend usage details to body and catalog discovery errors - #172

Merged
samzong merged 2 commits into
mainfrom
fix/usage-detail-coverage
Aug 30, 2026
Merged

fix(runtime): extend usage details to body and catalog discovery errors#172
samzong merged 2 commits into
mainfrom
fix/usage-detail-coverage

Conversation

@samzong

@samzong samzong commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two gaps left after #171: a required request body with no body input failed with a bare invalid-command-usage message, and the catalog discovery commands hid their failures — commands show <unknown path> returned a generic command-failed error with a misleading local-configuration hint (exit 1), and an empty search query exited 0 with no output, indistinguishable from zero matches.

  • resolveOperationBody required-body errors now carry a typed usage detail naming the accepted body inputs (--file, --set, --set-str, and body flags when present).
  • commands show with an unknown path is a usage error (exit 2) whose detail points at the commands listing without echoing the requested path.
  • A blank search query fails as a usage error stating the query must not be empty.

All details are static or spec-derived text under the existing error.detail contract (docs/contracts.md); no user input is echoed and no contract text changes.

Verification

  • go test ./pkg/runtime/ -run TestBuild_RequiredBodyUsageErrorDetail and go test ./pkg/lathe/ -run 'TestCommandsShowUnknownPathUsageError|TestSearchEmptyQueryUsageError' — red before the fix, green after.
  • make check and go test -race -count=1 ./... pass.
  • Real-CLI probe: tokener built with a local replace shows Detail: request body required: pass --file, --set, --set-str, or a body flag for bare keys create, Detail: no generated command at that path; run \tokener commands` to list paths(exit 2) forcommands show keys nope, and Detail: search query must not be emptyforsearch ""`.

Compatibility

commands show with an unknown path changes from exit 1 (command failed) to exit 2 (usage), and a blank search query changes from exit 0 to exit 2. Error envelope shape, catalog schema, and the detail contract are unchanged.

Checklist

  • Tests or focused verification cover the changed surface.
  • User-facing behavior changes are documented.
  • Generated output under internal/generated/, .cache/, and ad-hoc skills/<cli-name>/ directories is not committed.
  • Commits are signed off when this is ready to merge.

A generated command with a required request body and no changed body
input failed with a bare invalid-command-usage message. The required-body
errors in resolveOperationBody now carry a typed usage detail naming the
accepted body inputs (--file, --set, --set-str, and body flags when the
command has them), matching the detail contract introduced for enum and
required-flag errors. The detail is static spec-derived text and echoes
no user input.

Signed-off-by: samzong <samzong.lu@gmail.com>
commands show with an unknown path returned a generic command-failed
error with a misleading local-configuration hint and exit 1; it is a
usage error and now exits 2 with a detail pointing at the commands
listing, without echoing the requested path. An empty or blank search
query silently exited 0 with no output, indistinguishable from zero
matches; it now fails as a usage error stating the query must not be
empty.

Signed-off-by: samzong <samzong.lu@gmail.com>
@samzong
samzong merged commit 443259b into main Aug 30, 2026
4 checks passed
@codspeed-hq

codspeed-hq Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 21 untouched benchmarks


Comparing fix/usage-detail-coverage (91a99e1) with main (4677bfa)

Open in CodSpeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant