Skip to content

Add a diffStat field on Campaign to return combined diffStat

Warren Gifford requested to merge campaign-diff-stat into master

Created by: mrnugget

This is the first part of #10170, the second part would add diffStat on PatchSet.

Note that this does not include any caching of sorts. I think that makes it easier to understand for now, because I'm still not sure when would be the best time to cache these diff stats and when to invalidate the cache. Also easier to review.

So for now this "only" adds a diffStat field on Campaign that loads all the data under the hood and computes the diff stat. Probably equally as inefficient as computing the combined diff stat on the client (maybe even more in-efficient, since we need to do 2 additional SQL queries?). But it enables the caching later on.

I also changed the web code to make use of this new field.

This also adds an extensive integration-y test on the GraphQL level that not only tests the diffStat field but also the whole create a campaign with a patch set and create a changeset on the code host flow. I was in the mood for writing tests.

What I also want to follow up on (maybe in this PR as commits that review doesn't need to wait for or in separate PRs):

  • Remove the TODO related to the stray transaction in ExecChangeset
  • Create a single fakeChangesetSource somewhere that can be shared between tests
  • Clean up the type definitions and queries in the tests

Merge request reports

Loading