Handle Heroku maintenance status and unknown colors gracefully#1
Open
Montana wants to merge 1 commit into
Open
Handle Heroku maintenance status and unknown colors gracefully#1Montana wants to merge 1 commit into
Montana wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Heroku adapter only maps the
green,yellow, andredstatus colors. Heroku's status page also reports a maintenance state (blue), and the adapter currently raises a rawKeyErrorwhen it encounters it:This has three consequences:
#statusand#componentsraiseKeyError, which is not anUpcheck::Errorsubclass — breaking the README's promise that "every failure raises a specific subclass ofUpcheck::Error", and doing so precisely when a caller is most likely to be checking Heroku's status.Provider#maintenance?is unreachable for Heroku. Nothing maps to"maintenance", so it can never returntrue.statusarray also raises (KeyError: key not found: nil, viamax_byreturningnil).Fix
blue→ page status"maintenance"and component status"under_maintenance", with severity ranked betweengreenandyellow(matching Statuspage'snone < maintenance < minor < majorconvention, so a degraded system still wins over a maintenance window)."Systems under maintenance"description.Upcheck::ParseError(instead ofKeyError) with a descriptive message if Heroku ever reports a color the adapter doesn't recognize, keeping the error-contract promise."none"when the systems list is empty rather than raising.Notes for reviewers
minor) instead of raisingParseError, that's a one-line change — raising felt more honest for a canonical-vocabulary API, but I don't feel strongly.Testing
spec/fixtures/heroku/current_status_maintenance.jsonplus astub_heroku_bodyhelper for anomalous inline payloads."maintenance"status and"under_maintenance"components, yellow-beats-blue precedence, empty systems list,ParseErroron unknown colors (both#statusand#components), the maintenance description, and aProvider#maintenance?integration test.