diff --git a/.github/workflows/baseline.yml b/.github/workflows/baseline.yml index b0ad289..5408340 100644 --- a/.github/workflows/baseline.yml +++ b/.github/workflows/baseline.yml @@ -60,8 +60,11 @@ jobs: # Tier 1. THE BLUEPRINT, READ AND PLACED BY THE BINARY A BOOTSTRAP RUNS. # - # Pinned at the bootstrap floor (BOOTSTRAP.md), not the product's lane pin: - # every test here reads YAML with PyYAML, which parses anything well-formed; + # Pinned at v2.96.0, not the product's lane pin: at or above the bootstrap + # floor (v2.88.0, BOOTSTRAP.md), and the first orun that reads a + # component's `spec.preview`, so the placement's `orun validate` checks the + # product's live preview too. Every test here reads YAML with PyYAML, which + # parses anything well-formed; # only the pinned orun can say whether the document is one a bootstrap can # run. `--status` parses it, validates every hook against the action # registry, compiles every `when` and narration template, and writes @@ -81,7 +84,7 @@ jobs: - uses: actions/checkout@v6 - uses: sourceplane/orun-action@v1.2.0 with: - version: v2.88.0 + version: v2.96.0 - uses: pnpm/action-setup@v4 with: version: 10.12.1 @@ -124,8 +127,9 @@ jobs: # and the three built Workers served over that database with no SaaS key — # each one's own smoke, every route, the sample user's dashboard and the # API's cron. - # Pinned at the bootstrap floor (v2.88.0): the offline bootstrap reads the - # blueprint, and the floor is newer than the product's lane pin (v2.78.4), + # Pinned at v2.96.0, above the bootstrap floor (v2.88.0), the first orun + # that reads `spec.preview`: the offline bootstrap reads the blueprint, and + # the pin is newer than the product's lane pin (v2.78.4), # which is all the lane steps need. The runner image carries PostgreSQL 16 # (not started); the test starts its own on a random port. product: @@ -134,7 +138,7 @@ jobs: - uses: actions/checkout@v6 - uses: sourceplane/orun-action@v1.2.0 with: - version: v2.88.0 + version: v2.96.0 - uses: pnpm/action-setup@v4 with: version: 10.12.1 diff --git a/apps/web/component.yaml b/apps/web/component.yaml index a3e220a..d835132 100644 --- a/apps/web/component.yaml +++ b/apps/web/component.yaml @@ -78,6 +78,37 @@ spec: - profile: deploy when: triggerRef: github-push-main + # How the site runs itself for orun.work's live Preview tab + # (saas-parallel-baselining PB4): `orun preview` starts this, and a coding + # session keeps it running while it works, so the person watches it change + # as it is built. The dev server binds the box's loopback only, on a fixed + # port, and installs first, so a checkout the session has not installed yet + # still comes up. + # The marketing site alone, the page each environment's `url` opens + # (intent.yaml): the app (the dashboard behind Clerk, over the database) and + # the API do not start, nor does any database. Only this app's packages are + # installed (`--filter ...`); `next` runs itself, not `pnpm exec next`, with + # a 1 GiB heap cap; its KV binding is wrangler's local one (next.config.ts). + # The three apps' links are stage's, from the committed `.env.production` a + # local `next build` reads, which `next dev` does not load on its own. The + # contact form's rate limit is local, and every optional service (Clerk, + # BaseHub, Resend, PostHog) stays unconnected, as on a fresh deploy. + # `-H localhost`, not 127.0.0.1: every page is a proxy.ts locale rewrite + # (`/` → `/en`), and Next names its own URL `localhost`, so bound to + # 127.0.0.1 it takes its own rewrite for an external one and proxies it + # (a 307 loop, or a 500 over TLS behind the gateway's x-forwarded-proto). + # `--dns-result-order=ipv4first` keeps `localhost` on 127.0.0.1, never ::1. + preview: + run: + - sh + - -c + - pnpm install --frozen-lockfile --prefer-offline --filter "@app/web..." && set -a && . ./.env.production && set +a && exec node_modules/.bin/next dev -H localhost -p 3001 + port: 3001 + path: / + env: + NODE_OPTIONS: --max-old-space-size=1024 --dns-result-order=ipv4first + NEXT_TELEMETRY_DISABLED: "1" + WRANGLER_SEND_METRICS: "false" parameters: nodeVersion: "22" pnpmVersion: "10.12.1" diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts index 83e9e78..003fa26 100644 --- a/apps/web/next.config.ts +++ b/apps/web/next.config.ts @@ -11,6 +11,21 @@ import { env } from "@/env"; // Vercel) Sentry; none of the three runs on Workers (@repo/observability). let nextConfig: NextConfig = { ...config, + // Dev server only (`next build` ignores it): orun.work's live Preview tab + // loads `next dev` from the preview's own host, and Next.js refuses the + // hot reload and other /_next/* dev requests from an origin it is not told + // about. These are the preview's hosts, prod's and stage's. + allowedDevOrigins: ["*.orun-preview.app", "preview-gateway-stage.oruncloud.workers.dev"], + experimental: { + // Dev server only: behind orun.work's live Preview the browser's Origin + // is the preview's host while `next dev` sees a local Host, and Next.js + // refuses a Server Action from an origin it is not told about. `next + // build` runs with NODE_ENV=production, so production keeps its + // same-origin check. + ...(process.env.NODE_ENV === "development" + ? { serverActions: { allowedOrigins: ["*.orun-preview.app", "preview-gateway-stage.oruncloud.workers.dev"] } } + : {}), + }, images: { ...config.images, remotePatterns: [...(config.images?.remotePatterns ?? [])], diff --git a/intent.yaml b/intent.yaml index a03d60d..07482cc 100644 --- a/intent.yaml +++ b/intent.yaml @@ -57,6 +57,13 @@ compositions: cloudflare-domain: stack-tectonic db-migrate: stack-tectonic +# The live preview (saas-parallel-baselining PB4): the component orun.work's +# Preview tab shows while a coding session works on the site. Its own +# `spec.preview` (apps/web/component.yaml) says how it runs; `orun preview` +# runs it. +preview: + component: web + discovery: roots: - apps/