Skip to content

feat(logs): inspect entries inline while following live updates - #2136

Merged
DavidCockerill merged 25 commits into
stagefrom
feat/logs-explorer
Nov 20, 2026
Merged

DavidCockerill merged 25 commits into
stagefrom
feat/logs-explorer

Conversation

@DavidCockerill

@DavidCockerill DavidCockerill commented Nov 20, 2026 •

Copy link
Copy Markdown
Member
Keep them coming while holding the reader’s place

⊙ Problem

Inspecting a Studio log opens a modal that hides neighboring events. The filter panel also consumes space needed to scan messages.

💡 Solution

  • Expand logs inline and use ↑/↓ to inspect adjacent visible entries.
  • Keep live updates arriving without shifting the entry being read; “Jump to latest” restores following.
  • Put search and time ranges in a compact toolbar, with optional node/thread facets and resizable columns.

Inline log details and Jump to latest

Dark desktop sample-data capture at the timestamp-layout revision. Final refinements add timestamp spacing, bottom padding and directional neighboring-row reveal.

⚖️ Alternatives

  • Frozen inspection hides arriving rows; continuous intake was explicitly requested.
  • Mandatory oldest-first append removes the existing newest-first choice. Backend cursors would require capabilities absent from supported deployments.

🤔 Accept retained-context rendering cost at the maximum limit?

The table remains unvirtualized. Reduce shifted-poll and retained-view work after stable log-row IDs tracks the remaining optimization. At 1,000 current plus 1,000 retained rows, warm sampled stream batches used 71–72ms React work and 112–115ms long tasks in development Chromium. This keeps dynamic inline expansion within the existing table. Virtualization remains a possible redesign if production evidence warrants it.

🔧 Changes

Product and architecture tour

Product and architecture tour

Reading and navigation

Area Behavior and implementation
Explorer index.tsx coordinates filters, errors, deep-link selection, expansions and live controls. LogsDataTable.tsx renders inline details, preserves independent expansions, navigates visible rows with arrow keys and reveals expanded content with a neighboring row in the movement direction. Long messages adapt their inner scroll height to leave that context visible. ↑/↓ navigates logs while the message has focus; PageUp/Down and the wheel scroll its content.
Details LogDetails.tsx renders metadata and the original message without JSON number conversion. LogTimestamp.tsx shows local dates with milliseconds, a minute-updating relative age and UTC hover text. The wrapping message area scrolls within a viewport-aware cap of at most 32rem. Removes ViewLogModal.tsx and its unused logEditorLanguage.ts helper and its logEditorLanguage.test.ts tests.
Presentation Removes unused badgeLogLevel.tsx and badgeNode.tsx; levels use colored text. table.tsx adds optional container focus, custom header content and text-based auto-fit measurement. localStorageKeys.ts adds saved column sizing/visibility.

Live intake and filters

⚠️ Look hardest: useLogViewport.ts separates intake from viewport following. While reading, it retains the initial batch, current batch and individually expanded/anchored entries. Incoming batches preserve the visible row’s offset; jumping releases the held batch. Query/facet/order changes reset following.

mergeReadLogs.ts reconciles snapshot/tail duplicate counts and tags using compact exact identities with weak ownership. useInstanceLogs.ts retains SSE with polling fallback, exposes fetch errors, applies relative cutoffs and disables automatic refresh for fixed linked context.

logView.ts validates targets and constructs relative/context filters; routes.ts validates log search parameters. LogsFiltersForm.tsx supports a collapsible sidebar, validates date order and delegates canonical UTC handling. logFiltersFormSchema.ts adds relative presets and preserves valid generated dates under clock skew.

getReadLog.ts keeps unbounded tail reads for relative polling and disables focus/reconnect refetches; Live uses the SSE/polling loop. Bookmark targets use bounded context reads: at most eight pages before the target and one request after it. Dense windows fail with a Filters recovery message rather than silently presenting a distant prefix.

MAP.md indexes the implementation; root DESIGN.md links it.

🤔 Keep reading context beyond the selected window?

Yes. The initial reading batch and expanded/anchored entries survive incoming time/limit eviction until Jump. Intermediate batches can rotate out; the UI labels retained context and possible missing intervening logs. Download exports the loaded visible rows, including retained context. Refresh fetches current data while preserving the reading position.

🤔 Re-review the final UI edits?

Post-review changes (93 lines in 6 files) were not re-reviewed: viewport-aware neighboring-row reveal, wheel offset fixes, requested bottom padding and timestamp spacing. These tested, reversible edits stay in previously reviewed functions. Six full model passes are complete. A one-line test fixture correction makes partial DST-bound edits valid on UTC and New York runners; it reproduced the CI failure before the correction, then passed all 29 interactions in both timezones.

✅ Verification

  • Full pnpm test (760 files, 9,332 passed), lint, staged format, TypeScript and production build passed locally. End-to-end route: Chromium against the local app with intercepted sample APIs.
  • Thirteen browser scenarios passed: both sort orders, live viewport preservation, complete buffer replacement, keyboard navigation, short expanded lists, detail visibility, deep links, column persistence, mobile/dark, clock skew, live-edge keys, passive focus preservation and live mobile layout stability. Detail-reveal regressions failed before their fix.
  • No production cluster exercised. Live backend compatibility retains the existing capability/version gates. Message payloads remain uncapped; very large messages still carry memory/rendering cost.
Changed regression coverage
  • LogTimestamp.test.tsx: local timestamp precision, relative-age refresh, future values and invalid-input cleanup.
  • test/logLinks.ts: generates bookmark fixtures outside the production API.
  • e2e/tests/logs.anon.spec.ts: actual browser scrolling/focus, live arrivals, buffer rotation, navigation, links, sizing and viewport/theme cases.
  • Logs.test.tsx: filter/expansion interactions, independent keyboard expansions, focus/native-control boundaries, date handling and live controls.
  • LogsFiltersForm.test.tsx: preserves millisecond precision in native date controls.
  • mergeReadLogs.test.ts: duplicate occurrences, tags and snapshot/tail overlap.
  • useInstanceLogs.test.tsx: duplicate occurrences, polling, malformed timestamps, unchanged-result identity and moving relative cutoffs.
  • useLogViewport.test.tsx: bounded retention, expanded eviction, query/facet reset and loading gestures.
  • logView.test.ts: presets, target validation, exact raw values and context bounds.
  • getReadLog.test.ts: query bodies, bounded context pagination, cancellation and scan-budget failure.
  • logFiltersFormSchema.test.ts: unchanged generated future bounds and validation of edited dates.

Performance: Merge/filter work scales with loaded rows; unchanged polls preserve array identity and produced zero table mutations in the sampled run. Reading retains two bounded batches plus individually protected records. Default limit is 100; UI maximum is 1,000. Payload sizes remain uncapped. Explicit bookmark context adds bounded file scans and cluster fanout outside tail polling.

Local performance measurements

Full explorer in development Chromium, 1440×1000, 5KB messages, no CPU isolation. Fake HTTP parses prepared JSON inside the timed request; fixture preparation is excluded. Streaming invokes the real intake/reducer and 250ms flush through a transport shim.

Rows Unchanged poll wall / React Entire changed snapshot wall / React
100 20–27ms / 1.2ms 50–53ms / 25–30ms
1,000 23–33ms / 1.4–1.9ms 259–330ms / 63–132ms
10,000 stress 58–64ms / 2.9–3ms 3,085–3,446ms / 740–769ms

At 2,001 rendered rows (1,000 incoming, 1,000 held, one expanded detail), ten-entry stream batches after cell memoization measured 71–72ms warm React work and 112–115ms long tasks; first batch was 136ms / 180ms. Stream wall timing includes an intentional 270ms delivery wait and two animation frames. Heap deltas varied with garbage collection; retained heap and row-model rebuild counts were not measured. The 10,000-row stress case is above the UI limit and takes over a second per stream batch.

🤖 Generated by DAIvid / OpenAI Codex; posted via @DavidCockerill.

Related PRs: none found
Complexity: complicated

Deferred findings

Accepted behavior

Behavior the owner ruled intended, so there is nothing to file.

1 minor or nit
  • 59651559550517dc minor correctness — src/features/instance/log/hooks/useLogViewport.ts — Held history survives Refresh and relative cutoff — accepted: David requested continuous logs without moving what he is reading, in this session; retain reading context until Jump rather than evict or jump on Refresh. Incoming time/limit still bound new data; visible download includes held context. Th

Ready-For-Promotion: a35a572 urgency=normal late=none

Review-Coverage: authored=codex; ran=claude,gemini; adjudicated=domain; declined=cursor-grok,cursor-composer,muse; rounds=7; full=6 @ a35a572

Review-Attention: study ~20m (critical: logFiltersFormSchema.ts, localStorageKeys.ts; decisions: do-less-alternative, requirement-shift, retained-context, message-keyboard, perf-cost) @ a35a572

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

hdbms preview removed: this PR closed.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 86.9% 24743 / 28470
🔵 Statements 86.69% 26337 / 30380
🔵 Functions 83.16% 6891 / 8286
🔵 Branches 82.34% 22016 / 26737
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/components/ui/table.tsx 47.82% 63.41% 53.33% 48.88% 45-50, 112-141, 217-218
src/features/instance/log/LogsDataTable.tsx 94.96% 76.87% 94.28% 96.12% 102, 209, 262, 268, 271, 369-370
src/features/instance/log/index.tsx 83.96% 81.53% 84.21% 84.68% 86-89, 153, 177-179, 184-186, 200-203, 206, 377, 379, 386
src/features/instance/log/logView.ts 100% 92.85% 100% 100%
src/features/instance/log/routes.ts 100% 100% 100% 100%
src/features/instance/log/components/LogDetails.tsx 100% 66.66% 100% 100%
src/features/instance/log/components/LogTimestamp.tsx 100% 100% 100% 100%
src/features/instance/log/components/LogsFiltersForm.tsx 84.61% 60% 77.77% 83.33% 60-98
src/features/instance/log/hooks/mergeReadLogs.ts 98.33% 88.09% 100% 100% 18
src/features/instance/log/hooks/useInstanceLogs.ts 68.96% 72.97% 68.75% 67.85% 120-154
src/features/instance/log/hooks/useLogViewport.ts 90.96% 79.61% 100% 91.72% 42, 124-131, 132, 136, 142-143, 182, 215-218
src/features/instance/log/test/logLinks.ts 100% 57.14% 100% 100%
src/integrations/api/instance/status/getReadLog.ts 100% 89.58% 100% 100%
src/integrations/api/instance/status/logFiltersFormSchema.ts 100% 100% 100% 100%
src/lib/storage/localStorageKeys.ts 100% 100% 100% 100%
Generated in workflow #2633 for commit a35a572 by the Vitest Coverage Report Action

@DavidCockerill
DavidCockerill marked this pull request as ready for review November 20, 2026 18:55
@DavidCockerill
DavidCockerill requested a review from a team as a code owner November 20, 2026 18:55
@DavidCockerill
DavidCockerill added this pull request to the merge queue Nov 20, 2026
Merged via the queue into stage with commit c6b8759 Nov 20, 2026
12 checks passed
@DavidCockerill
DavidCockerill deleted the feat/logs-explorer branch November 20, 2026 19:16
@DavidCockerill
DavidCockerill deployed to preview-cleanup November 20, 2026 19:16 — with GitHub Actions Active

This branch was successfully deployed

2 active deployments
preview-cleanup — a35a5725 Deployed Nov 20, 2026 by DavidCockerill via cleanup #40
hdbms-preview — a35a5725 Deployed Nov 20, 2026 by github-actions[bot]
preview — a35a5725 Deployed Nov 20, 2026 by DavidCockerill via deploy #39
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