Skip to content

fix: dashboard bugs with untimed rows, sessions and averaged spikes - #82

Merged
firefly-cpp merged 1 commit into
mainfrom
fix/explore-bugs
Nov 20, 2026
Merged

firefly-cpp merged 1 commit into
mainfrom
fix/explore-bugs

Conversation

@firefly-cpp

Copy link
Copy Markdown
Owner

Three bugs in the /explore dashboard found after #80.

1. 500 error on the "All" range with rows without a timestamp

If timestamp: true was enabled after data had already been stored, the older rows have no time. /explore/api/data?range=all failed with a 500 error (NaTType does not support strftime), and these rows were sorted last, i.e. treated as the newest.

  • Missing times (NaT) are converted to null.
  • Rows without a time are treated as the oldest (kept first, in file order). They are only included in the "All" range.

2. Password sessions with several server processes

Without secret_key, each process created its own random key for the session cookie. With several gunicorn workers, a login was only valid on the worker that handled it, so users were sent back to the password prompt.

  • When a password is set and no secret_key is configured, the key is derived from the password (HMAC-SHA256), so every process accepts the same sessions and they survive restarts. Changing the password ends all sessions. The key is not the password itself.
  • Without a password, no session is needed and a random key is still used. secret_key in the configuration still takes precedence.

3. Short spikes hidden by averaging

With more than 1000 measurements, chart points are averaged, so a short spike outside min/max could disappear: the header said "3 outside" while the chart showed fewer or no points.

  • For averaged series, /explore/api/data also returns series.low and series.high (lowest and highest value per point).
  • The chart marks values outside min/max from these, scales to include them, and draws them as a light band around the line.

Tests

  • New tests: rows without timestamps (all ranges, ordering, last_valid_time), only untimed rows, low/high per point, a single spike kept when averaged, no low/high without averaging, sessions shared between two app instances, a new password ending sessions, key not equal to the password. Six of them fail on the previous code.
  • Full suite: 82 passed.
  • Checked in Chromium with 30 days of 5-minute data, three short spikes and 50 untimed rows: "All" and "30 d" load without errors, and the chart shows all three spikes, matching "3 outside".

Generated by Claude Code

- Fix a 500 error on the "All" range when the data has rows without a
  timestamp (e.g. stored before 'timestamp' was enabled). Missing times
  are now handled, and such rows are treated as the oldest instead of
  the newest; they are only included in the "All" range
- Derive the session key from the password when no secret_key is set,
  so sessions work with several server processes (e.g. gunicorn
  workers) and across restarts; changing the password ends them
- Return the lowest and highest value of each averaged chart point and
  use them to mark values outside min/max, so short spikes are no
  longer hidden by averaging; draw them as a band around the line
- Update the docs on sessions and add tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VCvw8haRnmyrVKrLkz5Yf8
@firefly-cpp
firefly-cpp merged commit 6a770c2 into main Nov 20, 2026
12 checks passed
@firefly-cpp
firefly-cpp deleted the fix/explore-bugs branch November 20, 2026 10:59
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