Skip to content

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

Merged
sarthakagrawal927 merged 1 commit into
mainfrom
speed/83-calorie
Oct 11, 2026
Merged

sarthakagrawal927 merged 1 commit into
mainfrom
speed/83-calorie

Conversation

@sarthakagrawal927

Copy link
Copy Markdown
Member

Part of the fleet speed program (sass-maker/app-health#83). Codex drafted; Claude reviewed every line (snapshot HTML diffs are exactly 16 +data-vitals tokens) and ran pnpm quality (green).

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

  • run_worker_first: true sends every static file through the Worker; on fresh connections the isolate is cold. Server time (TTFB minus TLS): /images/screens/today.webp 164-672 ms, /favicon-32.png 166-544 ms, / 154-450 ms; ~40 ms warm.
  • Lab (headless Chrome): LCP 884 / 988 / 484 ms at 390 / 768 / 1440 (LCP element H1), CLS 0, TTFB 381 / 468 / 270 ms, no console errors.

Change

  • wrangler.jsonc: run_worker_first: ["/*", "!/_astro/*", "!/images/*", "!/favicon-32.png", "!/favicon-64.png"]. None are handled by worker.ts or agent-edge.mjs; Calorie adds Worker security headers only on /api/* and /v1/*. HTML routes unchanged.
  • marketing/_headers: immutable caching for content-hashed /_astro/*.
  • data-vitals on all 16 snapshot tracker tags; the factory source change is Opt the factory App Health tracker into web vitals ios-landings#47 so the next sync keeps it.
  • Sampled api.stage_timing (APP_HEALTH_STAGE_SAMPLE_RATE, default 0.1) on /api/* and /v1/personal/*, Hono templates only, shared cached client, fail-open, inert without the ingest key.

After numbers will be posted on this PR after deploy.

🤖 Generated with Claude Code

Static /_astro, /images and favicon PNGs skip run_worker_first so they no
longer pay Worker cold starts (150-670 ms server time on fresh
connections); /_astro gets immutable caching. HTML stays Worker-first.
Adds data-vitals to every snapshot tracker tag (factory source:
ios-landings#47) and sampled api.stage_timing on /api/* and
/v1/personal/*, inert without the ingest key. sass-maker/app-health#83.

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

Copy link
Copy Markdown
Member Author

Deployed to production via pnpm run deploy from main a678b22. Version a877bd10-7f5f-49b6-9f2b-5d44401c690f. Rollback: 71775c56-ef27-4486-b62f-79e5a1fb28ff. Verified: / /privacy /support /blog /testflight 200, data-vitals present on home, no console errors in headless Chrome.

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