Page MenuHomePhabricator

Gerrit 3.7.8: CI has completed checks. Reload the change view? RELOAD button doesn't work
Open, Needs TriagePublic

Description

After CI has completed testing a change, Gerrit will present a notification to the user:
"CI has completed checks. Reload the change view?" with RELOAD and DISMISS buttons:

gerrtit1.png (777×1 px, 148 KB)

Previously when clicking RELOAD the page would actually reload and show updated information. Now it does nothing other than close the notification.

Browser: Chrome

Event Timeline

dancy attached a referenced file: F42861232: gerrtit1.png. (Show Details)
dancy added subscribers: Paladox, hashar.

@dancy yeah my bad I should have filed it. I talked about it with Paladox immediately after upgrading to 3.7 and the API my code relies on got broken. Namely that is the reload event in the frontend:

showAlertToReloadChange() {
  document.dispatchEvent( new CustomEvent('show-alert', {
    detail: {
      message: 'CI has completed checks. Reload the change view?',
      dismissOnNavigation: true,
      showDismiss: true,
      action: 'Reload',
      callback: () => document.querySelector('gr-app')
        .shadowRoot.querySelector('gr-app-element')
        .shadowRoot.querySelector('gr-change-view')
        .dispatchEvent(new Event('reload')),    // <<<-----------------------
    },
  }));

There is some other code path in Gerrit 3.7 which offers a person to reload the code, and that one works. Thus maybe I use the wrong event or some other data/option gotta be passed. I think, it is still broken in 3.8 but is supposedly fixed in 3.9, @Paladox would know more :)

This is fixed in gerrit 3.9. This is to do with the migration to lit that to get it working needed to use the change model. The changes couldn't be back-ported because they are big and would require a lot being backported.

From what I remember it's https://github.com/GerritCodeReview/gerrit/blob/stable-3.7/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts#L629. I last took a dive years ago so I'm a little fuzzy. But I do remember it was within there.

I have tried with Gerrit 3.8.5 and it still does not work. The debug console has:

show-alert: {"text":"CI has completed checks. Reload the change view?"}
button-click: {"path":"html.lightTheme>body>gr-alert>div.content-wrapper>gr-button.action>paper-button"}

But there are other Reload actions that do work such as:

  • commenting on a change while another patchset has been sent would show a link to reload the patch
  • I had a change notifying me about myself having sent a new patchset (iirc)

So clearly there is a way to reload, and maybe the way I have implemented is slightly broken. We will see in 3.9.

As a side note, when a new patchset has been uploaded, after some minutes a popup shows "A newer patchset has been uploaded RELOAD DISMISS" and the console has:

show-alert: {"text":"A newer patch set has been uploaded"}

Clicking on it does a full reload and the console has:

button-click: {"path":"html.lightTheme>body>gr-alert>div.content-wrapper>gr-button.action>paper-button"}
Page: handleChangeRoute
ChangeReloaded: 845
ChangeFullyLoaded: 3075

So at least that code path does reload the change! :)