Skip to content

Clean up QBO export picker location helpers and copy key#92429

Draft
MelvinBot wants to merge 2 commits into
mainfrom
claude-cleanupQboExportLocationHelpers
Draft

Clean up QBO export picker location helpers and copy key#92429
MelvinBot wants to merge 2 commits into
mainfrom
claude-cleanupQboExportLocationHelpers

Conversation

@MelvinBot
Copy link
Copy Markdown
Contributor

@MelvinBot MelvinBot commented Jun 2, 2026

Explanation of Change

Maintainability cleanup from #92421. The syncLocations === TAG check was duplicated across three call sites, so I replaced the single-use canUseVendorBillForCompanyCardExport helper with a condition-centric areLocationsImportedAsTags and used it in both QBO export pickers (company-card and out-of-pocket).

Also renamed the companyCardsLocationEnabledDescription translation key to companyCardsLocationTagDescription across all 10 locales, since its copy now describes the tag-specific case rather than the old broad "locations enabled" rule. Behaviour-preserving — no copy content changed.

Fixed Issues

$ #92421

Tests

// TODO: The human co-author must fill out the tests you ran before marking this PR as "ready for review". Suggested coverage: with a QBO-connected workspace, toggle Locations import between "Tags" and "Report fields"/off, then open both the out-of-pocket export picker and the company-card export picker and verify the Check/Vendor bill options (and the company-card footer copy) show/hide correctly.

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • 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 followed proper code patterns (see Reviewing the code)
    • 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. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • 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.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • 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)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • 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)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • 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
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • 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 a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • 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.

Screenshots/Videos

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

Extract condition-centric areLocationsImportedAsTags helper and use it in
both the company-card and out-of-pocket QBO export pickers, and rename the
companyCardsLocationEnabledDescription translation key to
companyCardsLocationTagDescription to match its tag-specific copy.

Co-authored-by: Jules <Julesssss@users.noreply.github.com>
@OSBotify
Copy link
Copy Markdown
Contributor

OSBotify commented Jun 2, 2026

🦜 Polyglot Parrot! 🦜

Squawk! Looks like you added some shiny new English strings. Allow me to parrot them back to you in other tongues:

View the translation diff
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index 620960c1eff..4e9908e05de 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -2978,7 +2978,7 @@ ${amount} pour ${merchant} - ${date}`,
         phoneOrEmail: 'Téléphone ou e-mail',
         error: {
             agentSignInBlocked:
-                'Les comptes d\u2019agent ne permettent pas de se connecter directement. Pour utiliser un agent, connectez-vous avec votre propre compte et accédez-y via Copilot.',
+                'Les comptes d’agent ne permettent pas de se connecter directement. Pour utiliser un agent, connectez-vous avec votre propre compte et accédez-y via Copilot.',
             invalidFormatEmailLogin: 'L’adresse e-mail saisie est invalide. Veuillez corriger le format et réessayer.',
         },
         cannotGetAccountDetails: 'Impossible de récupérer les détails du compte. Veuillez essayer de vous reconnecter.',

Note

You can apply these changes to your branch by copying the patch to your clipboard, then running pbpaste | git apply 😉

View workflow run

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 2, 2026

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/pages/workspace/accounting/qbo/utils.ts 22.22% <100.00%> (ø)
...ckbooksCompanyCardExpenseAccountSelectCardPage.tsx 0.00% <0.00%> (ø)
...icQuickbooksOutOfPocketExpenseEntitySelectPage.tsx 0.00% <0.00%> (ø)
... and 229 files with indirect coverage changes

@MelvinBot
Copy link
Copy Markdown
Contributor Author

The failing check is unrelated to this PR — main is currently broken, so I'm not pushing a fix here.

The one real failure: typecheck

src/components/Search/SearchFiltersParticipantsSelector.tsx(72,81): error TS2304: Cannot find name 'allPolicies'.

This PR only touches QBO export files and src/languages/* — it does not touch SearchFiltersParticipantsSelector.tsx. CI runs typecheck against the PR test-merged with the latest main, and that merge inherits a broken file from main.

Evidence that the breakage is on main, not this PR

On the current main tip (54ec1bf), allPolicies is used at line 72 but never declared anywhere in the file:

72:    const expensifyTeamExclusions = getExpensifyTeamExclusions(personalDetails, allPolicies, currentUserEmail);

The PR branch still carries the original declaration (const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY);) because it was cut from an older, healthy main — but since the PR doesn't modify this file, the CI test-merge uses main's broken copy. The error's line number (72) matches main's version, not the PR branch's (where the usage sits at line 81), confirming CI typechecked the merged-with-main content.

What needs to happen

The allPolicies declaration needs to be restored in SearchFiltersParticipantsSelector.tsx on main (a recent merge dropped it). That's a separate main fix — it's blocking every open PR, not just this one — and patching an unrelated file inside this QBO-cleanup PR would be the wrong place for it. Once main is green, this PR's typecheck will pass on the next run.

The checklist and all other checks pass; branch-perf-tests, knip, and ESLint were still running at time of writing.

@MelvinBot
Copy link
Copy Markdown
Contributor Author

The two failing checks (typecheck and ESLint) are not caused by this PRmain is currently broken, and the merge-commit CI builds inherits the breakage.

Root cause

src/components/Search/SearchFiltersParticipantsSelector.tsx:72 on main calls getExpensifyTeamExclusions(personalDetails, allPolicies, currentUserEmail), but the const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY) declaration was deleted — so allPolicies is undefined there. That produces exactly the two errors seen in CI (both at 72:81):

  • typecheck: error TS2304: Cannot find name 'allPolicies'.
  • ESLint: @typescript-eslint/no-unsafe-argument (the now-error-typed allPolicies).

This file is not in this PR's diff (it only touches QBO export helpers + language files), so the failures can't originate here. The declaration was removed in 85e40e5 (merged via #92045) which dropped the allPolicies useOnyx call and two of its three usages but left the getExpensifyTeamExclusions usage behind. Since getExpensifyTeamExclusions still requires an OnyxCollection<Policy> second argument, the leftover reference is a regression. It most likely passed CI on #92045 due to a semantic merge conflict with a concurrently-landed PR.

What needs to happen

This is a main-wide breakage that blocks every open PR's typecheck/ESLint, not just this one. The fix belongs on main (a follow-up/CP from the #92045 author), restoring the declaration:

const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY);

I did not push anything to this PR, since the fix is unrelated to its scope. Once main is fixed, re-run the checks here (or merge main in) and they should pass — this PR's own files type-check and lint cleanly.

@MelvinBot
Copy link
Copy Markdown
Contributor Author

Both failing checks (typecheck and ESLint check) are caused by a pre-existing break on main, not by anything in this PR. No fix is needed here.

Root cause: main currently has a broken SearchFiltersParticipantsSelector.tsx — it uses allPolicies on line 72 (getExpensifyTeamExclusions(personalDetails, allPolicies, currentUserEmail)) but the const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY) declaration is missing. That produces:

  • typecheck: error TS2304: Cannot find name 'allPolicies'
  • ESLint check: @typescript-eslint/no-unsafe-argument (the argument resolves to the TS error type, which is a downstream effect of the same TS2304)

PR checks run against refs/pull/92429/merge (this branch merged into the latest main), so the broken main state gets pulled into the type-check even though this PR doesn't touch that file.

Evidence
  • This PR's changed files are only QBO export pages, qbo/utils.ts, a unit test, and src/languages/*SearchFiltersParticipantsSelector.tsx is not in the diff.
  • This branch's own head (ebeda32) has the correct file — allPolicies is declared on line 73 and used on lines 81/119/202. npm run typecheck passes on the bare branch head locally.
  • git show origin/main:src/components/Search/SearchFiltersParticipantsSelector.tsx | grep allPolicies returns only the line-72 usage — no declaration exists on main.
  • The failing CI run (headSha ebeda32) type-checks the merge ref, where the merged file has the usage but not the declaration.

What needs to happen: This is a broken-main / deploy-blocker situation affecting every open PR, and the fix belongs on main, not here — re-add const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY); to SearchFiltersParticipantsSelector.tsx. Once main is green, merge main into this branch (or re-run the checks) and they'll pass. Per policy I don't push fixes for failures unrelated to a PR's own changes.

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.

3 participants