Skip to content

chore: improve argument handling and error messages - #722

Merged
miparnisari merged 1 commit into
mainfrom
tstirrat/improve-arg-handling
Sep 4, 2026
Merged

miparnisari merged 1 commit into
mainfrom
tstirrat/improve-arg-handling

Conversation

@tstirrat15

Copy link
Copy Markdown
Contributor

Written with LLM assistance.

Description

I ran into this when I fatfingered a zed permission lookup-resources today. The error looks like this:

❯ zed permission lookup-resources thumper/user:someuser view thumper/resource
5:56PM ERR terminated with errors error="the length of the unpacked is not equal to the provided input"

Which is cryptic and doesn't indicate where the issue is - it sounds like it could as easily be a gRPC internal error as a malformed input error.

This PR improves the error output so that it points at the specific arg and provides a template.

Changes

  • Add more parsing helpers and improve existing parsing helpers
  • Use those parsing helpers
  • Tests for parsing helpers
  • Test of overall command

Testing

Review. See that tests pass. do go run ./cmd/... permission lookup-resources thumper/user:someuser view thumper/resource and see that you get more useful output.

@tstirrat15
tstirrat15 marked this pull request as ready for review September 4, 2026 00:20
@tstirrat15
tstirrat15 force-pushed the tstirrat/improve-arg-handling branch from 2da9182 to e1e642c Compare September 4, 2026 00:20
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.43478% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/commands/permission.go 25.00% 8 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Comment thread internal/commands/permission.go
miparnisari
miparnisari previously approved these changes Sep 4, 2026
@miparnisari
miparnisari merged commit 81a1975 into main Sep 4, 2026
14 checks passed
@miparnisari
miparnisari deleted the tstirrat/improve-arg-handling branch September 4, 2026 00:53
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants