Low: locale-formatted context window values with dot thousands separators clamp to 2048
Severity
Low / internationalization — the Context window numeric input displays grouping according to the browser locale, but parses only comma/space/underscore grouping. In locales that use a dot as the thousands separator, typing or pasting the displayed format can unexpectedly clamp the setting to the minimum.
Evidence
GenerationControls.tsx:75–110: Context window usesformat={(tokens) => tokens.toLocaleString()}(the viewer locale) and the sharedNumberInputwith integer bounds 2,048 to 65,536.NumberInput.tsx:20–29: integer parser strips[\\s,_]but not '.';Number("8.192")yields 8.192, not 8192.NumberInput.tsx:57–79: a value outside the valid range is not committed while typing, but is clamped on blur. Here the parsed value becomes 2048, silently changing what the user meant.NumberInput.test.tsxcovers comma-grouped integers (12,288), but not common German/Spanish/Dutch period-grouped integers.
Reproduction
- Use a browser locale such as
de-DE;(8192).toLocaleString("de-DE")displays8.192. - In Context window, select all and type/paste
16.384to request 16,384 tokens. - Blur the input. Actual:
parse("16.384", 0)returns the number 16.384;clamp()commits 2048, the minimum, instead of 16384. - Expected: a locale-formatted integer is parsed consistently with its own display format, or the input consistently uses locale-neutral digits without grouping.
Suggested fix and tests
Prefer locale-aware Intl.NumberFormat(...).formatToParts grouping and decimal separator normalization, with strict integer syntax validation (avoiding accidental acceptance of 1.5 as a misleading count). Alternatively render all editable integer values without separators and keep grouping in noneditable labels. Test de-DE, en-US, fr-FR including NBSP/narrow NBSP, and blur/keyboard stepping.
Reviewed revision: e824fe2dcba0d1be127c9fff165f776186dc37e9. Deterministic parse/clamp logic; browser locale integration not executed.