Skip to content

Reject negative lookback and receipt retention counts - #100

Merged
laaielichter merged 1 commit into
laaielichter:mainfrom
yinbowen-dc:fix/nonnegative-lookback-retention
Nov 18, 2026
Merged

laaielichter merged 1 commit into
laaielichter:mainfrom
yinbowen-dc:fix/nonnegative-lookback-retention

Conversation

@yinbowen-dc

Copy link
Copy Markdown
Contributor

Reject negative incremental lookbacks and prune retention counts with an error and next step. Validate before SQL advice or store pruning; zero remains valid. Tests cover Python and CLI entry points, JSON/text output, dry runs and byte-for-byte preservation of receipt/audit files on rejected pruning.

Validation: pytest -q (858 passed, 10 skipped in 39.05s), ruff check ., git diff --check. Added regression tests fail against the original implementation and pass with this change. PostgreSQL-specific tests were not run; no external warehouse was contacted.

Closes #98

@laaielichter laaielichter left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @yinbowen-dc. On its merits this is correct and complete for the "Done when" list of #98: negative --lookback and --keep-last return status: error with a next_step and exit 1, 0 stays valid, and the prune test snapshots the whole state folder to prove nothing is deleted on a refused value (in dry-run and real runs, with and without --json). I merged it onto current main in a scratch checkout: ruff check . is clean and pytest -q gives 858 passed, 10 skipped. The change is small and the README lines are a nice touch.

This approval is about the code only. CI is waiting for the maintainer's approval because it is your first contribution, and if main moves before it lands, a quick git merge upstream/main is all that is needed (the CHANGELOG line is where a small conflict is likely).


Generated by Claude Code

Copy link
Copy Markdown
Owner

Hi @yinbowen-dc, a quick heads-up, and thank you for your patience. The maintainer approved and merged your #99 this morning (thanks for that one too), and it added a line at the top of ### Fixed in CHANGELOG.md, which is exactly where this PR adds its line. So #100 now conflicts with main in CHANGELOG.md only (I merged it in a scratch checkout: README.md and the code merge cleanly).

Could you merge the latest main of laaielichter/Gulliver into your branch and push? When Git asks about CHANGELOG.md, keep both lines: the #97 line from main and your #98 line, and leave every other line as it is. For example git fetch upstream && git merge upstream/main if you named the remote upstream. After that this PR is ready to land: my approval of the code (ruff clean, 858 passed on the earlier main) still stands, and the maintainer takes the final look. As before, CI waits for the maintainer's approval of the first run.

One thing to expect: #101 also adds a line near the top of ### Fixed, so whichever of the two lands second may need one more merge of main with the same "keep both lines" step.


Generated by Claude Code

Copy link
Copy Markdown
Owner

Good news: you no longer need to resolve the CHANGELOG conflict. We changed the rule so contributors don't edit CHANGELOG.md any more; we add your entry with credit when we merge. Easiest fix: drop your CHANGELOG.md change (or merge main and take main's version of the file) and push; the rest of the PR is unchanged.


Generated by Claude Code

@laaielichter laaielichter left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @yinbowen-dc. This PR refuses negative --lookback and --keep-last, which #102 also does (it closes #98 and was opened first), so the maintainer will take #102 for that part. The branch also conflicts with main in CHANGELOG.md and README.md. If you want to keep working on this, please rebase on main and tell us which part is not covered by #102. Otherwise we can close it.


Generated by Claude Code

laaielichter added a commit that referenced this pull request Nov 18, 2026
Land #100: Reject negative lookback and receipt retention counts
@laaielichter
laaielichter merged commit 119bf98 into laaielichter:main Nov 18, 2026

Copy link
Copy Markdown
Owner

Thank you @yinbowen-dc for the fix and for the careful tests, especially the byte-for-byte check that a rejected prune leaves the receipt and audit files alone. It is merged with your commit kept (landed through #203, which merges your branch head; the conflicts were only in CHANGELOG.md and README.md, where I kept both sides' lines), and the credit is in the CHANGELOG under Unreleased. On the merged code incremental --lookback -3 and prune --keep-last -1 now return status: error with a next_step, 0 still works, and your tests fail when either check is removed.

Your three PRs (#99, #100 and #101) are now all in. If you want a next one, #159 (translate the README quick start into your language) is free and labelled good first issue.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

incremental --lookback and prune --keep-last: refuse negative numbers

2 participants