Repository navigation
fix(cli): ignore incomplete --budget pairs instead of panicking - #415
Merged
j-mendez merged 1 commit intoOct 16, 2026
Merged
Conversation
--budget expects comma-separated path,limit pairs. An odd number of tokens (for example a trailing path with no limit, or a trailing comma) made chunks(2) yield a one-element slice and indexing [1] panicked. Parse pairs only when both path and limit are present so incomplete input is ignored instead of aborting the process.
Contributor
Author
|
Note on CI: Security Audit is failing on |
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.
What does this PR do?
Fix a panic in
spider_cliwhen parsing--budgetwith an incompletepath,limitpair.The flag documents comma-separated pairs such as
"*,1"or"*,100,/blog/,10". The parser usedchunks(2)and always indexed[1]:An odd token count produced a final one-element slice and panicked with an index-out-of-bounds abort. Realistic inputs that hit this:
--budget "*,100,/blog"— trailing path without a limit--budget "*,100,"— trailing commaIncomplete pairs are now skipped so the CLI keeps the valid pairs instead of crashing.
How was this tested?
Extracted
parse_budgetand added unit tests inspider_cli/src/main.rs:"*,1""*,100,/blog/,10"0, unchanged)cargo test -p spider_cliNote: this environment has no local Rust toolchain; please rely on CI for the full
spider_clitest run.Checklist
cargo testpassescargo fmtappliedInternal CLI helper only; no public library API change.