[Bug]: --repeat accepts invalid values and can crash or silently misbehave
Summary
The --repeat flag has no input validation. Invalid values can raise an uncaught ValueError, while 0 or negative values are silently treated as a single run.
Expected Behavior
Invalid --repeat values should be rejected with a clear stderr message and exit code 1, consistent with --top validation via _validate_top().
Actual Behavior
--repeat abc→ uncaughtValueError: invalid literal for int() with base 10: 'abc'--repeat 0or--repeat -1→ silently runs once (becauseruns > 1is false), with no warning
Steps to Reproduce
-
Run command:
-
Use input/script:
-
Observe output/error:
-
Create a minimal script
app.pywithprint("ok") -
Run
oracletrace app.py --repeat abc -
Observe a Python traceback instead of a friendly CLI error
Repeat with --repeat 0 and --repeat -1 — both exit 0 after a single trace run.
Command and Output
oracletrace app.py --repeat abc
ValueError: invalid literal for int() with base 10: 'abc'
oracletrace app.py --repeat 0
# Runs once, exits 0 — no warning that repeat was ignored
Environment
- OracleTrace version: 3.0.0
- Python version: 3.11+
- OS: any
- Shell/terminal (if relevant): any
Additional Context
Relevant code in oracletrace/cli.py:
runs: int = int(args.repeat)
_validate_top() already provides the pattern to follow (lines 29–39). Add _validate_repeat() and call it in _run_target() before the repeat loop. Add tests in tests/test_cli.py mirroring the existing --top rejection tests.
Checklist
- [x] I searched existing issues before opening this report
- [x] I provided a reproducible example or clear reproduction steps
- [x] I included version and environment details