Conversation
… ids (#2) issue list/take/update all set allow_unknown_args: true so bare tokens (e.g. CRY-1) can be captured as issue ids via result.unknown - Optimus has no type: :array equivalent for positional args. That same bucket also silently swallowed any unrecognized flag (a typo, or a real flag the subcommand just doesn't have, like --mine on issue list), which then got looked up as a literal issue id instead of erroring - a raw %Ash.Error.Unknown{} dump reaching the user. run/3 now filters result.unknown for anything flag-shaped before ever calling the command, returning a clean {:smells_bad, "unrecognized option(s): ..."} (exit 22) instead. Every other subcommand already has this covered by Optimus's own parser (allow_unknown_args: false rejects unknown args before we ever see a parse_result), so this only ever fires for the three subcommands that needed the escape hatch. Per the issue: --mine itself is intentionally not being added - --no-mine already covers it (--mine is the implied default).
There was a problem hiding this comment.
Pull request overview
This PR improves linear-cli’s handling of subcommands that enable allow_unknown_args: true (to capture bare issue IDs) by rejecting flag-shaped unknown tokens up front, preventing typos/unimplemented flags from being interpreted as issue identifiers and causing confusing Ash error dumps.
Changes:
- Added
reject_unknown_flags/1gating inrun/3to turn unknown-/---prefixed tokens into a clean{:smells_bad, "unrecognized option(s): ..."}error (exit 22) before any command/API call. - Added an ExUnit regression test ensuring
issue list --mineerrors clearly instead of being treated as an issue id.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| app/lib/linear_cli/cli.ex | Filters result.unknown for flag-shaped tokens and routes them through the existing :smells_bad error handling (exit 22). |
| app/test/linear_cli/cli_test.exs | Adds regression coverage for the issue list --mine case to ensure a clear, user-facing error. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
issue list/take/update all set allow_unknown_args: true so bare tokens
(e.g. CRY-1) can be captured as issue ids via result.unknown - Optimus
has no type: :array equivalent for positional args. That same bucket
also silently swallowed any unrecognized flag (a typo, or a real flag
the subcommand just doesn't have, like --mine on issue list), which
then got looked up as a literal issue id instead of erroring - a raw
%Ash.Error.Unknown{} dump reaching the user.
run/3 now filters result.unknown for anything flag-shaped before ever
calling the command, returning a clean {:smells_bad, "unrecognized
option(s): ..."} (exit 22) instead. Every other subcommand already has
this covered by Optimus's own parser (allow_unknown_args: false
rejects unknown args before we ever see a parse_result), so this only
ever fires for the three subcommands that needed the escape hatch.
Per the issue: --mine itself is intentionally not being added -
--no-mine already covers it (--mine is the implied default).