Repository navigation
[HOLD for payment 2024-04-15] [$500] Task - Chat messages are out of order after reassigning task, sometimes beginning of chat is duplicated #38439
Description
Activity
- addedDailyKSv2KSv2BugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.
on Mar 16, 2024 Triggered auto assignment to @sakluger (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.@sakluger I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors.
We think that this bug might be related to #vip-vsb
Proposal
Please re-state the problem that we are trying to solve in this issue.
Task - Beginning of chat shown after reassigning task from user you have no chat to recent user
What is the root cause of that problem?
when we select assignee we call
setAssigneeChatReport.Line 660 in e40fba1
setAssigneeChatReport(chatReport);
which merge the value with the old value.
Lines 623 to 625 in e40fba1
function setAssigneeChatReport(chatReport: OnyxTypes.Report) { Onyx.merge(ONYXKEYS.TASK, {assigneeChatReport: chatReport}); } the root cause is the merge leed to merge
ReportUtils.buildOptimisticChatReportfor new user withReportUtils.getChatByParticipantsfor user chated before and this add optimistic fields likeisOptimisticReportto the old reportWhat changes do you think we should make in order to solve the problem?
we need to reset the old value of
assigneeChatReportbefore merge the new value here.
Lines 623 to 625 in e40fba1
function setAssigneeChatReport(chatReport: OnyxTypes.Report) { Onyx.merge(ONYXKEYS.TASK, {assigneeChatReport: chatReport}); } we can do that by merge it to null then merge it to the new value.
Onyx.merge(ONYXKEYS.TASK, {assigneeChatReport: null}).then(() => Onyx.merge(ONYXKEYS.TASK, {assigneeChatReport: chatReport}));
What alternative solutions did you explore? (Optional)
Proposal
Please re-state the problem that we are trying to solve in this issue.
A duplicated beginning of the report is displayed, sometimes task is shown as the first message
What is the root cause of that problem?
When we select an assignee that is a new user, we create an optimistic report here and set it to
assigneeChatReport. After we re-select a recent contact, another chat report is set toassigneeChatReportbut other fields likeisOptimisticReport,pendingFieldsare in-correct because we merge from old assignee report.Line 660 in c915e7f
setAssigneeChatReport(chatReport); And then a created action is created here.
Lines 4813 to 4814 in c915e7f
if (assigneeChatReport?.isOptimisticReport && assigneeChatReport.pendingFields?.createChat !== CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) { optimisticChatCreatedReportAction = buildOptimisticCreatedReportAction(assigneeChatReportID); What changes do you think we should make in order to solve the problem?
Instead of storing assignReport in task data, we can store the assigneeChatReportID which is the ID of chat report and then get the correct data from Onyx to check here.
Lines 4813 to 4814 in c915e7f
if (assigneeChatReport?.isOptimisticReport && assigneeChatReport.pendingFields?.createChat !== CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) { optimisticChatCreatedReportAction = buildOptimisticCreatedReportAction(assigneeChatReportID); I checked all use of
task.assigneeChatReportand saw that it's only used when we create the task. So we can only store the reportID of chat report and then get the report data from Onyx correctly.What alternative solutions did you explore? (Optional)
Updated the chat report with updating the optimistic field correctly if the
chatReportis an exist reportsetAssigneeChatReport({ ...chatReport, isOptimisticReport: chatReport.isOptimisticReport, pendingField: chatReport.pendingField, pendingAction: chatReport.pendingAction });Line 660 in c915e7f
setAssigneeChatReport(chatReport); - changed the title
[-]Task - Beginning of chat shown after reassigning task from user you have no chat to recent user[/-][+]Task - Chat messages are out of order after reassigning task[/+]on Mar 19, 2024 Updated the issue title and description for clarify.
- addedExternalAdded to denote the issue can be worked on by a contributorAdded to denote the issue can be worked on by a contributor
on Mar 19, 2024 - changed the title
[-]Task - Chat messages are out of order after reassigning task[/-][+][$500] Task - Chat messages are out of order after reassigning task[/+]on Mar 19, 2024 38 remaining items
- addedWeeklyKSv2KSv2Awaiting PaymentAuto-added when associated PR is deployed to productionAuto-added when associated PR is deployed to production
on Apr 8, 2024 - changed the title
[-][$500] Task - Chat messages are out of order after reassigning task, sometimes beginning of chat is duplicated[/-][+][HOLD for payment 2024-04-15] [$500] Task - Chat messages are out of order after reassigning task, sometimes beginning of chat is duplicated[/+]on Apr 8, 2024 Reviewinglabel has been removed, please complete the "BugZero Checklist".The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.60-13 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 2024-04-15. 🎊
For reference, here are some details about the assignees on this issue:
- @hungvu193 requires payment automatic offer (Reviewer)
- @nkdengineer requires payment (Needs manual offer from BZ)
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
- [@hungvu193] The PR that introduced the bug has been identified. Link to the PR:
- [@hungvu193] 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:
- [@hungvu193] A discussion in #expensify-bugs 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:
- [@hungvu193] Determine if we should create a regression test for this bug.
- [@hungvu193] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
- [@sakluger] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
Summarizing payment on this issue:
Contributor: @nkdengineer $500, sent offer via Upwork (https://www.upwork.com/nx/wm/offer/101873781)
Contributor+: @hungvu193 $500, paid via Upwork@hungvu193 could you please complete the BZ checklist?
Paid @nkdengineer, just waiting on the checklist now.
- The PR that introduced the bug has been identified. Link to the PR: Allow optimistic assignee chat reports #22778
- 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: https://github.com/Expensify/App/pull/22778/files#r1566611957
- A discussion in #expensify-bugs 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
- Determine if we should create a regression test for this bug: No
This is an edge case, so I don't think we need regression test for this one.
Reacted by Sasha KlugerThanks!
Metadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsCRITICAL
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: 1.4.53-2
Reproducible in staging?: y
Reproducible in production?: y
Issue reported by: Applause - Internal Team
Action Performed:
Expected Result:
The task is displayed as the last message in the report
Actual Result:
A duplicated beginning of the report is displayed, sometimes task is shown as the first message
Workaround:
n/a
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6415381_1710533895456.video_2024-03-15_16-16-07.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit