Skip to content

fix(worker): start uptime windows from first probe#30

Merged
VrianCao merged 2 commits intoVrianCao:masterfrom
Lumexia:master
Feb 18, 2026
Merged

fix(worker): start uptime windows from first probe#30
VrianCao merged 2 commits intoVrianCao:masterfrom
Lumexia:master

Conversation

@Lumexia
Copy link
Contributor

@Lumexia Lumexia commented Feb 18, 2026

Summary

Fixes incorrect UNKNOWN accounting for newly created monitors before their first probe.
The uptime window now starts at the first observed check within range, so pre-probe time is no longer treated as UNKNOWN/unavailable.

Changes

  • Updated synthetic "today" uptime computation in apps/worker/src/public/status.ts to use an effective range start based on first probe time.
  • Added last_checked_at context into uptime window resolution to distinguish "never checked" monitors.
  • Unified public uptime endpoint behavior in apps/worker/src/routes/public.ts:
    • /api/v1/public/monitors/:id/uptime
    • /api/v1/public/analytics/uptime (partial-day path)
  • Added/updated regression coverage in apps/worker/test/public-status.test.ts:
    • First-probe start behavior
    • Never-checked monitor behavior
    • Pre-creation downtime not counted

Test Plan

  • pnpm lint passes
  • pnpm typecheck passes
  • pnpm test passes
  • Manually tested

@VrianCao VrianCao merged commit 8217c1c into VrianCao:master Feb 18, 2026
2 checks passed
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