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

Random messages displayed in LHN and unable to discard #44693

Closed
1 of 6 tasks
m-natarajan opened this issue Jul 1, 2024 · 38 comments
Closed
1 of 6 tasks

Random messages displayed in LHN and unable to discard #44693

m-natarajan opened this issue Jul 1, 2024 · 38 comments
Assignees
Labels
AutoAssignerNewDotQuality Used to assign quality issues to engineers Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Needs Reproduction Reproducible steps needed

Comments

@m-natarajan
Copy link

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:
Reproducible in staging?: Needs Reproduction
Reproducible in production?: Needs Reproduction
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: @coleaeason
Slack conversation: https://expensify.slack.com/archives/C05LX9D6E07/p1719842019363059

Action Performed:

  1. Go to staging.new.expensify.com
  2. Observe the LHN

Expected Result:

Messages displayed in LHN as per priority mode

Actual Result:

Random messages displayed in LHN and unable to discard it

Workaround:

Unknown

Platforms:

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

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

Screenshots/Videos

Add any screenshot/video evidence
Screenshot 2024-06-28 at 4 53 06 PM

View all open jobs on GitHub

@m-natarajan m-natarajan added Daily KSv2 Needs Reproduction Reproducible steps needed Bug Something is broken. Auto assigns a BugZero manager. labels Jul 1, 2024
@MelvinBot
Copy link

This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989

Copy link

melvin-bot bot commented Jul 1, 2024

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

@m-natarajan m-natarajan added the AutoAssignerNewDotQuality Used to assign quality issues to engineers label Jul 1, 2024
Copy link

melvin-bot bot commented Jul 1, 2024

Triggered auto assignment to @jasperhuangg (AutoAssignerNewDotQuality)

@melvin-bot melvin-bot bot added the Weekly KSv2 label Jul 1, 2024
@m-natarajan
Copy link
Author

@deetergp
Copy link
Contributor

deetergp commented Jul 1, 2024

I'll take this one @jasperhuangg, I'm pretty sure I know why the expense report related ones are notifying.

@deetergp deetergp assigned deetergp and unassigned jasperhuangg Jul 1, 2024
@deetergp
Copy link
Contributor

deetergp commented Jul 1, 2024

When Kortney copilots into accounting@expensify.com and exports expense reports to our accounting integration, it generates two report actions with the same exact timestamp: BILLABLEDELEGATE and EXPORTINTEGRATION because these are both technically visible report actions, when we run this subquery for either report action, it returns the same created time which is always going to be more recent than anyone's lastReadTime for that report and so these report actions get delivered as read and the unread reports clutter everyone's LHN.

scott@db2.rno:~$ sudo readdb.sh "SELECT * FROM reportActions WHERE reportID = 7468358293046644 ORDER BY created;"
created                  reportID          accountID  action             message                                                                                                                                                                                                                                                                                   reportActionID
-----------------------  ----------------  ---------  -----------------  ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  -------------------
2024-06-11 19:52:11.356  7468358293046644  297463     CREATED                                                                                                                                                                                                                                                                                                      8987734204827604593
2024-06-11 19:52:11.359  7468358293046644  297463     IOU                {"IOUReportID":7468358293046644,"IOUTransactionID":"1275664852902458768","amount":0,"comment":"","currency":"USD","lastModified":"2024-06-11 19:52:11.359","participantAccountIDs":[297463,0],"type":"create"}                                                                            1977781071499759992
2024-06-12 08:41:35.675  7468358293046644  297463     SUBMITTED          {"cc":"","harvesting":true,"harvestingGUID":"0CFE78B25EBE2A0A66694e5a32265","hasExternalComment":false,"lastModified":"2024-06-12 08:41:35.675","message":"","to":"puneet@expensify.com","workflow":"BASIC"}                                                                              9080892226874754453
2024-06-13 16:46:59.361  7468358293046644  778531     APPROVED           {"IOUReportID":7468358293046644,"amount":1000,"currency":"USD","html":"approved $10.00","lastModified":"2024-06-13 16:46:59.361"}                                                                                                                                                         3284189292439783785
2024-06-13 16:47:06.207  7468358293046644  10903701   REIMBURSED         {"accountNumber":"XXXXXX8990","addressName":"CIBC Expensify Inc. Test Account","automaticAction":true,"creditBankAccountNumber":"9345","expectedDate":"2024-06-14","lastModified":"2024-06-13 16:47:06.207","method":"Fast_ACH","routingNumber":"071006486"}                              6642415101504022780
2024-06-27 22:37:28.511  7468358293046644  9713816    EXPORTINTEGRATION  {"automaticAction":false,"delegate":"rhindel.lleva-contractor@mossadams.com","label":"All Transaction Data Report (Expensify/Zedra/MA/SVFG)","lastModified":"2024-06-27 22:37:28.511","markedManually":false,"nonReimbursableUrls":null,"reimbursableUrls":null,"type":"exportTemplate"}  5731281980129695591
2024-06-27 22:37:28.511  7468358293046644  10389575   BILLABLEDELEGATE   {"actionTaken":"EXPORTINTEGRATION","forAccountID":9713816}                                                                                                                                                                                                                                9223372026415719862
2024-07-01 17:56:08.295  7468358293046644  9645353    EXPORTINTEGRATION  {"automaticAction":false,"delegate":"kortney@expensify.com","label":"All Transaction Data Report (Expensify/Zedra/MA/SVFG)","lastModified":"2024-07-01 17:56:08.295","markedManually":false,"nonReimbursableUrls":null,"reimbursableUrls":null,"type":"exportTemplate"}                   4262162027559088473
2024-07-01 17:56:08.295  7468358293046644  5726973    BILLABLEDELEGATE   {"actionTaken":"EXPORTINTEGRATION","forAccountID":9645353}                                                                                                                                                                                                                                9223372026415860932
scott@db2.rno:~$ getemail.sh 5726973
kortney@expensify.com
scott@db2.rno:~$ getemail.sh 9645353
accounting@expensify.com

@deetergp
Copy link
Contributor

deetergp commented Jul 1, 2024

scott@db2.rno:~$ sudo readdb.sh "
>     SELECT MAX(created)
>     FROM reportActions
>     WHERE JSON_VALID(message)
>     AND reportID = 7468358293046644
>     AND reportActionID != 9223372026415860932
>     AND JSON_TYPE(message, '$.deleted') IS NULL
>     AND JSON_TYPE(message, '$.whisperedTo') IS NULL
>     AND COALESCE(message->>'$.moderationDecisions[#-1].decision', '') != 'pendingRemove'
> ;"
MAX(created)
-----------------------
2024-07-01 17:56:08.295
scott@db2.rno:~$ sudo readdb.sh "
>     SELECT MAX(created)
>     FROM reportActions
>     WHERE JSON_VALID(message)
>     AND reportID = 7468358293046644
>     AND reportActionID != 4262162027559088473
>     AND JSON_TYPE(message, '$.deleted') IS NULL
>     AND JSON_TYPE(message, '$.whisperedTo') IS NULL
>     AND COALESCE(message->>'$.moderationDecisions[#-1].decision', '') != 'pendingRemove'
> ;"
MAX(created)
-----------------------
2024-07-01 17:56:08.295

@deetergp
Copy link
Contributor

deetergp commented Jul 1, 2024

One solution could be to include a clause in that query to only include report actions whose created time is older than the action being sent. But I think the best solution is to just exclude any of these ESM-supported report actions from the list.

scott@db2.rno:~$ sudo readdb.sh "
>     SELECT MAX(created)
>     FROM reportActions
>     WHERE JSON_VALID(message)
>     AND reportID = 7468358293046644
>     AND action NOT IN ('BILLABLEDELEGATE', 'EXPORTINTEGRATION')
>     AND JSON_TYPE(message, '$.deleted') IS NULL
>     AND JSON_TYPE(message, '$.whisperedTo') IS NULL
>     AND COALESCE(message->>'$.moderationDecisions[#-1].decision', '') != 'pendingRemove'
> ;"
MAX(created)
-----------------------
2024-06-13 16:47:06.207

@deetergp
Copy link
Contributor

deetergp commented Jul 1, 2024

Here it is with all of them excluded:

scott@db2.rno:~$ sudo readdb.sh "
>     SELECT MAX(created)
>     FROM reportActions
>     WHERE JSON_VALID(message)
>     AND reportID = 7468358293046644
>     AND action NOT IN ('APPROVED', 'BILLABLEDELEGATE', 'CHANGEFIELD', 'CHANGEPOLICY', 'CHANGETYPE', 'DELEGATESUBMIT', 'EXPORTCSV', 'EXPORTINTEGRATION', 'FORWARDED', 'MANAGERATTACHRECEIPT', 'MANAGERDETACHRECEIPT', 'POLICYCHANGELOG_ADD_APPROVER_RULE', 'POLICYCHANGELOG_ADD_BUDGET', 'POLICYCHANGELOG_ADD_CATEGORY', 'POLICYCHANGELOG_ADD_CUSTOM_UNIT_RATE', 'POLICYCHANGELOG_ADD_EMPLOYEE', 'POLICYCHANGELOG_ADD_INTEGRATION', 'POLICYCHANGELOG_ADD_REPORT_FIELD', 'POLICYCHANGELOG_ADD_TAG', 'POLICYCHANGELOG_DELETE_ALL_TAGS', 'POLICYCHANGELOG_DELETE_APPROVER_RULE', 'POLICYCHANGELOG_DELETE_BUDGET', 'POLICYCHANGELOG_DELETE_CATEGORY', 'POLICYCHANGELOG_DELETE_CUSTOM_UNIT', 'POLICYCHANGELOG_DELETE_CUSTOM_UNIT_RATE', 'POLICYCHANGELOG_DELETE_CUSTOM_UNIT_SUB_RATE', 'POLICYCHANGELOG_DELETE_EMPLOYEE', 'POLICYCHANGELOG_DELETE_INTEGRATION', 'POLICYCHANGELOG_DELETE_REPORT_FIELD', 'POLICYCHANGELOG_DELETE_TAG', 'POLICYCHANGELOG_IMPORT_CUSTOM_UNIT_RATES', 'POLICYCHANGELOG_IMPORT_TAGS', 'POLICYCHANGELOG_INDIVIDUAL_BUDGET_NOTIFICATION', 'POLICYCHANGELOG_INVITETOROOM', 'POLICYCHANGELOG_LEAVEROOM', 'POLICYCHANGELOG_LEAVE_POLICY', 'POLICYCHANGELOG_REMOVEFROMROOM', 'POLICYCHANGELOG_SET_AUTO_JOIN', 'POLICYCHANGELOG_SET_CATEGORY_NAME', 'POLICYCHANGELOG_SHARED_BUDGET_NOTIFICATION', 'POLICYCHANGELOG_UPDATE_ACH_ACCOUNT', 'POLICYCHANGELOG_UPDATE_APPROVER_RULE', 'POLICYCHANGELOG_UPDATE_AUDIT_RATE', 'POLICYCHANGELOG_UPDATE_AUTOHARVESTING', 'POLICYCHANGELOG_UPDATE_AUTOREPORTING_FREQUENCY', 'POLICYCHANGELOG_UPDATE_AUTOREIMBURSEMENT', 'POLICYCHANGELOG_UPDATE_BUDGET', 'POLICYCHANGELOG_UPDATE_CATEGORY', 'POLICYCHANGELOG_UPDATE_CURRENCY', 'POLICYCHANGELOG_UPDATE_CUSTOM_UNIT', 'POLICYCHANGELOG_UPDATE_CUSTOM_UNIT_RATE', 'POLICYCHANGELOG_UPDATE_CUSTOM_UNIT_SUB_RATE', 'POLICYCHANGELOG_UPDATE_DEFAULT_BILLABLE', 'POLICYCHANGELOG_UPDATE_DEFAULT_REIMBURSABLE', 'POLICYCHANGELOG_UPDATE_DEFAULT_TITLE', 'POLICYCHANGELOG_UPDATE_DEFAULT_TITLE_ENFORCED', 'POLICYCHANGELOG_UPDATE_DISABLED_FIELDS', 'POLICYCHANGELOG_UPDATE_EMPLOYEE', 'POLICYCHANGELOG_UPDATE_FIELD', 'POLICYCHANGELOG_UPDATE_MANUAL_APPROVAL_THRESHOLD', 'POLICYCHANGELOG_UPDATE_MAX_EXPENSE_AMOUNT', 'POLICYCHANGELOG_UPDATE_MAX_EXPENSE_AMOUNT_NO_RECEIPT', 'POLICYCHANGELOG_UPDATE_NAME', 'POLICYCHANGELOG_UPDATE_OWNERSHIP', 'POLICYCHANGELOG_UPDATE_REIMBURSEMENT_CHOICE', 'POLICYCHANGELOG_UPDATE_REPORT_FIELD', 'POLICYCHANGELOG_UPDATE_TAG', 'POLICYCHANGELOG_UPDATE_TAG_ENABLED', 'POLICYCHANGELOG_UPDATE_TAG_LIST', 'POLICYCHANGELOG_UPDATE_TAG_LIST_NAME', 'POLICYCHANGELOG_UPDATE_TAG_NAME', 'POLICYCHANGELOG_UPDATE_TIME_ENABLED', 'POLICYCHANGELOG_UPDATE_TIME_RATE', 'REIMBURSEMENTDELAYED', 'REIMBURSEMENTACHCANCELED', 'MARKEDREIMBURSED', 'ACTIONMARKEDREIMBURSEDFROMINTEGRATION', 'SELECTEDFORRANDOMAUDIT', 'SUBMITTED', 'SHAREREPORT', 'UNHOLD', 'UNSHAREREPORT', 'STRIPEPAID', 'TAKECONTROL', 'UNAPPROVED')
>     AND JSON_TYPE(message, '$.deleted') IS NULL
>     AND JSON_TYPE(message, '$.whisperedTo') IS NULL
>     AND COALESCE(message->>'$.moderationDecisions[#-1].decision', '') != 'pendingRemove'
> "
MAX(created)
-----------------------
2024-06-13 16:47:06.207

@deetergp
Copy link
Contributor

deetergp commented Jul 3, 2024

Not sure why this didn't close since the PR was deployed to production five hours ago and the email script was definitely run. Weird.

I have reached out to @kortneywynn and asked that she ping me the next time she copilots into accounting@expensify.com and exports expense reports. Will follow up here once that happens and hopefully put this issue to bed for good.

Copy link

melvin-bot bot commented Jul 11, 2024

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

@deetergp
Copy link
Contributor

Daily Update

  • We discovered what was causing the EXPORTINTEGRATION report actions to mark the chats as unread and fixed it here, but may have introduced a new bug that is causing this test to be flaky when we run the tests in Github Actions.

Next steps

Fix it. Obivously! 😅

@puneetlath puneetlath reopened this Jul 30, 2024
@muttmuure
Copy link
Contributor

@deetergp
Copy link
Contributor

deetergp commented Aug 2, 2024

Yes, @muttmuure 👍 The tl;dr is that accounting@expensify.com exported ~500 reports yesterday and some of them did become unread for a few users. I looked into the ones Puneet & JMills had gotten and the good news is that each of their lastReadTimes were updated on the back and as appropriate. The bad news while we found proof in the logs that we were queueing their last read times to go out as onyx updates in Pusher, for whatever reason, the updates did not make it to their NewDot clients, so the reports became unread when they received the EXPORTINTEGRATION system message.

@muttmuure
Copy link
Contributor

@muttmuure muttmuure moved this from Done to CRITICAL in [#whatsnext] #quality Aug 6, 2024
@deetergp
Copy link
Contributor

deetergp commented Aug 7, 2024

It looks like the latest PR finally took care of this issue. I think we can finally close this one out 🎉

@deetergp deetergp closed this as completed Aug 7, 2024
@github-project-automation github-project-automation bot moved this from CRITICAL to Done in [#whatsnext] #quality Aug 7, 2024
@muttmuure
Copy link
Contributor

Wooo!

@deetergp deetergp reopened this Aug 12, 2024
@deetergp
Copy link
Contributor

We unfortunately had to revert the PR that fixed this issue because adding IOU actions to Enhanced System Messages broke one of our bottom up flows. By setting an updated lastReadTime for IOUs, we ended up preventing IOU from appearing in any NotifyOfflineUsersAboutActivity emails which one of the key ways we hope to bring more users into the fold.

@puneetlath and I are investigating alternative ways to fix this issue in a way that does not break things or cause other issues.

@sonialiap sonialiap added Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels Aug 16, 2024
Copy link

melvin-bot bot commented Aug 16, 2024

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

@sonialiap
Copy link
Contributor

@joekaufmanexpensify I'm OOO Aug 19-30, adding leave buddy.
Status: engineering is reworking the solution. At the moment no action necessary for BZ

@joekaufmanexpensify
Copy link
Contributor

Sounds good! Also @deetergp do we expect the fix for this to be entirely in auth? If so, I wonder if this even needs a BZ, as there wouldn't really be any payment we'd be processing.

@joekaufmanexpensify
Copy link
Contributor

Still pending input from Scott

@joekaufmanexpensify
Copy link
Contributor

@deetergp is this auth PR the last thing needed in this issue?

@joekaufmanexpensify
Copy link
Contributor

Auth PR was deployed. Just pending input from @deetergp on if this one is now all set.

@muttmuure
Copy link
Contributor

I might still be seeing this with workspace chats that were created by setting a preferred domain group:

https://expensify.slack.com/archives/C05LX9D6E07/p1724243554783079?thread_ts=1723722469.695359&cid=C05LX9D6E07

@joekaufmanexpensify
Copy link
Contributor

Interesting. I see discussion of another issue in that thread. You think it might be related to this instead?

@joekaufmanexpensify
Copy link
Contributor

Also, as an fyi, I am now also OOO until Monday. I don't think this needs a tertiary BZ member as there is no frontend PR(s) here. So should be nothing for BZ to do while I am out. Please bring to slack if that proves to not be correct.

@deetergp
Copy link
Contributor

I'll be diving back into this today.

@deetergp deetergp removed the Reviewing Has a PR in review label Aug 23, 2024
@joekaufmanexpensify
Copy link
Contributor

Sounds good. So there are more PR(s) left for this one?

@deetergp
Copy link
Contributor

There are not currently any PRs pending, but Matt just got hit with a bunch of unreads in his LHN, so there may be some soon.

@deetergp
Copy link
Contributor

I think we're going to create a new issue for the latest batch that have popped up. Let's go ahead and close this one.

@joekaufmanexpensify
Copy link
Contributor

Sounds good. TY!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoAssignerNewDotQuality Used to assign quality issues to engineers Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Needs Reproduction Reproducible steps needed
Projects
Development

No branches or pull requests

9 participants