Skip to content

FIX: Reject unsafe integers in parameter form coercion (#3857) - #3927

Merged
Roman Lutz (romanlutz) merged 2 commits into
microsoft:mainfrom
Hrushikesh-ramilla:fix/parameter-form-safe-integer-3857
Nov 8, 2026
Merged

Roman Lutz (romanlutz) merged 2 commits into
microsoft:mainfrom
Hrushikesh-ramilla:fix/parameter-form-safe-integer-3857

Conversation

@Hrushikesh-ramilla

Copy link
Copy Markdown
Contributor

Description

Fixes #3857.

When integer parameters (such as seed on RandomCapitalLettersConverter) are coerced from string inputs in coerceToken, values exceeding the safe integer range (Number.MAX_SAFE_INTEGER / Number.MIN_SAFE_INTEGER) were previously accepted by Number.isInteger, causing JavaScript's IEEE-754 representation to silently round them into different integers (e.g. 9007199254740993 becoming 9007199254740992).

This change adds a Number.isSafeInteger check to coerceToken for typeName === 'int', returning an error (${paramName} must be a safe integer.) when values exceed supported safe integer bounds, preventing silent mutation of reproducibility seeds and integer configurations.

Tests and Documentation

  • Added unit tests in frontend/src/components/Parameters/parameterForm.test.ts verifying rejection of unsafe integers above Number.MAX_SAFE_INTEGER and below Number.MIN_SAFE_INTEGER, as well as acceptance of safe integer boundary values (9007199254740991 and -9007199254740991).
  • Added unit test in parameterForm.test.ts verifying rejection of unsafe integers in list[int] parameters.
  • Added dialog integration test case in frontend/src/components/Registry/CreateConverterDialog.test.tsx verifying that entering 9007199254740993 for seed surfaces the safe integer validation error and aborts submission.
  • Verified all unit and dialog tests pass with Jest, and ran npm run type-check and npm run lint.

Validate that integer parameters satisfy Number.isSafeInteger during form coercion, rejecting magnitudes outside the safe integer range before submission instead of silently rounding them into different numbers.

Signed-off-by: Hrushikesh Ramilla <ramillahrushikesh@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 4, 2026 09:24

Copilot AI 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.

🟢 Approval recommended

No active review issues are reported for the change to reject unsafe integer inputs before submission.

No open issues 🎉

What changed in this PR

Fixes #3857 by rejecting integer form inputs outside JavaScript’s safe integer range, preventing silent rounding of seeds and other integer parameters before submission.

Changes:

  • Adds Number.isSafeInteger validation with a dedicated error message.
  • Tests unsafe scalar and list values, plus valid safe-integer boundaries.
  • Extends dialog coverage to verify unsafe seed input blocks submission.
File Description
frontend/​src/​components/​Registry/​CreateConverterDialog.test.tsx Verifies unsafe seed input displays an error and prevents submission.
frontend/​src/​components/​Parameters/​parameterForm.ts Rejects unsafe integers during parameter coercion.
frontend/​src/​components/​Parameters/​parameterForm.test.ts Tests unsafe integer rejection and safe boundary acceptance.

Review effort: Balanced

@romanlutz Roman Lutz (romanlutz) self-assigned this Nov 5, 2026
@romanlutz
Roman Lutz (romanlutz) added this pull request to the merge queue Nov 8, 2026
Merged via the queue into microsoft:main with commit e0e97be Nov 8, 2026
55 checks passed
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.

Converter form rounds unsafe integer values before sending them

3 participants