diff --git a/.github/workflows/baseline.yml b/.github/workflows/baseline.yml index 0a3ce2d..98b4901 100644 --- a/.github/workflows/baseline.yml +++ b/.github/workflows/baseline.yml @@ -51,11 +51,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - - name: Contract tests (manifest, phases, coverage, rebrand, retouch, bootstrap-defer, fleet-stubs, pen-reset) + - name: Contract tests (manifest, phases, coverage, rebrand, retouch, bootstrap-defer, fleet-stubs, pen-reset, console-artifact) run: | set -euo pipefail python3 -c 'import yaml' 2>/dev/null || pip install --quiet pyyaml - for t in manifest phases coverage rebrand retouch bootstrap-defer fleet-stubs pen-reset; do + for t in manifest phases coverage rebrand retouch bootstrap-defer fleet-stubs pen-reset console-artifact; do echo "── $t" bash "testing/$t.test.sh" done diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml new file mode 100644 index 0000000..87785d5 --- /dev/null +++ b/.github/workflows/tag.yml @@ -0,0 +1,181 @@ +name: Baseline tag + +# CUTS A `baseline-vN` TAG FOR THIS REPOSITORY. +# +# A baseline tag is what the platform's registry resolves and what every +# product bootstrapped from this repository is built out of, so it is cut by a +# workflow rather than by hand: the version must look like a baseline tag, an +# existing tag is never moved, and the commit is resolved here, once. +# +# Whether a commit is fit to release is decided outside this repository, by +# whoever cuts the tag; nothing here asks for proof beyond a green `main`. + +on: + workflow_dispatch: + inputs: + version: + description: "The tag to cut, e.g. baseline-v25." + required: true + type: string + ref: + description: "Branch, tag or sha to cut it from. Defaults to main." + required: false + default: main + type: string + publish_only: + description: "Skip the cut: only publish the prebuilt console for an existing tag." + required: false + default: false + type: boolean + replace: + description: "Replace a published console for the same sources (a packing fix)." + required: false + default: false + type: boolean + +concurrency: + group: baseline-tag + cancel-in-progress: false + +permissions: + contents: read + +jobs: + cut: + if: ${{ !inputs.publish_only }} + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v6 + with: + # Full history: the ref being cut from may be any commit, and a + # shallow clone cannot resolve one it did not fetch. + fetch-depth: 0 + ref: ${{ inputs.ref }} + + - name: the version must look like a baseline tag + run: | + set -euo pipefail + # Refused here rather than by the API, because the API's error for a + # malformed ref says nothing about the convention it broke — and a + # tag that does not match `baseline-v*` is invisible to the backstop + # above, which is the one shape of mistake that disables the gate. + case "${{ inputs.version }}" in + baseline-v[0-9]*) ;; + *) echo "✕ '${{ inputs.version }}' is not a baseline-vN tag" >&2; exit 1 ;; + esac + + - name: resolve the commit + id: commit + run: | + set -euo pipefail + sha="$(git rev-parse HEAD)" + echo "sha=$sha" >> "$GITHUB_OUTPUT" + echo "Cutting ${{ inputs.version }} from ${{ inputs.ref }} = $sha" + + - name: the tag must not already exist + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + code="$(curl -sS -o /dev/null -w '%{http_code}' \ + -H "Authorization: Bearer $GH_TOKEN" \ + -H "Accept: application/vnd.github+json" \ + "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/git/ref/tags/${{ inputs.version }}")" + if [ "$code" = "200" ]; then + echo "✕ ${{ inputs.version }} already exists. A baseline tag is never moved:" >&2 + echo " products resolve it, and repointing one changes what a build that" >&2 + echo " already shipped was made of. Cut the next number." >&2 + exit 1 + fi + # Anything other than 200 or 404 means the question was not answered, + # and "it probably does not exist" is not a thing to guess about a + # tag that is about to be created. + [ "$code" = "404" ] || { echo "✕ could not check for the tag (HTTP $code)" >&2; exit 1; } + + - name: cut the tag + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + curl -sS -X POST --fail-with-body \ + -H "Authorization: Bearer $GH_TOKEN" \ + -H "Accept: application/vnd.github+json" \ + "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/git/refs" \ + -d "$(printf '{"ref":"refs/tags/%s","sha":"%s"}' \ + "${{ inputs.version }}" "${{ steps.commit.outputs.sha }}")" + echo "" + echo "✓ ${{ inputs.version }} → ${{ steps.commit.outputs.sha }}" + echo " Next: move the registry row in orun-cloud's infra/baselines-registry/baselines.yaml." + + # THE PREBUILT CONSOLE (saas-console-artifact CA3). The console carries no + # product identity and no environment in its build (CA1/CA2), so the + # OpenNext output of this tag can be any product's first console deploy. + # It is CONTENT-ADDRESSED — named by a hash of the sources that produce it + # (apps/web-console-next/scripts/console-artifact.mjs) — and kept on one + # rolling `console-artifacts` release, so a bootstrap finds it from the + # baseline's own files without knowing the tag. Same sources, same name: + # an asset that already exists is left as it is. + publish-console: + needs: cut + if: ${{ always() && (needs.cut.result == 'success' || (inputs.publish_only && needs.cut.result == 'skipped')) }} + runs-on: ubuntu-latest + permissions: + contents: write + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v6 + with: + ref: refs/tags/${{ inputs.version }} + # The PACKER comes from this workflow's own commit, not the tag: the + # sources being packed are the tag's (and name the asset), but a fix to + # how they are packed must reach an existing tag's console too. + - uses: actions/checkout@v6 + with: + ref: ${{ github.sha }} + path: .packer + sparse-checkout: apps/web-console-next/scripts/console-artifact.mjs + sparse-checkout-cone-mode: false + - uses: actions/setup-node@v6 + with: + node-version: "22" + - uses: pnpm/action-setup@v4 + with: + version: "10.12.1" + - name: build the console + run: | + set -euo pipefail + pnpm install --frozen-lockfile + # No NEXT_PUBLIC_DEPLOY_ENV: the environment comes from the host. + unset NEXT_PUBLIC_DEPLOY_ENV + pnpm exec turbo run build --filter=@saas/web-console-next + - name: pack it + id: pack + run: | + set -euo pipefail + node .packer/apps/web-console-next/scripts/console-artifact.mjs pack --root . --out dist/console-artifact | tee pack.log + echo "asset=$(sed -n 's/^asset=//p' pack.log)" >> "$GITHUB_OUTPUT" + - name: publish it + run: | + set -euo pipefail + asset="${{ steps.pack.outputs.asset }}" + if ! gh release view console-artifacts >/dev/null 2>&1; then + gh release create console-artifacts --prerelease \ + --target "$(git rev-parse HEAD)" \ + --title "Prebuilt consoles" \ + --notes "Content-addressed builds of apps/web-console-next, one per set of console sources, used by a bootstrap's first console deploy. See specs/epics/saas-console-artifact." + fi + if gh release view console-artifacts --json assets --jq '.assets[].name' | grep -qx "$asset"; then + if [ "${{ inputs.replace }}" = "true" ]; then + gh release upload console-artifacts --clobber "dist/console-artifact/$asset" "dist/console-artifact/$asset.sha256" + echo "✓ replaced $asset for ${{ inputs.version }}" + else + echo "✓ $asset is already published (same sources, same build)" + fi + else + gh release upload console-artifacts "dist/console-artifact/$asset" "dist/console-artifact/$asset.sha256" + echo "✓ published $asset for ${{ inputs.version }}" + fi + diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index cef4e9a..fb0253a 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -13,12 +13,13 @@ now either a typed action inside the orun binary or a hook this repo still owns, which is why the version floor matters and why a phase can be run alone, months later, from a fresh container. -Budget: **53 minutes**, the sum of the phases' own `expectedMinutes`. The -long poles are the worker fleet (~14m, one landing and one deploy each) and -the console build (~13m); Supabase project creation (5–7m per environment) is -the longest wait nobody can shorten. The budget came down from 84 because a -bootstrap landing is no longer verified twice (its PR runs `plan` alone), the -fleet no longer deploys twice, and prod no longer waits out stage. Where the +Budget: **45 minutes**, the sum of the phases' own `expectedMinutes`. The +long pole is now the worker fleet (~14m, one landing and one deploy each); +Supabase project creation (5–7m per environment) is the longest wait nobody +can shorten. The budget came down from 84 because a bootstrap landing is no +longer verified twice (its PR runs `plan` alone), the fleet no longer deploys +twice, prod no longer waits out stage, and the console is fetched from a +prebuilt artifact instead of built cold. Where the numbers come from, and which are still estimates: [docs/phases/TIMINGS.md](docs/phases/TIMINGS.md). diff --git a/apps/web-console-next/component.yaml b/apps/web-console-next/component.yaml index b44fc88..b11386c 100644 --- a/apps/web-console-next/component.yaml +++ b/apps/web-console-next/component.yaml @@ -14,6 +14,9 @@ spec: owner: platform domain: starter-ui path: apps/web-console-next + # Its own lane per environment (execution.lanes in intent.yaml): the Next.js + # build is the longest job in the plan, and a shared lane would wait on it. + lane: isolated # The deploy smoke health-checks the api-edge worker # (lumen-api-edge-/health), so api-edge must be live before this # component's stage/prod deploy+smoke runs. Without this ordering the smoke @@ -67,10 +70,21 @@ spec: # ${WORKERS_DEV_SUBDOMAIN} and used to build ${DEPLOYED_URL}. workersDevSubdomain: rahulvarghesepullely - environmentBuildVar: NEXT_PUBLIC_DEPLOY_ENV + # NO environmentBuildVar (saas-console-artifact CA2): the console learns its + # environment at runtime — CONSOLE_DEPLOY_ENV if the deploy sets one, else + # the `-` its workers.dev host carries — so the build is the same for + # every environment and a build made anywhere can be deployed to any of + # them. It used to pass NEXT_PUBLIC_DEPLOY_ENV, which baked the environment + # into the bundle and is exactly what stopped one build from serving both. installCommand: pnpm install --frozen-lockfile - buildCommand: pnpm exec turbo run build --filter=@saas/web-console-next + # saas-console-artifact CA4: with a console-artifact.pin.json (written by + # the bootstrap's 06-console phase) and sources that still hash to it, this + # fetches the baseline's prebuilt console and verifies its sha256 instead + # of building. No pin, changed sources or an unreachable artifact all fall + # back to the normal turbo build, so a product that never saw a published + # artifact behaves exactly as before. + buildCommand: node scripts/console-artifact.mjs build # Smoke: follow redirects (root `redirect("/orgs")` is a 307) and confirm # the SSR'd page contains the console marker. The api-edge worker is the diff --git a/apps/web-console-next/scripts/console-artifact.mjs b/apps/web-console-next/scripts/console-artifact.mjs new file mode 100644 index 0000000..59b099b --- /dev/null +++ b/apps/web-console-next/scripts/console-artifact.mjs @@ -0,0 +1,227 @@ +#!/usr/bin/env node +// THE CONSOLE, BUILT ONCE PER BASELINE (saas-console-artifact CA3/CA4). +// +// Since CA1/CA2 the console carries no product identity and no environment in +// its build — both come from the Worker's `vars` and host at runtime — so the +// OpenNext output of a baseline commit can be deployed as any product's +// console. A bootstrap's first console deploy downloads it instead of spending +// 4-5 minutes on a cold Next.js build. +// +// Artifacts are CONTENT-ADDRESSED: named by a hash of the sources that produce +// the build (this app, packages/, the lockfile and root build config), on one +// rolling `console-artifacts` release. An artifact can only ever be used for +// exactly the code it was built from, and nothing needs to know a tag. +// +// hash [--root ] print the source hash +// pack [--root ] [--out ] bundle the built worker +// (wrangler --dry-run) and tar it with the static assets as +// web-console-next-.tar.gz (+ .sha256); build first +// pin --baseline --repo (a bootstrap hook, run in +// [--root ] the product) if the +// baseline's sources have a published artifact, record it and the +// product's own source hash in console-artifact.pin.json +// build [--root ] (the component's build +// command) if a pin exists and this tree still hashes to it, fetch +// and verify the artifact; otherwise run the normal turbo build +// +// Node + the system `tar` and `gzip`. No dependencies. + +import { execFileSync } from "node:child_process"; +import { createHash } from "node:crypto"; +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const APP = "apps/web-console-next"; +const RELEASE = "console-artifacts"; +const PIN = "console-artifact.pin.json"; +// What decides the console's build output, relative to the repo root. +const SOURCES = [APP, "packages", "tooling/tsconfig", "package.json", "pnpm-lock.yaml", "pnpm-workspace.yaml", "turbo.json"]; +const SKIP_DIRS = new Set(["node_modules", ".next", ".open-next", "dist", ".turbo", ".wrangler", "coverage"]); +const SKIP_FILES = new Set([`${APP}/${PIN}`]); +// Byproducts a build or typecheck writes into the source tree: hashing them +// would make the publish job (which hashes after building) disagree with a +// bootstrap (which hashes a clean clone). +const SKIP_FILE_RE = /(\.tsbuildinfo|(^|\/)next-env\.d\.ts)$/; + +function arg(name, fallback) { + const i = process.argv.indexOf(`--${name}`); + return i >= 0 && process.argv[i + 1] !== undefined ? process.argv[i + 1] : fallback; +} + +function fail(message) { + console.error(`✕ console-artifact: ${message}`); + process.exit(1); +} + +function repoRoot() { + const given = arg("root"); + if (given) return path.resolve(given); + let dir = path.dirname(fileURLToPath(import.meta.url)); + while (!fs.existsSync(path.join(dir, "pnpm-workspace.yaml"))) { + const up = path.dirname(dir); + if (up === dir) fail("no pnpm-workspace.yaml above this script; pass --root"); + dir = up; + } + return dir; +} + +const sha256 = (data) => createHash("sha256").update(data).digest("hex"); + +/** sha256 over every source file's path and content, in a fixed order. */ +export function sourceHash(root) { + const files = []; + const walk = (rel) => { + const abs = path.join(root, rel); + if (!fs.existsSync(abs)) return; + const stat = fs.lstatSync(abs); + if (stat.isSymbolicLink()) return; + if (stat.isDirectory()) { + if (SKIP_DIRS.has(path.basename(rel))) return; + for (const name of fs.readdirSync(abs)) walk(rel ? `${rel}/${name}` : name); + } else if (stat.isFile() && !SKIP_FILES.has(rel) && !SKIP_FILE_RE.test(rel)) { + files.push(rel); + } + }; + for (const source of SOURCES) walk(source); + files.sort(); + const h = createHash("sha256"); + for (const rel of files) h.update(`${rel}\0${sha256(fs.readFileSync(path.join(root, rel)))}\n`); + return h.digest("hex").slice(0, 32); +} + +const assetName = (hash) => `web-console-next-${hash}.tar.gz`; +const releaseUrl = (repo) => `https://github.com/${repo}/releases/download/${RELEASE}`; + +function pack() { + const root = repoRoot(); + const hash = sourceHash(root); + const app = path.join(root, APP); + for (const required of ["worker.js", "assets"]) { + if (!fs.existsSync(path.join(app, ".open-next", required))) fail(`${APP}/.open-next/${required} is missing: build first`); + } + const out = path.resolve(arg("out", "dist/console-artifact")); + fs.mkdirSync(out, { recursive: true }); + const work = fs.mkdtempSync(path.join(os.tmpdir(), "console-artifact-pack-")); + try { + // BUNDLE HERE, WHERE THE BUILD IS. OpenNext's output require()s files by + // ABSOLUTE build-machine paths (/home/runner/work//…/.open-next/…), + // which `wrangler deploy` resolves when it bundles — so the raw + // .open-next only deploys on the machine, at the path, that built it. + // Bundling on this machine resolves them; the artifact is the + // self-contained worker plus the static assets — exactly what a deploy + // uploads — and re-bundling it in a product's deploy is a no-op. + const wrangler = path.join(app, "node_modules", ".bin", "wrangler"); + if (!fs.existsSync(wrangler)) fail(`${wrangler} is missing: install the workspace first`); + execFileSync(wrangler, ["deploy", "--dry-run", "--config", "wrangler.jsonc", "--outdir", path.join(work, "bundle")], { + cwd: app, + stdio: ["ignore", "ignore", "inherit"], + }); + const bundled = path.join(work, "bundle", "worker.js"); + if (!fs.existsSync(bundled)) fail("wrangler produced no bundled worker.js"); + if (/require\(\s*["']\//.test(fs.readFileSync(bundled, "utf8"))) { + fail("the bundled worker still require()s an absolute path; it would only run on this machine"); + } + const stage = path.join(work, "stage", ".open-next"); + fs.mkdirSync(stage, { recursive: true }); + fs.copyFileSync(bundled, path.join(stage, "worker.js")); + fs.cpSync(path.join(app, ".open-next", "assets"), path.join(stage, "assets"), { recursive: true }); + + const name = assetName(hash); + const raw = path.join(out, name.replace(/\.gz$/, "")); + // Deterministic: the same build packs to the same bytes. + execFileSync("tar", ["--sort=name", "--mtime=@0", "--owner=0", "--group=0", "--numeric-owner", "-cf", raw, "-C", path.join(work, "stage"), ".open-next"]); + execFileSync("gzip", ["-n", "-9", "-f", raw]); + const tarball = path.join(out, name); + const digest = sha256(fs.readFileSync(tarball)); + fs.writeFileSync(`${tarball}.sha256`, `${digest} ${name}\n`); + console.log(`✓ ${name} ${(fs.statSync(tarball).size / 1e6).toFixed(1)} MB sha256:${digest}`); + console.log(`asset=${name}`); + } finally { + fs.rmSync(work, { recursive: true, force: true }); + } +} + +async function get(url) { + if (url.startsWith("file://")) return fs.readFileSync(fileURLToPath(url)); + const res = await fetch(url, { redirect: "follow" }); + if (!res.ok) { + const err = new Error(`GET ${url}: HTTP ${res.status}`); + err.status = res.status; + throw err; + } + return Buffer.from(await res.arrayBuffer()); +} + +async function pin() { + const baseline = arg("baseline"); + const repo = arg("repo"); + if (!baseline || !repo) fail("pin needs --baseline and --repo "); + const root = repoRoot(); + const name = assetName(sourceHash(path.resolve(baseline))); + const base = arg("from", releaseUrl(repo)); + let digest; + try { + digest = (await get(`${base}/${name}.sha256`)).toString("utf8").trim().split(/\s+/)[0]; + } catch (err) { + // No artifact for this baseline's sources: the product builds the console + // itself, exactly as before. Not an error. + console.log(`· no prebuilt console for this baseline (${err.message}); the product will build it`); + fs.rmSync(path.join(root, APP, PIN), { force: true }); + return; + } + if (!/^[0-9a-f]{64}$/.test(digest ?? "")) fail(`${name}.sha256 is not a sha256`); + const record = { url: `${base}/${name}`, sha256: digest, sourceHash: sourceHash(root) }; + fs.writeFileSync(path.join(root, APP, PIN), JSON.stringify(record, null, 2) + "\n"); + console.log(`✓ pinned ${name} for this product's console (sources ${record.sourceHash})`); +} + +function turboBuild(root) { + execFileSync("pnpm", ["exec", "turbo", "run", "build", "--filter=@saas/web-console-next"], { cwd: root, stdio: "inherit" }); +} + +async function build() { + const root = repoRoot(); + const pinFile = path.join(root, APP, PIN); + if (!fs.existsSync(pinFile)) return turboBuild(root); + const record = JSON.parse(fs.readFileSync(pinFile, "utf8")); + const current = sourceHash(root); + if (current !== record.sourceHash) { + console.log(`· the console's sources changed since the pin (${record.sourceHash} → ${current}); building from source`); + return turboBuild(root); + } + let tarball; + try { + tarball = await get(record.url); + } catch (err) { + console.log(`· ${err.message}; building from source`); + return turboBuild(root); + } + const actual = sha256(tarball); + // A digest mismatch is never papered over with a build: something served + // bytes other than the ones that were published. + if (actual !== record.sha256) fail(`${record.url}: sha256 ${actual}, pinned ${record.sha256}`); + const work = fs.mkdtempSync(path.join(os.tmpdir(), "console-artifact-")); + try { + fs.writeFileSync(path.join(work, "a.tar.gz"), tarball); + execFileSync("tar", ["-xzf", path.join(work, "a.tar.gz"), "-C", work, "--no-same-owner"]); + if (!fs.existsSync(path.join(work, ".open-next", "worker.js"))) fail(`${record.url} holds no .open-next/worker.js`); + const app = path.join(root, APP); + fs.rmSync(path.join(app, ".open-next"), { recursive: true, force: true }); + fs.renameSync(path.join(work, ".open-next"), path.join(app, ".open-next")); + } finally { + fs.rmSync(work, { recursive: true, force: true }); + } + console.log(`✓ prebuilt console ${path.basename(record.url)} (sha256:${actual}); no build`); +} + +const command = process.argv[2]; +if (command === "hash") console.log(sourceHash(repoRoot())); +else if (command === "pack") pack(); +else if (command === "pin") await pin(); +else if (command === "build") await build(); +else { + console.error("usage: console-artifact.mjs hash|pack|pin|build [--root ] … (see the header)"); + process.exit(2); +} diff --git a/apps/web-console-next/src/app/(app)/orgs/[orgSlug]/settings/page.tsx b/apps/web-console-next/src/app/(app)/orgs/[orgSlug]/settings/page.tsx index 9f1ce68..0f21708 100644 --- a/apps/web-console-next/src/app/(app)/orgs/[orgSlug]/settings/page.tsx +++ b/apps/web-console-next/src/app/(app)/orgs/[orgSlug]/settings/page.tsx @@ -7,7 +7,7 @@ import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { CopyButton } from "@/components/ui/copy-button"; import { SettingsCard } from "@/components/settings/settings-card"; -import { PRODUCT_NAME } from "@/lib/app-config"; +import { appConfig } from "@/lib/app-config"; import { TENANT_NOUN } from "@/lib/solo-mode"; export default function OrgSettingsPage() { @@ -24,7 +24,7 @@ function Inner({ org }: { org: { id: string; name: string; slug: string } }) {
@@ -32,7 +32,7 @@ function Inner({ org }: { org: { id: string; name: string; slug: string } }) { } > diff --git a/apps/web-console-next/src/app/layout.tsx b/apps/web-console-next/src/app/layout.tsx index efcb507..3f6db2c 100644 --- a/apps/web-console-next/src/app/layout.tsx +++ b/apps/web-console-next/src/app/layout.tsx @@ -1,18 +1,33 @@ import type { Metadata, Viewport } from "next"; import "../styles/globals.css"; import { Providers } from "./providers"; -import { CONSOLE_TITLE, PRODUCT_DESCRIPTION, PRODUCT_NAME } from "@/lib/app-config"; +import { headers } from "next/headers"; +import { consoleTitle, rememberRequestHost, resolveAppConfig, type AppConfig } from "@/lib/app-config"; -export const metadata: Metadata = { - title: CONSOLE_TITLE, - description: PRODUCT_DESCRIPTION, - manifest: "/manifest.webmanifest", - appleWebApp: { - capable: true, - title: PRODUCT_NAME, - statusBarStyle: "black-translucent", - }, -}; +// The product's identity for this request, from the Worker's `vars` (OpenNext +// copies them into process.env per request), falling back to the compiled-in +// defaults (saas-console-artifact CA1); the deploy environment falls back to +// the one the host names (CA2). Server only: the client receives it through +// . +async function requestConfig(): Promise { + const host = (await headers()).get("host"); + rememberRequestHost(host); + return resolveAppConfig(process.env, undefined, host); +} + +export async function generateMetadata(): Promise { + const config = await requestConfig(); + return { + title: consoleTitle(config), + description: config.productDescription, + manifest: "/manifest.webmanifest", + appleWebApp: { + capable: true, + title: config.productName, + statusBarStyle: "black-translucent", + }, + }; +} // `viewport-fit=cover` enables `env(safe-area-inset-*)` on notched devices; // theme-color tints the mobile browser chrome to match light/dark surfaces. @@ -35,7 +50,8 @@ export const viewport: Viewport = { // failing code paths live in the layout's Providers. export const dynamic = "force-dynamic"; -export default function RootLayout({ children }: { children: React.ReactNode }) { +export default async function RootLayout({ children }: { children: React.ReactNode }) { + const config = await requestConfig(); return ( @@ -51,7 +67,7 @@ export default function RootLayout({ children }: { children: React.ReactNode }) __html: "globalThis.__name=globalThis.__name||function(t){return t};", }} /> - {children} + {children} ); diff --git a/apps/web-console-next/src/app/login/page.tsx b/apps/web-console-next/src/app/login/page.tsx index 1f1c21b..bb63713 100644 --- a/apps/web-console-next/src/app/login/page.tsx +++ b/apps/web-console-next/src/app/login/page.tsx @@ -11,7 +11,7 @@ import { Label } from "@/components/ui/label"; import { useSession } from "@/lib/session"; import { resolvePostAuthDestination } from "@/lib/last-org"; import { wrap, createClient } from "@/lib/api"; -import { CONSOLE_TITLE } from "@/lib/app-config"; +import { consoleTitle } from "@/lib/app-config"; import { useToast } from "@/components/ui/toast"; import { ZodForm } from "@/components/ui/zod-form"; import type { OAuthProviderInfo } from "@saas/contracts/auth"; @@ -77,7 +77,7 @@ export default function LoginPage() { S
-
{CONSOLE_TITLE}
+
{consoleTitle()}
{isLocked ? `locked to ${target.name}` : `target: ${target.name}`}
diff --git a/apps/web-console-next/src/app/onboarding/page.tsx b/apps/web-console-next/src/app/onboarding/page.tsx index c1694e7..a756704 100644 --- a/apps/web-console-next/src/app/onboarding/page.tsx +++ b/apps/web-console-next/src/app/onboarding/page.tsx @@ -13,7 +13,7 @@ import { useRequireAuth } from "@/lib/use-async"; import { useApiQuery, qk } from "@/lib/query"; import { wrap } from "@/lib/api"; import { defaultOrgDestination, readLastOrgSlug } from "@/lib/last-org"; -import { CONSOLE_TITLE } from "@/lib/app-config"; +import { consoleTitle } from "@/lib/app-config"; /** * Mandatory first-run onboarding (Supabase/Vercel-style): a focused, full-screen @@ -53,7 +53,7 @@ export default function OnboardingPage() {
S
- {CONSOLE_TITLE} + {consoleTitle()}