Skip to content

perf(inertia): page audit skill, dev Server-Timing, fast-pages guide; background-tasks pages stop waiting on the broker - #825

Merged
antosubash merged 3 commits into
mainfrom
perf/inertia-pages
Nov 5, 2026
Merged

antosubash merged 3 commits into
mainfrom
perf/inertia-pages

Conversation

@antosubash

Copy link
Copy Markdown
Owner

Summary

Audited every Inertia page in the dev host for speed and perceived speed, fixed what was slow, and shipped the tooling and guide so apps can do the same.

Audit (26 signed-in pages via menus + 2-level crawl, 4 public pages, 19-page production-build pass; SQLite, 2,000 users, 20,000 audit rows)

  • Production build: server 2–25 ms, 0–6 SQL statements per visit, client-side navigation 27–125 ms, LCP 144–328 ms, CLS 0 on every page.
  • Fixed: Background tasks list (empty) and Workers page took ~1,050 ms server time waiting out Celery's inspect timeout. The poll is now a deferred prop (workers group) with same-size placeholders ("Checking for workers…" empty state, skeleton worker cards, aria-busy): server ~10–20 ms, CLS ≤ 0.002. Behaviour change: worker_presence / snapshot arrive in the deferred group, not the first response.
  • Fixed: background-tasks pages linked to /admin/background-tasks (no slash), costing a redirect per "back" click.
  • Verified: users admin list has no N+1 (one batched role lookup); a new test pins its statement count as rows grow.
  • Left as is (noted): /tenants/members|settings menu items redirect for a user with no active organisation (UX, not perf); /admin/settings/ ships a 54 KB modules prop that its cross-module search needs.

Added

  • Development-only Server-Timing: app;dur=…, db;dur=…;desc="N queries" header (ServerTimingMiddleware, right inside request logging) and simple_module_db.query_stats (install_query_stats, track_queries) for tests.
  • skills/simple-module-page-perf: SKILL.md + scripts/page_audit — signs in, discovers pages, measures server time/SQL/payload/props/deferred props (Inertia JSON with the client's headers), first load (FCP, LCP, CLS, JS/CSS bytes), click-through navigation (click → paint → deferred painted), phone-width overflow and UX checks (stuck loaders, unnamed controls, h1), against budgets; Markdown + JSON report, exit 1 on failure.
  • docs/frontend/performance.md ("Fast pages"): budgets, where time goes, measuring, server (DTOs, pagination, N+1, prop kinds, callables for partial reloads, shared props, canonical URLs, caching), client (chunks, lazy widgets, DOM size, filters), UX (progress, same-size placeholders, WhenVisible, distinct states, button states, polling, prefetch trade-off, phones), checklist.

Test plan

  • make lint (ruff, ty, biome, tsc, file size, i18n, doc paths)
  • make test-py — 7,848 passed; the one failure is the local /tmp/.git environmental test (test_clean_target_is_not_in_repo), passes after rmdir /tmp/.git
  • make test-js — 894 passed (new Workers skeleton + Index "checking" tests)
  • New: test_db_query_stats.py, test_hosting_server_timing.py, test_users_admin_list_query_count.py, test_skill_page_audit.py; background-tasks tests assert the deferred contract (first response never calls inspect)
  • Audit run end to end against dev (exit 0, no failures) and a production build
  • Independent Codex review: one P2 (deferred budget skipped for pages without a visible link) fixed with a test

https://claude.ai/code/session_01FXHA3ZJ5EgoJN4zXTAhBR2

… background-tasks pages stop waiting on the broker

- Development responses carry Server-Timing (app time, db time, SQL statement
  count); simple_module_db.query_stats exposes the count to tests.
- skills/simple-module-page-perf: SKILL.md + scripts/page_audit, which audits
  every page (server, browser, phone width, UX checks) against budgets.
- docs/frontend/performance.md: building pages that are fast and feel fast.
- Background tasks: worker presence and the Workers snapshot are deferred
  props with same-size placeholders (server ~1,050 ms -> ~15-20 ms); links
  to the executions list use the canonical trailing-slash URL.
- Users admin list: test pins a flat SQL count as rows grow.

Claude-Session: https://claude.ai/code/session_01FXHA3ZJ5EgoJN4zXTAhBR2
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-11-05T14:38:41.732486Z d9abd88 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying simple-module-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: d9abd88
Status: ✅  Deploy successful!
Preview URL: https://84edfd41.simple-module-python.pages.dev
Branch Preview URL: https://perf-inertia-pages.simple-module-python.pages.dev

View logs

@antosubash
antosubash merged commit b2e5fc1 into main Nov 5, 2026
13 of 17 checks passed
@antosubash
antosubash deleted the perf/inertia-pages branch November 5, 2026 17:31
antosubash added a commit that referenced this pull request Nov 6, 2026
* fix(page-perf): align perf docs with code; simplify snapshot loader; rename audit test

Post-merge review of #825 (maintainability pass).

Claude-Session: https://claude.ai/code/session_01FXHA3ZJ5EgoJN4zXTAhBR2

* fix(page-perf): query tracking stops at exit; Workers refresh recovers a missing snapshot; audit fixes (UTF-8 sizes, unexpected redirects fail, CLS session windows, --max-pages)

Correctness findings from a post-merge Codex review of #825.

Claude-Session: https://claude.ai/code/session_01FXHA3ZJ5EgoJN4zXTAhBR2

* fix(page-perf): keep the newer worker snapshot when Refresh races the deferred load; percent-encoded paths are not redirects

Second review pass on the #825 follow-up.

Claude-Session: https://claude.ai/code/session_01FXHA3ZJ5EgoJN4zXTAhBR2
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