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

[HOLD for payment 2025-01-17] [$250] Copilot not correctly displayed in report action #53882

Closed
1 of 8 tasks
m-natarajan opened this issue Dec 10, 2024 · 36 comments
Closed
1 of 8 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@m-natarajan
Copy link

m-natarajan commented Dec 10, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.73-6
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:
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: @heyjennahay
Slack conversation (hyperlinked to channel name): expensify_expense

Action Performed:

  1. User A creates a workspace, turns on approvals
  2. User A adds a Copilot (User C)
  3. User A invites User B to the workspace (User B has never interacted with Copilot)
  4. User B submits an expense report, and logs out
  5. Copilot copilots into User A's account and approves the report
  6. User B logs back in and views the report

Expected Result:

User C on the behalf of User A approved the report as action message

Actual Result:

User C on behalf of User C approved the report as action message.

While reproducing observed this: On hovering over a username, the tooltip displays the text:
"User C (as copilot for User C)"

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

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

image (12)

Screenshot 2024-12-10 133348

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021869141076979307076
  • Upwork Job ID: 1869141076979307076
  • Last Price Increase: 2024-12-17
  • Automatic offers:
    • nkdengineer | Contributor | 105389296
Issue OwnerCurrent Issue Owner: @dukenv0307
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 10, 2024
Copy link

melvin-bot bot commented Dec 10, 2024

Triggered auto assignment to @anmurali (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.

@ChavdaSachin
Copy link
Contributor

ChavdaSachin commented Dec 10, 2024

Edited by proposal-police: This proposal was edited at 2024-12-10 20:49:32 UTC.

Proposal

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

What is the root cause of that problem?

wrong Account IDs being passed here.

accountID={Number(icon.id ?? -1)}

accountID={Number(icon.id) ?? -1}

Because icon.id also would contain delegator account id if action is performed by a delegator from here.
} else if (action?.delegateAccountID && personalDetails[action?.delegateAccountID]) {
displayName = delegatePersonalDetails?.displayName ?? '';
avatarSource = delegatePersonalDetails?.avatar;
avatarId = delegatePersonalDetails?.accountID;

const icon = {
source: avatarSource ?? FallbackAvatar,
type: isWorkspaceActor ? CONST.ICON_TYPE_WORKSPACE : CONST.ICON_TYPE_AVATAR,
name: primaryDisplayName ?? '',
id: avatarId,
};

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

pass accountID={Number(action?.actorAccountID ?? -1)} at both places.

accountID={Number(icon.id ?? -1)}

accountID={Number(icon.id) ?? -1}

We would also need to add delegateAccountID prop to component, and render on behalf of delegate... tooltip wherever needed.

Specifics could be discussed during PR.

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

Mostly doesn't need any test for such small ui change, but it could be added in case

What alternative solutions did you explore? (Optional)

Alternatively modify icon object to contain both actorAccountID and delegateAccountID, and modify to read those IDs from icon prop, this will solve both single icon and multiple icon issue.
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.

@nkdengineer
Copy link
Contributor

nkdengineer commented Dec 11, 2024

Edited by proposal-police: This proposal was edited at 2024-12-18 10:17:17 UTC.

Proposal

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

User C on behalf of User C approved the report as action message.

What is the root cause of that problem?

By default, the icon.id is the default user (it's userA in this case) and it's changed to delegateAccountID if the user has personal details of the delegate account.

  1. The user B doesn't have the personal details of user C then icon.id is the userA

} else if (action?.delegateAccountID && personalDetails[action?.delegateAccountID]) {
displayName = delegatePersonalDetails?.displayName ?? '';
avatarSource = delegatePersonalDetails?.avatar;
avatarId = delegatePersonalDetails?.accountID;
} else if (isReportPreviewAction && isTripRoom) {

accountID={Number(icon.id ?? -1)}

  1. The user A has the personal details of user C then icon?.id and action?.delegateAccountID are the same

accountID={Number(icon.id ?? -1)}
delegateAccountID={Number(action?.delegateAccountID ?? -1)}
icon={icon}

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

  1. We should only display the onBehalfOfMessage if delegatePersonalDetails exists.
{!!action?.delegateAccountID && !isReportPreviewAction && !!delegatePersonalDetails && (
    <Text style={[styles.chatDelegateMessage]}>{translate('delegate.onBehalfOfMessage', {delegator: accountOwnerDetails?.displayName ?? ''})}</Text>
)}

{!!action?.delegateAccountID && !isReportPreviewAction && (
<Text style={[styles.chatDelegateMessage]}>{translate('delegate.onBehalfOfMessage', {delegator: accountOwnerDetails?.displayName ?? ''})}</Text>
)}

  1. If action?.delegateAccountID && personalDetails[action?.delegateAccountID] is true, here we should pass accountID as actorAccountID. If we always use actorAccountID that can cause the avatar is display wrongly.

accountID={Number(icon.id ?? -1)}
delegateAccountID={Number(action?.delegateAccountID ?? -1)}
icon={icon}

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

What alternative solutions did you explore? (Optional)

If we want to display the fallback avatar and the delegate email, here we can remove personalDetails[action?.delegateAccountID], fallback displayName to action.originalMessage.delegate and avatarId to action?. delegateAccountID

} else if (action?.delegateAccountID && personalDetails[action?.delegateAccountID]) {
displayName = delegatePersonalDetails?.displayName ?? '';
avatarSource = delegatePersonalDetails?.avatar;
avatarId = delegatePersonalDetails?.accountID;
} else if (isReportPreviewAction && isTripRoom) {

Then here, we will not display the tooltip for this issue because we don't have personal detail of delegate account


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.

@melvin-bot melvin-bot bot added the Overdue label Dec 13, 2024
Copy link

melvin-bot bot commented Dec 16, 2024

@anmurali Eep! 4 days overdue now. Issues have feelings too...

@garrettmknight garrettmknight moved this to Bugs and Follow Up Issues in [#whatsnext] #expense Dec 17, 2024
@anmurali anmurali added the External Added to denote the issue can be worked on by a contributor label Dec 17, 2024
@melvin-bot melvin-bot bot changed the title Copilot not correctly displayed in report action [$250] Copilot not correctly displayed in report action Dec 17, 2024
Copy link

melvin-bot bot commented Dec 17, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 17, 2024
Copy link

melvin-bot bot commented Dec 17, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Dec 17, 2024
@dukenv0307
Copy link
Contributor

We have 2 proplems here:

  1. On user A and C side:

The tooltip shows the wrong value: A (as copilot for A)

@ChavdaSachin We shouldn't use accountID={Number(action?.actorAccountID ?? -1)} we used it before and updated to use icon.id in #51180.

I like @nkdengineer's proposal to switch to use actorAccountID when delegateAccountID exists. But we should use isWorkspaceActor check along with action?.actorAccountID, ... to be safer.

  1. On user B side:

It shows the actor as A -> That's incorrect (the correct actor is C)

BE doesn't return personalDetail of C. I'm not sure it's the bug since user B doesn't know about user C, we need to confirm the expectation in this case.

Overall, let's go with @nkdengineer's proposal to fix the first issue.

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Dec 18, 2024

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

@dukenv0307
Copy link
Contributor

BE doesn't return personalDetail of C. I'm not sure it's the bug since user B doesn't know about user C, we need to confirm the expectation in this case.

@dangrous Can you please take a look at this point? Thanks

@dangrous
Copy link
Contributor

dang, I was hoping someone would come up with a clever FE solution, haha. We're aware of the personalDetails issue but haven't been able to figure out a solution to it yet unfortunately. I'll bump that discussion and see if we can get more action. (internal link here)

But, we can fix the tooltip in the meantime. @nkdengineer's proposal for that makes sense to me!

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 18, 2024
Copy link

melvin-bot bot commented Dec 18, 2024

📣 @nkdengineer 🎉 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 📖

@dangrous
Copy link
Contributor

Just to note - the BE issue would also solve some similar - but rare - issues, like not having the personalDetails of a user with whom the report was previously shared but isn't shared anymore.

Good/bad news about that, it's a broader problem, not just for copilot. Sooooo trying to figure out what to do.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Dec 20, 2024
@garrettmknight garrettmknight moved this from Bugs and Follow Up Issues to Hold for Payment in [#whatsnext] #expense Jan 14, 2025
@dangrous
Copy link
Contributor

I think we're aligned on a way forward in a broad sense, but need to figure out the best way to implement. This may need a mini design doc or at least a little bit more process, so it could be a bit of time.

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Jan 16, 2025
Copy link

melvin-bot bot commented Jan 21, 2025

@dangrous, @anmurali, @dukenv0307, @nkdengineer Huh... This is 4 days overdue. Who can take care of this?

@dangrous
Copy link
Contributor

Oops yes, dropped on this one. The consensus in Slack was that we should make a mini design doc for this issue since the likely solution breaks 1:1:1 and is a little more complicated that initially thought. It will also account for other situations in which we wouldn't have personalDetails stored in the report for users.

I will try to get started on that process this week, though it might be a bit of time.

@dangrous
Copy link
Contributor

Follow up - given that, I think we might want to split this issue, since it's sort of two bugs anyway:

  • Tooltip issue - Fixed, and ready to be paid out
  • Main view issue - Needs the design doc.

@anmurali does that make sense to you? I can make the new issue and then we can pay/close this one.

@anmurali
Copy link

Sounds good to me.

@dangrous
Copy link
Contributor

Great. I made https://github.com/Expensify/Expensify/issues/463521 to cover the internal remaining aspect of this and this App issue to track the actual bug we noticed for this.

We're good to finish out this issue now.

Thanks!

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

melvin-bot bot commented Jan 27, 2025

@dangrous, @anmurali, @dukenv0307, @nkdengineer Huh... This is 4 days overdue. Who can take care of this?

@anmurali
Copy link

@dangrous - do I pay $250 to @dukenv0307 and @nkdengineer ?

@melvin-bot melvin-bot bot removed the Overdue label Jan 29, 2025
@dangrous
Copy link
Contributor

yep that's perfect!

@melvin-bot melvin-bot bot added the Overdue label Jan 31, 2025
Copy link

melvin-bot bot commented Feb 3, 2025

@dangrous, @anmurali, @dukenv0307, @nkdengineer Huh... This is 4 days overdue. Who can take care of this?

Copy link

melvin-bot bot commented Feb 5, 2025

@dangrous, @anmurali, @dukenv0307, @nkdengineer 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

Copy link

melvin-bot bot commented Feb 7, 2025

@dangrous, @anmurali, @dukenv0307, @nkdengineer 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!

@dangrous
Copy link
Contributor

bump @anmurali for payment when you have a moment - thank you!

Copy link

melvin-bot bot commented Feb 11, 2025

@dangrous, @anmurali, @dukenv0307, @nkdengineer 12 days overdue. Walking. Toward. The. Light...

@mallenexpensify
Copy link
Contributor

Contributor: @nkdengineer paid $250 via Upwork
Contributor+: @dukenv0307 due $250 via NewDot

Do we want a regresssion test for this? I feel like we might (it might also be created later if BE work gets gone)

@dukenv0307
Copy link
Contributor

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other:

Where bug was reported:

  • 2a. Reported on production
  • 2b. Reported on staging (deploy blocker)
  • 2c. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other:
  • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

    Link to comment: We need to resolve on both BE and FE side, so no need for offending PR

  • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

    Link to discussion: N/A

  • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again. Yes

Regression Test Proposal Template
  • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

    Link to issue:

Regression Test Proposal

Test:

  1. Set up a copilot relationship
  2. Take action as the copilot
  3. Hover over the copilot's name
  4. Ensure it says [Copilot account] (as copilot for [original account])

Do we agree 👍 or 👎

Sorry, something went wrong.

@melvin-bot melvin-bot bot removed the Overdue label Feb 14, 2025
@dangrous
Copy link
Contributor

I'd modify step 4 to say "Ensure it says [Copilot account] (as copilot for [original account]) in the tooltip" just to be extra clear but otherwise looks great!

@mallenexpensify
Copy link
Contributor

Thx @dukenv0307 and @dangrous test case created with updated step 4

@github-project-automation github-project-automation bot moved this from Hold for Payment to Done in [#whatsnext] #expense Feb 14, 2025
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. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
Status: Done
Development

No branches or pull requests

7 participants