Skip to content

[Due for payment 2025-05-20] [$250]Report - Not Found page is displayed when opening user's chat after paying invoice #60253

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

Closed
2 of 8 tasks
jponikarchuk opened this issue Apr 15, 2025 · 36 comments
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

@jponikarchuk
Copy link

jponikarchuk commented Apr 15, 2025

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.1.28-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
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): [email protected]
Issue reported by: Applause Internal Team
Device used: MacOS Chrome, Desktop
App Component: Chat Report View

Action Performed:

Precondition:

  • User A has a workspace with invoicing enabled. (User A: [email protected])
  • User B does not have any workspace. (User B: [email protected])
  • User A and B do not have chat history with each other.
  1. [User A] Send an invoice to User B.
  2. [User B] Go to Reports > Chats.
  3. [User B] Click Pay.
  4. [User B] Click Pay as business > Pay elsewhere.
  5. [User B] Click on the workspace avatar > Members > Click on User A’s profile > Click on Message button

Expected Result:

User B should be navigated to a chat with user A

Actual Result:

Not found page is displayed, and an undefined value is displayed in the URL

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021914790682113304013
  • Upwork Job ID: 1914790682113304013
  • Last Price Increase: 2025-04-22
Issue OwnerCurrent Issue Owner: @twisterdotcom
@jponikarchuk jponikarchuk added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Apr 15, 2025
Copy link

melvin-bot bot commented Apr 15, 2025

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

@bernhardoj
Copy link
Contributor

bernhardoj commented Apr 15, 2025

🚨 Edited by proposal-police: This proposal was edited at 2025-04-15 10:00:43 UTC.

Proposal

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

Not found report when we press the message button after receiving invoice.

What is the root cause of that problem?

When we receive the invoice and then press the Message button on the new user profile page, we call navigateToAndOpenReportWithAccountIDs.

App/src/libs/actions/Report.ts

Lines 1300 to 1312 in bd8186e

function navigateToAndOpenReportWithAccountIDs(participantAccountIDs: number[]) {
let newChat: OptimisticChatReport | undefined;
const chat = getChatByParticipants([...participantAccountIDs, currentUserAccountID]);
if (!chat) {
newChat = buildOptimisticChatReport({
participantList: [...participantAccountIDs, currentUserAccountID],
});
}
const report = chat ?? newChat;
// We want to pass newChat here because if anything is passed in that param (even an existing chat), we will try to create a chat on the server
openReport(report?.reportID, '', [], newChat, '0', false, participantAccountIDs);
Navigation.navigateToReportWithPolicyCheck({report});

It first finds the existing chat between the users, and if not found, it will create a new report. In our case, we don't have it yet, but getChatByParticipants returns a result, but the report object doesn't have the reportID, basically the data is incomplete. The data is received from the Pusher when receiving the invoice.

Since the reportID is undefined, we are navigated to the r/undefined page.

After further investigation, the incomplete report object is the invoice transaction thread.

Image

It's considered a one-on-one chat.

App/src/libs/ReportUtils.ts

Lines 2207 to 2216 in 1493af6

function isOneOnOneChat(report: OnyxEntry<Report>): boolean {
const participants = report?.participants ?? {};
const participant = currentUserAccountID ? participants[currentUserAccountID] : undefined;
const isCurrentUserParticipant = participant ? 1 : 0;
const participantAmount = Object.keys(participants).length - isCurrentUserParticipant;
if (participantAmount !== 1) {
return false;
}
return !isChatRoom(report) && !isExpenseRequest(report) && !isMoneyRequestReport(report) && !isPolicyExpenseChat(report) && !isTaskReport(report) && isDM(report) && !isIOUReport(report);
}

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

We need to also check whether the report has reportID or not to decide whether we want to create a new report or not.

const chat = getChatByParticipants([...participantAccountIDs, currentUserAccountID]);
if (!chat?.reportID) {
    newChat = buildOptimisticChatReport({
        participantList: [...participantAccountIDs, currentUserAccountID],
    });
}
const report = newChat ?? chat;

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

We can test by calling navigateToAndOpenReportWithAccountIDs and make sure navigateToReportWithPolicyCheck is called with a report object that has the reportID, even though getChatByParticipants returns an incomplete report data.

What alternative solutions did you explore? (Optional)

Update isOneOnOneChat (or isDM) to return true if the report has policyID of _FAKE_.

@melvin-bot melvin-bot bot added the Overdue label Apr 17, 2025
@RachCHopkins
Copy link
Contributor

Sorry, I'm OOO until the 28th and I haven't had time to triage this yet. Reassigning.

@melvin-bot melvin-bot bot removed the Overdue label Apr 17, 2025
@RachCHopkins RachCHopkins added Overdue Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels Apr 17, 2025
Copy link

melvin-bot bot commented Apr 17, 2025

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

@melvin-bot melvin-bot bot removed the Overdue label Apr 17, 2025
@RachCHopkins RachCHopkins removed their assignment Apr 17, 2025
@Christinadobrzyn
Copy link
Contributor

I can't get this to work, I think everything is broken today in NewDot. I'll try on Monday

@melvin-bot melvin-bot bot added the Overdue label Apr 21, 2025
@Christinadobrzyn
Copy link
Contributor

Christinadobrzyn commented Apr 21, 2025

Okay, I got this to work. I think it is resolved, I was routed to the chat with User A when clicking the message. I'll ask QA to test.

https://expensify.slack.com/archives/C9YU7BX5M/p1745269473227699

@melvin-bot melvin-bot bot removed the Overdue label Apr 21, 2025
@Christinadobrzyn
Copy link
Contributor

@bernhardoj are you still getting this error?

@IuliiaHerets
Copy link

Issue is still reproducible

Screen.Recording.2025-04-22.at.7.46.36.in.the.morning.mp4

@Christinadobrzyn Christinadobrzyn added the External Added to denote the issue can be worked on by a contributor label Apr 22, 2025
@melvin-bot melvin-bot bot changed the title Report - Not Found page is displayed when opening user's chat after paying invoice [$250] Report - Not Found page is displayed when opening user's chat after paying invoice Apr 22, 2025
Copy link

melvin-bot bot commented Apr 22, 2025

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 22, 2025
Copy link

melvin-bot bot commented Apr 22, 2025

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

@Christinadobrzyn
Copy link
Contributor

@mananjadhav, can you check this proposal when you have a moment? #60253 (comment)

@mananjadhav
Copy link
Collaborator

@bernhardoj's proposal looks good to me.

🎀 👀 🎀 C+ reviewed.

@melvin-bot melvin-bot bot added the Awaiting Payment Auto-added when associated PR is deployed to production label May 13, 2025
@melvin-bot melvin-bot bot changed the title [$250][not here] Report - Not Found page is displayed when opening user's chat after paying invoice [Due for payment 2025-05-20] [$250][not here] Report - Not Found page is displayed when opening user's chat after paying invoice May 13, 2025
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label May 13, 2025
Copy link

melvin-bot bot commented May 13, 2025

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

Copy link

melvin-bot bot commented May 13, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.44-8 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-05-20. 🎊

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

  • @mananjadhav requires payment through NewDot Manual Requests
  • @bernhardoj requires payment through NewDot Manual Requests

Copy link

melvin-bot bot commented May 13, 2025

@mananjadhav @Christinadobrzyn @mananjadhav 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]

@Christinadobrzyn Christinadobrzyn changed the title [Due for payment 2025-05-20] [$250][not here] Report - Not Found page is displayed when opening user's chat after paying invoice [Due for payment 2025-05-20] [$250]Report - Not Found page is displayed when opening user's chat after paying invoice May 13, 2025
@Christinadobrzyn
Copy link
Contributor

@mananjadhav Do we need a regression test?

@Christinadobrzyn Christinadobrzyn added Daily KSv2 and removed Weekly KSv2 labels May 19, 2025
@melvin-bot melvin-bot bot added Daily KSv2 and removed Daily KSv2 labels May 20, 2025
Copy link

melvin-bot bot commented May 20, 2025

Payment Summary

Upwork Job

BugZero Checklist (@Christinadobrzyn)

  • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1914790682113304013/hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

@Christinadobrzyn
Copy link
Contributor

@mananjadhav do we need a regression test?

@Christinadobrzyn
Copy link
Contributor

Christinadobrzyn commented May 20, 2025

Just a heads up that I'm going to be ooo May 21st - May 27th. Back on the 28th.

I'll assign someone to pay this. Payment summary - #60253 (comment)

We're just waiting on the regression test step. cc @twisterdotcom

@Christinadobrzyn Christinadobrzyn removed their assignment May 20, 2025
@Christinadobrzyn Christinadobrzyn added Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels May 20, 2025
Copy link

melvin-bot bot commented May 20, 2025

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

@Christinadobrzyn Christinadobrzyn self-assigned this May 20, 2025
@twisterdotcom
Copy link
Contributor

Starring @mananjadhav for the checklist.

@mananjadhav
Copy link
Collaborator

mananjadhav commented May 22, 2025

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 (eg. bug slipped through the normal regression and PR testing process on staging)
  • 2b. Reported on staging (eg. found during regression or PR testing)
  • 2d. 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:

  • [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:

  • [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.

  • [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

Precondition:

  • We need a new user and an existing user.

Test:

  1. [User B] Sign up as a new user
  2. [User B] Create a new workspace and enable invoices
  3. [User B] Send an invoice to User A
  4. [User A] Open the invoice room
  5. [User A] Press the report header > Members
  6. [User A] Press the User B
  7. [User A] Press Message on the profile page
  8. [User A] Verify the User B chat is open

Do we agree 👍 or 👎

@mananjadhav
Copy link
Collaborator

@Christinadobrzyn @twisterdotcom I think it makes sense to add a regression test for this one. Suggested one from the PR. I haven't been able to spend time on finding the offending PR.

Will do try to do that. Meanwhile @bernhardoj do you have any idea on the offending PR?

@bernhardoj
Copy link
Contributor

Based on my root cause, I don't think there is an offending PR. The isOneOnOneChat logic is quite old. I think it's more of an issue that has recently been noticed by QA when performing the test steps where the user receives the incomplete report data.

Image

@twisterdotcom
Copy link
Contributor

Payment Summary:

@bernhardoj
Copy link
Contributor

Requested in ND.

@JmillsExpensify
Copy link

$250 approved for @bernhardoj

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

10 participants