Skip to content

[Payment due @mananjadhav] Duplicate workspaces with Auth's part names and new rate IDs - #104362

Merged
francoisl merged 47 commits into
Expensify:mainfrom
ishpaul777:ishpaul/675336-duplicate-auth-parts
Dec 2, 2026
Merged

francoisl merged 47 commits into
Expensify:mainfrom
ishpaul777:ishpaul/675336-duplicate-auth-parts

Conversation

@ishpaul777

@ishpaul777 ishpaul777 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Use DuplicatePolicyWithSettings and share setting selection, dependencies, and Travel consent with Copy settings. Copy only selected settings; keep new workspace defaults for everything else.

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/675336
PROPOSAL: N/A

Tests

Manual platform testing is pending. Automated copy/duplicate and affected regression tests pass.

  1. Duplicate a configured workspace and verify its options match Copy settings.
  2. Choose a subset of settings and verify only those settings are copied.
  3. Repeat with no settings selected and verify the workspace keeps its defaults.
  • Verify that no errors appear in the JS console

Offline tests

  1. Disconnect and duplicate with a subset of settings; verify the new workspace shows those settings.
  2. Reconnect and verify completion without errors or duplicate rates.

QA Steps

  1. Follow the Tests and Offline tests steps above.
  2. Select Accounting or Workflows with reimbursement banking; verify dependent settings and Currency stay selected when required.
  3. Select Travel from a source with completed setup; verify consent is required and the duplicate gets its own Travel setup.
  4. Deselect Overview while Travel is selected; verify Travel requires an address.
  5. Copy Rules and Merchant rules separately, then Time tracking and Receipt partners; verify only selected groups are copied.
  6. Duplicate with only Overview; verify the rules PDF is copied.
  7. Run Copy settings between existing workspaces and verify completion.

Agent rules follow-up for https://github.com/Expensify/Web-Expensify/pull/57988 and https://github.com/Expensify/Auth/pull/26320. Run with both backend changes deployed.

  1. Add two Agent rules with different instructions to a Control workspace under Rules > Agents.
  2. Duplicate that workspace with Rules and Members selected; verify the duplicate has both saved instructions and its own RuleBot under Members, with a different email from the source RuleBot.
  3. Reload the duplicate and reopen Rules > Agents; verify both rules remain, then edit one and verify the source workspace's instructions stay unchanged.
  4. Duplicate the source again with Rules deselected; verify the new workspace has no Agent rules.
  5. Copy Rules to an existing Control workspace with its own Agent rules; verify its instructions are replaced and its RuleBot email stays unchanged.
  6. Copy Rules from a Control workspace with no Agent rules to that target; verify the target's Agent rules are cleared.
  7. Copy Rules from the configured source to a Collect workspace; verify an upgrade is required before copying.
  8. Repeat the Agent-rules duplication and copy checks on mobile.
  • 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.

Screenshots/Videos

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

@codecov

codecov Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/CONST/SENTRY_LABEL.ts 100.00% <ø> (ø)
src/components/PolicyCopyTravelTerms.tsx 100.00% <100.00%> (ø)
src/libs/API/types.ts 100.00% <ø> (ø)
src/libs/CopyPolicySettingsUtils.ts 89.26% <100.00%> (+2.43%) ⬆️
src/libs/FlagForReviewRulesUtils.ts 26.66% <ø> (-2.37%) ⬇️
src/libs/PolicyRulesUtils.ts 93.33% <100.00%> (+43.33%) ⬆️
src/libs/PolicyUtils/customUnits.ts 100.00% <100.00%> (+4.16%) ⬆️
src/libs/PolicyUtils/policy.ts 84.66% <ø> (-0.50%) ⬇️
src/libs/RequireFieldsRulesUtils.ts 28.65% <ø> (-4.60%) ⬇️
src/libs/actions/Policy/CopyPolicySettings.ts 97.47% <100.00%> (+10.92%) ⬆️
... and 9 more
... and 7 files with indirect coverage changes

ishpaul777 and others added 2 commits October 30, 2026 05:26
…675336-duplicate-auth-parts

# Conflicts:
#	src/libs/actions/Policy/Policy.ts
#	src/pages/workspace/copyPolicySettings/CopyPolicySettingsSelectFeaturesPage.tsx
@ishpaul777
ishpaul777 marked this pull request as ready for review October 30, 2026 20:13
@ishpaul777
ishpaul777 requested review from a team as code owners October 30, 2026 20:13
@melvin-bot
melvin-bot Bot requested review from parasharrajat and removed request for a team October 30, 2026 20:13
@melvin-bot

melvin-bot Bot commented Oct 30, 2026

Copy link
Copy Markdown

@parasharrajat 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]

@melvin-bot
melvin-bot Bot requested review from garrettmknight and removed request for a team October 30, 2026 20:13
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 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-25T20:15:51.998466Z f80fd5e New commits
ℹ️ 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: 627e30f405

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/libs/actions/Policy/Policy.ts Resolved
Comment thread tests/actions/CopyPolicySettingsTest.ts Resolved
Comment thread src/libs/actions/Policy/Policy.ts Resolved
Comment thread src/libs/actions/Policy/Policy.ts Resolved
@ishpaul777

Copy link
Copy Markdown
Contributor Author

@MelvinBot review this PR extensively and carefully
Check for:

  • Correctness: bugs, edge cases, regressions, incorrect assumptions, error handling.
  • Code quality: unnecessary complexity, poor naming, over-engineering, maintainability.
  • DRY: duplicated logic or business rules where extraction genuinely improves the code.
  • Performance: unnecessary loops, nested/repeated iterations, expensive work in loops, unnecessary API/DB calls, redundant computations.
  • Simplicity: verbose or unnecessarily lengthy code, redundant conditions/variables, abstractions that don't add value, dangling pointer or pass by reference that can messup (unless its a default way of doing it).
  • Comments: remove unnecessary/obvious comments, especially verbose or undurable comments that are likely to become stale as the code changes.

Please leave inline code comments as many as you want

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

Inline review from MelvinBot. Summary follows in a separate comment.

Comment thread src/libs/actions/Policy/Policy.ts Resolved
Comment thread src/libs/CopyPolicySettingsUtils.ts Resolved
Comment thread src/libs/CopyPolicySettingsUtils.ts Resolved
Comment thread src/libs/actions/Policy/Policy.ts Resolved
Comment thread src/libs/PolicyRulesUtils.ts Resolved
Comment thread src/libs/PolicyRulesUtils.ts Resolved
@mananjadhav

mananjadhav commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

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-duplicate-workspace.mov
Android: mWeb Chrome
mweb-chrome-duplicate-workspace.mov
iOS: HybridApp
ios-duplicate-workspace.mov
iOS: mWeb Safari
ios-duplicate-workspace.mov
MacOS: Chrome / Safari
web-duplicate-workspace.mov

@mananjadhav mananjadhav left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

May be best to get @Expensify/design input too? wdyt @ishpaul777 @francoisl ?

@melvin-bot
melvin-bot Bot requested a review from francoisl November 30, 2026 18:34
@melvin-bot melvin-bot Bot changed the title Duplicate workspaces with Auth's part names and new rate IDs [Payment due @mananjadhav] Duplicate workspaces with Auth's part names and new rate IDs Nov 30, 2026
@melvin-bot

melvin-bot Bot commented Nov 30, 2026

Copy link
Copy Markdown

🎯 @mananjadhav, thanks for reviewing and testing this PR! 🎉

A payment issue will be created for your review once this PR is deployed to production.
E/E issue linked to the PR - https://www.github.com/Expensify/Expensify/issues/675336.

If payment is not needed (e.g., regression PR review fix etc), react with 👎 to this comment to prevent the payment issue from being created.

@shawnborton

Copy link
Copy Markdown
Contributor

I don't love the + icon for duplicate workspace... bummer that the copy icon is already being used here though:

CleanShot 2026-11-30 at 7 49 43 PM@2x

Any thoughts @Expensify/design ?

@dannymcclain

Copy link
Copy Markdown
Contributor

I don't love the + icon for duplicate workspace... bummer that the copy icon is already being used here though:

@shawnborton Yeah I don't love that either. What if we did something like this?

CleanShot 2026-11-30 at 1 11 02 PM@2x

I kinda like the generic duplicate icon since we could use it for other duplicate actions elsewhere. Or we could follow what we do elsewhere for duplicate and make a workspace specific version.

Other dupe examples:
CleanShot 2026-11-30 at 1 07 17 PM@2x

@shawnborton

Copy link
Copy Markdown
Contributor

I could get down with any of those. I could see generic dupe being too close to Copy, so maybe we wanna lick one of the bottom two you made? That's kinda where I lean.

@dannymcclain

dannymcclain commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

I could get down with any of those. I could see generic dupe being too close to Copy, so maybe we wanna lick one of the bottom two you made? That's kinda where I lean.

Right on. Was doing some cursory research and apparently the copy + icon is a fairly common icon for duplicate. But if we're worried about it being too close/if we don't wanna mess, I'd go for the one that matches the dupe for expenses & reports. Like this:

image

cc @dubielzyk-expensify for thoughts too

@shawnborton

Copy link
Copy Markdown
Contributor

is a fairly common icon for duplicate

Ah if that's the case, I say let's go for it then? But yeah, let's let the judge weigh in!

@dubielzyk-expensify

dubielzyk-expensify commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Yeah, I remember looking into this for something a while back (probs the duplicate expense thing) and I saw the exact same thing, which is copy and duplicate are generally pretty similar when it comes to icon treatment.

If anything, I wonder if we could have duplicate workspace use the copy icon and then copy settings use a cog with a copy subscript icon. If we're worried about them clashing.

CleanShot 2026-12-01 at 9 44 02 AM

I actually don't mind the cog with the arrow in the above. And I would usually say that we should just use the copy icon for duplicate, but when there are two settings that use the same icon, I think we should try to avoid it even though I think it's the right icon for both actions in general

@shawnborton

Copy link
Copy Markdown
Contributor

No strong feelings. Looking at this with fresh eyes, I quite like the idea of extending this pattern that Danny made here:

image

Happy to go with anything though.

@dannymcclain

Copy link
Copy Markdown
Contributor

No strong feelings. Looking at this with fresh eyes, I quite like the idea of extending this pattern that Danny made here:

I'd probably vote to go with this for now as well. I've been finding the subscript icons to be a little busy or overly complicated/detailed lately. And since we already have this pattern for report and expense, I think it makes sense to just carry it through for this as well.

(Personally I'm still a fan of just using a singular, generic duplicate icon in all situations, but we can always do that later if we decide we like that).

@dubielzyk-expensify

Copy link
Copy Markdown
Contributor

Let's do it 👍 I like the duplicate pattern as well so definitely fine with going with that

@francoisl

Copy link
Copy Markdown
Contributor

Cool, thanks design people for chiming in. So it sounds like we're leaning towards using new icons, right? Given that this PR doesn't touch the menu icon and is already pretty big, maybe we can do this in a follow-up PR?

@dubielzyk-expensify

Copy link
Copy Markdown
Contributor

That works for me 👍

@francoisl

Copy link
Copy Markdown
Contributor

Sweet, let's work on that in #108610 then.

@francoisl
francoisl merged commit ca2d6c3 into Expensify:main Dec 2, 2026
43 of 47 checks passed
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

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

@OSBotify

OSBotify commented Dec 2, 2026

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

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

@OSBotify

OSBotify commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/francoisl in version: 9.5.58-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

Help site update needed — duplication now supports selecting Currency, Time, and Receipt partners. Created a minimal draft help site PR, labeled HelpDot and assigned to ishpaul777.

@ishpaul777, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR Ready for review


view run

@OSBotify

OSBotify commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/roryabraham in version: 9.5.58-3 🚀

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

Bundle Size Analysis (Sentry):

@melvin-bot

melvin-bot Bot commented Dec 4, 2026

Copy link
Copy Markdown

🤖 Payment issue created: #108923

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.

9 participants