Page MenuHomePhabricator

Some data inconsistencies in Gerrit when querying for status_value
Closed, DeclinedPublic

Description

Followup on T224755: Allow to filter by Gerrit label 'code review' (on the latest patchset) in the frontend

Background / context: I was wondering if on https://wikimedia.biterg.io , I could get a list of the oldest open Gerrit changesets which do NOT have a code review label (means: !_exists_:status_value). (I know I could also do this on Gerrit itself.)

First query: Go to https://wikimedia.biterg.io/app/kibana#/dashboard/Gerrit-Backlog , make sure that the timespan in the upper right corner is set to "Last 10 years", set the Advanced Filter to status:"NEW" AND !_exists_:status_value. See that the first link in the "Backlog" widget is https://gerrit.wikimedia.org/r/8786 .
Going to "Discover" and choosing gerrit and filtering on url:"https://gerrit.wikimedia.org/r/8786" shows that status_value is empty in the very first entry.

Second query: Go to https://wikimedia.biterg.io/app/kibana#/dashboard/Gerrit-Backlog , make sure that the timespan in the upper right corner is set to "Last 10 years", set the Advanced Filter to status:"NEW". See that the first link in the "Backlog" widget is https://gerrit.wikimedia.org/r/8785 .
Going to "Discover" and choosing gerrit and filtering on url:"https://gerrit.wikimedia.org/r/8785" shows that it has status_value: -1 in the very first entry.

I'm confused when looking at both URLs in the Gerrit web interface, as both patches at some point had status_value: -1 in the past, and both patches currently do not have a status_value set.
I would have expected 8785 to also be included in the first query already.

Is my expectation wrong that querying for status_value should query on the current value of the latest patchset in a changeset?

Upstream: https://gitlab.com/Bitergia/c/Wikimedia/support/issues/70 (not public)

Event Timeline

Aklapper triaged this task as Low priority.Dec 17 2019, 2:48 PM
Aklapper created this task.
Aklapper updated the task description. (Show Details)

Quoting Quan from internal ticket:

The status_value stores the value of the last Code-Review approval. Verified or others are ignored when this field is calculated.
In the case of https://gerrit.wikimedia.org/r/8785, as you mentioned, it received a -1 in Patch-Set 3. Other activity is ignored.
https://wikimedia.biterg.io/goto/6de9825b8f7890a9297675e906840e35
In the case of https://gerrit.wikimedia.org/r/8786, there's no Code-Review approvals so no value set.
https://wikimedia.biterg.io/goto/3b1d64756ce65db3d7b9ad943bcfb9bb

Aklapper renamed this task from Results when querying for status_value in Gerrit can be surprising to Some data inconsistencies in Gerrit when querying for status_value.Jan 17 2020, 6:56 PM
Aklapper closed this task as Declined.

Quoting internal reply:

As you can see, in the data we retrieve there's no approval section for that patchset. Maybe they did the revision in a different way?

$ ssh  -p 29418 owl@gerrit.wikimedia.org gerrit  query limit:1 '(status:open OR status:closed) AND 8786'  --all-approvals --comments --format=JSON
{
  "id": "If6e18d7ed05bed12c7310a462076c5370cce518a",
  "number": 8786,
  "subject": "Pre-save transform inside extension hooks",
  "url": "https://gerrit.wikimedia.org/r/8786",
   [...],
  "patchSets": [
    {
      "number": 1,
      "revision": "52a5b6b3fd472a7c75f03826703968b6b36bace2",
      "parents": [
        "c00fc726d9f06f4741438a7c6e2b74f7431d900d"
      ],
      "ref": "refs/changes/86/8786/1",
      "uploader": {
         [...]
      },
      "createdOn": 1337878319,
      "author": {
         [...]
      },
      "kind": "REWORK",
      "comments": [
        {
          "file": "ImageMap.php",
          "line": 4,
          "reviewer": {
            [...]
          },
          "message": "Use $dir (which you can change to $dir = __DIR__ by now."
        },
        {
          "file": "ImageMap.php",
          "line": 22,
          "reviewer": {
            [...]
          },
          "message": "missing spaces around array elements"
        }
      ],
      "sizeInsertions": 19,
      "sizeDeletions": -1
    },
    {
      "number": 2,
      "revision": "55f2d47abd0518fac3ef0f52e68a7b4bd3471715",
      [...]
      "kind": "REWORK",
      "approvals": [
        {
          "type": "Verified",
          "description": "Verified",
          "value": "-1",
          "grantedOn": 1443018362,
          "by": {
            "name": "jenkins-bot",
            "username": "jenkins-bot"
          }
        }
      ],
      "sizeInsertions": 18,
      "sizeDeletions": 0
    },
    {
      "number": 3,
      "revision": "f90f36ba9ac8d53875c5fce087c295d3c633daeb",
       [...]
      "kind": "REWORK",
      "approvals": [
        {
          "type": "Verified",
          "description": "Verified",
          "value": "-1",
          "grantedOn": 1443018496,
          "by": {
            "name": "jenkins-bot",
            "username": "jenkins-bot"
          }
        }
      ],
      [...]
    },
[...]