in app/lib/PRUpdater.scala [33:60]
private def getSummaryOfCheckpointChangesGiven(prSnapshot: PRSnapshot, repoSnapshot: RepoSnapshot)(implicit
gitHub: GitHub,
sentryApiClientOpt: Option[SentryApiClient]
): Future[Option[PullRequestCheckpointsStateChangeSummary]] = {
val pr = prSnapshot.pr
val (oldStateLabelsSeq, userLabels) = prSnapshot.labels.map(_.name).partition(repoSnapshot.allPossibleCheckpointPRLabels)
val oldLabels = oldStateLabelsSeq.toSet
val existingPersistedState: PRCheckpointState = repoSnapshot.labelToStateMapping.stateFrom(oldLabels)
if (!ignoreItemsWithExistingState(existingPersistedState)) {
for (currentSnapshot <- findCheckpointStateChange(existingPersistedState, pr, repoSnapshot)) yield {
val newPersistableState = currentSnapshot.newPersistableState
val stateChanged = newPersistableState != existingPersistedState
logger.debug(s"handling ${pr.prId.slug} : state: existing=$existingPersistedState new=$newPersistableState stateChanged=$stateChanged")
if (stateChanged) {
logger.info(s"#${pr.prId.slug} state-change: $existingPersistedState -> $newPersistableState")
val newLabels: Set[String] = repoSnapshot.labelToStateMapping.labelsFor(newPersistableState)
assert(oldLabels != newLabels, s"Labels should differ for differing states. labels=$oldLabels oldState=$existingPersistedState newState=$newPersistableState")
pr.labels.replace(userLabels ++ newLabels)
delayer.doAfterSmallDelay {
actionTaker(currentSnapshot, repoSnapshot)
}
}
Some(currentSnapshot)
}
} else Future.successful(None)
}