Skip to content

Add /api/landing timing + source diagnostics#12

Open
dirtybits wants to merge 2 commits into
mainfrom
perf/landing-observability
Open

Add /api/landing timing + source diagnostics#12
dirtybits wants to merge 2 commits into
mainfrom
perf/landing-observability

Conversation

@dirtybits

Copy link
Copy Markdown
Owner

Summary

Adds request-path observability to /api/landing so we can see, in production, whether metrics are served from the fast Postgres snapshot or the slow on-chain fallback — and how long the DB read takes. This is a diagnostic step toward the "homepage/marketplace still feels slow" report.

  • /api/landing now emits:
    • X-AgentVouch-Source: snapshot-hit | snapshot-stale | live-compute | snapshot-error
    • Server-Timing: snapshot;dur=<ms>, compute;dur=<ms>
  • This mirrors the Server-Timing the /api/skills route already emits, making the metrics load path visible in DevTools → Network.
  • Also fixes a type-only error in authorTrustView.test.ts (CachedTrustRow typing) that vitest didn't catch.

How to read it

Open the homepage with DevTools → Network:

  • /api/landingX-AgentVouch-Source (snapshot-hit = fast; live-compute/snapshot-error = slow fallback) and Server-Timing snapshot;dur= (big number = cold Neon).
  • /api/skills?mode=fast → existing Server-Timing db;dur=.

No behavior change to the payloads. Full web suite green; tsc + ESLint clean.


Generated by Claude Code

dirtybits added 2 commits June 9, 2026 02:06
- /api/landing now emits Server-Timing (snapshot vs compute duration) and an
  X-AgentVouch-Source header (snapshot-hit | snapshot-stale | live-compute |
  snapshot-error) so the metrics load path is observable in DevTools. This
  mirrors the Server-Timing the /api/skills route already emits, and makes it
  obvious whether the fast Postgres snapshot path or the slow on-chain fallback
  is being taken in production.
- Fix a type-only error in authorTrustView.test.ts (CachedTrustRow typing) that
  vitest did not catch.
- Extend stale-while-revalidate windows for the public card/metrics lists so a
  low-traffic site serves an instant (slightly stale) edge response on sporadic
  visits while the function revalidates in the background. s-maxage stays modest
  so data still refreshes regularly.
- Add docs/FAST_SKILL_CARDS.md: where request time actually goes (client
  waterfall + cold Neon + cold-function DDL + API) and the ranked, sequenced
  levers to make cards blazingly fast (server-render via ISR is the top win).
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