GeezerVison is showing github.com — pkgs/id(scripts): prod-lines-check.sh ignores unaccounted CLI arguments before running the scan · Issue #10518 · developing-today/code
pkgs/id(scripts): prod-lines-check.sh ignores unaccounted CLI arguments before running the scan #10518DescriptionProblem
pkgs/id/scripts/prod-lines-check.sh accepts and ignores unaccounted positional CLI arguments, then proceeds with its normal scan/work instead of failing fast with a usage error.
This violates the operator-script argument contract (#3352): every operator script must declare its whole command line and reject anything unaccounted for with a non-zero exit before any subprocess, network, file write, lock, or deploy step.
Evidence
- Script:
pkgs/id/scripts/prod-lines-check.sh (HEAD 87e0133). It documents env-var test seams (PROD_LINES_ROOT, PROD_LINES_LIMIT) but declares no positional arguments and has no $#/arg validation; it resolves paths and runs a full find/awk-based production-line scan over the tree.
- Verified repro from
pkgs/id on 87e0133:
bash scripts/prod-lines-check.sh extra-arg-test did not reject the extra argument. It performed the full scan and reported results (prod-lines-check: 330 production files scanned..., with existing over-limit findings in this checkout) before exiting 1 due to those violations — demonstrating that work ran despite the unaccounted argument instead of failing on argument validation before the scan.
Why it matters
Unaccounted arguments are silently accepted, so typos or misuse (e.g. a mistaken path passed positionally instead of via PROD_LINES_ROOT, or a stray flag) do not stop execution. That can hide operator error and makes the script's CLI contract ambiguous.
Acceptance criteria
pkgs/id/scripts/prod-lines-check.sh rejects any unaccounted positional arguments with a clear usage/error on stderr and a non-zero exit (exit 2, consistent with sibling pkgs/id scripts) before resolving/validating paths or scanning files.
- Normal invocation with no positional arguments behaves as before, including existing env-var seams (
PROD_LINES_ROOT, PROD_LINES_LIMIT).
--help/-h behavior, if added or already present, also rejects trailing unaccounted arguments per contract.
- A regression test covers rejection of extra arguments (and preserves existing check behavior for valid invocations).
Suggested fix shape
- Add an explicit argument contract (e.g.
usage() + reject $# > 0, with optional --help handling that also rejects extra args) near the top, before computing pkg_dir/root or running find/awk.
- Follow the strict pattern used by other covered pkgs/id operator scripts (e.g.
build.sh, test-shard-sandbox.sh).
Activitydeveloping-today commented on Nov 15, 2026 added a commit that references this issue on Nov 15, 2026This issue will close once commit 9b4f72e is merged into the 'main' branch.9b4f72e dezren39 commented on Nov 23, 2026
Reconciliation — Lane KK (archer), 2026-11-23. This issue is already satisfied on current main; closing as completed with evidence.
What landed: PR #10546 (merged 2026-11-16, merge commit 76a837c7e01f) — "fix(id/scripts): reject unaccounted args in prod-lines-check". Its body names this issue as the one it fixes; the auto-close evidently never fired.
Verified fresh against current main this pass:
pkgs/id/scripts/prod-lines-check.sh now declares the argument contract at the top, before any path resolution or scan work: any positional argument prints unexpected argument: <arg> plus usage to stderr and exits 2. No-arg invocation and the PROD_LINES_ROOT / PROD_LINES_LIMIT seams are unchanged below that guard.
- Regression coverage is on main in
pkgs/id/scripts/prod-lines-check-test.sh: check_usage_fail 'extra positional argument' extra-arg-test asserts exit status 2 and the unexpected-argument message, alongside the preserved valid-invocation checks.
Every acceptance criterion is met by that landed change, so no new code is needed. Closing as completed.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|