Skip to content

fix(cli): reject non-finite numbers in settings editor - #29229

Open
bunnysayzz wants to merge 1 commit into
google-gemini:mainfrom
bunnysayzz:fix/settings-reject-nonfinite-29226
Open

bunnysayzz wants to merge 1 commit into
google-gemini:mainfrom
bunnysayzz:fix/settings-reject-nonfinite-29226

Conversation

@bunnysayzz

Copy link
Copy Markdown

Fixes #29226.

parseEditedValue('number', ...) only rejected NaN, so overflow input like 1e309 parsed to Infinity, passed validation, and JSON serialization silently stored it as null — corrupting the setting the dialog had just accepted. Number.isFinite covers NaN and both infinities; returning null makes the dialog keep the existing value (it already early-returns on null in handleEditCommit).

Tests: new parseEditedValue > number block (finite, empty, non-numeric, and the 1e309/Infinity/-Infinity regression cases — the regression test fails pre-fix). settingsUtils.test.ts: 53 passed. eslint + prettier clean.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 addresses a data corruption issue in the settings editor where overflow values were being accepted as valid input. By switching to a stricter finite number check, the application now prevents non-finite values from being processed, ensuring that the settings remain consistent and preventing serialization errors.

Highlights

  • Validation Logic Update: Updated the parseEditedValue function to use Number.isFinite instead of Number.isNaN, ensuring that non-finite numbers like Infinity are correctly rejected.
  • Regression Testing: Added comprehensive unit tests in settingsUtils.test.ts to verify that finite numbers are accepted and non-finite inputs are properly handled.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the 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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. 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.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

📊 PR Size: size/S

  • Lines changed: 29
  • Additions: +28
  • Deletions: -1
  • Files changed: 2

@google-cla

google-cla Bot commented Sep 6, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-cli gemini-cli Bot added the area/core Issues related to User Interface, OS Support, Core Functionality label Sep 6, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the parseEditedValue utility function in packages/cli to use !Number.isFinite(numParsed) instead of Number.isNaN(numParsed). This ensures that non-finite numeric values (such as Infinity, -Infinity, and overflow values like 1e309) are correctly rejected and treated as invalid (returning null), preventing potential serialization issues. Corresponding unit tests have been added to verify this behavior. I have no feedback to provide.

@gemini-cli

gemini-cli Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Hi there! Thank you for your interest in contributing to Gemini CLI.

To ensure we maintain high code quality and focus on our prioritized roadmap, we only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'.

This PR will be closed in 7 days if it remains without that designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding.

parseEditedValue('number', ...) only rejected NaN, so overflow input
like '1e309' parsed to Infinity, passed validation, and JSON
serialization silently stored it as null - corrupting the setting the
dialog had just accepted. Number.isFinite covers NaN and both
infinities; returning null makes the dialog keep the existing value.

Fixes google-gemini#29226
@bunnysayzz
bunnysayzz force-pushed the fix/settings-reject-nonfinite-29226 branch from c595c36 to aa5edaa Compare September 14, 2026 07:33
@bunnysayzz

Copy link
Copy Markdown
Author

Rebased onto latest main (was 9 behind, clean, upstream never touched these files). This push should also retrigger the CLA check: I have now signed the Google CLA, so cla/google should flip green on this run.

@gemini-cli gemini-cli Bot added the priority/p2 Important but can be addressed in a future release. label Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality priority/p2 Important but can be addressed in a future release. size/s A small PR status/pr-nudge-sent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: numeric settings editor saves overflow values as null

1 participant