5 Commits
Author SHA1 Message Date
dualfroz 6a0426c751 Describe this repository 2026-10-22 21:06:47 +02:00
dualfroz 18ce81580f fix: do not corrupt state when Add/Set overshoots max
Add64 checked currentNum > max only after already mutating currentNum
and currentBytes, so a single call that overshoots max returned an
error but left the bar stuck: currentNum frozen above max, percent
stuck above 100%, and every later Add/Set call failing with the same
error forever, since the top-of-function currentNum < max guard could
never pass again.

Check the bound before mutating state instead, so an overshooting call
is rejected as a whole and leaves currentNum/currentBytes/currentPercent
exactly as they were. The now-unreachable post-hoc check is removed.

Add TestAddExceedsMaxDoesNotCorruptState covering the corrupted-state
case and that the bar keeps accepting valid progress afterwards.
2026-09-04 08:23:03 +02:00
upstream ab40861d8a Upstream schollz/progressbar state of the touched files before e3d2ea3ccc 2026-09-04 08:23:03 +02:00
dualfroz cf25c2235d fix: do not corrupt state when Add/Set overshoots max
Add64 checked currentNum > max only after already mutating currentNum
and currentBytes, so a single call that overshoots max returned an
error but left the bar stuck: currentNum frozen above max, percent
stuck above 100%, and every later Add/Set call failing with the same
error forever, since the top-of-function currentNum < max guard could
never pass again.

Check the bound before mutating state instead, so an overshooting call
is rejected as a whole and leaves currentNum/currentBytes/currentPercent
exactly as they were. The now-unreachable post-hoc check is removed.

Add TestAddExceedsMaxDoesNotCorruptState covering the corrupted-state
case and that the bar keeps accepting valid progress afterwards.
2026-09-06 00:44:44 +02:00
upstream b1e7a8656a Upstream schollz/progressbar state of the touched files before 74081543ba 2026-09-04 08:23:03 +02:00