Files
Mark Fogle 56b51aeaef fix(showcase/shell-dojo): runtime-derive preview backend URL
The dojo's preview iframe built its src from `integration.backend_url`,
which generate-registry.ts bakes into registry.json at Docker BUILD time
(default `showcase-{slug}-production.up.railway.app`). So the staging
dojo iframed PROD integration backends — the exact staging->prod leakage
the shell's SU-13 runtime-derivation fix already prevents, but which was
never ported to shell-dojo.

Port the `backendHostPattern` slice of SU-13:
- copy shell's backend-url.ts verbatim (resolveBackendUrl + the
  NEXT_PUBLIC_LOCAL_BACKENDS local-dev override); a scripts drift-guard
  test keeps it byte-identical to the shell's and pins the default
  pattern across backend-url.ts and generate-registry.ts.
- add `backendHostPattern` to shell-dojo's RuntimeConfig (server reads
  SHOWCASE_BACKEND_HOST_PATTERN at request time; client carries the SSR
  sentinel) — the existing layout injection picks it up automatically.
- page.tsx derives previewUrl via resolveBackendUrl at request time,
  gated on a `mounted` flag so the SSR-phase sentinel host never reaches
  an iframe src (shell-dojo loads the registry synchronously, so unlike
  the shell it has no data-loading guard to defer the read past
  hydration).

Staging dojo's SHOWCASE_BACKEND_HOST_PATTERN is set to
`showcase-{slug}-staging.up.railway.app`; prod stays unset (= default
prod pattern), so prod behavior is byte-identical.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 21:37:34 +00:00
..
…
…