Skip to content

CI state machine event naming should be consistent

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

The following discussions from !150503 (merged) should be addressed:

  • @mfanGitLab started a discussion: (+3 comments)

    @allison.browne nice find! Looking at our current event naming, they do seem like nouns instead of verbs :( I wonder if we have any docs/guides on how to best name these going forward

  • @allison.browne said:

    It is very inconsistent. We've got pending in bridge which is the same name as the status but most events don't have the same name as the status.

    As hfyngvason mentioned in slack Ci::Stage is the only class that actually defines methods automatically based on the status names via enum status: Ci::HasStatus::STATUSES_ENUM, it might also be valid to remove that and enforce transitions always happening through the state machine. There are loads of failures when I try to do that, but it might be worth creating an issue to follow-up and remove it, as right now it's a gotcha that we will overwrite the enum mehod by adding an event of the same name, even though that is how we do it elsewhere.

    Otherwise, we could forbid naming the event directly after the status as a follow-up.

Context

We found a bug where the canceling event introduced on Ci::Stage conflicted with automatically added rails methods (through enum) based on the status names.

Proposal

  • Remove Ci::HasStatus::STATUSES_ENUM and enforce transitions always happening through the state machine
  • Establish and document event naming conventions
Edited by 🤖 GitLab Bot 🤖