Skip to content

Keep Now live when device details stop updating - #65

Merged
frahlg merged 2 commits into
mainfrom
fix/now-status-freshness
Sep 7, 2026
Merged

frahlg merged 2 commits into
mainfrom
fix/now-status-freshness

Conversation

@frahlg

@frahlg frahlg commented Sep 7, 2026

Copy link
Copy Markdown
Member

When /api/status fails while telemetry keeps arriving, Now leaves old device watts under a live display. This change switches the diagram to fresh telemetry totals after a failed read or 15 seconds without a usable reply. It clears old device and daily-share labels, dates retained energy and fuse readings, and restores the details when status recovers.

Status polling stops when Now is hidden or the session ends. An expired EV overlay also stops overriding telemetry.

Validation:

  • Browser check on bf27cc06c32ee8494e69ec73ab6d081aaf5df58f, using a local SimBox fixture that fails only /api/status: healthy → HTTP 503 with telemetry continuing → recovery without a reload. The diagram kept moving, the daily share disappeared, energy and Fuse showed Last known with a timestamp, and fresh labels and values returned on recovery.
  • Viewed the changed states at 1280×720 and 390×844. The mobile note and timestamps fit without horizontal overflow.
  • Regression tests fail before the fixes and pass afterward, including the rendered daily-share label. Tests cover a pending request, a backwards clock change, recovery and a reply arriving after the watcher stops.
  • Type checks, the full suite with two workers (1,022 passed, 1 skipped), and the production build pass. Entry JavaScript is about 76 kB gzip, below the 90 kB CI limit.

Browser evidence uses simulated data. Physical box behavior has not been tested for this change.


Note

Medium Risk
Changes live-display honesty and fallback logic on the primary Now screen when status and telemetry disagree; mistakes could mislabel power flow or fuse safety readings.

Overview
When /api/status fails or goes quiet while the 1 Hz stream still runs, Now no longer keeps drawing stale per-device details as if they were live.

Status polling now emits a StatusSnapshot with a 15s freshness window (elapsed time via timers, not wall clock). Failed reads, overdue replies, or stop/hide mark the retained snapshot stale instead of silently reusing it.

On stale status, the energy-flow hero switches to telemetry totals, explicitly clears self-powered today, and shows a short “Device details are out of date” note while particles can still move. Today and Fuse in Outlook switch to Last known / Last totals copy with last-updated timestamps until status recovers.

The EV charger overlay reports 0 W when loadpoints data is stale so it cannot override fresh telemetry. Status watching is limited to when Now is active, visible, and streaming with API passthrough.

Reviewed by Cursor Bugbot for commit bf27cc0. Bugbot is set up for automated code reviews on this repo. Configure here.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 7, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
ftw-webapp bf27cc0 Commit Preview URL

Branch Preview URL
Sep 07 2026, 06:25 PM

@frahlg
frahlg marked this pull request as ready for review September 7, 2026 18:28
@cursor

cursor Bot commented Sep 7, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_959269e3-c360-4585-9e9c-0201aa96e539)

@frahlg
frahlg merged commit 01cb376 into main Sep 7, 2026
4 checks passed
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-07T18:34:18.412897Z bf27cc0 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

1 participant