Skip to content

fix(web): worker detail loads fast — stats from summary + lightweight flow + SWR tab cache - #2227

Open
federicodeponte wants to merge 2 commits into
mainfrom
fix/worker-detail-perf
Open

fix(web): worker detail loads fast — stats from summary + lightweight flow + SWR tab cache#2227
federicodeponte wants to merge 2 commits into
mainfrom
fix/worker-detail-perf

Conversation

@federicodeponte

Copy link
Copy Markdown
Member

Problem

The authed worker-detail page (floom.dev/app/workers?sel=<id>, the split-pane operators live in) is sluggish:

  • Overview stat cards (Last run / Runs / Success) sit on "Loading" for seconds.
  • The Flow section shows a persistent grey skeleton.
  • Tab switches (Overview/Runs/Setup/Source/…) are slow.

Root cause

OverviewTab blocked its stat cards and the flow on the full GET /workers/{id} payload, which the backend documents as ~6-8s warm / tens of seconds cold on Cloud (recent runs + latest-run output + ~3s stats batch + recipe + secret/connection availability + on-disk bundle materialize). The 3 stats need none of that — they come from recent_stats/last_run already on the list summary.

Separately, #2186 shrank the detail cache freshness to 250ms, which effectively disabled the "cached so tab switches don't refetch" behavior and re-fired the heavy fetch on nearly every tab click.

Fix

  • Stats render instantly from the list summary and upgrade to fresh detail values when it arrives (stale-while-revalidate). No more "Loading" text sitting for seconds.
  • Overview flow uses the existing lightweight ?shape=run fetch (config only) → resolves in <1s instead of blocking on the heavy assembly. The full detail loads in the background to warm the file-backed tabs (Source/Setup/Versions/Tools/Library) so they're instant on first click.
  • Detail cache → stale-while-revalidate + 30s fresh window: a cached detail is served immediately on tab switches (never re-blanks to a spinner) and revalidated in the background. Cross-workspace safety (fix(web): prevent stale dashboard renders #2186's concern) is preserved by the workspace-scoped cache key, not a tiny freshness window.
  • Home stat-card sparkline tooltip: dropped the overflow-hidden wrapper that was clipping the hover tooltip into card content.

Expected speedup

Opening a worker: stat cards resolve in <100ms (were 6-8s), flow in <1s (was 6-8s). Tab switches: instant from cache after first load (were a fresh 6-8s refetch each).

Verification

  • vitest: updated workers-overview-flow-schedule + 9 other worker-detail DOM suites (40 tests) green; stale-closure timeout regression test green.
  • tsc --noEmit: 0 errors in changed source (37 pre-existing test-file errors unchanged).
  • eslint, lint:detail-tabs, lint:borders, lint:tokens: clean.
  • Live floom.dev/app verification pending Fede's authed session (2FA); fix verified by code path + build + tests.

Notes

workers-overview-flow-schedule.dom.test.tsx previously asserted the stat summary must show "Loading" and hide the summary's run count until the heavy detail loaded — that encoded the exact slow behavior being fixed, so it now asserts stats render from the summary immediately while the flow shows its skeleton.

🤖 Generated with Claude Code

WorkerOS and others added 2 commits July 8, 2026 01:46
…htweight flow + SWR tab cache)

The worker-detail Overview blocked its 3 stat cards (Last run / Runs / Success)
and the Flow section on the full GET /workers/{id} payload, which the backend
documents as ~6-8s warm / tens of seconds cold on Cloud (recent runs +
latest-run output + ~3s stats batch + recipe + secret/connection availability +
on-disk bundle). So operators saw 'Loading / Loading / Loading' and a persistent
flow skeleton on every open. #2186 had also shrunk the detail cache freshness to
250ms, which effectively disabled the tab-switch cache and re-fired the heavy
fetch on nearly every tab click.

- Stats now render instantly from the list summary (recent_stats/last_run) and
  upgrade to fresh detail values when it arrives (stale-while-revalidate); no
  more 'Loading' text sitting for seconds.
- Overview flow uses the existing lightweight ?shape=run fetch (config only), so
  it resolves in <1s instead of blocking on the heavy assembly; the full detail
  loads in the background to warm the file-backed tabs.
- Detail cache restored to stale-while-revalidate with a 30s fresh window: a
  cached detail is served immediately on tab switches (never re-blanks to a
  spinner) and revalidated in the background. Cross-workspace safety is kept by
  the workspace-scoped cache key, not a tiny freshness window.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The Runs completed / Runs today cards wrapped the sparkline in an
overflow-hidden box; the hover tooltip renders above the sparkline
(bottom-full) and was clipped by that box, so it read as a stray tooltip
overlapping card content. Drop the clip — the area fill already fades to
transparent at the bottom edge, so nothing bleeds past the card.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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