Skip to content

Bump spf13/pflag to v1.1.0 - #7083

Merged
rdimitrov merged 2 commits into
mainfrom
bump-pflag-1-1-0
Nov 9, 2026
Merged

rdimitrov merged 2 commits into
mainfrom
bump-pflag-1-1-0

Conversation

@jhrozek

@jhrozek jhrozek commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • pflag v1.1.0 changes how bool flags appear in help output. They now print as --flag[=true|false] and the option column widens. The generated CLI docs under docs/cli/ are regenerated with task docs so the docs check stays green.
  • This was bundled into the grouped Renovate update (Update go modules #7077), where it failed the docs check. It is a user-visible help change, so it lands on its own.
  • Flag parsing is unchanged for our uses. thv run, thv build and thv-proxyrunner still pass unknown flags through to the MCP server.

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

  • Unit tests (task test)
  • E2E tests (task test-e2e)
  • Linting (task lint-fix)
  • Manual testing (describe below)

Manual testing: built thv with task build and compared it with a build that uses pflag v1.0.10. For thv run and thv build, unknown flags (--bogus-flag some-value, --bogus=1, flags after the server name, and flags after --) produce the same output on both builds. thv list --bogus-flag still fails with "unknown flag". thv run --help shows the new [=true|false] form. Unit tests and lint are left to CI.

Does this introduce a user-facing change?

Yes, help output only:

  • Before: thv run --help lists bool flags as --debug and --isolate-network.
  • After: the same flags show as --debug[=true|false] and --isolate-network[=true|false], in every command's help.

Flag behavior is unchanged. Bad values for typed flags, such as a non-integer given to an int flag, now use pflag v1.1.0's error wording (spf13/pflag#469). Nothing in the repo matches on that text.

Special notes for reviewers

  • The 133 files under docs/cli/ are generated. After removing [=true|false] and collapsing spaces, each old and new file pair is identical, so the diff is formatting only.
  • go.mod and go.sum change only for pflag. The go directive is unchanged.

pflag v1.1.0 prints the explicit-value syntax for bool flags in help
output (pflag #453), so every bool flag in thv --help now reads
--flag[=true|false] and the option column widens. The generated CLI
docs are regenerated with task docs to match; this is the only
generated output that changes.

Flag parsing is unchanged for our uses. thv run and thv build still
ignore unknown flags through cobra's FParseErrWhitelist, and thv list
still rejects them, identical to a v1.0.10 build.

This was previously bundled into the grouped Renovate update, where it
failed the docs check; it is a user-visible help change, so it lands
on its own.

Co-authored-by: Mecatl <[email protected]>
@jhrozek jhrozek mentioned this pull request Nov 9, 2026
1 task
@github-actions github-actions Bot added the size/XL Extra large PR: 1000+ lines changed label Nov 9, 2026

@rdimitrov rdimitrov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving: the bump is isolated, the regenerated CLI docs are formatting-only, and no pflag 1.1.0 behaviour change reaches toolhive's flag parsing.

Design: Splitting pflag out of the grouped dependency update and regenerating docs/cli via task docs is the right shape; pflag owns parsing and help formatting, so regeneration rather than hand edits is correct. The only behaviour-sensitive path is unknown-flag pass-through in thv run, thv build and thv-proxyrunner (FParseErrWhitelist{UnknownFlags: true}); cobra v1.10.2 converts that to pflag's ParseErrorsAllowlist, and 1.1.0 still maps UnknownFlags: true to IgnoreUnknownFlag, so args after -- pass through as before. On upgrade, users only see --flag[=true|false] in bool help text and friendlier error wording for bad typed values; toolhive uses no map flags, MarkDeprecated, SetNormalizeFunc or custom bool values, and no test asserts the old error text.

Follow-up (not blocking): pflag 1.1.0 marks ParseErrorsAllowlist.UnknownFlags deprecated in favour of UnknownFlagsHandling: pflag.IgnoreUnknownFlag. The three call sites above (cmd/thv/app/run.go:133, cmd/thv/app/build.go:55, cmd/thv-proxyrunner/app/run.go:51) can move over later; staticcheck does not flag it today.

🤖 Reviewed with Claude Code

@codecov

codecov Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.84%. Comparing base (394a9fd) to head (e085d43).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7083      +/-   ##
==========================================
- Coverage   80.90%   80.84%   -0.06%     
==========================================
  Files         864      864              
  Lines       88639    88639              
==========================================
- Hits        71709    71662      -47     
- Misses      16925    16972      +47     
  Partials        5        5              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jhrozek jhrozek mentioned this pull request Nov 9, 2026
1 of 10 tasks
@github-actions github-actions Bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Nov 9, 2026
@rdimitrov
rdimitrov merged commit 97ae26b into main Nov 9, 2026
43 checks passed
@rdimitrov
rdimitrov deleted the bump-pflag-1-1-0 branch November 9, 2026 10:45
@github-actions github-actions Bot mentioned this pull request Nov 10, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XL Extra large PR: 1000+ lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants