Page MenuHomePhabricator

Gerrit: All WIP changes are marked as "Merge Conflict" in the dashboard, even when they are not
Closed, ResolvedPublicBUG REPORT

Description

Gerrit: All WIP changes are marked as "Merge Conflict" in the dashboard, even when they are not

Steps to replicate the issue (include links if applicable):

  • Go to a Wikimedia Gerrit Review user dashboard with WIP changes
  • Check the "Status" field
  • Click one of the "Merge Conflict, WIP" changes that does not have merge conflict

What happens?:

  • The change does not have merge conflict
  • There's "WIP" label shown in the change
  • There's no label show "Merge Conflict" in the change
  • The status in user dashboard show as "WIP, Merge Conflict"

What should have happened instead?:

  • The status in user dashboard should only show "WIP"
  • The status in user dashboard should not show "Merge Conflict"

Software version (skip for WMF-hosted wikis like Wikipedia):

  • Gerrit Code Review 3.5.4

Other information (browser name/version, screenshots, etc.):

image.png (107×698 px, 17 KB)

image.png (102×982 px, 25 KB)

image.png (103×832 px, 22 KB)

Event Timeline

hashar subscribed.

Nice finding @Winston_Sung when querying Gerrit for changes with is:wip is:open, all those work in progress are marked as being in merge conflict (and adding is:mergeable returns no change).

To reproduce, I have send two empty patchsets https://gerrit.wikimedia.org/r/c/test/gerrit-ping/+/886511 The first is marked with kind: REWORK which means Gerrit detected a Nontrivial content changes. which does not make any sense for an empty patchset.

Looking at upstream issue tracker for wip and conflict it is already filed:

It is definitely an Upstream issue and I don't think we can do much about it.

Winston_Sung changed the task status from Open to Stalled.Feb 6 2023, 11:03 AM

I had a very quick look. An open change in WIP stat has:

mergeablefalse
work_in_progresstrue

Which causes the frontend to add a Merge Conflict status to the list of statuses. From Gerrit 3.5 code:

polygerrit-ui/app/utils/change-util.ts
export function changeStatuses(
  change: ChangeInfo,
  opt_options?: ChangeStatusesOptions
): ChangeStates[] {
  const states = [];
  if (change.status === ChangeStatus.MERGED) {
    states.push(ChangeStates.MERGED);
  } else if (change.status === ChangeStatus.ABANDONED) {
    states.push(ChangeStates.ABANDONED);
  } else if (
    change.mergeable === false ||
    (opt_options && opt_options.mergeable === false)
  ) {
    // 'mergeable' prop may not always exist (@see Issue 6819)
    states.push(ChangeStates.MERGE_CONFLICT);
  }
  if (change.work_in_progress) {
    states.push(ChangeStates.WIP);
  }

But if one heads to the change itself, the Merge Conflict does not show up (I guess due to a different code path being used) or maybe the API used for the change list view has the mergeable state undefined/false by default and requires another query to fetch it (since computing mergeability is a potentially costly operation).

The fix is in v3.8.5, v3.9.4 and will be in v3.10.0

Winston_Sung edited projects, added Gerrit (Gerrit 3.8); removed Gerrit (Gerrit 3.9).

Thanks.

Confirmed already fixed in Gerrit v3.8.5:

https://gerrit.wikimedia.org/r/dashboard/self