0349628249
Given two PRs with B depending on A which are enqueued in gate, A is closed and then immediately reopened. This sequence of events will currently dequeue A and then immediately enqueue it behind B. Since the check for whether a dependency is already in the queue doesn't care if it's ahead or behind the current change, we'll not dequeue B and the content of builds executed by B will not include A. This change updates the check to determine if a change is already in the queue to only check for changes ahead of it. This causes B to be correctly dequeued in the next pipeline pass. This behavior is correct, but isn't always intuitive or consistent. If the time between closing and reopening a change is long enough for a pipeline process, then both changes will be enqueued by the reopening (because we check for changes needing enqueued changes and enqueue them behind). But if both events are processed in a single pipeline run, then the removal of B happens after the re-enqueue of A which means that it won't be re-added. To correct this, whenever we remove abandoned changes, we will also remove changes behind them that depend on the removed abandoned changes at the same time. This means that in our scenario above, the re-enqueue happens under the same conditions as the original enqueue, and both A and B are re-enqueued. Co-Authored-By: James E. Blair <jim@acmegating.com> Change-Id: Ia1d79bccb9ea39e486483283611601aa23903000