Add a 5m/1h/24h time-range selector with persisted traffic history #12

Merged
ClaudiuSchuster merged 2 commits from oss-oo/graph-timerange-rt20261009 into main 2026-10-09 04:52:52 +00:00
Owner

What

Adds a 5m / 1h / 24h time-range selector to the traffic graphs, backed by a small persisted sample log so long windows survive UI restarts.

How

  • Selector chips on the graph card (keyboard accessible, EN + DE, minimum-width safe); the last selection persists through the existing preference mechanism without a new settings row.
  • 5m stays the live rolling window from the in-memory poll buffer. 1h/24h read ~/.local/state/rclone/pdrive-graph-history.log: the existing live-poll loop appends one compact sample (epoch_ms, upload_bps, download_bps) every 30 s — same two series, same sources and API-overhead disclosure as the live graphs.
  • The log is atomic-append, 0600 under a 0700 directory, rotates at ~1 MiB / ≈8.5 days, heals torn trailing lines in the same write, and the reader skips corrupt/negative/non-finite/oversized lines defensively.
  • Rendering decimates to the card width; gaps (≥120 s without samples, e.g. Control Center closed) render as honest gaps, never interpolated; a fresh install shows an honest collecting placeholder, never fabricated data.
  • README highlights the new capability; docs/OPERATIONS.md documents windows, persistence, data basis and gap semantics.

Validation

  • make check fully green (re-verified after rebasing onto the v0.9.4 receipt commit).
  • Independent review dossier: ACCEPT-WITH-FINDINGS, all technical sections PASS. Findings (non-blocking, recorded as follow-ups): a README edit beyond the original claim (disclosed in the commit, user-facing per repo law) and one unreachable placeholder branch ("collecting since {time}" with timestamp) whose reachable variants already behave honestly.
## What Adds a 5m / 1h / 24h time-range selector to the traffic graphs, backed by a small persisted sample log so long windows survive UI restarts. ## How - Selector chips on the graph card (keyboard accessible, EN + DE, minimum-width safe); the last selection persists through the existing preference mechanism without a new settings row. - 5m stays the live rolling window from the in-memory poll buffer. 1h/24h read `~/.local/state/rclone/pdrive-graph-history.log`: the existing live-poll loop appends one compact sample (epoch_ms, upload_bps, download_bps) every 30 s — same two series, same sources and API-overhead disclosure as the live graphs. - The log is atomic-append, 0600 under a 0700 directory, rotates at ~1 MiB / ≈8.5 days, heals torn trailing lines in the same write, and the reader skips corrupt/negative/non-finite/oversized lines defensively. - Rendering decimates to the card width; gaps (≥120 s without samples, e.g. Control Center closed) render as honest gaps, never interpolated; a fresh install shows an honest collecting placeholder, never fabricated data. - README highlights the new capability; `docs/OPERATIONS.md` documents windows, persistence, data basis and gap semantics. ## Validation - `make check` fully green (re-verified after rebasing onto the v0.9.4 receipt commit). - Independent review dossier: ACCEPT-WITH-FINDINGS, all technical sections PASS. Findings (non-blocking, recorded as follow-ups): a README edit beyond the original claim (disclosed in the commit, user-facing per repo law) and one unreachable placeholder branch ("collecting since {time}" with timestamp) whose reachable variants already behave honestly.
The Overview traffic graphs gain a shared Time-range selector with the
chips 5m · 1h · 24h. The default 5m stays the live rolling in-memory
window; 1h and 24h render a persisted sample log that the live poll
loop appends while the window is visible or tray background polling is
enabled.

- ~/.local/state/rclone/pdrive-graph-history.log (honoring
  XDG_STATE_HOME and a PDRIVE_GRAPH_HISTORY override) holds one line
  per 30 seconds with the epoch millisecond timestamp and exactly the
  two rates the graphs draw. Appends are single O_APPEND writes to a
  mode-0600 file that heal a torn non-newline tail, and rotate
  atomically under a 1 MiB cap retaining ~8.5 days of samples. The
  reader skips corrupt lines and over-sized files defensively.
- Rendering decimates to the drawing width by keeping each pixel
  column's maximum, so bursts survive and the drawn peak equals the
  data peak. Persisted windows anchor at wall-clock time so stale
  history slides out honestly, and runs separated by more than 120
  seconds render as separate lines: closed Control Center periods stay
  honest gaps instead of interpolated data. Empty windows show a
  "Collecting traffic history since ..." placeholder, or "No traffic
  samples in this range · latest ..." when only stale data exists —
  never fabricated lines. Isolated samples render as ticks.
- The chips are modeless Gtk.RadioButtons sharing one group (arrow-key
  navigable, with focus, hover, pressed and checked states) spanning
  both graph cards; the selection is view state persisted through the
  existing mode-0600 pdrive-ui.json preference mechanism
  (graph_time_range, no new settings row) and reloaded on launch.
  Bandwidth limit bars keep scaling to the recent five-minute peak
  through live_values(); demo mode synthesizes privacy-safe long
  windows and never touches the persisted log.
- Widget coverage: chip group semantics and per-language strings,
  decimation and gap math on fixture series, corrupt-trailing-line
  tolerance, rotation caps and permissions, both empty states,
  min-width layout, and selection persistence across a fresh isolated
  non-demo instance with a failing state stub and fixture XDG paths.
Document the traffic graph time range
All checks were successful
Checks / Functional checks (pull_request) Successful in 1m25s
c72b6bda6c
Describe the selector in the Operations handbook's pdrive-ui section:
access path above the two traffic cards, the three windows and their
data bases (live in-memory five-minute window versus the 30-second
sample log), mode-0600 appends with size-capped ~8-day rotation,
honest gap semantics without interpolation, the collecting
placeholder, and preference-file persistence as view state rather
than a settings row. State the README highlight and extend the widget
suite's documented-control check accordingly.
ClaudiuSchuster deleted branch oss-oo/graph-timerange-rt20261009 2026-10-09 04:52:52 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
OSS-Singularity/proton-drive-linux!12
No description provided.