Skip to content

Declare the console's live preview (saas-parallel-baselining PB4) - #125

Draft
ruehowl wants to merge 1 commit into
mainfrom
claude/declare-preview
Draft

ruehowl wants to merge 1 commit into
mainfrom
claude/declare-preview

Conversation

@ruehowl

@ruehowl ruehowl commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

What

The baseline declares its live preview, so orun.work's Preview tab can show a coding session's dev server (saas-parallel-baselining PB4).

  • apps/web-console-next/component.yaml: spec.preview:
    preview:
      run:
      - sh
      - -c
      - pnpm install --frozen-lockfile --prefer-offline --filter "@saas/web-console-next..." && exec node_modules/.bin/next dev -H 127.0.0.1 -p 3001
      port: 3001
      path: /
      env:
        CONSOLE_DEPLOY_ENV: stage
        NODE_OPTIONS: --max-old-space-size=1024
        NEXT_TELEMETRY_DISABLED: '1'
  • intent.yaml: preview: {component: web-console-next}.
  • apps/web-console-next/next.config.mjs: a dev-only Server Actions allow-list (experimental.serverActions.allowedOrigins, only when NODE_ENV === "development") for the preview's hosts. Behind the gateway the browser's Origin is the preview's host while next dev sees Host: 127.0.0.1:3001, and Next refuses the action ("Invalid Server Actions request", 500). next build runs with NODE_ENV=production, so production keeps its same-origin check (experimental evaluates to {} there). Next 15.0.3 has no allowedDevOrigins and needs none: its hot-reload socket connects from the preview origin.
  • .github/workflows/baseline.yml: orun v2.88.0 → v2.96.0, the first release that reads spec.preview, so the placement test's orun validate checks the declaration. ci.yml (the product's own lane pin, v2.89.0) is unchanged.

Nothing about how the baseline builds or deploys changes.

Checked

From a clean clone, with orun v2.96.0, and through a local stand-in of the preview gateway (the dev server sees a local Host and the browser's own Origin; the page is framed from a foreign origin):

Check Result
orun validate passes
orun preview start --json ready in 4.2 s (warm pnpm store)
GET / 200, 32.4 KB, "Lumen Console"
foreign Host + Origin straight to the dev server 200
through the gateway stand-in, framed frame 200, failed: FAILED net::ERR_ABORTED /login?_rsc=v3pub, hot-reload socket connected
an edit reaches the frame hot update in 0.5s
memory dev server 929 MB at its peak (page compiled, after an edit); the install peaks at 929 MB
orun preview stop stops it; port freed

Console errors in the frame: Access to fetch at 'https://lumen-api-edge-stage.rahulvarghesepullely.workers.dev/v1/auth/oauth/providers' from origin 'http://abc123def456.orun-preview.app:13001' has been blocked by CORS policy: Response to preflight request doesn't pass ; Failed to load resource: net::ERR_FAILED

Notes

  • Draft, not for merging yet — the pin bump surfaces a real problem. With orun v2.96.0, testing/placement.test.sh fails at 01-scaffold: the blueprint places intent.yaml (with its preview: block) in 01-scaffold, but web-console-next only in 06-console, so orun validate refuses preview.component "web-console-next" names no component ("the scaffolded intent does not plan"). Bootstraps run the latest orun, so a product built from this as it stands would stop at phase 01. cirrus does not hit this (its single 01-product phase places the intent and the console together). The fix is either in orun (validate treating a not-yet-placed preview component as "(yet)", as orun preview already does) or here (strip the block in 01, add it back in 06-console) — a bootstrap change this PR does not make on its own.
  • Merging runs the real pipeline (workspace ws_4975BJ7P): it redeploys the stage and prod console (identical build) and runs its smoke, which also checks lumen-api-edge-<env>/health. That answers 404 (Cloudflare error 1042) on stage and prod today, and the last console deploy on main (run 40205327869, 25 Oct) failed that smoke the same way.
  • Server Actions, probed by POSTing a Next-Action request with Host: 127.0.0.1:3001: before the allow-list, every Origin gets 500 "Invalid Server Actions request"; with it, https://<token>.orun-preview.app and https://preview-gateway-stage.oruncloud.workers.dev pass the origin check (the probe's made-up action id then reads "Failed to find Server Action"), and a foreign Origin is still refused.
  • What it shows: / (Loading…) forwards to /login, which renders in full, "locked to stage". Pages behind sign-in show the sign-in prompt. The stage API refuses the preview origin by CORS (the sign-in page's OAuth-providers fetch), and stage's API edge is not answering today. The two aborted /login?_rsc requests are router prefetches cancelled by the client-side redirect, not failed assets. First run 12.5 s, then 4.2 s; install peak 1.35 GB on the first run.

Generated by Claude Code

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. The box is small and shared with
the agent, so the preview is the console alone, as on cirrus:

- apps/web-console-next/component.yaml: spec.preview. It installs the
  console's own packages only (--filter "@saas/web-console-next..."), then
  runs `next dev` directly on 127.0.0.1:3001, with a 1 GiB heap cap; its API
  is the product's deployed stage (CONSOLE_DEPLOY_ENV=stage). No `needs`, so
  no Worker, Supabase or wrangler starts.
- intent.yaml: preview: {component: web-console-next}.
- apps/web-console-next/next.config.mjs: a dev-only Server Actions
  allow-list for the preview's hosts. Behind the gateway the browser's
  Origin is the preview's host while `next dev` sees a local Host, and Next
  refuses the action. `next build` runs with NODE_ENV=production, so
  production 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.89.0) is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019PcpNV6SjymJBPv3nNkC4z
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.

2 participants