Ensure that submittability info of change is refreshed when check is created/updated

If a user loaded a change screen in the browser and then a check was
created/updated that changed the submittability of the change, the new
submittability info was not reflected on the change screen if the user
reloaded the screen. This was because the browser remembers the ETag for
the change details and the ETag for the revision actions, and the ETag
computation didn't consider the checks of the change.

Fix this by implementing the ChangeETagComputation extension point that
allows to provide a value for the change ETag computation. Since all
checks of a change are stored in a single ref, we can just return the
SHA1 of this ref to ensure that the change ETag changes each time when a
check is created or updated. Strictly speaking this changes the change
ETag a little too often, since we need a new change ETag only if the
submittability of the change changes, which only happens when the
combined check state changes (and not all check updates affect the
combined check state). This is fine for now and may be optimized later.

The implementation of ChangeETagComputation delegates to Checks to do
the actual computation of the ETag because this computation is specific
to NoteDb and all NoteDb-specifics are hidden behind the
Checks and ChecksUpdate interfaces.

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I98f3198986c0a543321d56ae15d4332691248b56
6 files changed
tree: 094d6dc1ff274c9a7ed3d4f9fdc92b4fb64e531a
  1. gr-checks/
  2. java/
  3. javatests/
  4. proto/
  5. resources/
  6. test/
  7. .gitignore
  8. bower.json
  9. BUILD
  10. LICENSE
  11. README.md
README.md

Gerrit Code Review Checks Plugin

This plugin provides a unified experience for checkers (CI systems, static analyzers, etc.) to integrate with Gerrit Code Review.

This plugin uses polymer-cli to test.

After bower install, running polymer test -l chrome will run all tests in Chrome, and running polymer serve and navigating to http://127.0.0.1:8081/components/checks/gr-checks/gr-checks-view_test.html allows for manual debugging.