scan.go:54-56 does if workers < 1 { workers = 1 }, and main.go:71-72 registers the flag with no validation. So --workers 0 and --workers -8 — both plain typos — quietly run the whole scan single-threaded.
On a 150 TB pool that is the difference between a scan finishing overnight and a scan still running the next afternoon, with nothing on stderr to explain why. README §Error handling defines exit 2 for usage errors, which is what a nonsensical flag value is.
Definition of done
scan rejects --workers less than 1 with a one-line usage error on stderr and exit 2.
The clamp in scan.go:54-56 is removed, since the value is now validated upstream.
README §scan mode documents the constraint and states the default is runtime.NumCPU().
A CLI test asserts exit 2 and the message for --workers 0 and --workers -1.
make check green.
`scan.go:54-56` does `if workers < 1 { workers = 1 }`, and `main.go:71-72` registers the flag with no validation. So `--workers 0` and `--workers -8` — both plain typos — quietly run the whole scan single-threaded.
On a 150 TB pool that is the difference between a scan finishing overnight and a scan still running the next afternoon, with nothing on stderr to explain why. README §Error handling defines exit 2 for usage errors, which is what a nonsensical flag value is.
## Definition of done
1. `scan` rejects `--workers` less than 1 with a one-line usage error on stderr and exit 2.
2. The clamp in `scan.go:54-56` is removed, since the value is now validated upstream.
3. README §scan mode documents the constraint and states the default is `runtime.NumCPU()`.
4. A CLI test asserts exit 2 and the message for `--workers 0` and `--workers -1`.
5. `make check` green.
clawbot
added this to the 1.0.0 milestone 2026-08-09 03:44:20 +02:00
Plan (implementer's brief). The clamp now lives at the top of runScan in scan.go. Validate --workers where the flag is parsed, so a value below 1 is a usage error: one line on stderr, exit 2, through the same path the other usage errors take in run. Then remove the clamp. README.md §scan mode states the constraint and the default (runtime.NumCPU()). Tests per the definition of done.
Model: opus-5-5
Plan (implementer's brief). The clamp now lives at the top of `runScan` in `scan.go`. Validate `--workers` where the flag is parsed, so a value below 1 is a usage error: one line on stderr, exit 2, through the same path the other usage errors take in `run`. Then remove the clamp. `README.md` §scan mode states the constraint and the default (`runtime.NumCPU()`). Tests per the definition of done.
Model: opus-5-5
clawbot
self-assigned this 2026-10-04 12:02:36 +02:00
Implemented in #86: scan --workers below 1 now exits 2 with a one-line error on stderr, and the clamp in runScan is removed.
Model: opus-5-5
Implemented in https://git.eeqj.de/sneak/sfdupes/pulls/86: `scan --workers` below 1 now exits 2 with a one-line error on stderr, and the clamp in `runScan` is removed.
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
scan.go:54-56doesif workers < 1 { workers = 1 }, andmain.go:71-72registers the flag with no validation. So--workers 0and--workers -8— both plain typos — quietly run the whole scan single-threaded.On a 150 TB pool that is the difference between a scan finishing overnight and a scan still running the next afternoon, with nothing on stderr to explain why. README §Error handling defines exit 2 for usage errors, which is what a nonsensical flag value is.
Definition of done
scanrejects--workersless than 1 with a one-line usage error on stderr and exit 2.scan.go:54-56is removed, since the value is now validated upstream.runtime.NumCPU().--workers 0and--workers -1.make checkgreen.Plan (implementer's brief). The clamp now lives at the top of
runScaninscan.go. Validate--workerswhere the flag is parsed, so a value below 1 is a usage error: one line on stderr, exit 2, through the same path the other usage errors take inrun. Then remove the clamp.README.md§scan mode states the constraint and the default (runtime.NumCPU()). Tests per the definition of done.Model: opus-5-5
Implemented in #86:
scan --workersbelow 1 now exits 2 with a one-line error on stderr, and the clamp inrunScanis removed.Model: opus-5-5