beads/cmd
Rongjun GENG d82c82d965
fix(cmd/bd): purge/prune reject negative --older-than overflow, carry --limit in confirm hint (#7540)
daysAge only checked the upper bound (maxOlderThanDays) before
multiplying by 24h. A day count negative enough overflows the
int64-nanosecond multiplication into a small positive duration, so
positiveAge's own check never sees the sign flip: `bd purge
--older-than=-213503d --force` purged every closed row older than a
day instead of being refused. Reject non-positive counts before the
multiplication can run.

Fixes gastownhall/beads#7524.

Separately: `bd purge ... --limit N` (no --force) previews N
deletions, but the confirmation's suggested --force command dropped
--limit, so following it literally deleted every eligible row instead
of the N the preview showed. Threaded limit through to the hint
builder (now its own function, sweepConfirmHint, for a direct unit
test) so the suggested command always matches the selection it
previewed.

Fixes gastownhall/beads#7534.

Verified the overflow fix catches the regression directly: temporarily
reverted just daysAge and confirmed the new -213503d/-213503 test rows
fail without it, pass with it. go build/vet clean, golangci-lint's two
findings are pre-existing in main.go, untouched by this change.


Claude-Session: https://claude.ai/code/session_01VN2SgXAHW1eTB1izwWwmyr

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-16 08:56:26 +00:00
..
bd fix(cmd/bd): purge/prune reject negative --older-than overflow, carry --limit in confirm hint (#7540) 2026-10-16 08:56:26 +00:00