fix: minor correctness, doc, and include nits#1366
Merged
Conversation
- Guard `FileOnDefaultPath` lambda against UB when `default_path` is empty
(skip `back()` call on empty string)
- Use `denorm_min` instead of `min` for `PositiveNumber` so subnormal
positives are accepted
- Fix `overflowCheck` return type from `T` to `bool` in both overloads
- Fix `ExecPermissions` comment ("write" -> "execute")
- Fix `AsSizeValue` doc example ("1 b" => 100 -> => 1)
- Reword stale `App` class comment (removed nonexistent `Program()` / `.start`)
- Fix copy-pasted doc on `App::required()` to describe what it actually does
- Remove unused `<algorithm>` include from `impl/Argv_inl.hpp`
- Add regression tests for empty-path `FileOnDefaultPath` and subnormal
positive values in `PositiveNumber`
Assisted-by: ClaudeCode:claude-sonnet-4-6
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.
🤖 AI text below 🤖
Summary
FileOnDefaultPathUB fix: Guarddefault_path.back()call so constructing with an emptydefault_pathno longer invokes undefined behaviour; added regression tests intests/HelpersTest.cpp.PositiveNumbersubnormal fix: Replacestd::numeric_limits<double>::min(smallest normal positive) withdenorm_minso subnormal-positive values like5e-324are correctly accepted; added regression test.overflowCheckreturn type: Both signed and unsigned overloads declaredTas return type but actually returned aboolcomparison; changed tobool.checked_multiplycallers are unaffected (they test the result as bool).ExecPermissionscomment corrected from "available for write" to "available for execute".AsSizeValueexample"1 b" => 100corrected to=> 1.Appclass doc reworded to remove references to nonexistentProgram()and.start.App::required()doc fixed (was copy-paste ofallow_extrasdoc).<algorithm>frominclude/CLI/impl/Argv_inl.hpp(confirmed unused; needed headers<memory>,<stdexcept>,<string>remain).Test plan
100% tests passed, 0 tests failed out of 24)prek -a --quietpasses cleanly (clang-format auto-fixes incorporated)Validators: FilePathModifiercovers empty-path construction without crashValidators: PositiveValidatorcovers subnormal-positive acceptancePart of #1357