[AvatarButton] Fix unexpected showing of the Promo state [chromium/src : main]

0 views
Skip to first unread message

Ryan Sultanem (Gerrit)

unread,
May 4, 2026, 11:05:03 AM (22 hours ago) May 4
to David Roger, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from David Roger

Ryan Sultanem voted and added 1 comment

Votes added by Ryan Sultanem

Commit-Queue+1

1 comment

Patchset-level comments
File-level comment, Patchset 2 (Latest):
Ryan Sultanem . resolved

Hello David, can you please check the following?

Thanks!

Open in Gerrit

Related details

Attention is currently required from:
  • David Roger
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I03cb80e177e8651044dece57deb3a6afffd47a5d
Gerrit-Change-Number: 7810460
Gerrit-PatchSet: 2
Gerrit-Owner: Ryan Sultanem <rs...@google.com>
Gerrit-Reviewer: David Roger <dro...@chromium.org>
Gerrit-Reviewer: Ryan Sultanem <rs...@google.com>
Gerrit-Attention: David Roger <dro...@chromium.org>
Gerrit-Comment-Date: Mon, 04 May 2026 15:04:48 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

David Roger (Gerrit)

unread,
May 4, 2026, 11:46:53 AM (21 hours ago) May 4
to Ryan Sultanem, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Ryan Sultanem

David Roger added 2 comments

File chrome/browser/ui/views/profiles/avatar_toolbar_button_state_manager.cc
Line 936, Patchset 2 (Latest): // should not show the promo. Instead clear the state.
David Roger . unresolved

I don't understand this. Why would we want to disallow showing the promo in this case?

Line 1160, Patchset 2 (Latest): void ShowPromo() {
David Roger . unresolved

I don't see where this function shows the promo, is this name really accurate?

Open in Gerrit

Related details

Attention is currently required from:
  • Ryan Sultanem
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I03cb80e177e8651044dece57deb3a6afffd47a5d
    Gerrit-Change-Number: 7810460
    Gerrit-PatchSet: 2
    Gerrit-Owner: Ryan Sultanem <rs...@google.com>
    Gerrit-Reviewer: David Roger <dro...@chromium.org>
    Gerrit-Reviewer: Ryan Sultanem <rs...@google.com>
    Gerrit-Attention: Ryan Sultanem <rs...@google.com>
    Gerrit-Comment-Date: Mon, 04 May 2026 15:46:40 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Ryan Sultanem (Gerrit)

    unread,
    May 4, 2026, 12:07:09 PM (21 hours ago) May 4
    to David Roger, Chromium LUCI CQ, chromium...@chromium.org
    Attention needed from David Roger

    Ryan Sultanem added 2 comments

    File chrome/browser/ui/views/profiles/avatar_toolbar_button_state_manager.cc
    Line 936, Patchset 2: // should not show the promo. Instead clear the state.
    David Roger . unresolved

    I don't understand this. Why would we want to disallow showing the promo in this case?

    Ryan Sultanem

    I've explained the reasoning more in the commit message.

    My thought here is that we wouldn't want to show the promo because we don't have an exact control on when the the states with higher priority will be resolved.
    Also when resolving it, we would then present the users with another CTA on the same button, which seems like a less appropriate time.

    The initial intention of showing the promo was right after the greeting (and now few seconds after startup with the new promo), the scenario described (which was also problematic in very specific cases) seems like an unexpected case of showing the promo IMO. So my suggestion was to not only fix the crash with this solution, but also prevent showing the promos after resolving any higher priority state.

    Line 1160, Patchset 2: void ShowPromo() {
    David Roger . resolved

    I don't see where this function shows the promo, is this name really accurate?

    Ryan Sultanem

    Right - reverting to the previous name. It was more accurate indeed.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • David Roger
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I03cb80e177e8651044dece57deb3a6afffd47a5d
    Gerrit-Change-Number: 7810460
    Gerrit-PatchSet: 3
    Gerrit-Owner: Ryan Sultanem <rs...@google.com>
    Gerrit-Reviewer: David Roger <dro...@chromium.org>
    Gerrit-Reviewer: Ryan Sultanem <rs...@google.com>
    Gerrit-Attention: David Roger <dro...@chromium.org>
    Gerrit-Comment-Date: Mon, 04 May 2026 16:06:56 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: David Roger <dro...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    David Roger (Gerrit)

    unread,
    May 4, 2026, 12:35:26 PM (20 hours ago) May 4
    to Ryan Sultanem, Chromium LUCI CQ, chromium...@chromium.org
    Attention needed from Ryan Sultanem

    David Roger added 1 comment

    File chrome/browser/ui/views/profiles/avatar_toolbar_button_state_manager.cc
    Line 936, Patchset 2: // should not show the promo. Instead clear the state.
    David Roger . unresolved

    I don't understand this. Why would we want to disallow showing the promo in this case?

    Ryan Sultanem

    I've explained the reasoning more in the commit message.

    My thought here is that we wouldn't want to show the promo because we don't have an exact control on when the the states with higher priority will be resolved.
    Also when resolving it, we would then present the users with another CTA on the same button, which seems like a less appropriate time.

    The initial intention of showing the promo was right after the greeting (and now few seconds after startup with the new promo), the scenario described (which was also problematic in very specific cases) seems like an unexpected case of showing the promo IMO. So my suggestion was to not only fix the crash with this solution, but also prevent showing the promos after resolving any higher priority state.

    David Roger

    I have 2 concerns:

    • The greeting is higher priority than the promo, isn't it? I wonder if just excluding all higher priority states is the right thing to do.
    • There was a way to get into an inconsistent state. It looks like this CL is not really addressing this problem directly, but rather just working around it. Isn't there a more fundamental bug that we need to fix, so that it should be impossible to be in an inconsistent state to begin with?
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ryan Sultanem
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I03cb80e177e8651044dece57deb3a6afffd47a5d
    Gerrit-Change-Number: 7810460
    Gerrit-PatchSet: 3
    Gerrit-Owner: Ryan Sultanem <rs...@google.com>
    Gerrit-Reviewer: David Roger <dro...@chromium.org>
    Gerrit-Reviewer: Ryan Sultanem <rs...@google.com>
    Gerrit-Attention: Ryan Sultanem <rs...@google.com>
    Gerrit-Comment-Date: Mon, 04 May 2026 16:35:08 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: David Roger <dro...@chromium.org>
    Comment-In-Reply-To: Ryan Sultanem <rs...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Ryan Sultanem (Gerrit)

    unread,
    7:31 AM (1 hour ago) 7:31 AM
    to David Roger, Chromium LUCI CQ, chromium...@chromium.org
    Attention needed from David Roger

    Ryan Sultanem added 2 comments

    Patchset-level comments
    File-level comment, Patchset 4 (Latest):
    Ryan Sultanem . resolved

    Thanks David!

    File chrome/browser/ui/views/profiles/avatar_toolbar_button_state_manager.cc
    Line 936, Patchset 2: // should not show the promo. Instead clear the state.
    David Roger . resolved

    I don't understand this. Why would we want to disallow showing the promo in this case?

    Ryan Sultanem

    I've explained the reasoning more in the commit message.

    My thought here is that we wouldn't want to show the promo because we don't have an exact control on when the the states with higher priority will be resolved.
    Also when resolving it, we would then present the users with another CTA on the same button, which seems like a less appropriate time.

    The initial intention of showing the promo was right after the greeting (and now few seconds after startup with the new promo), the scenario described (which was also problematic in very specific cases) seems like an unexpected case of showing the promo IMO. So my suggestion was to not only fix the crash with this solution, but also prevent showing the promos after resolving any higher priority state.

    David Roger

    I have 2 concerns:

    • The greeting is higher priority than the promo, isn't it? I wonder if just excluding all higher priority states is the right thing to do.
    • There was a way to get into an inconsistent state. It looks like this CL is not really addressing this problem directly, but rather just working around it. Isn't there a more fundamental bug that we need to fix, so that it should be impossible to be in an inconsistent state to begin with?
    Ryan Sultanem

    First one is not really a problem as the enabling of the state is done in two steps; first triggering the promo computation (from the previous state being the Greeting), then requesting an update which would potentially make the current state active. So `new_state` should always be `kPromo` at this point, if we want to show the promo.

    Second one is actually slightly problematic you are right - I thought of fixing it by making a more general assumption that the promo should always clear (IMO it still holds, but I will remove from this CL).
    The initial problem was that this depended on the order of observer of the Identity Manager triggering a sign out event. If another state provider requests an update as a reaction of the IdentityManager notification (which did not yet reach the PromoStateProvder), then the state would be incorrect.

    As a solution now, we just double check that the state is still valid. I will adapt the commit message if you agree with this solution.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • David Roger
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I03cb80e177e8651044dece57deb3a6afffd47a5d
      Gerrit-Change-Number: 7810460
      Gerrit-PatchSet: 4
      Gerrit-Owner: Ryan Sultanem <rs...@google.com>
      Gerrit-Reviewer: David Roger <dro...@chromium.org>
      Gerrit-Reviewer: Ryan Sultanem <rs...@google.com>
      Gerrit-Attention: David Roger <dro...@chromium.org>
      Gerrit-Comment-Date: Tue, 05 May 2026 11:30:49 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages