Validate command-line arguments and route diagnostics to stderr#19
Open
ssiddhantsharma wants to merge 1 commit into
Open
Validate command-line arguments and route diagnostics to stderr#19ssiddhantsharma wants to merge 1 commit into
ssiddhantsharma wants to merge 1 commit into
Conversation
Targets the devel branch. Addresses the argument-parser TODOs in plaac.java
("should check for valid input here!") without changing any scoring behavior:
the branch's existing MOT3 regression test remains byte-identical, and the
versioning added in devel (-V / VERSION) is untouched.
- Non-numeric values for numeric options (-a, -c, -w, -W, -m) previously threw
a raw NumberFormatException stack trace and exited 0. They now print a clear
usage error to stderr and exit non-zero (parseIntArg/parseDoubleArg helpers).
- 'skipping unknown option' was printed to stdout, mixing a diagnostic into the
TSV results; it now goes to stderr.
- A value-taking flag in the last position (e.g. a trailing '-p' with no
print-list) was silently dropped, running plaac in an unintended mode. It now
warns on stderr; the run still completes.
Diagnostics go to stderr throughout, so stdout stays a clean TSV.
Tests: cli/tests/test_input_validation.sh covers all three behaviors plus a
valid-invocation sanity check, added as a step to the cli-unit-test workflow.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Targets
devel. Small, self-contained CLI-robustness change that addresses the argument-parser TODOs inplaac.java(// should check for valid input here!).No scoring behavior changes —
devel’s MOT3 regression test stays byte-identical, and the versioning added indevel(-V/VERSION) is untouched.What it fixes
devel)-a foo/-c foo→ rawNumberFormatExceptionstack trace, exit 0# skipping unknown optionprinted to stdout → mixed into the TSV-i x.fa -p(value-flag with no value, last position) → silently runs summary modeAll diagnostics now go to stderr, so stdout stays a clean TSV.
Tests
cli/tests/test_input_validation.shcovers all three fixes plus a valid-invocation sanity check, wired intocli-unit-test.ymlas an extra step (so it runs on the existing Java 11 + 17 matrix). Verified locally: the MOT3 gold diff still passes and-Vstill prints the version.Compatibility
build_plaac.shstill runsplaac.jar -i dummyto generate the web doc headers; that path is deliberately left non-fatal, so the build is unaffected. The web app builds its command with validated args and captures stderr separately, so the exit-code and stderr changes are compatible.