Mysterious Custom-Rule submit requirement after upgrade to 3.6.1

132 views
Skip to first unread message

Marquis Wong

unread,
Aug 23, 2022, 11:30:49 AM8/23/22
to Repo and Gerrit Discussion
My organization recently upgraded to 3.6.1. We ran the copy-approvals as a site-command offline on 3.5.2.

We're seeing some interesting UI behavior after the upgrade. First is that some changes show a mysterious Custom-Rule. This is inconsistent per-change, and other changes in the same repository don't have it. 
Screenshot.jpg

This is especially annoying in the dashboard, because it adds another "CR" column that is completely irrelevant, but reads just like Code-Review.
Screenshot 2.jpg

Has anyone else seen this? Is there some way for me to get rid of these?

Finally, the Trigger Votes don't show up consistently in the Dashboard as columns.

We have several non-required labels, such as Static-Analysis:
Screensho5 .jpg
This trigger vote sometimes shows up in the dashboard or search results, and it sometimes doesn't.
Screenshot 4.jpg

I think this is because for one project that label is a submit requirement rather than a trigger vote. Do we expect that only submit requirements show up here?

Thanks,
Marquis

Youssef Elghareeb

unread,
Aug 23, 2022, 6:31:56 PM8/23/22
to Repo and Gerrit Discussion
With the release of submit requirements [1], any legacy label functions, custom or prolog submit rules results are converted by the server to submit requirements which are then displayed on the change page.

"Custom-Rule" is generated from plugins implementing the SubmitRule interface ([2] for code-owners as example). For old merged changes prior to submit-requirements, the Gerrit server used to store submit records (result of evaluating of submit rules) in the database, but did not include a field indicating which plugin generated them, so now the server converts them to a "Custom-Rule" since we don't have meaningful data / name for them. I adapted the implementation of Code-Owners (see [3]) to export a meaningful name, so that results are displayed as "Code-Owners" in the submit requirements section in the UI. Do you see this "Custom-Rule" entry showing up on newly merged changes?

Marquis Wong

unread,
Aug 23, 2022, 7:23:45 PM8/23/22
to Repo and Gerrit Discussion
Thanks!

I think this clarifies it. This does only happen for old changes, as far as I can tell.

Do you know where the legacy submit records are stored? I may be interested in going through and deleting them automatically for us, to clean up the UI.

Thanks,
Marquis

Youssef Elghareeb

unread,
Aug 29, 2022, 4:46:10 AM8/29/22
to Repo and Gerrit Discussion
Hi Marquis, submit records are stored in special refs called the change-meta-ref that has the format "refs/changes/YZ/ABCDYZ/meta" (ABCDYZ is the change number). However I'd strongly recommend not to touch / modify the stored records as a wrong modification might result in the server unable to parse these refs, and also because "Custom-Rule" is only affecting old changes. Below is an explanation of the format.

If you checkout this ref (change-meta-ref) and look at the history, you will find submit records stored in commit message footers with the following format:

```
Submitted-with: OK
Submitted-with: OK: Code-Review: Gerrit User $USER_ID <$$USER_ID@$SERVER_ID>
Submitted-with: OK: Code-Style: Gerrit User $USER_ID <$USER_ID@$SERVER_ID>
Submitted-with: OK: Verified: Gerrit User $USER_ID <$USER_ID@$SERVER_ID>
```

The first line shows the status of the submit record, then subsequent lines show the status of labels associated with the submit record.

Note that there might be multiple stored submit records, e.g.

```
Submitted-with: OK  // submit record 1
Submitted-with: OK: $LABEL_1
Submitted-with: OK: $LABEL_2
Submitted-with: OK // submit record 2
Submitted-with: OK: $LABEL_3
...
```

Submit records can occur without association with labels. This is the case for the "Custom-Rule" that shows up on the UI. Hence to locate these submit records, you need to search for lines that don't have labels in subsequent lines.

Finally, we recently added https://gerrit-review.googlesource.com/c/gerrit/+/316538 that added a rule-name sub-footer with submit records, like:

```
Submitted-with: OK
Submitted-with: Rule-Name: gerrit~PrologRule
Submitted-with: OK: $LABEL: Gerrit User $USER <...>
```

You need to filter these occurrences out as well, because if rule-name footer is present it will show up on the UI. "Custom-Rule" is shown otherwise.
Reply all
Reply to author
Forward
0 new messages