Skip to content

fix(cli): Normalize boolean flags before parsing - #763

Open
reneleonhardt wants to merge 1 commit into
tsenart:masterfrom
reneleonhardt:fix/boolean-flags
Open

fix(cli): Normalize boolean flags before parsing#763
reneleonhardt wants to merge 1 commit into
tsenart:masterfrom
reneleonhardt:fix/boolean-flags

Conversation

@reneleonhardt

Copy link
Copy Markdown

Background

Legacy boolean syntax (-keepalive false) could be interpreted as a positional argument, causing inconsistent parsing and keepalive behavior.
Positional parsing consumed -keepalive and treated false as an argument, so later flags were ignored and text consumers could fail on binary stdout ('utf-8' codec can't decode byte 0xff in position 0).

What

  • Normalize boolean CLI args before parsing in both global and attack command paths.
  • Added unit tests for boolean-arg normalization and parsing edge cases.
  • Added unit coverage for attack boolean parsing and version output.

Reproduction

go run . attack -keepalive false -http2 false -duration 1s -rate 1 -output /tmp/vegeta-results.bin

Verification

  • go test ./...
  • go test ./... -run '^(TestNormalizeBooleanFlagArgs|TestNormalizeBooleanFlagArgsForUnknownFlags|TestAttackCmdLegacyBooleanStyleUsesNormalizedBooleanParsing|TestAttackCmdAttachedBooleanStyleUsesNormalizedBooleanParsing|TestMainVersionPrintsBuildMetadata)$'

Checklist

  • Git commit messages conform to community standards.
  • Each Git commit represents meaningful milestones or atomic units of work.
  • Changed or added code is covered by appropriate tests.

Developed with carefully directed, manually reviewed AI assistance.

Co-Authored-By: GPT-5.6 Sol codex@openai.com

Co-Authored-By: GPT-5.6 Sol <codex@openai.com>
@reneleonhardt
reneleonhardt requested a review from tsenart as a code owner July 28, 2026 21:36
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