Skip to content

fix: prevent invalid repeat counts from skipping queries - #249

Open
Bewear777 wants to merge 2 commits into
vesoft-inc:masterfrom
Bewear777:fix/repeat-validation-message
Open

Bewear777 wants to merge 2 commits into
vesoft-inc:masterfrom
Bewear777:fix/repeat-validation-message

Conversation

@Bewear777

@Bewear777 Bewear777 commented Oct 19, 2026 •

Copy link
Copy Markdown

What type of PR is this?

  • bug
  • feature
  • enhancement
  • documentation

What problem(s) does this PR solve?

Issue(s) number:

Fixes #255

Description:

The ":repeat" command may silently skip the next nGQL statement when an invalid repeat count is provided.

The existing validation prints an error but still assigns the invalid value to "g_repeats".

For example:

  • ":repeat 0" sets "g_repeats" to 0.
  • ":repeat -1" sets "g_repeats" to -1.
  • ":repeat abc" fails integer parsing but still sets "g_repeats" to 0.

As a result, the next nGQL statement is skipped because the execution loop does not run.

Additionally, the validation message contains a spelling mistake and incorrectly describes the minimum allowed value.

How do you solve it?

  • Return immediately when integer parsing fails.
  • Return immediately when the repeat count is less than 1.
  • Update "g_repeats" only after successful validation.
  • Correct the error message to state that the repeat count must be greater than or equal to 1.

Special notes for your reviewer, ex. impact of this fix, design document, etc:

  • Minimal change limited to the "Repeat" case in "main.go".
  • No changes to valid repeat-count behavior.
  • No changes to command parsing.
  • No public API or backward compatibility impact.
  • Automated tests have not been performed.

Reproduction

nebula> :repeat 0
Error: invalid integer, repeats should be greater than or equal to 1

nebula> SHOW HOSTS;

Before this fix, "SHOW HOSTS" is skipped. After the fix, invalid repeat counts no longer change "g_repeats", so the next statement executes normally.

@Bewear777 Bewear777 changed the title fix: correct the repeat count validation message fix: prevent invalid repeat counts from skipping queries Nov 1, 2026
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.

Invalid repeat count causes the next nGQL query to be skipped

1 participant