Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The repository holds one Next.js app that serves two sites:
How the two sites share the app:

- **Hosts.** bench's routes are under `/bench`. `next.config.mjs` rewrites every path on bench.vortex.dev onto `/bench`, before the filesystem, so bench's public URLs are the root paths they always were (`/`, `/chart/{slug}`, `/api/…`). Previews, local dev and a deployment's own URL serve bench at `/bench`. vortex.dev and www.vortex.dev do not: `/bench` 404s there, except `/bench/api/health`, which the Vercel cron may call on any of the deployment's hosts. bench builds every root-relative link and fetch with `benchPath()` (`src/bench/lib/base-path.ts`): bench's root layout reads the request's host and hands the base to client components (`src/bench/components/BenchBase.tsx`). The site's links to bench go through `benchHref()` (`src/lib/bench-link.ts`): https://bench.vortex.dev on production (`VERCEL_ENV`, which `next.config.mjs` embeds at build time), and the deployment's own `/bench` everywhere else, so a preview's links stay on the preview.
- **Root layouts.** Each site has its own, so Next.js has none to draw an unmatched URL's 404 in. `src/app/global-not-found.tsx` (`experimental.globalNotFound`) is the site's 404, in the site's layout, prerendered for every unmatched URL; a catch-all route (`src/app/(bench)/bench/[...notFound]`) keeps bench's unmatched paths out of it. bench has no `not-found.tsx`, so those paths get Next.js's default 404 document, with bench's metadata but without bench's layout. `robots.ts` stays at the app root, where Next.js reads it; the favicon is `public/favicon.ico`, named in the site's metadata, because the `app/favicon.ico` convention would also put it on bench's pages. Next.js serves a metadata image route inside a route group with a hash suffix (`/opengraph-image-12o0cb`), and the og:image tags name that URL; rewrites in `next.config.mjs` keep the plain `/opengraph-image` URLs (which the posts' JSON-LD names) serving the same images.
- **Root layouts.** Each site has its own, so Next.js has none to draw an unmatched URL's 404 in. `src/app/global-not-found.tsx` (`experimental.globalNotFound`) is the site's 404, in the site's layout, prerendered for every unmatched URL; a catch-all route (`src/app/(bench)/bench/[...notFound]`) keeps bench's unmatched paths out of it. `src/app/(bench)/bench/not-found.tsx` draws those paths in bench's layout: the shared Status card under bench's header, with bench's 404 metadata (`src/bench/lib/not-found-metadata.ts`). `robots.ts` stays at the app root, where Next.js reads it; the favicon is `public/favicon.ico`, named in the site's metadata, because the `app/favicon.ico` convention would also put it on bench's pages. Next.js serves a metadata image route inside a route group with a hash suffix (`/opengraph-image-12o0cb`), and the og:image tags name that URL; rewrites in `next.config.mjs` keep the plain `/opengraph-image` URLs (which the posts' JSON-LD names) serving the same images.
- **Headers.** The CSP and the other security headers in `next.config.mjs` cover both sites: one policy, since both self-host their fonts. bench now sends the site's security headers, including `X-Frame-Options: DENY` and `frame-ancestors 'none'`, so no other site can embed bench's pages in a frame. `vercel.json` holds bench's cron (`/bench/api/health`) and bench's CDN rule for its landing, chart, and methodology pages on bench.vortex.dev (header rules match the path as requested, before the rewrites). bench's HTML differs between its two URL forms, so the `/bench` form gets the CDN rule only outside production (`benchPrefixCdnRules` in `next.config.mjs`): a cached `/bench` page must never answer for bench.vortex.dev.
- **Toolchain.** One package: one `package.json`, one `bun.lock`, one `bunfig.toml`, one `tsconfig.json`. Next.js 16.4.1, React 19.3 and TypeScript 7. `tsconfig.json` has every strict flag either app had, including bench's `noFallthroughCasesInSwitch` and `noUncheckedSideEffectImports`; `src/css.d.ts` types the CSS side-effect imports. The root `biome.json` lints and formats both sites: an override keeps bench's files (`src/bench`, `src/app/(bench)`, the parity and deploy checks, `vitest.config.ts`) in bench's old Prettier style (single quotes, trailing commas, 100 columns) with bench's lint rules (see "bench" below), and `bun run check:ci` checks all of it. bench's tests run on Vitest from the root `vitest.config.ts`, scoped to bench's files; the site's run on `bun test`. bench's PostCSS config sits beside its stylesheets (`src/bench/styles/postcss.config.mjs`), and Turbopack applies it to those alone: with no config at the root, the site's CSS gets Turbopack's defaults.
- **CI.** Every check covers both sites and runs on every change; nothing is split by which site a change touches. `ci.yml`'s `Lint, build, verify` first lints the workflows with actionlint and zizmor (images pinned by digest; justify a zizmor exception beside its line as `# zizmor: ignore[audit] reason`), then runs Biome on the whole repository, one build, the typecheck, knip, the site's unit tests, bench's Vitest suite with its Postgres integration tests (testcontainers, so the runner needs Docker), the migration-runner (`db/tests`), infrastructure (`infra/tests`), parity and deploy-check tests, `bun run verify`, the Playwright smoke specs, and `bun audit`, which fails the job on any advisory (see "Audit advisories"). The smoke specs run in Microsoft's Playwright image, pinned by digest, so no step runs apt; the tag must name the installed `@playwright/test`, and Renovate moves both in one PR. CI retries a failed browser test once for diagnosis, but a test that passes only on retry still fails (`failOnFlakyTests`), and the JSON report (`test-results/results.json`) uploads on every run. Dependency review, the secret scan and REUSE run beside it. `links.yml` checks the blog's external links with lychee each week and on a PR that changes `src/content/`; it is not a required check, so a broken link on another site never blocks a merge.
Expand Down
Loading