Skip to content

Show uptime to three decimals; never round an outage up to 100%#98

Merged
lewispb merged 1 commit into
mainfrom
uptime-percentage-precision
Jul 1, 2026
Merged

Show uptime to three decimals; never round an outage up to 100%#98
lewispb merged 1 commit into
mainfrom
uptime-percentage-precision

Conversation

@lewispb

@lewispb lewispb commented Jul 1, 2026

Copy link
Copy Markdown
Member

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 bare 100% (not 100.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::ServicesHelperTest covering the bare-100%, tiny-outage, trailing-zero, and floor-not-round cases.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings July 1, 2026 14:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 %.2f uptime 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.

@lewispb lewispb force-pushed the uptime-percentage-precision branch 2 times, most recently from 6351514 to a3d46e5 Compare July 1, 2026 14:18
Copilot AI review requested due to automatic review settings July 1, 2026 14:18
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>
@lewispb lewispb merged commit 632113d into main Jul 1, 2026
9 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants