Repository navigation
fix(spend): reject a --days window wider than a year - #140
Hayabusa-YL wants to merge 1 commit into
Conversation
timedelta(days=...) overflows before any ledger line is read when --days is huge, so the report died with a raw traceback. Validate the window against 1-365 (the same bound gulliver top uses) and return a clean error instead. Closes laaielichter#107
laaielichter
left a comment
There was a problem hiding this comment.
Welcome to Gulliver, @Hayabusa-YL, and thank you for the PR. The fix itself is the right shape: it checks the window before timedelta can overflow and returns the clean status: "error".
Why I cannot take this one forward. #107 was claimed by @rohangoud17 on the issue at 20:37 on 2026-11-10 ("I'd like to work on this one too", with a plan), about four hours before this PR was opened at 00:57 today, and I have assigned the issue to them. The project rule is that the first claim goes forward, so a second PR for the same issue only costs both of us time. This is not about the quality of your code. The comment on the issue is the part that is easy to miss: for next time, please comment on an issue first (a one-line "I'd like to take this" is enough) and you will be assigned.
For the record, if you want to keep your work: the issue's "Done when" also asks for a test through main([...]), a test one above the limit (366) and that --days 365 still works, a line under Unreleased in CHANGELOG.md (at the end of ### Fixed), and a sentence saying why 365 was chosen (the issue asks to check what window the ledger allows). Please do not push more to this PR for now.
Where to go next: please read CONTRIBUTING.md for the setup. A free good first issue that nobody has claimed is #127 (an unknown default_connection in gulliver.toml is quietly replaced by another connection). Comment on it first and you will be assigned.
If Gulliver is useful to you, a ⭐ helps other people find it.
CI: the runs for this commit are action_required (GitHub holds a first-time contributor's run until a maintainer approves it), so no check has run on this PR.
Generated by Claude Code
|
@Hayabusa-YL a short follow-up to my review: #107 was claimed first by @rohangoud17, whose PR #161 is now reviewed and goes forward, so this PR will not be merged. Thank you again for the fix, it had the right shape. I will close it in favour of #161; #127 is still free if you want another issue (comment on it first and you will be assigned). Generated by Claude Code |
|
Closed in favour of #161. Correction to my last comment: #127 already has an open PR (#162), so it is not free. Please pick any open issue without an assignee or PR from #57 instead, and comment on it first. Generated by Claude Code |
What
gulliver spend --days <huge>overflows the date arithmetic inrunaway.spend:timedelta(days=...)receives a value wider than the supported range and raises before the ledger is read.Fix
Validate
--daysagainst 1-365 (the same windowgulliver topaccepts for its history argument) and return a clean error instead:Verification
test_spend_refuses_days_above_365coversdays=1000000anddays=99999999999.871 passed, 11 skipped.Closes #107