Repository navigation
Fix spend days 107 - #161
rohangoud17 wants to merge 9 commits into
Conversation
# Conflicts: # CHANGELOG.md
laaielichter
left a comment
There was a problem hiding this comment.
Thank you @rohangoud17, this is correct and approved from my side. #107 is yours (you claimed it first on 2026-11-10), and the other PR for it, #140, is not being taken forward, so this one goes ahead.
What I checked on f0f8697 (clean against current main 52666d3):
ruff check .is clean and the full suite passes (888 passed, 10 skipped; no flaky failure in my run).- By hand with the demo database:
spend --days 99999999999and--days 366givestatus: error, "--days must be between 1 and 365." with anext_step, exit code 1.--days 1and--days 365work,--days 0keeps its old message. - Mutation: with
src/frommain, the same call crashes withOverflowError: Python int too large to convert to C int, and both new tests (test_spend_refuses_a_window_above_365_days,test_cli_spend_refuses_days_above_365) fail. With your change they pass. - Your PR description says why 365 was chosen, as the issue asked.
One small request, the CHANGELOG credit: please end the entry with Thanks to @rohangoud17! (#107, #161) like the entries around it. If you would rather not touch the branch again, I will add the credit in a follow-up after merge.
CI: the runs for this commit are action_required (a first-time contributor's run waits for maintainer approval), so no check has run on GitHub yet:
- ci: https://github.com/laaielichter/Gulliver/actions/runs/43554923508
- codeql: https://github.com/laaielichter/Gulliver/actions/runs/43554923511
Generated by Claude Code
laaielichter
left a comment
There was a problem hiding this comment.
Thank you @rohangoud17 for adding the credit so quickly. One small thing is left in CHANGELOG.md on 0f231ef: the entry lost its leading - , so it is no longer a list item and shows up as a loose paragraph below the #122/#147 bullet. Please change the line to start with - again:
- `spend --days N` refuses a value above 365 ... on a huge N. Thanks to @rohangoud17! (#107, #161)Nothing else changed since my review on f0f8697 (the diff is only that CHANGELOG line, and the branch merges cleanly with main 52666d3), so the code approval stands. After the fix I will look once more, and the PR is ready as soon as the maintainer has approved the first-time CI runs and the 14 checks are green.
Generated by Claude Code
|
Good news for part of the conflict: the CHANGELOG part got easier. We changed the rule so contributors don't edit CHANGELOG.md any more; we add your entry with credit when we merge. When you merge main, just take main's version of CHANGELOG.md (or drop your change to it). The conflicts in Generated by Claude Code |
|
Thanks @rohangoud17. The Before it can merge, two things are still open from the earlier comment:
After the push, the CI runs wait for a maintainer approval, and we will review the new head. Generated by Claude Code |
laaielichter
left a comment
There was a problem hiding this comment.
Thanks @rohangoud17. I reproduced #107 on main: spend --days 1000000000 crashes with an OverflowError traceback, and on this branch it returns a clean error. The mutation check fails 2 tests when the cap is removed.
Two things before it can merge:
- The CHANGELOG.md line conflicts with main. Please remove it; the maintainer writes that entry.
- The 365 cap is a behaviour change:
spend --days 400works on main today and would now be refused. Could you check where the crash actually starts, and cap there (or explain why 365 is the right limit, in the docs)? That would keep valid windows working.
Generated by Claude Code
# Conflicts: # CHANGELOG.md # tests/test_cli_and_mcp.py # tests/test_runaway.py
…ielichter#107) The window start is today - (N-1) days, and Python dates stop at 0001-01-01. Refuse only windows that would start before that, so long windows such as --days 400 keep working.
|
Thanks for the review and the mutation check! Removed the CHANGELOG line (merged the latest main; the PR no longer touches CHANGELOG.md). |
|
Thanks @rohangoud17, that is the cap we asked for: it sits where the crash starts, and the Generated by Claude Code |
|
I checked Generated by Claude Code |
|
Thanks @rohangoud17, the diagnosis is right: the crash really does start where One thing I would like to change before merging. The limit is computed from today's date ( Could you use a fixed constant instead? For example, For the tests, please:
The Thank you for the patience with the several rounds on this one. I am approving the pending CI runs on the current head now so you get a signal, and they will need approving again for the new push. Generated by Claude Code |
Fixes #107
What and why
spend --days Nrefused N < 1 but crashed with a rawOverflowErrorfor very large N (timedelta/date arithmetic). It now returnsstatus: "error"with anext_stepand exit code 1, liketop.MAX_SPEND_DAYS = 365in runaway.py, checked right afterdays < 1and before any date math.top's window (checked inline in workload.py). The ledger has no retention limit, so this is a consistency choice, not a technical one.--days 1through365behave exactly as before.How it was tested
pytest: changed test files pass (68 passed, 1 skipped). One unrelated test,test_verify.py::test_fix_verify_with_connection, failed once in the full run but passes alone on this branch and on cleanmain, so it looks flaky.ruff check .passesgit diff --check upstream/main...HEADcleanNew tests:
spend()with 99999999999 and 366 returns an error naming 365 with anext_step; 1 and 365 return ok;main([...])exits 1 for both bad values. I confirmed the new tests fail with the originalOverflowErrorbefore the fix.AI-assisted; I reviewed and understand every change.