Repository navigation
Conversation
… self-hosted Add STATUS_PAGE_BASE_DOMAIN (runtime, server-side, default openstatus.dev). Status page: hosts under the base domain resolve by slug like *.openstatus.dev; canonical/alternate links, feed links and base URLs use it. The client feed links get the value from a context provider set in the [domain] server layout. Dashboard: slug suffix, onboarding summary, page links, list column and chat summaries use the base domain, passed from the root server layout through DeploymentConfigProvider (with the SELF_HOST flag) so prebuilt images pick it up at runtime. API: when SELF_HOST is true, the Vercel add/remove helpers are no-ops, the "openstatus" substring check is skipped, and the domain status/verify/certificate endpoints return a neutral verified result without calling Vercel. The custom-domain form hides the Vercel DNS/SSL panel and shows a one-line reverse-proxy hint instead. Subscriber verification links use the base domain.
|
@tuergeist is attempting to deploy a commit to the OpenStatus Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
6 issues found across 51 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/status-page/src/lib/alternates.test.ts">
<violation number="1" location="apps/status-page/src/lib/alternates.test.ts:67">
P2: This test bypasses the runtime configuration path by injecting `baseDomain` directly, so it will not catch a regression where alternates stop reading `STATUS_PAGE_BASE_DOMAIN`. Stub the environment and call `statusPageAlternates({ slug: "acme" })` to verify the feature end to end.</violation>
</file>
<file name="packages/api/src/router/page.custom-domain.test.ts">
<violation number="1" location="packages/api/src/router/page.custom-domain.test.ts:50">
P2: This test does not force hosted mode, so it fails or tests the wrong branch when the API suite inherits `SELF_HOST=true`. Mock `../env` with `SELF_HOST: "false"` (or otherwise isolate the environment) before creating the router.</violation>
</file>
<file name="packages/api/src/router/page.custom-domain.self-host.test.ts">
<violation number="1" location="packages/api/src/router/page.custom-domain.self-host.test.ts:102">
P2: This test depends on the preceding mutation test to persist `firstDomain`; running it alone (for example with Vitest’s test-name filter) fails in `assertOwned` before exercising the self-hosted endpoint behavior. Create and assign the domain in this test or a per-test setup so each test owns its required state.</violation>
</file>
<file name="apps/dashboard/src/lib/deployment-config.ts">
<violation number="1" location="apps/dashboard/src/lib/deployment-config.ts:41">
P2: The dashboard and API disagree on which `SELF_HOST` values enable self-hosted mode. Use the same string-boolean parsing as the API so values such as `1`, `yes`, or `on` do not leave the dashboard showing Vercel-specific controls while the API skips Vercel.</violation>
</file>
<file name="apps/dashboard/src/components/chat/tool-renderers/index.tsx">
<violation number="1" location="apps/dashboard/src/components/chat/tool-renderers/index.tsx:164">
P2: The new summary uses the configured host, but expanding the same create/update result still shows the old `openstatus.dev` URL from `output.url`. Pass the deployment context through result rendering and display the configured URL there too, or keep both views consistent with the agent-tool output.</violation>
</file>
<file name="apps/status-page/src/lib/base-domain.ts">
<violation number="1" location="apps/status-page/src/lib/base-domain.ts:8">
P3: `normalizeBaseDomain` duplicates the dashboard and API implementations. Extract one shared helper so host normalization cannot diverge across these URL producers.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
|
|
||
| test("configured base domain replaces openstatus.dev", () => { | ||
| expect( | ||
| statusPageAlternates({ slug: "acme", baseDomain: "status.example.com" }), |
There was a problem hiding this comment.
P2: This test bypasses the runtime configuration path by injecting baseDomain directly, so it will not catch a regression where alternates stop reading STATUS_PAGE_BASE_DOMAIN. Stub the environment and call statusPageAlternates({ slug: "acme" }) to verify the feature end to end.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/status-page/src/lib/alternates.test.ts, line 67:
<comment>This test bypasses the runtime configuration path by injecting `baseDomain` directly, so it will not catch a regression where alternates stop reading `STATUS_PAGE_BASE_DOMAIN`. Stub the environment and call `statusPageAlternates({ slug: "acme" })` to verify the feature end to end.</comment>
<file context>
@@ -61,4 +61,27 @@ describe("statusPageAlternates", () => {
+
+ test("configured base domain replaces openstatus.dev", () => {
+ expect(
+ statusPageAlternates({ slug: "acme", baseDomain: "status.example.com" }),
+ ).toEqual({
+ canonical: "https://acme.status.example.com",
</file context>
| expect(after?.customDomain).toBe(before?.customDomain); | ||
| }); | ||
|
|
||
| test("page.updateCustomDomain (hosted) still rejects a domain containing 'openstatus'", async () => { |
There was a problem hiding this comment.
P2: This test does not force hosted mode, so it fails or tests the wrong branch when the API suite inherits SELF_HOST=true. Mock ../env with SELF_HOST: "false" (or otherwise isolate the environment) before creating the router.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/api/src/router/page.custom-domain.test.ts, line 50:
<comment>This test does not force hosted mode, so it fails or tests the wrong branch when the API suite inherits `SELF_HOST=true`. Mock `../env` with `SELF_HOST: "false"` (or otherwise isolate the environment) before creating the router.</comment>
<file context>
@@ -46,3 +46,35 @@ test("page.updateCustomDomain rejects a taken domain before touching Vercel", as
expect(after?.customDomain).toBe(before?.customDomain);
});
+
+test("page.updateCustomDomain (hosted) still rejects a domain containing 'openstatus'", async () => {
+ const ctx = createInnerTRPCContext({
+ req: undefined,
</file context>
| }); | ||
|
|
||
| test("domain status endpoints answer without Vercel", async () => { | ||
| const domain = await caller.domain.getDomainResponse({ |
There was a problem hiding this comment.
P2: This test depends on the preceding mutation test to persist firstDomain; running it alone (for example with Vitest’s test-name filter) fails in assertOwned before exercising the self-hosted endpoint behavior. Create and assign the domain in this test or a per-test setup so each test owns its required state.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/api/src/router/page.custom-domain.self-host.test.ts, line 102:
<comment>This test depends on the preceding mutation test to persist `firstDomain`; running it alone (for example with Vitest’s test-name filter) fails in `assertOwned` before exercising the self-hosted endpoint behavior. Create and assign the domain in this test or a per-test setup so each test owns its required state.</comment>
<file context>
@@ -0,0 +1,137 @@
+ });
+
+ test("domain status endpoints answer without Vercel", async () => {
+ const domain = await caller.domain.getDomainResponse({
+ domain: firstDomain,
+ });
</file context>
| ): DeploymentConfig { | ||
| return { | ||
| statusPageBaseDomain: normalizeBaseDomain(env.STATUS_PAGE_BASE_DOMAIN), | ||
| isSelfHosted: env.SELF_HOST === "true", |
There was a problem hiding this comment.
P2: The dashboard and API disagree on which SELF_HOST values enable self-hosted mode. Use the same string-boolean parsing as the API so values such as 1, yes, or on do not leave the dashboard showing Vercel-specific controls while the API skips Vercel.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/dashboard/src/lib/deployment-config.ts, line 41:
<comment>The dashboard and API disagree on which `SELF_HOST` values enable self-hosted mode. Use the same string-boolean parsing as the API so values such as `1`, `yes`, or `on` do not leave the dashboard showing Vercel-specific controls while the API skips Vercel.</comment>
<file context>
@@ -0,0 +1,59 @@
+): DeploymentConfig {
+ return {
+ statusPageBaseDomain: normalizeBaseDomain(env.STATUS_PAGE_BASE_DOMAIN),
+ isSelfHosted: env.SELF_HOST === "true",
+ };
+}
</file context>
| isSelfHosted: env.SELF_HOST === "true", | |
| isSelfHosted: ["1", "true", "yes", "on"].includes( | |
| (env.SELF_HOST ?? "").toLowerCase(), | |
| ), |
| <ChangesTable changes={createStatusPageChanges(input, output)} /> | ||
| ), | ||
| summary: (o) => `${o.slug}.openstatus.dev`, | ||
| summary: (o, ctx) => getStatusPageHost(o.slug, ctx.statusPageBaseDomain), |
There was a problem hiding this comment.
P2: The new summary uses the configured host, but expanding the same create/update result still shows the old openstatus.dev URL from output.url. Pass the deployment context through result rendering and display the configured URL there too, or keep both views consistent with the agent-tool output.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/dashboard/src/components/chat/tool-renderers/index.tsx, line 164:
<comment>The new summary uses the configured host, but expanding the same create/update result still shows the old `openstatus.dev` URL from `output.url`. Pass the deployment context through result rendering and display the configured URL there too, or keep both views consistent with the agent-tool output.</comment>
<file context>
@@ -148,7 +161,7 @@ export const toolRenderers: ToolRendererRegistry = {
<ChangesTable changes={createStatusPageChanges(input, output)} />
),
- summary: (o) => `${o.slug}.openstatus.dev`,
+ summary: (o, ctx) => getStatusPageHost(o.slug, ctx.statusPageBaseDomain),
},
update_status_page: {
</file context>
| * Normalizes a configured base domain to a bare lowercase hostname: drops a | ||
| * scheme, path, port and surrounding dots. An empty value means the default. | ||
| */ | ||
| export function normalizeBaseDomain(value?: string | null): string { |
There was a problem hiding this comment.
P3: normalizeBaseDomain duplicates the dashboard and API implementations. Extract one shared helper so host normalization cannot diverge across these URL producers.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/status-page/src/lib/base-domain.ts, line 8:
<comment>`normalizeBaseDomain` duplicates the dashboard and API implementations. Extract one shared helper so host normalization cannot diverge across these URL producers.</comment>
<file context>
@@ -0,0 +1,40 @@
+ * Normalizes a configured base domain to a bare lowercase hostname: drops a
+ * scheme, path, port and surrounding dots. An empty value means the default.
+ */
+export function normalizeBaseDomain(value?: string | null): string {
+ const normalized = (value ?? "")
+ .trim()
</file context>
Problem
Self-hosted status pages cannot use slug routing on the instance's own domain, and custom domains cannot be removed:
getValidSubdomainreads the slug only for hosts underopenstatus.dev/stpg.dev. Any other host, e.g.acme.status.example.combehind a wildcard record, is looked up as a custom domain, so the page with slugacmeis not found.{slug}.openstatus.dev(slug field suffix, onboarding, page links, canonical/alternate links, feed links).status.openstatus.example.com, and the custom-domain form shows Vercel DNS/SSL instructions that do not apply.Change
STATUS_PAGE_BASE_DOMAIN(server-side, defaultopenstatus.dev, so hosted behaviour is unchanged).{slug}.{base}resolves by slug like{slug}.openstatus.dev; base URL, canonical/alternates and feed links use it (client components get it from the[domain]layout via a small context).DeploymentConfigProvider. Read at runtime, notNEXT_PUBLIC_*, so prebuilt images can be configured.SELF_HOST=true:.env.docker.example/.env.docker-lightweight.exampledocument the variable.Not in this PR:
apps/server(REST/RPC page routes still reject "openstatus" and build{slug}.openstatus.devlinks),packages/emails,packages/subscriptions,packages/services/agent-tools,packages/reactwidget. Happy to follow up if the approach is fine.Tests
New/extended unit tests in
apps/status-page(base-domain,domain,resolve-route,base-url,alternates,resolve-default-rewrite),apps/dashboard(deployment-config,status-pages.client, chat tool-renderer registry) andpackages/api(deployment,page.custom-domain.self-host, hosted "openstatus" rejection kept).Local run: status-page 546 passed, dashboard 451 passed, api 448 passed;
pnpm format:checkclean;tsc --noEmitclean for dashboard and api.