Show uptime to three decimals; never round an outage up to 100%#98
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes misleading “100.00%” uptime displays by introducing a floored, three-decimal uptime label so any non-zero downtime is reflected (e.g., 99.999%), while a truly perfect window still renders as 100% (no trailing decimals).
Changes:
- Replaced the previous rounded
%.2fuptime display with a new helper that floors to three decimals and trims trailing zeros. - Updated the service partial to render the formatted label (or “No data yet”) instead of a numeric average.
- Added helper tests covering flawless windows, tiny outages, trimming behavior, and floor-not-round behavior.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/helpers/upright/public/services_helper_test.rb | Adds coverage for the new uptime label formatting and edge cases. |
| app/views/upright/public/services/_service.html.erb | Switches the UI to display the formatted uptime label (string) instead of a rounded numeric average. |
| app/helpers/upright/public/services_helper.rb | Introduces uptime_percentage_label that floors to 3 decimals, trims zeros, and renders bare 100% for perfect uptime. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
6351514 to
a3d46e5
Compare
A service's overall uptime was averaged and shown as "%.2f", so a real outage too small to register at two decimals (e.g. a 1-minute blip over 90 days ≈ 99.99923%) displayed as "100.00%" — contradicting the degraded day in its own bar chart. Show three decimals and floor rather than round, so any real downtime reads as 99.999% while a flawless window still shows a bare "100%". Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
A service's overall uptime figure was the mean of its daily fractions shown as
%.2f. A real outage too small to register at two decimals — e.g. a 1-minute blip over 90 days ≈ 99.99923% — displayed as 100.00%, contradicting the degraded day visible in the same service's bar chart.Now shows three decimals and floors (not rounds), so any real downtime reads as
99.999%while a genuinely flawless window still shows a bare100%(not100.000%). Trailing zeros are trimmed.Surfaced by the Statuspage history backfill in 37upright: Basecamp 2 has a day with a 1-minute outage (99.93% that day), yet the headline read 100.00%.
Added
Upright::Public::ServicesHelperTestcovering the bare-100%, tiny-outage, trailing-zero, and floor-not-round cases.🤖 Generated with Claude Code