Closed JmillsExpensify closed 1 year ago
π£ @bernhardoj You have been assigned to this job by @PauloGasparSv! Please apply to this job in Upwork 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 π
Agree with @thesahindia and their reason, assigned @bernhardoj here
Thanks! I will open the PR in a few hours.
PR is ready for review.
Reviewing
label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 1.2.72-1 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2023-02-23. :confetti_ball:
After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
As a reminder, here are the bonuses/penalties that should be applied for any External issue:
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:
Woo! That was fast. PR qualifies for the 50% bonus, so I believe this is where that leaves us:
Sound right? The upwork job is here: https://www.upwork.com/jobs/~01fbd874b8451c4608. Please apply and we can finalize the final payment when the regression period ends. Thanks all!
Applied.
Here is the Regression Test Steps:
Do we agree π or π
Still need to investigate but maybe the changes from here created https://github.com/Expensify/App/issues/15251
I did test that issue's scenario (sending a comment in the Chat to see if it would stick in the LNH), and it did work so I'm confused. I still didn't replicate it locally and a comment there suggests the problem is in the backend, planning on investigating it on Monday.
@bernhardoj I think that addition looks good. I agree with you that everything else should already be covered for the other cases, including an existing chat and a draft message.
I just created https://github.com/Expensify/App/pull/15334 to revert the solution for this issue, because:
I think this is more fair than proceeding with https://github.com/Expensify/App/issues/15251, because we should not pay a separate bounty to resolve the regression. Instead we should revert the PR that introduced the regression and try again with a proper fix.
There is a front-end piece that @bernhardoj can still handle to earn the bounty here, but there's also some back-end stuff we'll need to do. I will start working on writing up a plan of action.
Sounds like a plan Rory. I'll update the issue to clarity that we're HOLDing on a regression fix.
Okay, it's basically a mini design doc, but here's my proposed plan
reportActionCount
fieldCREATED
action) in options list, unless it is the currently viewed reportWhen you create a new DM but don't send any messages, it should not appear in the LHN for other users. If you don't create a draft message, then navigate away from the chat, it should disappear from the LHN for you.
(after https://github.com/Expensify/App/pull/15334 is merged) There is no special logic in ReportUtils.shouldReportBeInOptionsList
to hide DMs with only a created action from the LHN β the default is to show the report.
reportActionCount
field to reports in OnyxTo make this change, we need to examine all NewDot flows that add or remove reportActions from a report. This includes:
CREATED
action)reportActionCount
correctly in the APIFirst, we need to make sure that when we initially fetch reports, those reports contain their canonical reportActionCount
from the back-end. Fortunately, the reportActionCount
is already returned from Auth::GetChats
, Auth::GetReportSummaryList
, Auth::CreateChatReports
, etc..., so all we have to do for this is to update ReportUtils::structureReportForOnyx
to include reportActionCount
, which, as @PauloGasparSv pointed out above, is already used to generate the maxSequenceNumber
field.
Next, we'll need to update ReportUtils::buildOnyxDataForNewAction
here so that we include reportActionCount
as well as the other fields.
Lastly, we'll update ReportAPI::editComment
, so that, if we're deleting a comment we always update the report in Onyx to decrement the reportActionCount
, regardless for whether it's the newest visible reportAction on the report, or if we shouldKeyReportActionsByID
.
reportActionCount
There are a few locations where new reports are created in the NewDot front-end, and we can find them by searching for usages of ReportUtils.buildOptimisticChatReport
:
src/libs/actions/Report.navigateToAndOpenReport
src/libs/actions/Report.addPolicyReport
ReportUtils.buildOptimisticWorkspaceChats
IOU.requestMoney
IOU.createSplitsAndOnyxData
IOU.getSendMoneyParams
In each of the above-listed locations, there is some code to add an optimistic CREATED
action, along with potentially more actions such as an IOU action. We will want to trace each of these flows and ensure that we set the correct optimistic reportActionCount
according to the number of optimistically-generated reportActions
before writing the report to Onyx.
reportActionCount
can safely be assumed to be 1
in each of these places:
openReport
addPolicyReport
buildOptimisticWorkspaceChats
IOU.requestMoney
and IOU.getSendMoneyParams
, the optimistic reportActionCount
should be incremented by 1
if we are not creating a new report, but should be 2
if we are creating a new reportIOU.createSplitsAndOnyxData
should use the same defaults as IOU.requestMoney
, except it will vary for the group DM and for every 1:1 DM associated with the bill split.This happens in Report.addActions
, where we'll always be able to assume that the report has an existing reportActionCount
field. We will increment that field by 1
if there is just text or just an attachment, but 2
if there is both text and an attachment.
This is covered by the same flows listed above under Creating a new report
. If creating a new report, the correct value for reportActionCount
on the new report is 2
. If adding an IOU
action to an existing report, the reportActionCount
should be incremented by 1
.
This flow lives in src/libs/actions/Report.deleteReportComment
. The report is optimistically updated here, so we need to update that piece of code to also optimistically decrement the reportActionCount
on the report by 1
.
To do this, we will draw inspiration from https://github.com/Expensify/App/pull/15129:
isDirectMessage
to src/libs/ReportUtils
that returns true
if the chatType
rNVP on the report is empty, and false
if it is not.src/libs/ReportUtils.shouldReportBeInOptionList
to return false
if the report is a direct message and the reportActionCount
is 1
.reportActionCount
field into reports in Onyx. This can probably be 1 PR, but could also be split up. It should be covered by unit tests.reportActionCount
in openReport
reportActionCount
in addPolicyReport
reportActionCount
in buildOptimisticWorkspaceChats
reportActionCount
in addActions
reportActionCount
in deleteReportComment
reportActionCount
in requestMoney
reportActionCount
in getSendMoneyParams
reportActionCount
in createSplitsAndOnyxData
ππΌ So given that this is a broad issue with a large scope, I suggest we create a GitHub project or tracking issue to track these changes, with a separate issue for each item in the rollout plan above. This particular issue will basically be the issue for item 10 in the proposed rollout plan above.
Does this sound like a good plan @PauloGasparSv @JmillsExpensify @chiragsalian?
Sorry for the regression guys.
I like the plan above, I can handle the frontend part. I would also like to add that because we will optimistically increment the reportActionCount
, we should decrement it back if it fails.
For example, when we send a single message, we will increment it by 1, but when it fails for some reason, we decrement it by 1.
π£ @bernhardoj! π£
Hey, it seems we donβt have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Contributor details Your Expensify account email: bernhard.josephus@gmail.com Upwork Profile Link: https://www.upwork.com/freelancers/~013e648527fa0266fd
β Contributor details stored successfully. Thank you for contributing to Expensify!
I like the proposed plan rory π
My one concern is the optimistic plan. In the rollout plan I'm wondering if before step 2 we should create a centralized method like getReportActionCount
that connects to the report and returns the reportActionCount
. This way all the other places can use this method and then increment or decrement the number as needed.
Let's remember for every optimistic action. We should also add failure data to revert the value as necessary.
I'm not sure i follow why some of the flows are on HOLD for steps other than 1.
And i agree we should make another tracking issue.
All good @bernhardoj! Thanks @roryabraham for the investigation and getting this mini-plan typed up.
Ya'll want me to take on creating the tracking issue and related issues?
The proposal is amazing, thanks so much for the help @roryabraham!
Ya'll want me to take on creating the tracking issue and related issues?
@JmillsExpensify that would be great! Would you mind creating those?
I would also like to add that because we will optimistically increment the reportActionCount, we should decrement it back if it fails.
Correct @bernhardoj! When dealing with API.write
commands, we have optimisticData
, successData
and failureData
. What you've described is a good use-case for failureData
ππΌ
Nice, I'll do that now ya'll.
Alright, the tracking issue and related implementation issues are created here: https://github.com/Expensify/App/issues/15352.
A couple of questions follow:
Oh and finally, perhaps we'll put this issue on hold now for the tracking issue?
Once we align on the above I can clean up some of the labels and what not on the implementation issues. Thanks!
Someone in this issue, or should we raise it in #engineering-chat in Slack?
Anyone can. if we go with the internal route i prefer if we post on slack so that it's spread out faster.
Shouldn't we post on this more broadly in open-source somewhere?
I think all the App issues posted above can be handled externally. We just have to share steps including failure steps with our expected outcome. Maybe @roryabraham can confirm since I'm unsure why he suggested all internal earlier.
Oh and finally, perhaps we'll put this issue on hold now for the tracking issue?
I'd say we can just close this since the last issue mentioned here should tackle this issue. If it hasn't then we reopened this issue later.
Also @roryabraham, did you have a chance to check out my comment asking for
deleteReportComment
we could add to the steps to fake insert reportActionCount 10 and then the expected optimistic data should decrease the number and its failure data should increase the same number. It doesn't feel like the HOLD is necessary except for item 10 since that is user-facing.I'd say we can just close this since the last issue mentioned https://github.com/Expensify/App/issues/15352 should tackle this issue. If it hasn't then we reopened this issue later.
That's cool, it's just that we also need to pay out on this issue, and it's tied to a regression at the moment.
Assigning the "Add a reportActionCount field to reports in Onyx" internal issue https://github.com/Expensify/App/issues/15353 to me here if that's ok!
I really like @chiragsalian suggestion to create a centralized function to fetch the report action count (like getReportActionCount
) and I think we should add an issue for that.
cc @roryabraham
Lastly, we'll update ReportAPI::editComment, so that, if we're deleting a comment we always update the report in Onyx to decrement the reportActionCount, regardless for whether it's the newest visible reportAction on the report, or if we shouldKeyReportActionsByID.
Hey, while testing https://github.com/Expensify/Web-Expensify/pull/36578 I realized that deleting a reportAction doesn't decrease reportActionCount
in GetChats.cpp
.
IMO that's ok but I want to know your opinions. If that's the case then I don't think we need to update the logic for deleting comments anymore since that counter doesn't decrease right?
Still held for the linked tracking issue. Adding weekly back.
No updates or blockers here, P.R. still in progress! Had to shift focus to other issues but now I'm coming back to this.
Still no updates here.
https://github.com/Expensify/App/issues/15952 is a dupe of this
This time I have an update :D
I've just finished implementing the Web-E and Auth P.R.'s for adding reportActionCount
in those layers. I'll finish fixing and adding tests then they'll be ready for reviews.
I believe this will unblock all the other issues we have in the main tracking one.
Changing this to monthly or else this will keep getting overdue!
Just out of curiosity, what do we still use reportActionCount
for? Since we don't have sequenceNumber
is there any value in it?
I thought we mainly just used it to calculate the unreads, but now that is something more like "last read compared to most recent created".
@JmillsExpensify can we update the title to point to the issue it's held on for clarity? Pretty sure it's this one: https://github.com/Expensify/App/issues/15352.
@JmillsExpensify can we update the title to point to the issue it's held on for clarity? Pretty sure it's this one: https://github.com/Expensify/App/issues/15352.
I think this is the revert P.R. https://github.com/Expensify/App/pull/15334 and this was the regression https://github.com/Expensify/App/issues/15251
I don't think this is on HOLD anymore.
Following this thread and this comment I'm trying to find time this week to test the feature using the lastMessageHTML
field instead of the reportActionCount
.
Agreed, I don't think this is one hold. This got wrapped up into the larger reportActionCount project.
I'll have time to implement this between this and next week so I'll have an update here soon.
Since this is no longer on Hold, I'm going to flip it back to Daily
per the standardized process (I'm just combing through for the weekly resync).
Sure thing @michaelhaxhiu! No updates since this and this is still on my todo list.
@roryabraham For confirmation, where did we land with implementing reportActionCount. I kind of remember a conversation where it might be paused?
@JmillsExpensify, @PauloGasparSv, @bernhardoj, @thesahindia Whoops! This issue is 2 days overdue. Let's get this updated quick!
No updates here because I couldn't focus on this issue last week as I planned. Now planning to work on this before EOW.
No updates but we discussed this issue today here.
No updates
Will start working on this tomorrow!
If you havenβt already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
Chat should not show in the LHN as there is not at least 1 ADDComment action, or 1 draft message.
Actual Result:
Empty chat shows in the LHN and remains in the LHN after simply navigating to it.
Workaround:
None
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.2.58-3 Reproducible in staging?: Y Reproducible in production?: Y 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 Notes/Photos/Videos: Any additional supporting documentation Expensify/Expensify Issue URL: Issue reported by: Slack conversation:
View all open jobs on GitHub
Upwork Automation - Do Not Edit