[NoQA] Make connections optional in the Policy type to match real data
Explanation of Change
In the Onyx Policy type the connections property had all of its own properties required (each representing one kind of a possible integration). This does not match real data, as we only store the connected integrations. Therefore there was a risk of runtime errors and (now forbidden) type casts were required in tests. Now the connections in the type are optional.
Fixed Issues
$ https://github.com/Expensify/App/issues/95608 PROPOSAL: N/A
Tests
No tests.
Offline tests
N/A
QA Steps
N/A
PR Author Checklist
- [x] I linked the correct issue in the
### Fixed Issuessection above - [x] I wrote clear testing steps that cover the changes made in this PR
- [x] I added steps for local testing in the
Testssection - [x] I added steps for the expected offline behavior in the
Offline stepssection - [x] I added steps for Staging and/or Production testing in the
QA stepssection - [x] I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
- [x] 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)
- [x] 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).
- [x] I added steps for local testing in the
- [x] I included screenshots or videos for tests on all platforms
- [x] I ran the tests on all platforms & verified they passed on:
- [x] Android: Native
- [x] Android: mWeb Chrome
- [x] iOS: Native
- [x] iOS: mWeb Safari
- [x] MacOS: Chrome / Safari
- [x] 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)
- [x] I followed proper code patterns (see Reviewing the code)
- [x] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e.
toggleReportand notonIconClick) - [x] I verified that comments were added to code that is not self explanatory
- [x] I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
- [x] I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and 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)
- [x] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e.
- [x] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
- [x] I followed the guidelines as stated in the Review Guidelines
- [x] 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 usingAvatarare working as expected) - [x] If any new file was added I verified that:
- [x] The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
- [x] If a new CSS style is added I verified that:
- [x] A similar style doesn't already exist
- [x] The style can't be created with an existing StyleUtils function (i.e.
StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
- [x] If new assets were added or existing ones were modified, I verified that:
- [x] The assets are optimized and compressed (for SVG files, run
npm run compress-svg) - [x] The assets load correctly across all supported platforms.
- [x] The assets are optimized and compressed (for SVG files, run
- [x] 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.
- [x] 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
Avataris modified, I verified thatAvataris working as expected in all cases) - [x] 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.
- [x] 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.
- [x] 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:
- [x] I verified that all the inputs inside a form are aligned with each other.
- [x] I added
Designlabel and/or tagged@Expensify/designso the design team can review the changes.
- [x] I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
- [x] If the
mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.
Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Codecov Report
✅ Changes either increased or maintained existing code coverage, great job!
| Files with missing lines | Coverage Δ | |
|---|---|---|
| src/libs/CardUtils.ts | 82.86% <100.00%> (ø) |
|
| ...ace/accounting/intacct/ExistingConnectionsPage.tsx | 0.00% <0.00%> (ø) |
|
| ...uiteTokenInput/NetSuiteExistingConnectionsPage.tsx | 0.00% <0.00%> (ø) |
|
| ...DynamicNetSuiteInvoiceItemPreferenceSelectPage.tsx | 0.00% <0.00%> (ø) |
|
| ... and 184 files with indirect coverage changes |
@nyomanjyotisa 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]
PR doesn’t need product input as a refactor PR. Unassigning and unsubscribing myself.
Reviewer Checklist
- [x] I have verified the author checklist is complete (all boxes are checked off).
- [x] I verified the correct issue is linked in the
### Fixed Issuessection above - [x] I verified testing steps are clear and they cover the changes made in this PR
- [x] I verified the steps for local testing are in the
Testssection - [x] I verified the steps for Staging and/or Production testing are in the
QA stepssection - [x] 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)
- [x] 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)
- [x] I verified the steps for local testing are in the
- [x] I checked that screenshots or videos are included for tests on all platforms
- [x] I included screenshots or videos for tests on all platforms
- [x] 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.
- [x] I verified tests pass on all platforms & I tested again on:
- [x] Android: HybridApp
- [x] Android: mWeb Chrome
- [x] iOS: HybridApp
- [x] iOS: mWeb Safari
- [x] MacOS: Chrome / Safari
- [x] 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
- [x] I verified proper code patterns were followed (see Reviewing the code)
- [x] I verified that comments were added to code that is not self explanatory
- [x] I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
- [x] I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and 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)
- [x] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
- [x] I verified that this PR follows the guidelines as stated in the Review Guidelines
- [x] 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 usingAvatarhave been tested & I retested again) - [x] If a new component is created I verified that:
- [x] A similar component doesn't exist in the codebase
- [x] All props are defined accurately
- [x] The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
- [x] The only data being stored in the state is data necessary for rendering and nothing else
- [x] 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
- [x] If a new CSS style is added I verified that:
- [x] A similar style doesn't already exist
- [x] The style can't be created with an existing StyleUtils function (i.e.
StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
- [x] 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.
- [x] 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
Avataris modified, I verified thatAvataris working as expected in all cases) - [x] 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.
- [x] 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.
- [x] 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:
- [x] I verified that all the inputs inside a form are aligned with each other.
- [x] I added
Designlabel and/or tagged@Expensify/designso the design team can review the changes.
- [x] For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
- [x] If the
mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps. - [x] 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
We did not find an internal engineer to review this PR, trying to assign a random engineer to #95608 as well as to this PR... Please reach out for help on Slack if no one gets assigned!
🚧 flodnv has triggered a test Expensify/App build. You can view the workflow run here.
:hand: This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.
:test_tube::test_tube: Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! :test_tube::test_tube: Built from App PR Expensify/App#95395.
| Android :robot: | iOS :apple: |
|---|---|
| https://ad-hoc-expensify-cash.s3.us-east-1.amazonaws.com/rock-artifacts/ad-hoc/rock-android-Adhoc-bf37378f181-fbc55b5-218d6e9464304c20bbb326202daf6ace9278b7fc/index.html | https://ad-hoc-expensify-cash.s3.us-east-1.amazonaws.com/rock-artifacts/ad-hoc/rock-ios-device-AdHoc-bf37378-fbc55b5-a2aa1792c0981d50822b48a5096cf938f941bcc5/index.html |
| Web :spider_web: |
|---|
| https://95395.pr-testing.expensify.com |
:eyes: View the workflow run that generated this build :eyes:
🚀 Deployed to staging by https://github.com/flodnv in version: 9.4.34-0 🚀
| platform | result |
|---|---|
| 🕸 web 🕸 | success ✅ |
| 🤖 android 🤖 | success ✅ |
| 🍎 iOS 🍎 | success ✅ |
Help site review: no changes required
I reviewed the changes in this PR against the help site articles under docs/articles. No help site changes are required, so I did not create a docs PR.
Why: This is a [NoQA] TypeScript type-only refactor with no user-facing impact. It makes the Onyx Policy.connections property Partial<Connections> so the type matches real stored data (a policy only carries the integrations it has actually connected), and updates a handful of optional-chaining accesses (connections?.netsuite?.…, connections?.intacct?.…) plus test type annotations to suit. There are no new or changed features, feature names, tab names, settings labels, or buttons — nothing that any help article describes.
What I checked
- PR is titled "[NoQA] Make connections optional in the Policy type to match real data" and carries no user-facing test/QA steps (Tests and QA both
N/A/ "No tests"). - Files changed are all types, internal utils, accounting connection pages (optional-chaining only), and unit tests — see
src/types/onyx/Policy.ts(connections?: Partial<Connections>),src/libs/CardUtils.ts,src/pages/workspace/accounting/**, and thetests/**files. - No copy, labels, or product flows are added or altered, so no article in
docs/articles(e.g. accounting integration guides for NetSuite / Sage Intacct / QuickBooks) needs updating.
Note: I was unable to verify in the browser this run (NewDot web could not be driven here), so this assessment is based on static analysis of the diff. Given the change is purely type-level, browser verification isn't needed to reach this conclusion.
Since no help site PR was created, there is nothing to link for review. If you believe a specific article should change regardless, let me know which one and I'll draft it.
🚀 Deployed to production by https://github.com/roryabraham in version: 9.4.34-14 🚀
| platform | result |
|---|---|
| 🕸 web 🕸 | success ✅ |
| 🤖 android 🤖 | failure ❌ |
| 🍎 iOS 🍎 | failure ❌ |