Skip to content
This repository was archived by the owner on Apr 20, 2026. It is now read-only.

Making random-range-ratio configurable#186

Merged
ishandhanani merged 1 commit intoishandhanani:mainfrom
YAMY1234:sa-bench
Feb 24, 2026
Merged

Making random-range-ratio configurable#186
ishandhanani merged 1 commit intoishandhanani:mainfrom
YAMY1234:sa-bench

Conversation

@YAMY1234
Copy link
Copy Markdown
Collaborator

@YAMY1234 YAMY1234 commented Feb 24, 2026

Summary by CodeRabbit

  • Chores
    • Made benchmark script parameters configurable, enabling customization of random range ratio settings while preserving default behavior.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 24, 2026

📝 Walkthrough

Walkthrough

This change introduces a RANDOM_RANGE_RATIO variable in the benchmark script and replaces hardcoded occurrences of the value 0.8 with this variable across two Python invocations, improving configuration maintainability.

Changes

Cohort / File(s) Summary
Benchmark Configuration
src/srtctl/benchmarks/scripts/sa-bench/bench.sh
Extracted hardcoded random-range-ratio value (0.8) into a new RANDOM_RANGE_RATIO variable for improved configurability across benchmark invocations.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A ratio once locked in stone,
Now dances free as its own—
Variables bloom where numbers slept,
Config wisdom our script has kept! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly summarizes the main change: introducing configurability for the random-range-ratio parameter that was previously hard-coded.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 452bb8d and 140803f.

📒 Files selected for processing (1)
  • src/srtctl/benchmarks/scripts/sa-bench/bench.sh

@ishandhanani ishandhanani merged commit 43a2e44 into ishandhanani:main Feb 24, 2026
4 of 5 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants