Repository navigation
Description
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.1.41-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @JmillsExpensify
Slack conversation (hyperlinked to channel name): #Expensify Bugs
Action Performed:
- Create a Collect workspace
- Navigate to Workflows in the workspace editor
- Click Add approval workflow
- Get the Control update modal, confirm
- Add custom approval workflows
- Navigate to Overview in the workspace editor
- Click Plan and choose Collect
- Confirm the downgrade
Expected Result:
Added approval flow removed or not displayed
Actual Result:
Existing custom workflows still appear in the workspace editor, even though they should have been removed and no longer apply.
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
- Android: App
- Android: mWeb Chrome
- iOS: App
- iOS: mWeb Safari
- iOS: mWeb Chrome
- Windows: Chrome
- MacOS: Chrome / Safari
- MacOS: Desktop
Platforms Tested:
On which of our officially supported platforms was this issue tested:- Android: App
- Android: mWeb Chrome
- iOS: App
- iOS: mWeb Safari
- iOS: mWeb Chrome
- Windows: Chrome
- MacOS: Chrome / Safari
- MacOS: Desktop
Screenshots/Videos
Add any screenshot/video evidence
Recording.1198.mp4
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~021920211342191991857
- Upwork Job ID: 1920211342191991857
- Last Price Increase: 2025-05-21
Issue Owner
Current Issue Owner: @carlosmiceliMetadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
melvin-bot commentedon May 7, 2025
Current assignee @JmillsExpensify is eligible for the Bug assigner, not assigning anyone new.
[-]Downgrading to Collect doesn’t clear Control features[/-][+][$250] Downgrading to Collect doesn’t clear Control features[/+]melvin-bot commentedon May 7, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021920211342191991857
melvin-bot commentedon May 7, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Pujan92 (
External)JmillsExpensify commentedon May 7, 2025
For the solutions, let's make sure that we are clearing related workspace features whenever an admin downgrades from Control to Collect. That minimally includes:
Based on testing I believe the main loophole is approval workflows, though I think we need to confirm as part of this issue.
MobileMage commentedon May 8, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a workspace is downgraded from a "Control" plan to a "Collect" plan, the user interface does not immediately and fully reflect this change. Features exclusive to the Control plan (like custom approval workflows, advanced rules, report fields, and per diem) may still appear in the UI or appear in an inconsistent state. This is because the frontend data (in Onyx) is not comprehensively updated optimistically during the downgrade action.
What is the root cause of that problem?
The frontend root cause is that the
downgradeToTeamaction insrc/libs/actions/Policy/Policy.tsdoes not clear all Control-plan-specific attributes from the policy object in its optimistic Onyx update. It primarily changes the policytypeandisPendingDowngradestatus, leaving other Control-specific data intact on the client-side until a full policy refresh occurs from the backend.What changes do you think we should make in order to solve the problem?
We will modify the
downgradeToTeamfunction insrc/libs/actions/Policy/Policy.ts. TheoptimisticDatapayload sent toOnyx.METHOD.MERGEwill be expanded to include a more comprehensive set of default "Collect" plan values for the policy object. This ensures that the UI immediately reflects the cleared state of Control-specific features.Specifically, the
optimisticDatawill be updated to:approvalModeto the Collect plan's default (e.g.,CONST.POLICY.APPROVAL_MODE.OPTIONAL) and clear any policy-levelapprover.rulesobject on the policy (e.g.,policy.rules.approvalRules = [],policy.rules.expenseRules = []) to an empty or default state expected for Collect plans.fieldList(e.g.,policy.fieldList = {}) to optimistically remove custom report fields from the UI.customUnits(e.g.,policy.customUnits = {}) and any other per diem related configurations from the policy object.The
failureDatawill also be correspondingly updated to ensure that if the backend API call fails, these additional optimistically set fields are reverted to their state prior to the downgrade attempt, using thecurrentPolicyvalues.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
None.
What alternative solutions did you explore? (Optional)
Relying solely on backend changes for data clearing without comprehensive optimistic frontend updates.
nkdengineer commentedon May 8, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Existing custom workflows still appear in the workspace editor, even though they should have been removed and no longer apply.
What is the root cause of that problem?
After we downgrade to the collect, the backend doesn't update employee data to clear the custom workflow and we also don't update this in optimistic data
What changes do you think we should make in order to solve the problem?
We should update:
BASIC, clearforwardToand updatesubmitTofor all members to default approver.App/src/libs/actions/Policy/Policy.ts
Line 3720 in bd59655
I checked and the backend has done point 2 and updated the approval mode, we only update update
employeeListdata.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
None
What alternative solutions did you explore? (Optional)
NA
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
bradyrose commentedon May 8, 2025
Withdrawing this proposal to comply with Expensify’s one-proposal-at-a-time policy.
Hope to circle back if it’s still open later. Thanks!
16 remaining items
carlosmiceli commentedon May 20, 2025
Will do my best to get started on this tomorrow.
carlosmiceli commentedon May 20, 2025
@JmillsExpensify from the Expected Result in the description I'm a bit confused with the sentence "Existing custom workflows still appear in the workspace editor, even though they should have been removed and no longer apply."
Can I get some clarification of:
Is it this being toggled off:
Or this (and Workflows remain open in the LHN):
Or this should still be visible and the workflows removed?:
melvin-bot commentedon May 21, 2025
@JmillsExpensify @carlosmiceli @Pujan92 this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
melvin-bot commentedon May 21, 2025
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
carlosmiceli commentedon May 23, 2025
Asking for clarification on Slack: https://expensify.slack.com/archives/C03U7DCU4/p1747999493664739
JmillsExpensify commentedon May 23, 2025
No
No
Any workflow aside from the default workflow should be removed.
carlosmiceli commentedon May 26, 2025
PR is up for review.
melvin-bot commentedon Jun 3, 2025
@carlosmiceli Whoops! This issue is 2 days overdue. Let's get this updated quick!
carlosmiceli commentedon Jun 3, 2025
PR was deployed, closing.