Skip to content

perf: serve static assets without the Worker; web vitals and stage timing - #82

Merged
sarthakagrawal927 merged 2 commits into
mainfrom
speed/83-reader
Oct 11, 2026
Merged

sarthakagrawal927 merged 2 commits into
mainfrom
speed/83-reader

Conversation

@sarthakagrawal927

Copy link
Copy Markdown
Member

Part of the fleet speed program (sass-maker/app-health#83). Codex drafted the implementation; Claude reviewed every line and re-ran typecheck, tests (92/92) and biome.

Measured cause (before, production, this Mac, SIN/HKG)

  • run_worker_first = ["/*"] sends every static file through the Worker. On fresh connections the isolate is cold: server time (TTFB minus TLS) for /_astro/index.*.css 132-412 ms, LCP image /footer-art/reader-precise-original-v1.webp 119-388 ms, landing HTML 230-707 ms; ~45 ms when warm.
  • Lab (headless Chrome, cache disabled): LCP 1540 / 964 / 560 ms at 390 / 768 / 1440 (LCP element: footer-art backdrop image), CLS 0.001-0.012, TTFB 794 / 237 / 110 ms, ~557 KB transferred (332 KB fonts from the shared UI-library theme, a library gap).

Change

  • wrangler.toml: keep /* Worker-first, exclude /_astro/*, /assets/*, /images/*, /footer-art/* (verified in the built dist/; nothing in worker.ts or agent-edge.mjs handles them). Security headers still come from _headers /*.
  • public/_headers: immutable 1-year caching for content-hashed /_astro/* and /assets/*.
  • HTML routes unchanged (markdown negotiation, Link/Vary, auth redirect, agent surfaces).
  • data-vitals on the landing App Health tracker (inert until App Health #186 deploys).
  • Sampled api.stage_timing (APP_HEALTH_STAGE_SAMPLE_RATE, default 0.1) on /api/links, /api/articles, /api/mcp, /api/keys, Hono route templates only, sharing the existing cached client. Inert until the ingest key is active (Activate Reader App Health endpoint key and verify live receipt #59).

After numbers will be posted on this PR after deploy.

🤖 Generated with Claude Code

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
reader 9cfbc1c Oct 11 2026, 12:12 PM

sarthakagrawal927 and others added 2 commits October 11, 2026 17:39
Static build/media dirs (/_astro, /assets, /images, /footer-art) skip
run_worker_first so they no longer pay Worker cold starts (120-700 ms
server time on fresh connections). Hashed dirs get immutable caching.
HTML routes stay Worker-first for markdown negotiation and agent surfaces.
Adds data-vitals to the landing tracker and sampled api.stage_timing logs
on /api/links, /api/articles, /api/mcp and /api/keys (inert without the
ingest key). sass-maker/app-health#83.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gate

Extract sample-rate parsing and route-safety checks from stageTimingMiddleware
(CCN 19 > 15). Behavior unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sarthakagrawal927
sarthakagrawal927 merged commit 61f2539 into main Oct 11, 2026
2 checks passed
@sarthakagrawal927

Copy link
Copy Markdown
Member Author

Deployed to production via the manual deploy.yml workflow (run 38138882653) from main. Version c0239e9e-404c-4600-b9ef-8c57b445a513. Rollback: 361d797f-980c-4952-a64a-4b16637a5265. Verified: home 200, data-vitals present, no console errors. Complexity fix (stageTimingMiddleware CCN 19 to under 15) pushed on this branch before merge.

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