Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Due for payment 2025-03-17] [$250] Sage Intacct - Preferred exporter remains the same after changing the role of admin to member #55729

Open
3 of 8 tasks
lanitochka17 opened this issue Jan 24, 2025 · 41 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Jan 24, 2025

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.0.89-2
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): htad26+ri@gmail.com
Issue reported by: Applause - Internal Team

Action Performed:

Prerequisite
An account with a workspace connected to Sage Intacct

  1. Go to members > Invite > Choose the role as Admin > Finish the flow
  2. Navigate to accounting > Export > Preferred exporter > Change the exporter to the newly invited admin
  3. Go to members > Change the role of the newly invited admin to member
  4. Go back to Preferred exporter page and check the exporter

Expected Result:

The preferred exporter is changed back to the owner/admin of the workspace since only admins can be selected as preferred exporter

Actual Result:

The non-admin member is still selected as the preferred exporter even if it is not listed in the preferred exporter page. User has to manually change the exporter

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Bug6722779_1737727149465.2025-01-24_16_49_00.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021882884778254645916
  • Upwork Job ID: 1882884778254645916
  • Last Price Increase: 2025-02-14
  • Automatic offers:
    • dominictb | Reviewer | 106194656
    • FitseTLT | Contributor | 106194658
Issue OwnerCurrent Issue Owner: @lschurr
@lanitochka17 lanitochka17 added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Jan 24, 2025
Copy link

melvin-bot bot commented Jan 24, 2025

Triggered auto assignment to @lschurr (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@FitseTLT
Copy link
Contributor

FitseTLT commented Jan 24, 2025

🚨 Edited by proposal-police: This proposal was edited at 2025-01-24 21:04:07 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

Sage Intacct - Preferred exporter remains the same after changing the role of admin to member

What is the root cause of that problem?

We are displaying exporter config without checking if it is an admin

title: exportConfig?.exporter ?? translate('workspace.sageIntacct.notConfigured'),

but we don't see it selected in the list when opening preferred exporter page because we only include list of admins of the workspace

What changes do you think we should make in order to solve the problem?

In updateWorkspaceMembersRole we should check if it is the preferred exporter (policy?.connections?.intacct?.config.export.exporter) and the role is being demoted from admin role then we should either

  1. update exporter to the police owner optimistically like prepareOnyxDataForExportUpdate and make the corresponding BE update on UPDATE_WORKSPACE_MEMBERS_ROLE API
  2. or if we don't want to make a BE change we can use the existing updateSageIntacctExporter to set the owner as the exporter

These problems also for the other accounting integrations so similar fix can be applied. Similarly, this changes can be applied for the case of the admin member removal from a workspace if the user was the preferred exporter.

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

We can create tests for updateWorkspaceMembersRole to assert it properly updates exporter when the default exporter is demoted from admin role.

What alternative solutions did you explore? (Optional)

If we don't want to change the exporter to the owner at least we have to avoid showing the exporter in SageIntacctExportPage if it is not an admin because it will not currently be displayed in SageIntacctPreferredExporterPage as we only include admins in the list.

@lschurr lschurr added the External Added to denote the issue can be worked on by a contributor label Jan 24, 2025
Copy link

melvin-bot bot commented Jan 24, 2025

Job added to Upwork: https://www.upwork.com/jobs/~021882884778254645916

@melvin-bot melvin-bot bot changed the title Sage Intacct - Preferred exporter remains the same after changing the role of admin to member [$250] Sage Intacct - Preferred exporter remains the same after changing the role of admin to member Jan 24, 2025
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 24, 2025
Copy link

melvin-bot bot commented Jan 24, 2025

Triggered auto assignment to Contributor-plus team member for initial proposal review - @dominictb (External)

@ugogiordano
Copy link
Contributor

@lanitochka17, how can an external contributor test an accounting system connected to the workspace?

@melvin-bot melvin-bot bot added the Overdue label Jan 27, 2025
@ugogiordano
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

The preferred exporter in SageIntacctPreferredExporterPage doesn’t update when changing the user’s role from admin to member.

What is the root cause of that problem?

The issue is that SageIntacctPreferredExporterPage is using WithPolicyProps, which does not define the isConnectionDataFetchNeeded variable:

function SageIntacctPreferredExporterPage({policy}: WithPolicyProps) {

type WithPolicyOnyxProps = {
policy: OnyxEntry<OnyxTypes.Policy>;
policyDraft: OnyxEntry<OnyxTypes.Policy>;
isLoadingPolicy: boolean;
};
type WithPolicyProps = WithPolicyOnyxProps & {
route: PolicyRoute;
};

This variable is defined by WithPolicyConnectionsProps:

type WithPolicyConnectionsProps = WithPolicyProps & {
isConnectionDataFetchNeeded: boolean;
};

and is needed to trigger the connection data fetch when the role changes. Without this variable, the exporter doesn't update as expected.

In contrast, all the other pages for the account systems use WithPolicyConnectionsProps,

function XeroPreferredExporterSelectPage({policy}: WithPolicyConnectionsProps) {

function NetSuiteTaxPostingAccountSelectPage({policy}: WithPolicyConnectionsProps) {

function QuickbooksDesktopPreferredExporterConfigurationPage({policy}: WithPolicyConnectionsProps) {

function QuickbooksPreferredExporterConfigurationPage({policy}: WithPolicyConnectionsProps) {

, which correctly includes this variable and ensures the update is triggered when the role changes.

What changes do you think we should make in order to solve the problem?

Change SageIntacctPreferredExporterPage to use WithPolicyConnectionsProps instead of WithPolicyProps. This will ensure the component gets the isConnectionDataFetchNeeded variable and triggers the data fetch when the role changes.

...
import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections';
...


function SageIntacctPreferredExporterPage({policy}: WithPolicyConnectionsProps) {
...

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

  • Test that changing the user’s role from admin to member correctly triggers the preferred exporter update.
  • Ensure the component fetches connection data when isConnectionDataFetchNeeded is true.

What alternative solutions did you explore? (Optional)

N/A

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.

Copy link

melvin-bot bot commented Jan 28, 2025

@lschurr, @dominictb Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@lanitochka17
Copy link
Author

@ugogiordano If you don't have access to Sage Intacct then you won't be able to check this.

Copy link

melvin-bot bot commented Jan 30, 2025

@lschurr, @dominictb Huh... This is 4 days overdue. Who can take care of this?

@dominictb
Copy link
Contributor

dominictb commented Jan 30, 2025

Just able to reproduce. Reviewing.

@melvin-bot melvin-bot bot removed the Overdue label Jan 30, 2025
Copy link

melvin-bot bot commented Jan 31, 2025

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

Copy link

melvin-bot bot commented Feb 3, 2025

@lschurr, @dominictb Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@melvin-bot melvin-bot bot added the Overdue label Feb 3, 2025
@dominictb
Copy link
Contributor

dominictb commented Feb 4, 2025

UpdateWorkpsaceMembersRole and DeleteMembersFromWorkspace API do not update the preferred exporter accordingly. This is a BE issue but we still need to work on optimistic data as well.

I need confirmation on the expected behavior.

Context: The integration's Preferred exporter should always be a workspace admin. If the current preferred exporter's role is no longer an Admin, or get removed from the workspace, what should happen?

  1. Fallback to the workspace owner or another admin
  2. Clear the preferred exporter and let the user select another one later

🎀👀🎀

Copy link

melvin-bot bot commented Feb 4, 2025

Triggered auto assignment to @cristipaval, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@cristipaval
Copy link
Contributor

@yuwenmemon, I see you know about Sage Intacct integration in NewDot. Could you please manage this one? 🙏

Feel free to reassign it to me if you're full.

@melvin-bot melvin-bot bot removed the Overdue label Feb 17, 2025
@dominictb
Copy link
Contributor

@FitseTLT's proposal LGTM 🎀👀🎀.

Let's fallback to the workspace owner optimistically in this case. We need BE changes for the UpdateWorkpsaceMembersRole and DeleteMembersFromWorkspace as well.

And don't forget to address these points:

These problems also for the other accounting integrations so similar fix can be applied.

Similarly, this changes can be applied for the case of the admin member removal from a workspace if the user was the preferred exporter.

Copy link

melvin-bot bot commented Feb 19, 2025

Current assignee @yuwenmemon is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 19, 2025
Copy link

melvin-bot bot commented Feb 19, 2025

📣 @dominictb 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Feb 19, 2025

📣 @FitseTLT 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@yuwenmemon
Copy link
Contributor

@dominictb What makes you say we need backend changes? From what I can see in the code we send onyx updates for this change...

(Linking for my own reference, you won't be able to see this code)
Exporter is replaced in the policy here: https://github.com/Expensify/Auth/blob/0f1b1fd3fcd3bfc86f73fd091023c48c452d69d3/auth/lib/Policy.cpp#L1568
Onyx update is queued here:
https://github.com/Expensify/Auth/blob/0f1b1fd3fcd3bfc86f73fd091023c48c452d69d3/auth/lib/Policy.cpp#L3471-L3473

I'm even seeing these updates queued locally in my logs:

2025-02-21T07:23:04.943139+00:00 expensidev2004 bedrock: 2GHZy9 yuwen@expensify.com (AuthCommand.cpp:620) queueOnyxUpdatesForChannels [socket1927] [dbug] Queued update has data: [{"key":"policy_0F543102448B9559","onyxMethod":"merge","value":{"connections":{"netsuite":{"options":{"config":{"exporter":"yuwen@expensify.com"}}}},"lastModified":1740122584942924}}]

Can you please double check that you're indeed not getting an onyx update for the updated exporter?

@yuwenmemon
Copy link
Contributor

Oh wait... I see it now. It's spelled wrong in our server code intaact instead of intacct 😅

@yuwenmemon
Copy link
Contributor

That's why it was only for this integration

@yuwenmemon
Copy link
Contributor

Have a fix for the BE up.

@melvin-bot melvin-bot bot added the Overdue label Feb 24, 2025
Copy link

melvin-bot bot commented Feb 24, 2025

@yuwenmemon, @lschurr, @FitseTLT, @dominictb Whoops! This issue is 2 days overdue. Let's get this updated quick!

@dominictb
Copy link
Contributor

@FitseTLT we don't need to wait till BE changes are done.

@yuwenmemon
Copy link
Contributor

BE has been deployed to production!

@melvin-bot melvin-bot bot removed the Overdue label Feb 24, 2025
@yuwenmemon
Copy link
Contributor

Setting @FitseTLT as the starred assignee now

@FitseTLT
Copy link
Contributor

Will create the PR tomorrow

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Feb 25, 2025
@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Mar 10, 2025
@melvin-bot melvin-bot bot changed the title [$250] Sage Intacct - Preferred exporter remains the same after changing the role of admin to member [Due for payment 2025-03-17] [$250] Sage Intacct - Preferred exporter remains the same after changing the role of admin to member Mar 10, 2025
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 10, 2025
Copy link

melvin-bot bot commented Mar 10, 2025

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Mar 10, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.10-6 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2025-03-17. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Mar 10, 2025

@dominictb @lschurr @dominictb The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
Status: Bugs and Follow Up Issues
Development

No branches or pull requests

7 participants