Skip to content

[No QA] deprecate NumberWithSymbolForm and add lint guards - #105583

Merged
mountiny merged 3 commits into
Expensify:mainfrom
software-mansion-labs:jmgraa/deprecate-number-with-symbol-form
Nov 11, 2026
Merged

mountiny merged 3 commits into
Expensify:mainfrom
software-mansion-labs:jmgraa/deprecate-number-with-symbol-form

Conversation

@jmgraa

@jmgraa jmgraa commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Following the introduction and semantic separation of KeypadAmountEditor (full-screen layout) and AmountFormField (inline field), the legacy NumberWithSymbolForm, MoneyRequestAmountInput, and related primitives (TextInputWithSymbol, SymbolButton, CONST.TEXT_INPUT_SYMBOL_POSITION) are obsolete and scheduled for migration.

This PR establishes lint guards to prevent new usages while existing call sites are migrated across dedicated follow-up PRs, updates seatbelt ratchets, formalizes deprecations with JSDoc annotations, and adds comprehensive technical migration guidance.

Key changes in this PR:

  • Lint Guards & Seatbelts: Configured restrictedImportPatterns in oxlint.config.mts prohibiting default imports of NumberWithSymbolForm and MoneyRequestAmountInput. Baselined existing call sites in config/oxlint/oxlint.seatbelt.tsv to keep CI green while strictly forbidding any new import additions.
  • Deprecation Annotations: Added @deprecated JSDoc tags pointing developers to AmountFormField, KeypadAmountEditor, and the migration guide across:
    • src/components/NumberWithSymbolForm.tsx & NumberWithSymbolFormRef
    • src/components/MoneyRequestAmountInput.tsx & MoneyRequestAmountInputProps
    • src/components/SymbolButton.tsx & SymbolButtonProps
    • src/components/TextInputWithSymbol/ (BaseTextInputWithSymbol, platform variants, and types)
    • src/CONST/index.ts (TEXT_INPUT_SYMBOL_POSITION)
  • Migration Documentation: Added contributingGuides/NUMBER_WITH_SYMBOL_FORM_MIGRATION.md as a stable engineering reference detailing:
    • Component target selection by legacy render mode (KeypadAmountEditor vs AmountFormField) and deliberate landscape behavior parity.
    • Runtime behavior semantics (canonical signed values, key remounting, non-notifying imperative updates via updateNumber).
    • Native back gesture discard prompt handling (useDiscardChangesConfirmation) using render-time mirror state resets (previousSync) to satisfy React Compiler's rc/set-state-in-effect without reading refs in render.
    • Comprehensive prop mapping matrix, foundational prerequisites (submitBehavior, sentryLabel) and per-caller incremental prop additions, alongside a default-differences matrix for pad-without-pad callers (AmountFormField.Input).
    • Reference blueprints covering full-screen currency inputs, unit suffixes (hours/distance), inline list rows (AmountField), and standalone vs FormProvider integration.
    • MoneyRequestAmountInput wrapper sync rules, blur formatting, and signed magnitude business validation considerations (isAmountInvalid).
    • AmountForm as the FormProvider adapter: its current routing (17 of 20 usages already render AmountFormField, covering all displayAsTextInput usages including the currency-button variant and one standalone usage outside FormProvider, while 3 still reach NumberWithSymbolForm through the pad path, which lint does not flag), migration of the pad path inside the adapter with behavior parity, and a follow-up split into separate inline and pad adapters replacing the displayAsTextInput mode switch.
  • AmountFormField JSDoc: Pointed the AmountForm reference in src/components/AmountFormField/index.tsx to the inline (displayAsTextInput) adapter path and linked the migration guide.
  • Type Export Clean-up: Relocated AmountFormFieldProps to src/components/AmountFormField/types.ts and exported it from there. It is intentionally not re-exported from @components/AmountFormField yet to satisfy knip unused-export checks until the first consumer migrates.
  • Unit Tests: Strengthened tests in tests/unit/components/useAmountEditingControllerTest.ts by strictly typing test helper options and verifying that updateNumber sets the canonical value and moves the caret to the end without firing onInputChange, while intentionally bypassing validation constraints (decimals, maxLength, allowNegative).

Fixed Issues

$ #98172
PROPOSAL: #97970

Tests

  1. Temporarily add import NumberWithSymbolForm from '@components/NumberWithSymbolForm'; to an unratcheted file (e.g. src/pages/home/HomePage.tsx) and run npm run lint-changed.
  2. Verify that Oxlint reports a no-restricted-imports error and a @typescript-eslint/no-deprecated error, both referencing contributingGuides/NUMBER_WITH_SYMBOL_FORM_MIGRATION.md.
  3. Remove the temporary test import.
  • Verify that no errors appear in the JS console

Offline tests

N/A

QA Steps

N/A

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

@melvin-bot

melvin-bot Bot commented Nov 1, 2026

Copy link
Copy Markdown

Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers!

@codecov

codecov Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

@jmgraa

jmgraa commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T19:52:39.490739Z c7aea7f Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1b609d94a0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@jmgraa

jmgraa commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 1b609d94a0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@JakubKorytko JakubKorytko left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

two small ones, worth re-visiting after base PR is merged and the diff is clean

@jmgraa
jmgraa force-pushed the jmgraa/deprecate-number-with-symbol-form branch from 1b609d9 to 2c36afc Compare November 3, 2026 10:32
@jmgraa

jmgraa commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 2c36afcc59

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@jmgraa
jmgraa marked this pull request as ready for review November 3, 2026 11:26
@jmgraa
jmgraa requested review from a team as code owners November 3, 2026 11:26
@melvin-bot
melvin-bot Bot requested review from bernhardoj and dylanexpensify and removed request for a team November 3, 2026 11:26
@melvin-bot

melvin-bot Bot commented Nov 3, 2026

Copy link
Copy Markdown

@bernhardoj Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

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

Product input not required

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2c36afcc59

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@jmgraa
jmgraa marked this pull request as draft November 3, 2026 12:30
@jmgraa
jmgraa force-pushed the jmgraa/deprecate-number-with-symbol-form branch from 2c36afc to c64911f Compare November 3, 2026 12:52
@jmgraa

jmgraa commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@MelvinBot review
@codex review

@MelvinBot

Copy link
Copy Markdown
Contributor

I reviewed c64911f2 and found no blocking issues. This looks good to merge once the pending Jest jobs pass. Oxlint, typecheck, knip and spellcheck already pass.

What I checked
  • Lint guards: The two restrictedImportPatterns entries in oxlint.config.mts:78-87 restrict only default imports. Named type imports, such as NumberWithSymbolFormRef in ChronosScheduleOOOPage and DynamicIOURequestStepDistance, correctly get only no-deprecated seatbelt entries. Because typescript/no-deprecated is off for *.js files, the import ban is still needed there.
  • Seatbelt coverage: I searched src/ and tests/ for every user of NumberWithSymbolForm, MoneyRequestAmountInput, TextInputWithSymbol, SymbolButton and TEXT_INPUT_SYMBOL_POSITION. Every real user is either baselined or listed in the guide's inventory. The only other matches are code comments (TimePicker, IOURequestStepHoursTest, KeypadAmountEditorTest and others). TaxFields.test.tsx uses jest.mock with a string path, so lint can't catch it, but the inventory lists it.
  • updateNumber test: This matches useAmountEditingController.ts:112-115. It calls applyValue(..., {notify: false}) and then syncToEnd, so the test locks in the behaviour the guide relies on.
  • AmountFormFieldProps move: This is a type-only move. ref now uses AmountFormFieldRef, which is an alias of AmountEditingRef, so nothing changes at runtime.
  • Migration guide: The types it names exist: KeypadAmountEditorProps, KeypadAmountInputProps, and .CurrencyPickerButton on both roots. The list of CONST.TEXT_INPUT_SYMBOL_POSITION users matches the seatbelt. The updateNumber effect pattern in section 3B matches what IOURequestStepHours already does at L90-L96.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c64911f2bb

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@jmgraa
jmgraa force-pushed the jmgraa/deprecate-number-with-symbol-form branch from c64911f to c7aea7f Compare November 9, 2026 14:36
@jmgraa

jmgraa commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Failed to sample tokens
ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@jmgraa
jmgraa marked this pull request as ready for review November 9, 2026 15:25
@jmgraa

jmgraa commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: c7aea7f132

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@jmgraa

jmgraa commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

@bernhardoj ready for review. I'm aware of the conflicts with seatbelt and I'll resolve them after your review / right before the merge.

@bernhardoj

bernhardoj commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Android: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari

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

LGTM!

Image

@melvin-bot
melvin-bot Bot requested a review from mountiny November 10, 2026 14:56
…mber-with-symbol-form

# Conflicts:
#	config/oxlint/oxlint.seatbelt.tsv
mountiny
mountiny previously approved these changes Nov 10, 2026
…mber-with-symbol-form

# Conflicts:
#	config/oxlint/oxlint.seatbelt.tsv
@mountiny
mountiny merged commit 5038fc6 into Expensify:main Nov 11, 2026
36 of 38 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

Copy link
Copy Markdown
Contributor

@jmgraa
jmgraa deleted the jmgraa/deprecate-number-with-symbol-form branch November 12, 2026 08:35
@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 9.5.37-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor

No help site update needed — this PR only adds developer lint guards, deprecation annotations, migration guidance, type organization, and tests; it introduces no user-facing changes or beta releases and makes no existing article inaccurate.


view run

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.5.37-1 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 failure ❌
🍎 iOS 🍎 failure ❌

Bundle Size Analysis (Sentry):

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.

7 participants