fix: CLI rejects negative --max-depth and --limit values#253
Merged
raifdmueller merged 1 commit intodocToolchain:mainfrom Feb 7, 2026
Merged
Conversation
raifdmueller
commented
Feb 7, 2026
Collaborator
Author
raifdmueller
left a comment
There was a problem hiding this comment.
Code Review
Overall: Very good, no issues found
Positive
- Follows existing validation pattern from
sections-at-level- good consistency - Clear error messages include the actual value (
got -5) - Helpful hint text in error messages ("Use 0 for root level only, or omit for full depth")
- 12 tests: negative values rejected, value in error message, zero/positive work, aliases tested
- Both
--max-depthand--limit/--max-resultscovered
Design Decision
Allowing --limit 0 (returns empty result set) is a valid choice and consistent with --max-depth 0 (returns root level only). Both are documented in the error messages.
Version Conflict
All 3 bug fix PRs bump to 0.4.22. If PRs #254 and #252 are merged first, rebase this PR and bump to 0.4.24.
Reviewed-by: R{AI}f D. Müller (AI-assisted review)
…n#248, docToolchain#249) - structure --max-depth now validates for non-negative values - search --limit/--max-results now validates for non-negative values - Both use click.BadParameter with clear error messages - Follows existing pattern from sections-at-level (Issue docToolchain#199) - Bump version to 0.4.22 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5d0e4a0 to
a611332
Compare
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.
Summary
dacli structure --max-depth -1now rejects negative values with a clear error messagedacli search "test" --limit -5now rejects negative values with a clear error messagesections-at-level(Issue 🔧 sections-at-level cannot handle negative numbers (parsed as options) #199)Fixes #248, Fixes #249
Changes
--max-depthinstructurecommand (cli.py)--limit/--max-resultsinsearchcommand (cli.py)Test plan
str,s) also enforce validation🤖 Generated with Claude Code