You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Odometer - User can input any character in the Odometer input field #84222
Version Number: v9.3.31-1 Reproducible in staging?: Yes Reproducible in production?: No If this was caught during regression testing, add the test name, ID and link from BrowserStack:#78291 Email or phone of affected tester (no customers):applausetester+ds@applause.expensifail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Mac 14.5/ Chrome App Component: Other
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
Classification: Frontend bug Causing PR: #78291 - "Migrate useBeforeRemove to usePreventRemove in DiscardChangesConfirmation" by @mkzie2 (High confidence) Related Issues: #76326
Recommendation: REVERT
PR #78291 modified IOURequestStepDistanceOdometer.tsx as part of migrating to usePreventRemove. The changes introduced a regression in input validation that allows users to type any character (including letters) in the odometer input fields on web/Chrome.
Labels: This is a frontend bug. Keeping DeployBlockerCash label as appropriate for App deploy blocker.
Confirmed that PR #78291 modified IOURequestStepDistanceOdometer.tsx.
Root Cause
The validation logic in isOdometerInputValid() has a flaw where it accepts any input that normalizes to an empty string or NaN:
User types a non-numeric character like "a"
normalizeOdometerText("a", fromLocaleDigit) strips it to an empty string ""
parseFloat("") returns NaN
The validation checks !Number.isNaN(value) && value > MAX which is false for NaN
The function returns true, allowing the invalid input
The validation should explicitly reject input where:
The normalized text differs from the original input (indicating non-numeric chars were present)
The normalized text is empty but the original input was not
The parsed value is NaN (except for empty string)
On web/Chrome, keyboardType and inputMode only provide UI hints and do not enforce validation, so the isOdometerInputValid function is critical for preventing invalid input.
Please re-state the problem that we are trying to solve in this issue.
The odometer input field in Track Distance accepts any character (letters, symbols), not just numeric input. This happens on desktop web where keyboardType/inputMode props are only hints and don't restrict physical keyboard input.
What is the root cause of that problem?
The root cause is in PR #83170 (not #78291 as initially attributed). PR #83170 refactored the per-keystroke validation from a "clean-then-store" pattern to a "validate-stripped-but-store-raw" pattern.
Production (v9.3.30-3) uses cleanOdometerReading which strips non-numeric characters and stores the cleaned result — letters never appear.
The flow: user types "abc" → normalizeOdometerText("abc") strips to "" → parseFloat("") is NaN → max-value check is skipped → validation returns true → setStartReading("abc") stores the raw text with letters.
PR #78291 only changed DiscardChangesConfirmation from useBeforeRemove to usePreventRemove and migrated refs to state. It did not modify the input validation logic.
What changes do you think we should make in order to solve the problem?
In isOdometerInputValid in IOURequestStepDistanceOdometer.tsx, add a check that rejects input containing characters other than digits, locale decimal separators, and locale group separators. This should happen before the normalization step:
// Early in isOdometerInputValid, after the !text check:
// Reject input containing non-numeric characters (digits + locale decimal/group separators only)
This ensures the validation guards against raw text on web where inputMode='decimal' doesn't prevent character entry.
What alternative solutions did you explore? (Optional)
An alternative would be to revert to the production pattern of cleaning/stripping the text before storing it (i.e., setStartReading(normalizedText) instead of setStartReading(text)). This would also work but would silently strip characters rather than rejecting them, which is a different UX choice. The regex validation approach is preferable because it rejects invalid input outright while preserving the validate-on-input architecture from PR #83170.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.
Activity
melvin-bot commentedon Mar 5, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #78291
melvin-bot commentedon Mar 5, 2026
💬 A slack conversation has been started in #expensify-open-source
melvin-bot commentedon Mar 5, 2026
Triggered auto assignment to @garrettmknight (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.github-actions commentedon Mar 5, 2026
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
OSBotify commentedon Mar 5, 2026
🔍 Investigation Summary
Classification: Frontend bug
Causing PR: #78291 - "Migrate
useBeforeRemovetousePreventRemoveinDiscardChangesConfirmation" by @mkzie2 (High confidence)Related Issues: #76326
Recommendation: REVERT
PR #78291 modified
IOURequestStepDistanceOdometer.tsxas part of migrating tousePreventRemove. The changes introduced a regression in input validation that allows users to type any character (including letters) in the odometer input fields on web/Chrome.Labels: This is a frontend bug. Keeping
DeployBlockerCashlabel as appropriate for App deploy blocker.📋 Detailed Analysis
Evidence
useBeforeRemovetousePreventRemoveinDiscardChangesConfirmation#78291 is deployed) but not on productionuseBeforeRemovetousePreventRemoveinDiscardChangesConfirmation#78291useBeforeRemovetousePreventRemoveinDiscardChangesConfirmation#78291 modifiedsrc/pages/iou/request/step/IOURequestStepDistanceOdometer.tsxVerification
Files affected by the bug:
/home/runner/_work/App/App/src/pages/iou/request/step/IOURequestStepDistanceOdometer.tsx(lines 280-323, 520-578)/home/runner/_work/App/App/src/libs/DistanceRequestUtils.ts(lines 487-490)Confirmed that PR #78291 modified IOURequestStepDistanceOdometer.tsx.
Root Cause
The validation logic in
isOdometerInputValid()has a flaw where it accepts any input that normalizes to an empty string or NaN:normalizeOdometerText("a", fromLocaleDigit)strips it to an empty string ""parseFloat("")returnsNaN!Number.isNaN(value) && value > MAXwhich is false for NaNtrue, allowing the invalid inputThe validation should explicitly reject input where:
On web/Chrome,
keyboardTypeandinputModeonly provide UI hints and do not enforce validation, so theisOdometerInputValidfunction is critical for preventing invalid input.MelvinBot commentedon Mar 5, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
The odometer input field in Track Distance accepts any character (letters, symbols), not just numeric input. This happens on desktop web where
keyboardType/inputModeprops are only hints and don't restrict physical keyboard input.What is the root cause of that problem?
The root cause is in PR #83170 (not #78291 as initially attributed). PR #83170 refactored the per-keystroke validation from a "clean-then-store" pattern to a "validate-stripped-but-store-raw" pattern.
Production (v9.3.30-3) uses
cleanOdometerReadingwhich strips non-numeric characters and stores the cleaned result — letters never appear.Staging (v9.3.31-1) uses
isOdometerInputValid(IOURequestStepDistanceOdometer.tsx:280-303) which callsnormalizeOdometerText(DistanceRequestUtils.ts:487-490) to strip non-numeric characters, then validates the stripped result — but the handler stores the raw unstripped text in state.The flow: user types
"abc"→normalizeOdometerText("abc")strips to""→parseFloat("")isNaN→ max-value check is skipped → validation returnstrue→setStartReading("abc")stores the raw text with letters.PR #78291 only changed
DiscardChangesConfirmationfromuseBeforeRemovetousePreventRemoveand migrated refs to state. It did not modify the input validation logic.What changes do you think we should make in order to solve the problem?
In
isOdometerInputValidinIOURequestStepDistanceOdometer.tsx, add a check that rejects input containing characters other than digits, locale decimal separators, and locale group separators. This should happen before the normalization step:This ensures the validation guards against raw text on web where
inputMode='decimal'doesn't prevent character entry.What alternative solutions did you explore? (Optional)
An alternative would be to revert to the production pattern of cleaning/stripping the text before storing it (i.e.,
setStartReading(normalizedText)instead ofsetStartReading(text)). This would also work but would silently strip characters rather than rejecting them, which is a different UX choice. The regex validation approach is preferable because it rejects invalid input outright while preserving the validate-on-input architecture from PR #83170.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR, or@MelvinBot <your feedback>to refine this analysis.Julesssss commentedon Mar 5, 2026
Not a blocker, Odometer feature behind beta.
Julesssss commentedon Mar 5, 2026
dupe of #84220