Skip to content

batches: Add computed state value to DB

Warren Gifford requested to merge es/changeset-state-db into main

Created by: eseliger

This adds a trigger that updates the new computed_state value on a changeset in the DB before writes. This ensures it's always up to date. With this new column, we don't have to reverse-engineer the go logic from the resolver into SQL conditions anymore, thus making multiple places simpler to reason about and reducing the sources of truth for the logic to compute the state. This'll also make filtering extremely fast because we can now index on the state directly.

Most of the diff is actually just fixing bad state in tests that now showed up.

Closes https://github.com/sourcegraph/sourcegraph/issues/19975

Test plan

Manually verified a bunch of workflows still work and this is also heavily tested.

Merge request reports

Loading