-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[$500] Web – Assign Task - An error occurs when both User A and User B press the "Mark as done" button simultaneously #27570
Comments
Job added to Upwork: https://www.upwork.com/jobs/~0129a7b3f4233c245f |
Triggered auto assignment to @michaelhaxhiu ( |
Bug0 Triage Checklist (Main S/O)
|
Triggered auto assignment to @sakluger ( |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.An error message appears on User B's system, stating, "You do not have permission to perform the requested action." What is the root cause of that problem?At the time the What changes do you think we should make in order to solve the problem?We can check if the report action is We can do it in an
It can be fixed the same for the reopen/cancel case. What alternative solutions did you explore? (Optional)An alternative is to add a field in the back-end to clarify that the error is due to task is already completed, like |
ProposalPlease re-state the problem that we are trying to solve in this issue.In assign task when 2 users simulatenously complete task then 1 of 2 users gets an unwanted error. What is the root cause of that problem?Root cause is that we are hard coding error message like here: Lines 264 to 272 in 76c1559
Same is true for both completeTask and reopenTask methods. This is not considering other reasons of error and have just 1 hard coded case of permissions issue which is not true in this specific case. What changes do you think we should make in order to solve the problem?We need to add error handling for task errors and show error that is tailored to the problem that happened which in this case is e.g. "User 1 has already completed task.", "User 2 has already reopened task" or simply "Unable to complete/reopen task". In following piece of code Lines 1524 to 1539 in 76c1559
we need to add 2 more keys
then in completeTask method use task.completingError instead of task.messages.error Line 269 in 76c1559
and in reopenTask use task.reopeningError instead of task.messages.error Line 356 in 76c1559
Result: Untitled.9.mp4What alternative solutions did you explore? (Optional)Just simply remove this: Lines 264 to 272 in 76c1559
Lines 351 to 359 in 76c1559
That will stop showing error messages for tasks api call. |
Proposal |
Problem Statement: Root Cause: Proposed Solution:
Implementation: Backend: if (task.isLocked()) {
return { success: false, errorCode: 'CONCURRENCY_ISSUE', message: 'Another user is currently updating the task. Please try again in a moment.' };
}
task.lock();
// Carry out the task state modification
task.unlock(); Frontend: function changeTaskState(taskID) {
API.ChangeTaskState(taskID)
.then((response) => {
if (response.errorCode === 'CONCURRENCY_ISSUE') {
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${taskID}`, {
errors: {
concurrencyIssue: "Another user is updating this task. Kindly wait a moment."
}
});
} else if (!response.success) {
// Manage other potential errors
}
});
} Incorporate enhanced error messages in task: {
// ... existing keys
messages: {
// ... existing messages
concurrencyIssue: "Another user is updating this task. Kindly wait a moment.",
completingError: "Unable to finalize the task as completed. Please retry shortly.",
reopeningError: "Unable to revert the task. Please try again after a while."
}
} Advantages:
Disadvantages:
Alternative Solution:
Advantages:
Disadvantages:
|
This was marked @sobitneupane inviting your input on the proposals above. |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@michaelhaxhiu It is better to handle this issue internally. I think it's possible that we may need to make some adjustments to the backend in order to address the issue. |
@sobitneupane @michaelhaxhiu in the frontend showing simple error message in case of a failure should be enough as per my thinking. Handling it in the backend with semaphores and other simultaneous access jargon can make things more complicated and will cause more errors. Simply showing message unable to mark completed/reopen should be enough. @michaelhaxhiu what do you think? |
@sobitneupane what behavior do you think should happen here? If the |
Current assignee @sobitneupane is eligible for the Internal assigner, not assigning anyone new. |
Rodrigo is taking over for me to implement the backend change. |
This PR solves it in the backend if we are ok with showing the What do you think @neil-marcellini ? |
any room for new proposal here? |
@ayazalavi It is decided to fix the issue in the backend. It is no longer available for new proposals. |
So we are suggesting showing one action, |
In the end only one person actually completed the task, since we don't save a new completed action for a task that was already completed, that is why I think this is ok. |
Just to be sure, you think showing the task that one person actually completed to two people as completed by both of them to be OK? |
Oh no sorry, I think we should show only one completed message by the correct person, and that is what we are actually doing, showing only one complete action for this situation. I guess the screenshot I took made things a little bit confusing, but we fixed that screenshot in the backend PR. If two people complete a task simultaneously we are erasing the completed message from the person that didn't actually complete it. |
Awesome! |
This issue has not been updated in over 15 days. @rlinoz, @sobitneupane, @MitchExpensify, @dukenv0307 eroding to Monthly issue. P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do! |
I think we can close this issue, but I am not sure whether payment is due or not. |
Payment summary:
|
@MitchExpensify A proposal was selected and while implementing the PR, it was decided that the issue would be best solved on the backend. So, we ended of closing the PR without merging. |
Should we process payment for both C and C+ since we spent lots of effort in the PR and it's almost done. We have the same case in the past #17188 (comment) |
That seems fair, can you both please apply to this job for payment? https://www.upwork.com/jobs/~01314f533571a41c4f |
And same for you usmantariq96, thanks! |
@MitchExpensify applied for the job |
@MitchExpensify applied, thank you! |
@MitchExpensify I will request payment on newDot once you post the payment summary. |
Updated the payment summary - #27570 (comment) |
Do we need to add a regression test here @sobitneupane ? |
Regression Test Proposal
Do we agree 👍 or 👎 |
Requested payment on newDot. |
$500 payment approved for @sobitneupane based on this comment. |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Action Performed:
Expected Result:
The error should not appear and the task should be closed regardless of which user performs the action
Actual Result:
An error message appears on User B's system, stating, "You do not have permission to perform the requested action."
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.70-5
Reproducible in staging?: Yes
Reproducible in production?: Yes
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
Bug.2.mp4
0-02-01-6ce24cc1ebb53856f7b92b9ede59b4d4774dbe3451ed70704747a1e8a05c7c25_bdeb7f22536b3c99.1.mp4
Expensify/Expensify Issue URL:
Issue reported by: @usmantariq96
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1694588501046099
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: