Making random-range-ratio configurable#186
Conversation
📝 WalkthroughWalkthroughThis change introduces a Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/srtctl/benchmarks/scripts/sa-bench/bench.sh (1)
21-21: Validate and log the new RANDOM_RANGE_RATIO input.Since this is user-provided, add a quick range check (and consider echoing it in the config log) to avoid silent misconfiguration.
Proposed guard
RANDOM_RANGE_RATIO=${12:-0.8} +if ! awk "BEGIN {exit !($RANDOM_RANGE_RATIO >= 0 && $RANDOM_RANGE_RATIO <= 1)}"; then + echo "RANDOM_RANGE_RATIO must be between 0 and 1" >&2 + exit 1 +fi🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/srtctl/benchmarks/scripts/sa-bench/bench.sh` at line 21, The script reads RANDOM_RANGE_RATIO from user input but doesn't validate or log it; add validation in bench.sh after RANDOM_RANGE_RATIO=${12:-0.8} to ensure it's a numeric value between 0 and 1 (inclusive), and if not, print a clear error and exit with non-zero status; also echo the resolved RANDOM_RANGE_RATIO value into the existing config/log output so users can see the effective value. Use a simple numeric check (e.g. regex or awk/ bc) to detect non-numeric input and a range check, and reference the RANDOM_RANGE_RATIO variable in the error/log messages so it’s easy to locate and debug.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/srtctl/benchmarks/scripts/sa-bench/bench.sh`:
- Line 21: The script reads RANDOM_RANGE_RATIO from user input but doesn't
validate or log it; add validation in bench.sh after
RANDOM_RANGE_RATIO=${12:-0.8} to ensure it's a numeric value between 0 and 1
(inclusive), and if not, print a clear error and exit with non-zero status; also
echo the resolved RANDOM_RANGE_RATIO value into the existing config/log output
so users can see the effective value. Use a simple numeric check (e.g. regex or
awk/ bc) to detect non-numeric input and a range check, and reference the
RANDOM_RANGE_RATIO variable in the error/log messages so it’s easy to locate and
debug.
Summary by CodeRabbit