Repository navigation
Apply the selected copilot role when retrying an add for an existing delegate - #101660
Conversation
…delegate entry Co-authored-by: Situ Chandra Shil <situchan@users.noreply.github.com>
|
🤖 Web test steps verification results: I reached Worth calling out: even without the account-validation screen, this test plan is not automatable by me. Steps 4 and 8 require entering a wrong then a correct magic code from a real inbox, which is a physical blocker for automated runs. The fix itself is covered by the regression test in No console errors were observed up to the blocking point. |
DetailsExplanation of ChangeWhen That "already present" case is exactly what a failed add leaves behind: a wrong magic code leaves the copilot in the list with the original role and This change sets Added a regression test in Fixed Issues$ #99761 Tests
Offline testsSame as Tests QA StepsSame as Tests
PR Author Checklist
@MelvinBot please set the PR body to the content in the details section above and mark as ready for review |
|
🤖 Done — PR body updated and marked ready for review. I set the body to exactly the content inside your Two things worth flagging:
|
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppios.moviOS: mWeb SafariMacOS: Chrome / Safariweb.mov |
flaviadefaria
left a comment
There was a problem hiding this comment.
From a product standpoint, the fix looks good to me.
|
🚧 robertjchen has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/robertjchen in version: 9.4.91-0 🚀
|
|
🤖 No help site changes are required for this PR — no draft PR created. This PR is an internal state fix, not a behavior or copy change. It adds What I checkedHelp site articles covering Copilot:
None of them document what happens after a wrong magic code, so the bug this PR fixes was never described on the help site. There is nothing to correct or add. Separate, pre-existing label mismatches (not from this PR)While verifying labels against the app copy in
These predate this PR and are out of its scope, so I did not open a PR for them. Let me know if you want one. There is no help site PR to link, so the "review the linked help site PR and mark it |
|
🚀 Deployed to production by https://github.com/lakchote in version: 9.4.91-3 🚀
Bundle Size Analysis (Sentry): |


Explanation of Change
When
addDelegateruns for a copilot that is already present inaccount.delegatedAccess.delegates, all three Onyx writes spread the existing record ({...delegate, …}) and never setrole. The new-delegate branches right below each of them do set it, which is why a clean first-time add works.That "already present" case is exactly what a failed add leaves behind: a wrong magic code leaves the copilot in the list with the original role and
pendingAction: 'add'— the greyed-out row. Tapping that row re-enters the Add flow (the update-role branch inCopilotPagerequirespendingFields.rolewithoutpendingFields.email, and a failed add sets both), so the retry callsaddDelegateagain. The newly chosen role is sent to the server correctly, but Onyx keeps the stale one, so the badge still reads "Full" after the retry succeeds.This change sets
rolein the threeexistingDelegatebranches, matching the adjacent new-delegate branches and matching whatupdateDelegateRolealready does. The failure branch is included too, so a second wrong code leaves the row showing the role the user just attempted rather than reverting to the old one.Added a regression test in
tests/actions/DelegateTest.tsthat seeds a delegate withrole: ALL+pendingAction: 'add', callsaddDelegatewithrole: SUBMITTER, and asserts the stored role. It fails onmainand passes with this change.Fixed Issues
$ #99761
PROPOSAL: #99761 (comment)
Tests
Offline tests
Same as Tests
QA Steps
Same as Tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.