Skip to content

feat(dashboard): 24h / 7d / 30d availability window, saved per user - #821

Merged
fclairamb merged 3 commits into
mainfrom
claude/project-thread-n9x5iz
Nov 9, 2026
Merged

fclairamb merged 3 commits into
mainfrom
claude/project-thread-n9x5iz

Conversation

@fclairamb

@fclairamb fclairamb commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Requested by Florent · project thread

What & why

A user asked for the dashboard's availability over the last week, not only the last 24 hours. The dashboard header now has a 24h / 7 days / 30 days selector. It switches the availability tile and the all-green banner (figure, label, SLA pill). The choice is saved in users.preferences.dashboardWindow, so it follows the user to every browser. Spec: specs/done/2026/11/2026-11-09-02-dashboard-availability-window.md.

  • API: GET /checks/stats adds availability7d and availability30d, with the same null rule as availability24h (no countable data means null, never 100). All three come back in one response, so switching windows is instant.
  • DB: GetOrgAvailability24h is replaced by GetOrgAvailability(ctx, org, now, windows).
    • It still runs two queries, one per partial index, with a conditional SUM per window.
    • The rollup query now reads every rollup tier (period_type <> 'raw') instead of hour only. 7d and 30d need day rows: hour retention defaults to 7 days.
    • A rollup row counts when its period_start is inside the window, the same edge rule as uptimebar.WindowAvailability. For 24h nothing changes, since no day row starts inside a trailing day.
  • Preferences: PATCH /auth/me {preferences: {dashboardWindow}} accepts 24h, 7d, 30d or "" (clear). Anything else is 400 VALIDATION_ERROR. The column is JSON, so there is no migration.
  • dash0:
    • New updatePreferences in AuthContext. Demo and impersonating sessions keep the choice for the page load only.
    • Strings use i18next context keys (_7d, _30d) in en/fr/de/es.
    • The per-check availability table gets a "Last 7 days" row.
  • pkg/client/client_generated.go was regenerated. It also picks up two fields main had not regenerated yet (oldestEnabledCheckCreatedAt, githubStar).

Not included: the "Checks at a glance" uptime strips stay hourly over 24h. 7d or 30d strips would need a server-side org-wide bucket endpoint.

How to test

  • go test -short ./internal/handlers/checks/ ./internal/handlers/auth/. The availability table cases now assert all three windows, with new cases for hour rows older than 24h, a day row older than 7d, and rows older than 30d.
  • Postgres twin: TestGetCheckStatsAvailability24h_Postgres passes on embedded Postgres.
  • e2e/dashboard.spec.ts has a new selector test: tile, banner and the PATCH payload. Run with e2e/availability.spec.ts: 27/27 pass against a local server.
  • Manual: open /d/orgs/<org>, pick 7 days, reload. The choice sticks. Checked at 375px too: the selector wraps under the title and has no horizontal scroll.

Checklist

  • golangci-lint v2.15.0: 0 issues. dash0 tsc -b, e2e typecheck and vitest run (2817 tests) pass.
  • Tests added or updated for the change.
  • Docs: no dashboard page exists in web/docs/. The API reference picks up the OpenAPI changes.
  • Schema: no migration (JSON column).

Sandbox notes:

  • go test -short ./... has failures in server, internal/app, internal/config, internal/checkworker and the network checkers. A clean main checkout fails the same way here: hostname vm is not a valid worker slug, there is no outbound network, and docs/status0 are not built.
  • bun run lint reports 34 errors on both main and this branch.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XE5Bqr6tD92GwGqgXWX14r

The dashboard availability tile and banner only showed the last 24 hours.
A header selector now switches them to 7 or 30 days, and the choice is
saved in users.preferences.dashboardWindow so it follows the user.

- GET /checks/stats adds availability7d and availability30d. One rollup
  and one raw query compute all three windows; the rollup side now reads
  every rollup tier, so 7d and 30d include day rows.
- PATCH /auth/me accepts preferences.dashboardWindow (24h, 7d, 30d).
- The per-check availability table gets a "Last 7 days" row.

Spec: specs/done/2026/11/2026-11-09-02-dashboard-availability-window.md

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XE5Bqr6tD92GwGqgXWX14r
@fclairamb fclairamb self-assigned this Nov 9, 2026
@codecov

codecov Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.23009% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.25%. Comparing base (ec0aebf) to head (89d3c6f).

Files with missing lines Patch % Lines
server/internal/db/postgres/postgres.go 95.55% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #821      +/-   ##
==========================================
+ Coverage   89.24%   89.25%   +0.01%     
==========================================
  Files        1333     1333              
  Lines      136158   136202      +44     
==========================================
+ Hits       121510   121566      +56     
+ Misses      14639    14627      -12     
  Partials        9        9              
Files with missing lines Coverage Δ
server/internal/db/models/auth.go 100.00% <100.00%> (ø)
server/internal/db/sqlite/sqlite.go 96.73% <100.00%> (-0.02%) ⬇️
server/internal/handlers/auth/handler.go 90.34% <100.00%> (+0.01%) ⬆️
server/internal/handlers/auth/preferences.go 97.56% <100.00%> (+0.33%) ⬆️
server/internal/handlers/checks/stats.go 100.00% <100.00%> (ø)
server/internal/db/postgres/postgres.go 94.88% <95.55%> (-0.01%) ⬇️

... and 18 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fclairamb
fclairamb marked this pull request as ready for review November 9, 2026 20:54
@fclairamb
fclairamb enabled auto-merge (squash) November 9, 2026 21:02
@fclairamb
fclairamb merged commit 283a28e into main Nov 9, 2026
38 checks passed
@fclairamb
fclairamb deleted the claude/project-thread-n9x5iz branch November 9, 2026 21:25
@fclairamb fclairamb mentioned this pull request Nov 9, 2026
fclairamb added a commit that referenced this pull request Nov 9, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.45.0](v0.44.3...v0.45.0)
(2026-11-09)


### Features

* dashboard glance strips, failed sign-in account names, log noise fixes
([#824](#824))
([659c52c](659c52c))
* **dashboard:** 24h / 7d / 30d availability window, saved per user
([#821](#821))
([283a28e](283a28e))
* **mcp:** sharpen tool descriptions for Glama scoring
([#825](#825))
([ca305f1](ca305f1))
* **server:** run as a native Linux systemd service
([#819](#819))
([8a0cb2f](8a0cb2f))
* **server:** run as a native macOS launchd service
([#811](#811))
([c6612ea](c6612ea))
* **server:** run as a native Windows service, no NSSM
([#802](#802))
([c66c947](c66c947))
* **telegram:** explicit /support mode instead of capturing every
message ([#820](#820))
([571607e](571607e))


### Bug Fixes

* **auth:** admit by email address only when the email is verified
([#818](#818))
([91992fe](91992fe))
* batch of production-log and Slack issues
([#808](#808))
([580d09c](580d09c))
* **deps:** update github.com/dop251/goja digest to d6eaa50
([#800](#800))
([60b7443](60b7443))
* **deps:** update github.com/dop251/goja digest to d8dfb4d
([#810](#810))
([e11b926](e11b926))
* **deps:** update go dependencies (non-major)
([#806](#806))
([1c59927](1c59927))
* **deps:** update go dependencies (non-major)
([#822](#822))
([ec0aebf](ec0aebf))
* **deps:** update module github.com/aws/aws-sdk-go-v2/credentials to
v1.20.17 ([#823](#823))
([27efc51](27efc51))
* **deps:** update module github.com/crewjam/saml to v0.6.3
([#807](#807))
([0f06336](0f06336))
* **deps:** update module github.com/wneessen/go-mail to v0.8.2
([#812](#812))
([3670206](3670206))
* **oncall:** record on-call override changes in the audit log
([#816](#816))
([4561f41](4561f41))
* serve robots.txt, indexable on solidping.io only
([#809](#809))
([3512833](3512833))
* **server:** refuse a pre-existing Windows service data folder others
control ([#817](#817))
([b1832b5](b1832b5))
* **vendorstatus:** drop datadog and atlassian from the catalog
([#814](#814))
([d3397c5](d3397c5))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants