Skip to content

fix: layout-shift audit of the panel, store and quota-history hardening - #42

Merged
rune-gh merged 3 commits into
mainfrom
t3/audit-layout-shift
Dec 3, 2026
Merged

rune-gh merged 3 commits into
mainfrom
t3/audit-layout-shift

Conversation

@rune-gh

@rune-gh rune-gh commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Audit of the panel, backend and stores.

Panel: layout shifts

Loaded every route at 390px and 1440px over a throttled connection ("Slow 4G", cache disabled, 4x CPU on mobile) against the real hub's quota-history snapshot, recorded every layout-shift entry, then clicked through the main flows. Worst load score before: quota page on mobile, 0.29.

After: a returning viewer records no shifts on any route at either width; the remaining first-visit shifts come only from layout the browser has not seen yet (row counts, panel heights, plugin pages). Clicks no longer move nearby controls.

Causes fixed:

  • Skeletons take the loaded size (real Stat tiles with inline skeletons, accounts table header/rows/height, pool panel and first-pool heights remembered per breakpoint via useRememberedSize / utils/lastLayout).
  • Data-dependent rows render while loading (tab rows, pending tab counts count: null, toolbar summaries, Connect key row and hint, routing model line, header actions).
  • Live text cannot re-wrap (one-line quota summary, one-line pool meta, dashboard window pill, fixed-basis section headers, fixed log readouts, tabular digits panel-wide, fixed-layout pool accounts table).
  • Controls keep their width: loading buttons overlay the spinner, StableLabel for toggling labels, Today always laid out, icon-only chart options on phones, Connect key box sized by the row, provider-tile caption line.
  • Pool chart measures its width before paint (painted 80px too tall on phones first); pools are not dropped before history answers.
  • Accounts bulk-action bar floats in a sticky dock instead of pushing rows under the pointer.
  • CodeMirror is shown after its first measure; excluded-model rules hold their layout while the catalog loads.

DESIGN.md records the layout-stability rules; the dev fixture takes &latency=<ms>.

Visible changes: quota summary truncates on phones (attention first; tabs repeat the counts), a stale pool badge replaces the "Last reading" time (time in its tooltip), dashboard window is a title pill, "Chart options" is icon-only on phones, digits are tabular everywhere.

Backend / stores

  • Auth stores (file, git, object, Postgres) reject delete paths outside the auth directory; auth files written atomically.
  • bbolt KV store refuses use after Close; quota-history reads hold the store open; plan caches reset when recording stops; duration parsing rejects NaN/Inf/overflow.
  • Expired session-affinity snapshots are deleted; a failed local KV store disables affinity persistence.
  • Postgres pool bounded and closed on exit; refresh journal ensures its schema; object-store probe always cleaned up; temp credential files 0600 + fsync.
  • Codex websocket SOCKS dial honours the context; Codex/OpenAI thinking appliers use ojson.Doc.

Verification

go test ./..., go vet, make lint, make test-web (2257 tests, lint, build) pass.

🤖 Generated with Claude Code

rune-gh and others added 3 commits December 3, 2026 04:00
- Auth stores reject delete paths outside the managed auth directory
  (file, git, object and Postgres stores) and write auth files atomically.
- bbolt KV store refuses reads and writes after Close instead of racing it;
  plain sets skip the existence check NX/XX need.
- Quota history: History holds the store open while it reads, plan caches
  reset when recording stops or moves, a future last-sample time no longer
  delays the first poll, day durations reject NaN/Inf/overflow, and the
  scan bound cannot overflow.
- Session-affinity snapshots are deleted once expired; a failed local KV
  store disables affinity persistence instead of leaving it half on.
- Postgres store: pooled connections are bounded and closed on exit; the
  refresh journal ensures its schema before reads and completions.
- Object refresh journal always removes its capability probe; cooldown and
  Meta token temp files are 0600 and fsynced before rename.
- Codex websocket SOCKS dials honour the request context; Codex/OpenAI
  thinking appliers mutate an ojson.Doc as the conventions require.
- Server exit tests run the child without a controlling TTY.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Audited every panel route at 390px and 1440px on a throttled connection
with the cache disabled, then clicked through the main flows. Fixes target
each cause:

- Skeletons take the loaded size: dashboard stat tiles are real Stat tiles
  with inline skeletons and a reserved hint line; the accounts table
  skeleton has its header, last row count and last height; pool panels and
  the first pool keep their last height (useRememberedSize/lastLayout);
  the model-rules rail skeleton matches the phone chip row.
- Data-dependent rows render while loading: provider tab rows, pending tab
  counts (count: null), toolbar summaries, the Connect key row and hint,
  the routing model line, and header actions.
- Live text cannot re-wrap: one-line quota summary (attention first),
  one-line pool meta with the stale badge standing in for the time,
  dashboard window as a title pill, fixed-basis section headers, logs
  readouts with fixed boxes, tabular digits panel-wide.
- Buttons keep their width while loading (spinner over a hidden label);
  the plugin update dot no longer widens its tab.
- The pool chart measures its width before paint (it painted 80px too tall
  on phones first), and pools are not dropped before history answers.
- The accounts bulk-action bar floats in a sticky dock instead of pushing
  the rows down under the pointer.
- Sidebar plugin pages and other layout facts are remembered per viewer.

DESIGN.md records the layout-stability rules. The dev fixture accepts
&latency=<ms> to reproduce slow data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow-up from clicking through every main flow at 390px and 1440px:

- StableLabel lays out every alternative of a toggling label in one cell,
  so Hide/Show emails, Pause/Resume, Copy/Copied, Read now/Refresh,
  Cancel/Close and the login connection toggle never change width.
- Quota span control: Today is always laid out (hidden on today's span)
  and Chart options is icon-only on phones, so stepping the span never
  wraps the toolbar and drops the pools 36px.
- Pool accounts table uses a fixed layout with header widths, so live
  countdowns and credit counts no longer re-balance its columns.
- Connect key box is sized by the row, not the key text, so revealing the
  key does not move Copy or re-wrap the row.
- Provider tiles keep a badge-high caption line when a sign-in status
  replaces it.
- The YAML editor shows once CodeMirror has measured its lines, so line
  numbers no longer jump when the tab opens.
- Excluded-model rules show placeholder match lines and hold the chip
  row's last height while a provider's catalog loads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rune-gh
rune-gh merged commit 90afdde into main Dec 3, 2026
8 checks passed
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