Skip to content

fix(logs,storage): runtime logs overhaul + storage UI polish - #78

Merged
dviejokfs merged 8 commits into
mainfrom
fix/runtime-history-logs
May 9, 2026
Merged

dviejokfs merged 8 commits into
mainfrom
fix/runtime-history-logs

Conversation

@dviejokfs

@dviejokfs dviejokfs commented May 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Bundles a stack of fixes and UX work for the runtime log viewers (Live + History) plus a small Storage UI polish. None of the pieces depend on each other, but they ship together because the user-facing change is "log viewers are fixed and feel right."

Backend (crates/temps-log-aggregator)

  • Pagination wired up. The handler emitted next_cursor but the search service ignored filter.cursor on the way back in, so chevrons returned the same first page. Now: cursor is parsed, narrows effective end_time, lines strictly older than the cursor timestamp are returned with no overlap.
  • Chronological (ASC) ordering. Old behavior was sort-ASC-then-truncate, leaving users staring at the OLDEST 200 lines in their window. Wire format is now oldest-first / newest-last so the UI can render terminal-style with newest at the bottom.
  • No more early-exit bug. Chunks were processed oldest-first; the scanner bailed before reading any chunk past the start of the window — which is why "Last 6 hours" returned roughly the same lines as "Last 1 hour". Replaced unbounded Vec + early-break with a bounded BinaryHeap of size page_size+1. O(N log K) time, O(K) memory regardless of total matches.
  • total_scanned semantics fixed. Now counts only matches that pass time + level + service + text filters, not raw bytes read from chunks.
  • Page-size cap raised 500 → 2000.
  • 3 regression tests covering each of the above (test_search_logs_with_pagination, test_search_logs_returns_chronological_order, test_search_logs_wider_window_returns_more_recent_logs).

History viewer (web/src/components/runtime-logs/history-log-viewer.tsx)

  • Replaced the chevron pager (broken anyway) with an auto-loading rope: IntersectionObserver watches a sentinel at the top; scrolling near the top auto-loads older pages and prepends them.
  • Initial scroll snaps to bottom (most recent). Filter changes reset.
  • Scroll position preserved on prepend so older pages don't yank the user's reading point.
  • pageSize 200 → 500.
  • Custom date range option in the time-range select with the existing DateRangePicker (HH:MM precision). Seeded with the previous preset for smooth handoff.
  • 7d / 30d presets added.
  • Search box auto-disables (with tooltip) for ranges over 24h (server's MAX_FULLTEXT_HOURS cap).
  • Header text simplified to "Showing N of M+ logs"; dropped the misleading "Full scan" badge and "(N scanned)" parenthetical.

Live viewer (web/src/components/runtime-logs/log-viewer.tsx)

  • Auto-follow fixed. 8px tolerance + user-intent gating (wheel/touch/keyboard) so reflow events from the virtualizer can't disengage follow.
  • Throttled flush rate (~30Hz) so a firehose stream stays eye-paceable. LIVE_FLUSH_MIN_GAP_MS = 33.
  • Per-line fade-in (120ms, opacity 0→1) on the freshest batch only. Respects prefers-reduced-motion.
  • Live-rate counter in the status row (~Y lps) with a sampled chip when lps >= 60.
  • Interval mode no longer uses the WebSocket. Polls /api/logs/search every N seconds with page_size=500, replaces the visible buffer with the snapshot. Fires immediately on entry. "Refresh now" triggers an immediate poll.
  • Mode toggles preserve the visible buffer. Only genuine source changes (env, container, dates, tail, timestamps) wipe.
  • "Show timestamps" moved into Advanced Options.
  • Density tightened: log row line-height/padding, toolbar paddings, and pane height switched to h-[calc(100vh-280px)] so the rope fills the viewport. estimateLineHeight updated to match.
  • Connection-status banners hidden in non-Live modes (no more spurious "Connecting to log stream..." in Interval).

Command palette (web/src/components/command/CommandPalette.tsx)

Three "Logs"-flavored entries (Logs, Log History, Request Logs) all rendered with ScrollText. Now distinct: ScrollText for live runtime logs, History for the History deep-link, Network for HTTP request logs.

Storage UI polish (bundled per request)

  • Storage.tsx — "Storage" → "Databases" everywhere user-facing; compact CPU/memory cell on running services in the list.
  • ServiceResourcesPanel.tsx — tighter horizontal layout per cluster member, live-indicator dot.
  • EditResourceLimitsDialog.tsx — swap input now means "extra swap above memory" rather than Docker's raw memory_swap total. UI translation is done at submit time; API contract unchanged.

Test plan

  • cargo test --lib -p temps-log-aggregator test_search_logs — 8 passed (including the 3 new regression tests).
  • bun run build (web) — clean.
  • Manual API verification via /api/logs/search:
    • ASC ordering confirmed.
    • Cursor walks older pages, no overlap.
    • Time-window expansion works (1h vs 4h windows now return distinct line counts).
    • Page-size cap honored: 500 / 1000 / 2000 returned; 5000 clamped to 2000.
  • Manual UI verification still pending (MFA prompt blocks unattended browser testing locally).

Risk and rollout

  • Cursor format unchanged externally (<ts_millis>:<chunk_uuid>) but the semantics of "next page" inverted to "older lines." Existing UIs holding stale cursors get older logs instead of duplicates — strictly safer.
  • History display order flipped to ASC (newest-at-bottom). Users used to newest-at-top will need a beat to recalibrate. Worth noting in the changelog.
  • Live Interval mode no longer holds a WebSocket — uses HTTP polling. Reduces idle connections; first user-visible poll is immediate (no more 5s blank screen).

dviejokfs added 8 commits May 7, 2026 11:32
Both reverse-comparator sort_by calls in archive_search rewritten as
sort_by_key with std::cmp::Reverse. Behavior identical; clippy is happy
under -D warnings (which CI uses).
- Gate process_git_push_event on the merged project+environment
  automatic_deploy flag so pushes no longer deploy when the user
  has disabled deploy-on-push. Adds is_automatic_deploy_enabled
  helper with merge semantics and 6 unit tests covering each
  project/env combination.
- Migrate Observe page from hardcoded zinc-* classes to semantic
  theme tokens (bg-background, text-foreground, border-border,
  text-muted-foreground, bg-card) for proper light/dark theming.
@dviejokfs
dviejokfs merged commit 07a4eba into main May 9, 2026
2 of 6 checks passed
@dviejokfs
dviejokfs deleted the fix/runtime-history-logs branch July 1, 2026 00:07
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