Skip to content

Check for intermediate values on int validator#91

Open
embarc-gabriel wants to merge 2 commits into
musescore:mainfrom
embarc-gabriel:check-for-intermediate-values-on-int-validator
Open

Check for intermediate values on int validator#91
embarc-gabriel wants to merge 2 commits into
musescore:mainfrom
embarc-gabriel:check-for-intermediate-values-on-int-validator

Conversation

@embarc-gabriel

Copy link
Copy Markdown
Contributor

Resolves: #NNNNN

The input validator should not invalidate values that are merely intermediate ones.
For example, if the input should be [5, 50], the value 2 should not be considered invalid because it can be the first digit of 20.
Also empty string should be considered intermediate values. So we can remove all digits from a field in order to insert new digits.

  • I signed the CLA as username:
  • The title of the PR describes the problem it addresses.
  • Each commit's message describes its purpose and effects, and references the issue it resolves. If changes are extensive, there is a sequence of easily reviewable commits.
  • The code in the PR follows the coding rules.
  • I understand all aspects of the code I'm contributing and I'm able to explain it if requested.
  • The code compiles and runs on my machine, preferably after each commit individually. I have manually tested and verified that my changes fulfil their intended purpose.
  • No prior attempts to resolve this problem exist, or if they do, I listed them in my PR description and described how I avoided repeating past mistakes.
  • There are no unnecessary changes.
  • I created a unit test or vtest to verify the changes I made (if applicable).

Build configuration

audacity: audacity/audacity/master
audacity platforms: linux_x64
musescore: musescore/MuseScore/main
musescore platforms: linux_x64

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@embarc-gabriel, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 35 minutes and 23 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2452ef9e-2e1d-4bb0-af8f-22b8cde0f88f

📥 Commits

Reviewing files that changed from the base of the PR and between 9618aa2 and 6f958e4.

📒 Files selected for processing (2)
  • framework/uicomponents/qml/Muse/UiComponents/tests/intinputvalidator_tests.cpp
  • framework/uicomponents/qml/Muse/UiComponents/validators/intinputvalidator.cpp
📝 Walkthrough

Walkthrough

IntInputValidator::validate is updated to return Intermediate (instead of falling through or returning Invalid) when the input is empty or contains only a sign character. For out-of-range parsed values, the return is now sign-aware: a value above m_top yields Intermediate only if the value is negative (still being entered), and a value below m_bottom yields Intermediate only if the value is positive; otherwise Invalid is returned. Corresponding tests are added and updated to cover the empty-string, mid-range-minimum, and fully-negative-range scenarios.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: improving intermediate value detection in the integer validator, directly matching the PR's core objective.
Description check ✅ Passed The PR description includes the template structure with completed checklist items, issue reference placeholder, motivation explanation, and build configuration.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@framework/uicomponents/qml/Muse/UiComponents/validators/intinputvalidator.cpp`:
- Around line 92-94: The condition that checks for a lone negative sign "-"
currently returns Intermediate regardless of whether the configured range allows
negative values. When the range is positive-only (like [1, 10]), a lone "-"
should not be considered Intermediate since the next digit would make it
invalid. Modify the condition in the intinputvalidator.cpp file where
digits.contains(QRegularExpression("^\\-?$")) is checked to also verify that the
configured range allows negative values (by checking if the minimum allowed
value is negative). Return Intermediate only when the input is empty or when it
is a lone "-" AND the range can contain negative numbers; otherwise handle the
lone "-" as an invalid input for positive-only ranges.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 729d1841-5b02-4c2b-913f-8ca7888dbc3a

📥 Commits

Reviewing files that changed from the base of the PR and between 6d19b66 and 9618aa2.

📒 Files selected for processing (2)
  • framework/uicomponents/qml/Muse/UiComponents/tests/intinputvalidator_tests.cpp
  • framework/uicomponents/qml/Muse/UiComponents/validators/intinputvalidator.cpp

Comment thread framework/uicomponents/qml/Muse/UiComponents/validators/intinputvalidator.cpp Outdated
@embarc-gabriel embarc-gabriel force-pushed the check-for-intermediate-values-on-int-validator branch from 9618aa2 to 6f958e4 Compare June 17, 2026 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants