Skip to content

Avoid NaN numeric field emissions - #9

Merged
bnomei merged 1 commit into
mainfrom
codex/github-mention-avoid-nan-emissions-from-number-and-integer
Jun 17, 2026
Merged

Avoid NaN numeric field emissions#9
bnomei merged 1 commit into
mainfrom
codex/github-mention-avoid-nan-emissions-from-number-and-integer

Conversation

@bnomei

@bnomei bnomei commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Numeric subfields were emitting NaN for empty, invalid, or non-finite inputs instead of the established empty value undefined.
  • Ensure number and integer subfields consistently emit undefined for empty/invalid input while preserving valid numeric behavior.

Description

  • Add parseNumericInput(value: string, type: "number" | "integer") to normalize empty, invalid, non-finite, and non-integer integer inputs to undefined and return finite numbers otherwise.
  • Use parseNumericInput in readInputValue for type="number"|"integer" subfields and pass the subfield type into the input change handler.
  • Add tests/numeric-input.test.mjs with focused Node tests for empty, invalid, integer, decimal, and boundary inputs.
  • Add an npm test script that builds the package and runs the new numeric parsing tests.

Testing

  • Ran npm test which builds the package and executes tests/*.test.mjs, all tests passed (4/4).
  • Ran npm run typecheck (tsc --noEmit) which completed with no type errors.

Closes #4


Codex Task

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

More reviews will be available in 49 minutes and 57 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 72b8d626-6e34-4f50-b1df-82242fb24aff

📥 Commits

Reviewing files that changed from the base of the PR and between 40d08cf and dbca9f5.

📒 Files selected for processing (3)
  • package.json
  • src/admin.tsx
  • tests/numeric-input.test.mjs

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.

@augmentcode

augmentcode Bot commented Jun 17, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: This PR prevents numeric subfields from emitting NaN for empty/invalid input and instead normalizes those cases to undefined.

Changes:

  • Added parseNumericInput(value, type) to validate/normalize number vs integer inputs in the admin UI.
  • Updated readInputValue to use the new parser for <input type="number"> fields and to pass subfield type through the change handler.
  • Added focused Node tests covering empty/invalid/non-finite values and integer/decimal acceptance.
  • Introduced an npm test script that builds the package and runs the new node --test suite.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode 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.

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread package.json
"types:check": "attw --pack . --profile esm-only --no-summary",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"test": "npm run build && node --test tests/*.test.mjs"

@augmentcode augmentcode Bot Jun 17, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The node --test tests/*.test.mjs argument relies on shell glob expansion, which can fail on Windows/npm environments where * isn’t expanded, causing tests not to run (or to error on a literal path).

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Comment thread src/admin.tsx
}
if (target instanceof HTMLInputElement && target.type === "number") {
return target.value === "" ? undefined : Number(target.value);
return parseNumericInput(target.value, type === "integer" ? "integer" : "number");

@augmentcode augmentcode Bot Jun 17, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Because parseNumericInput() returns undefined for non-finite/invalid strings, controlled <Input type="number"> edits that temporarily produce values like "-" (common while typing negative numbers) will be normalized to "" and can effectively prevent entering some valid numbers interactively.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

@bnomei
bnomei merged commit f5b895d into main Jun 17, 2026
1 check passed
@bnomei
bnomei deleted the codex/github-mention-avoid-nan-emissions-from-number-and-integer branch June 17, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid NaN emissions from number and integer fields

1 participant