fix: optimistically build next step after resolving violation#47543
fix: optimistically build next step after resolving violation#47543dangrous merged 11 commits intoExpensify:mainfrom
Conversation
|
@rayane-djouah Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
Note: After reload, the BE still returns |
cc @dangrous ^^ I believe we can move forward with fixing the optimistic next step on frontend and then @dangrous will handle them on backend side as well. |
|
@dominictb - Could you please update the QA steps including how to get the optimistic / server side violation? We need to make them clear for QA team. |
|
@rayane-djouah updated! |
|
Nice! for optimistic violations like "missing category" violation. We're now clearing the violation optimistically. But the backend still returns the Screen.Recording.2024-08-23.at.12.36.28.AM.mov |
|
For server-side violations, I think we can't clear them optimistically because they need to be recalculated on backend. Screen.Recording.2024-08-23.at.12.34.25.AM.movBut the backend is returning the Screen.Recording.2024-08-23.at.12.33.24.AM.mov |
|
@dominictb - I think the QA steps to test clearing the optimistic violations can be:
wdyt? |
|
@dominictb - Bug: If we create a report with an optimistic violation, it displays "Waiting for to add expense(s)" instead of "Waiting for to fix the issue(s)" optimistic next step. Screen.Recording.2024-08-23.at.10.46.22.AM.mov |
|
@dominictb - Can we add automated tests in |
|
Backend bug not clearing "Waiting for to fix the issue(s)" next step after fixing server-side violations: Screen.Recording.2024-08-23.at.11.02.57.AM.movcc @dangrous |
|
Okay so this is a bit of a nightmare from the backend side, since we build the report next step dynamically when we call I'm not actually sure what the best option for this is. Do you have any thoughts @vit? |
|
Will check this today. |
|
@rayane-djouah added the tests and fixed this: #47543 (comment) |
Oops I mentioned the wrong person whoops! Let's try @mountiny |
|
@dangrous fun, do we optimistically clear the violations? We could update the next step when there are no violations left. Otherwise, I agree that we might have to make a change to a bunch of the API commands. We can add an optional parameter that would be true only if the local report's next steps say to fix issues. In that case, the API command would also re-compute and return the report's next steps. |
|
So yeah, we're clearing the violations optimistically here. @dominictb do you want to take a shot at seeing if we can call OpenReport here, or some other way to re-pull the next steps from the backend? That seems less intrusive than the backend solution, but I can work on that over time if we feel like it's best. |
|
I will take a look at this later and let you all know. |
|
thanks! happy to implement something on the backend too if we feel like that's the best solution, whether that's the checking every update transaction api command (hopefully not haha) or another option! |
I like this approach, but I think it will not work with server-side violations #47543 (comment) The solution of checking every update transaction api command will work well for both optimistic and server-side violations. |
|
I am mildly afraid the right solution is to update all the commands to recompute the next steps, but also this should wait for the auth migration @dangrous what do you think? Anything else is a hack/ workaround |
Sorry @dangrous but the OpenReport API is the problem here I think (I mentioned #47543 (comment) here). It seems like the optimal solution is to fix for every BE endpoint. One naive solution is for the BE to fix in the OpenReport API, and in the FE, if we can check if the |
I am afraid that would be against our 1:1:1 principle |
…ation if they had receipt required violation
|
@rayane-d Ready for review again. I also fixed 2 related issues:
App/src/libs/Violations/ViolationsUtils.ts Line 233 in 631006e App/src/libs/Violations/ViolationsUtils.ts Lines 234 to 237 in 631006e App/src/libs/Violations/ViolationsUtils.ts Lines 263 to 265 in 631006e Screen.Recording.2025-02-10.at.02.55.17-compressed.mov
|
|
@dominictb Could you please fill out the |
|
@rayane-d Updated. |
|
let me know when this is ready for a look @rayane-d - thank you! |
|
Bump @rayane-d |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2025-02-23.at.5.14.42.PM.movAndroid: mWeb ChromeScreen.Recording.2025-02-23.at.5.06.05.PM.moviOS: NativeSimulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2025-02-23.at.17.29.30.mp4iOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2025-02-23.at.17.12.42.mp4MacOS: Chrome / SafariScreen.Recording.2025-02-23.at.4.37.22.PM.movMacOS: DesktopScreen.Recording.2025-02-23.at.5.30.10.PM.mov |
|
@dominictb let's update the QA steps (and Tests steps) to: |
|
@dominictb please address #47543 (comment) and #47543 (comment) when you get a chance @dangrous this is ready for your review |
dangrous
left a comment
There was a problem hiding this comment.
Let's update that jsdoc but otherwise looks good!
|
bump for adding the param to the doc, then we're good to go! |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/dangrous in version: 9.1.7-1 🚀
|
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.1.7-2 🚀
|
Details
Build
fix the issue(s)next step optimistically when the transaction has violations.Fixed Issues
$ #46914
PROPOSAL: #46914 (comment)
Tests
Offline tests
See Tests
QA Steps
See Tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
android.webm
Android: mWeb Chrome
compressed_aweb.webm.mp4
iOS: Native
Screen.Recording.2025-02-10.at.03.49.24-compressed.mov
iOS: mWeb Safari
Screen.Recording.2025-02-10.at.03.53.10.mov
MacOS: Chrome / Safari
Screen.Recording.2025-02-10.at.03.27.54-compressed.mov
MacOS: Desktop
Screen.Recording.2025-02-10.at.03.33.42-compressed.mov