Skip to content
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

Fix copilot bugs #48517

Merged
merged 22 commits into from
Sep 18, 2024
Merged

Fix copilot bugs #48517

merged 22 commits into from
Sep 18, 2024

Conversation

rushatgabhane
Copy link
Member

@rushatgabhane rushatgabhane commented Sep 4, 2024

Details

Fixed Issues

$ #48261
#48246
#48252
#48253
#48259
#48244

New issues @mkhutornyi -

#48965
#48966
#48967
#48972

PROPOSAL:

Tests

Pre-req: be on copilot beta

Long name

  1. Go to profile
  2. Set your name as a very long name
  3. Go to settings page
  4. Verify that there is a space between your name and status emoji

Subscription page

  1. Go to Account settings.
  2. Go to Subscription.
  3. Click Account switcher.
  4. Select another account.
  5. Verify that the subscription page has a loading indicator.

Avatar error

  1. Go to Account settings > Profile.
  2. Upload a large image that will trigger error.
  3. Click on the account switcher.
  4. Select another account.
  5. Verify that the invalid avatar format error will disappear after switching account.

Interactivity

  1. Go to account with no copilot
  2. Go to settings page
  3. Click you account name
  4. Verify that clicking name does not show interactivity

Avatar skeleton

  1. GO to profile page
  2. Switch accounts
  3. Verify that avatar in profile page shows skeleton

Selected access level

  1. Go to Account settings > Security.
  2. Click Add copilot.
  3. Select a user.
  4. Select an access level.
  5. Click Access level on the confirmation page
  6. Verify that the selected access level will be highlighted.

Fallback avatar

  1. Go to Account settings > Security.
  2. Click on the account switcher.
  3. Switch to another acccount.
  4. After everything loads, switcher to the original account while staying on Security page.
  5. Scroll down the Security page.
  6. Verify that the account under "You can access these accounts via the account switcher:" should have an avatar.

Add yourself as copilot

  1. Go to settings > security > add Copilot
  2. Write the email you used to login
  3. Verify that you see "No results found message"

Learn more link

  1. Settings > Security
  2. Reduce the screen width to mobile size
  3. Verify that the "learn more" link has correct styles
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2024-09-08.at.21.49.11.mov
image
Screen.Recording.2024-09-08.at.21.56.05.mov
Screen.Recording.2024-09-08.at.22.32.04.mov
image
Screen.Recording.2024-09-08.at.22.54.11.mov

#48965 -

image

#48966 -

image

#48967 -

image

#48972 -

image
MacOS: Desktop

@dangrous
Copy link
Contributor

dangrous commented Sep 4, 2024

I know this is a draft but wanted to call out two bugs not yet listed in the list in the PR description:

@rushatgabhane
Copy link
Member Author

added them to the list

@rushatgabhane rushatgabhane marked this pull request as ready for review September 8, 2024 19:56
@rushatgabhane rushatgabhane requested a review from a team as a code owner September 8, 2024 19:56
@melvin-bot melvin-bot bot requested review from mkhutornyi and removed request for a team September 8, 2024 19:56
Copy link

melvin-bot bot commented Sep 8, 2024

@mkhutornyi 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]

@rushatgabhane
Copy link
Member Author

cc: @dangrous

@rushatgabhane
Copy link
Member Author

#47338 (comment)

@dangrous this was fixed in the PR itself. So I've removed it from the list

Screen.Recording.2024-09-09.at.02.20.15.mov

@rushatgabhane
Copy link
Member Author

All bugs here fixed - #48517 (comment)

cc @mkhutornyi

@mkhutornyi
Copy link
Contributor

Bug: app crashes while switching account. And blank account info

bug.mov

crash

blank

And console error:

console

Can we fix these here or out of scope?

@@ -141,7 +142,7 @@ function AccountSwitcher() {
<View style={[styles.flexRow, styles.gap1]}>
<Text
numberOfLines={1}
style={[styles.textBold, styles.textLarge]}
style={[styles.textBold, styles.textLarge, styles.flexShrink1]}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please link fixed issue per each change (github comment) so I can have context?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed fix #48261 on native

fix1

@rushatgabhane
Copy link
Member Author

Bug: app crashes while switching account. And blank account info

unrelated to copilot actually. and being fixed in another issue

@@ -141,7 +142,7 @@ function AccountSwitcher() {
<View style={[styles.flexRow, styles.gap1]}>
<Text
numberOfLines={1}
style={[styles.textBold, styles.textLarge]}
style={[styles.textBold, styles.textLarge, styles.flexShrink1]}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed fix #48261 on native

fix1


if (!subscriptionPlan && isAppLoading) {
return <FullScreenLoadingIndicator />;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed fix #48246

fix2.mov

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rushatgabhane I still see not here page for a brief amount of time, is that expected?

Screen.Recording.2024-09-16.at.9.19.42.PM.mov

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is worth improving this more. The subscription data is simply not in Onyx, so we have to show not found page

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the conditon now. the most we can do is to show a loader when the app is loading.

    if (!subscriptionPlan && isAppLoading) {
        return <FullScreenLoadingIndicator />;
    }
    if (!subscriptionPlan) {
        return <NotFoundPage />;
    }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think that's fine for now

@@ -193,6 +193,10 @@ function AvatarWithImagePicker({
setError(null, {});
}, [isFocused]);

useEffect(() => {
setError(null, {});
}, [source, avatarID]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed fix #48252

fix3.mov

@@ -127,6 +127,7 @@ function AccountSwitcher() {
}}
ref={buttonRef}
interactive={canSwitchAccounts}
pressDimmingValue={canSwitchAccounts ? undefined : 1}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed fix #48253

fix4.mov

/>
</MenuItemGroup>
{isEmptyObject(currentUserPersonalDetails) || accountID === -1 || !avatarURL ? (
<AvatarSkeleton size={CONST.AVATAR_SIZE.XLARGE} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed fix #48259

@@ -372,7 +376,7 @@ function AvatarWithImagePicker({
accessibilityLabel={translate('avatarWithImagePicker.editImage')}
disabled={isAvatarCropModalOpen || (disabled && !enablePreview)}
disabledStyle={disabledStyle}
style={[styles.pRelative, avatarStyle, type === CONST.ICON_TYPE_AVATAR && styles.alignSelfCenter]}
style={[styles.pRelative, avatarStyle]}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes regression when create new group:

regression

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch!

Copy link
Member Author

@rushatgabhane rushatgabhane Sep 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think i'll just override the avatar style then

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rushatgabhane please let me know when it's fixed

Copy link
Member Author

@rushatgabhane rushatgabhane Sep 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@dangrous
Copy link
Contributor

@rushatgabhane are we going to be able to add the new copilot bugs into this PR as well? I believe you're assigned to all of them currently. Thanks!

@rushatgabhane
Copy link
Member Author

yes will do

@allgandalf
Copy link
Contributor

Is it a bug from our PR ?, the error message is not visible on iOS native:

Screenshot 2024-09-16 at 10 15 32 PM

@rushatgabhane
Copy link
Member Author

rushatgabhane commented Sep 16, 2024

Is it a bug from our PR ?, the error message is not visible on iOS native:

looks like it let me see.

Happens on main too. Not this PR

Copy link
Contributor

@allgandalf allgandalf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@melvin-bot melvin-bot bot requested a review from dangrous September 16, 2024 19:48
@allgandalf
Copy link
Contributor

@dangrous can you delete the checklist from @mkhutornyi here, that is why the checklist workflow is not passing

@dangrous
Copy link
Contributor

Running through this, it's all looking good so far! Commenting here when I find bugs so you might get a couple messages.

I noticed that we don't differentiate between errors on the new validate code form. I tried adding a copilot from an unvalidated account, and got a 401 Delegator account must be validated error returned from the server, but all the form said was that it was an incorrect validation code

image

Although now that I'm writing it I'm realizing it might be something we should fix on the backend? Like if the verification code is correct (for all of these new flows), should that count to validate the account? cc @NikkiWines since you wrote the new code on the backend.

@dangrous
Copy link
Contributor

For #48246 I think we might want a fallback for if the delegator account doesn't have a subscription but the delegate does, or vice versa - that is, if you're on the subscription page and swap accounts to a user who doesn't have it. Maybe not found is fine here.

Copy link
Contributor

@dangrous dangrous left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fallback icon works for now for #48966, I will look into the back end fix.

Other than those commented bugs, I think we're almost there! Let me know what you think about those, and I agree that we can skip the ones @allgandalf called out


if (!subscriptionPlan && isAppLoading) {
return <FullScreenLoadingIndicator />;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think that's fine for now

@rushatgabhane
Copy link
Member Author

I noticed that we don't differentiate between errors on the new validate code form. I tried adding a copilot from an unvalidated account, and got a 401 Delegator account must be validated error returned from the server, but all the form said was that it was an incorrect validation code

you're right. we should fix on backend. We have to return onyx data and then frontend can show that.

@dangrous
Copy link
Contributor

Ready to merge this if you agree with #48517 (comment) - should we leave as is? Or would it be better to navigate from subscription page back to profile page or something?

@rushatgabhane
Copy link
Member Author

Ready to merge this if you agree with #48517 (comment) - should we leave as is? Or would it be better to navigate from subscription page back to profile page or something?

we don't have this pattern to fallback to another route. so i think we should do nothing here 👍

Copy link
Contributor

@dangrous dangrous left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay great! BE changes needed as noted to fix the remaining bugs but this gets 99% of them and looks great!

@dangrous dangrous merged commit 3657a67 into Expensify:main Sep 18, 2024
18 of 20 checks passed
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/dangrous in version: 9.0.38-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/grgia in version: 9.0.38-4 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants