Skip to content

Restore validation exit for input-too-large errors#189

Open
Copilot wants to merge 5 commits into
developfrom
copilot/restore-validation-exit-input-too-large-errors
Open

Restore validation exit for input-too-large errors#189
Copilot wants to merge 5 commits into
developfrom
copilot/restore-validation-exit-input-too-large-errors

Conversation

Copilot AI commented May 27, 2026

Copy link
Copy Markdown
Contributor

input-too-large errors for oversized stdin and known-command --initial values were falling back to usage exit 2. The spec requires these validation failures to exit 65 so scripts can distinguish bad CLI usage from oversized input.

  • Exit-code mapping

    • Added clet-specific mapping for input-too-largeExitCodes.ValidationError.
    • Preserved package fallback behavior for other errors.
  • Oversized --initial handling

    • Detects oversized --initial for registered aliases before the package parser converts it to usage failure.
    • Unknown aliases still return usage error 2.
  • Oversized stdin handling

    • Maps JSON error envelopes with code: input-too-large from md --json back to validation exit 65.
  • Regression coverage

    • Updated exit-code unit coverage for clet’s mapper.
    • Updated smoke coverage for oversized md --json stdin.
CommandResult result = new(
    CommandStatus.Error,
    null,
    "input-too-large",
    "...");

CletExitCodes.FromResult(result); // 65

Copilot AI assigned Copilot and tig May 27, 2026
Copilot AI linked an issue May 27, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Restore validation exit for input-too-large errors Restore validation exit for input-too-large errors May 27, 2026
Copilot finished work on behalf of tig May 27, 2026 15:37
Copilot AI requested a review from tig May 27, 2026 15:37
@tig tig marked this pull request as ready for review June 11, 2026 14:53

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ce9817183

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +20 to +22
if (exitCode == ExitCodes.UsageError && HasInputTooLargeCode (stdout))
{
return ExitCodes.ValidationError;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep oversized unknown aliases as usage errors

When an invocation uses an unknown alias with an oversized --initial and --json, TryHandleOversizedInitial deliberately falls through because registry.TryResolve fails, but the package parser still emits an input-too-large JSON error before command resolution. This broad remap then turns that usage failure into exit 65, contradicting the spec/commit note that unknown aliases must remain usage errors (exit 2), e.g. clet nope --json --initial <65K> now exits as validation instead of unknown-command usage.

Useful? React with 👍 / 👎.

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.

Restore validation exit for input-too-large errors

2 participants