diff --git a/.github/workflows/baseline.yml b/.github/workflows/baseline.yml index 7ef9ade..9a9216a 100644 --- a/.github/workflows/baseline.yml +++ b/.github/workflows/baseline.yml @@ -60,22 +60,24 @@ jobs: # Tier 1. THE BLUEPRINT, READ AND PLACED BY THE BINARY A BOOTSTRAP RUNS. # - # Pinned at the bootstrap floor (BOOTSTRAP.md), not the store'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 store'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 store'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, 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, 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 @@ -109,11 +111,12 @@ jobs: # 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 one `secrets` reconcile, 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. + # in the background, 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 @@ -127,8 +130,9 @@ jobs: # smoke-tested with the component's own smoke command — then browsed as a # shopper: the sample catalogue, the store listing, a product added to the # cart through the storefront's own server action, checkout's notice, and - # every route it promises. 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 + # every route it promises. 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. storefront: runs-on: ubuntu-latest @@ -136,7 +140,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 4342d0a..303075d 100644 --- a/apps/web/component.yaml +++ b/apps/web/component.yaml @@ -58,6 +58,29 @@ spec: - profile: deploy when: triggerRef: github-push-main + # How the storefront 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, on the + # storefront's own port, with its heap capped: the box is shared with the + # agent. No Medusa backend is named (NEXT_PUBLIC_MEDUSA_BACKEND_URL and its + # publishable key are Orun secrets the build reads), so it runs in sample + # mode, on its sample catalogue. The tab opens /dk, the default region's + # home: `/` is the middleware's rewrite to it, which `next dev` turns into a + # request to itself over https behind the preview (it fails). + 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 8000 + port: 8000 + path: /dk + 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.js b/apps/web/next.config.js index b038daa..636e1aa 100644 --- a/apps/web/next.config.js +++ b/apps/web/next.config.js @@ -19,6 +19,21 @@ const nextConfig = { // resolve from the root node_modules. output: "standalone", outputFileTracingRoot: path.join(__dirname, "../.."), + 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"], async headers() { return [ { diff --git a/intent.yaml b/intent.yaml index 1e55fce..c4c17ab 100644 --- a/intent.yaml +++ b/intent.yaml @@ -61,6 +61,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 storefront. Its own +# `spec.preview` (apps/web/component.yaml) says how it runs; `orun preview` +# runs it. +preview: + component: web + discovery: roots: - apps/