GH#4077: Simplify concurrency validation regex in batch.sh#4117
GH#4077: Simplify concurrency validation regex in batch.sh#4117alex-solovyev wants to merge 1 commit intomainfrom
Conversation
Replace two-part positive integer check (^[0-9]+$ + -eq 0) with a single regex ^[1-9][0-9]*$ that inherently excludes zero. More concise, readable, and robust against injection when parsing numeric data from untrusted sources. Closes #4077
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the concurrency validation logic within the Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Wed Mar 11 03:01:02 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ 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.
Code Review
This pull request simplifies the validation logic for the --concurrency parameter. However, the new regular expression is stricter than the previous logic and disallows positive integers with leading zeros (e.g., 01), which were previously accepted. I have added a review comment with a suggested fix to align the validation with the expected behavior of checking for any positive integer.
| } | ||
| # GH#3716: Validate concurrency is a positive integer before SQL interpolation | ||
| if ! [[ "$2" =~ ^[0-9]+$ ]] || [[ "$2" -eq 0 ]]; then | ||
| if ! [[ "$2" =~ ^[1-9][0-9]*$ ]]; then |
There was a problem hiding this comment.
The new regex ^[1-9][0-9]*$ is stricter than the original logic. It will now reject valid positive integer representations with leading zeros, like 01, which the previous check allowed. This is a subtle change in validation logic.
If the intent is to allow any valid positive integer representation, a regex that permits leading zeros while still excluding zero itself would be more appropriate, for example: ^(0*[1-9][0-9]*)$.
| if ! [[ "$2" =~ ^[1-9][0-9]*$ ]]; then | |
| if ! [[ "$2" =~ ^(0*[1-9][0-9]*)$ ]]; then |
|



Summary
^[0-9]+$+-eq 0) with single regex^[1-9][0-9]*$that inherently excludes zeroCloses #4077