Skip to content

Rename TrafficRecovery decision constants to avoid confusion with Color #853

Description

@bolshakov

Stoplight::Domain::TrafficRecovery defines GREEN, YELLOW, RED to represent a recovery strategy's decision about what to do next:

  • GREEN — recovered successfully
  • YELLOW — keep probing, not enough information to decide yet
  • RED — recovery failed

These share names with Stoplight::Color::GREEN/YELLOW/RED, which represent the light's actual state. The two are conceptually different things that happen to use the same words, which makes it is easy to misread and easy to accidentally couple.

Proposal

Rename the TrafficRecovery constants to something that doesn't overlap with Color at all, e.g.:

  • GREEN -> RECOVERED
  • YELLOW -> RECOVERING (or PROBING)
  • RED -> FAILED_TO_RECOVER

Where this touches

  • lib/stoplight/domain/traffic_recovery.rb (the constants themselves)
  • lib/stoplight/domain/traffic_recovery/consecutive_successes.rb (determine_color return values)
  • lib/stoplight/domain/tracker/recovery_probe.rb (the consumer)
  • Any specs asserting against these constants

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueFor newcomers to learn the codebase. Human contributions only, AI-assisted PRs not accepted

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions