From 0203c2905c774709a8de79d4dd960effbb86fe29 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 21:11:01 +0000 Subject: [PATCH] Declare the status page's live preview (saas-parallel-baselining PB4) orun.work's Preview tab shows a coding session's dev server, live from its box: `orun preview` (orun v2.96.0) runs what a repository declares, and the session keeps it running while it works. - apps/web/component.yaml: spec.preview. It installs this app's packages only (--filter "@app/web..."), then runs `next dev` alone on 127.0.0.1:3000, with a 1 GiB heap cap; the tab opens /incidents. Its D1 is wrangler's local one, empty until the migrations run, so the pages show the monitors with no state yet. The tab opens /incidents: `/` stops under `next dev` (never in a build) on its getServerSideProps' `undefined` optional fields, which only the dev server refuses to serialize. - intent.yaml: preview: {component: web}. - apps/web/next.config.mjs: allowedDevOrigins for the preview's hosts (*.orun-preview.app, preview-gateway-stage.oruncloud.workers.dev). The gateway passes the browser's Origin through, and Next 16 refuses the hot reload's WebSocket from an origin it is not told about. The setting is read by `next dev` only. - apps/web/next.config.mjs: experimental.serverActions.allowedOrigins for the same hosts, under `next dev` only (NODE_ENV=development): Next refuses a Server Action whose Origin is not the Host. `next build` runs with NODE_ENV=production, so a deploy keeps its same-origin check. - baseline.yml: orun v2.88.0 -> v2.96.0, the first release that reads spec.preview, so the placement's `orun validate` checks it. ci.yml (the product's own lane pin, v2.78.4) is unchanged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019PcpNV6SjymJBPv3nNkC4z --- .github/workflows/baseline.yml | 48 +++++++++++++++++++--------------- apps/web/component.yaml | 24 +++++++++++++++++ apps/web/next.config.mjs | 15 +++++++++++ intent.yaml | 7 +++++ 4 files changed, 73 insertions(+), 21 deletions(-) diff --git a/.github/workflows/baseline.yml b/.github/workflows/baseline.yml index d711d6b..a504859 100644 --- a/.github/workflows/baseline.yml +++ b/.github/workflows/baseline.yml @@ -60,23 +60,26 @@ jobs: # Tier 1. THE BLUEPRINT, READ AND PLACED BY THE BINARY A BOOTSTRAP RUNS. # - # Pinned at the bootstrap floor (BOOTSTRAP.md), not the site's lane pin: - # 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 + # Pinned at v2.96.0, not the site'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 site'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 # nothing. Then the leak gate (what a product would carry, derived by the - # floor too), and the placement tier (the offline bootstrap: both phases - # placed and finished by the blueprint's own hooks, then the product's own - # `orun plan` for the 01-product merge — the D1 apply, then the migrations, - # then the Worker's deploy — under the product's lane pin, below). + # pinned orun too), and the placement tier (the offline bootstrap: both + # phases placed and finished by the blueprint's own hooks, then the + # product's own `orun plan` for the 01-product merge — the D1 apply, then + # the migrations, then the Worker's deploy — under the product's lane pin, + # below). blueprint: runs-on: ubuntu-latest steps: - 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 @@ -111,11 +114,12 @@ jobs: # test refuses an orun older than the pin rather than assert the wrong # CLI's plan. The offline bootstrap before it reads the blueprint, which # takes the bootstrap floor (v2.88.0: the task set-up in the background, - # the landings checked in the box), so - # this tier runs the floor, which is newer than the lane pin. + # the landings checked in the box), so this tier runs v2.96.0, above the + # floor and the first orun that reads `spec.preview`, which is newer + # than the lane pin. - uses: sourceplane/orun-action@v1.2.0 with: - version: v2.88.0 + version: v2.96.0 - name: placement — the offline bootstrap, and the product's own plan run: | git config --global user.email ci@example.invalid @@ -123,20 +127,22 @@ jobs: bash testing/placement.test.sh # Tier 2. THE PRODUCT IT PRODUCES WORKS: its one landing installed, its - # fixture rendered, type-checked, linted, tested and built, the stage lane's own structure check, build - # (the live wiring render included), output check and dry deploy in the tree - # orun stages, the migration lane's plan and apply (against a stand-in D1 - # API), and the built Worker served and smoke-tested with the component's - # own smoke command. 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), which is all the lane steps need. + # fixture rendered, type-checked, linted, tested and built, the stage lane's + # own structure check, build (the live wiring render included), output check + # and dry deploy in the tree orun stages, the migration lane's plan and + # apply (against a stand-in D1 API), and the built Worker served and + # smoke-tested with the component's own smoke command. 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. site: runs-on: ubuntu-latest steps: - 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 8495554..96f068c 100644 --- a/apps/web/component.yaml +++ b/apps/web/component.yaml @@ -72,6 +72,30 @@ spec: - profile: deploy when: triggerRef: github-push-main + # How the status page 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. + # It installs only this app's packages and runs `next dev` alone, with its + # heap capped: the box is shared with the agent. Its D1 is wrangler's local + # one, empty until `pnpm run db:migrate:local` runs, and no monitor Worker + # checks anything, so the pages show its monitors with no state yet, as a + # fresh deploy does before its first check. The tab opens /incidents: `/` + # stops under `next dev` (never in a build), because its getServerSideProps + # returns the monitors' unset optional fields as `undefined`, which only the + # dev server refuses to serialize. + preview: + run: + - sh + - -c + - pnpm install --frozen-lockfile --prefer-offline --filter "@app/web..." && exec node_modules/.bin/next dev -H 127.0.0.1 -p 3000 + port: 3000 + path: /incidents + env: + NODE_OPTIONS: --max-old-space-size=1024 + NEXT_TELEMETRY_DISABLED: "1" parameters: nodeVersion: "22" pnpmVersion: "10.12.1" diff --git a/apps/web/next.config.mjs b/apps/web/next.config.mjs index 067eefe..6922b44 100644 --- a/apps/web/next.config.mjs +++ b/apps/web/next.config.mjs @@ -22,6 +22,21 @@ const nextConfig = { outputFileTracingIncludes: { '/*': ['../../node_modules/.pnpm/react-textarea-autosize@*/node_modules/react-textarea-autosize/dist/*edge-light*'], }, + 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'] } } + : {}), + }, + // 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'], } export default nextConfig diff --git a/intent.yaml b/intent.yaml index a4491d5..f7b7c6a 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 status page. Its own +# `spec.preview` (apps/web/component.yaml) says how it runs; `orun preview` +# runs it. +preview: + component: web + discovery: roots: - apps/