Update hivegrid-cloud reference to latest main

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
davidandClaude Fable 5 committed 2026-07-08 16:15:37 +02:00
1 parent e98d38e716
commit 7b21524c86
3781 files changed
+373484 -225607

No files matched your search

@@ -60,8 +60,8 @@ describe("getHostRoutingRuntimeDecision", () => {
new Request("http://app.localhost/internal/api/workflows/run/workflow_1?tenantId=tenant_1", {
method: "POST",
headers: {
"x-toolctrl-internal-web-api-proxy": "1",
"x-toolctrl-internal-web-api-proxy-signature": "signed",
"x-hivegrid-internal-web-api-proxy": "1",
"x-hivegrid-internal-web-api-proxy-signature": "signed",
"x-api-key": "tenant-api-key",
},
body: JSON.stringify({ name: "Ada" }),
@@ -71,8 +71,8 @@ describe("getHostRoutingRuntimeDecision", () => {
expect(decision.target).toBe("web");
expect(new URL(decision.request.url).pathname).toBe("/internal/api/workflows/run/workflow_1");
expect(new URL(decision.request.url).search).toBe("?tenantId=tenant_1");
expect(decision.request.headers.get("x-toolctrl-internal-web-api-proxy")).toBe("1");
expect(decision.request.headers.get("x-toolctrl-internal-web-api-proxy-signature")).toBe("signed");
expect(decision.request.headers.get("x-hivegrid-internal-web-api-proxy")).toBe("1");
expect(decision.request.headers.get("x-hivegrid-internal-web-api-proxy-signature")).toBe("signed");
expect(decision.request.headers.get("x-api-key")).toBe("tenant-api-key");
});
@@ -96,6 +96,14 @@ describe("getHostRoutingRuntimeDecision", () => {
expect(new URL(metricsDataDecision.request.url).pathname).toBe("/metrics/summary.data");
});
test("redirects the legacy admin login URL on the canonical admin host", () => {
expect(getHostRoutingRuntimeDecision(new Request("http://admin.localhost/admin/login?error=sso_state_invalid#retry"))).toEqual({
type: "redirect",
status: 308,
location: "http://admin.localhost/login?error=sso_state_invalid#retry",
});
});
test.each([
["/api?tab=overview", "/api"],
["/api/keys?filter=active#keys", "/api/keys"],
@@ -159,6 +167,10 @@ describe("getHostRoutingRuntimeDecision", () => {
type: "reject",
status: 404,
});
expect(getHostRoutingRuntimeDecision(new Request("http://app.localhost/admin/login?error=sso_state_invalid"))).toEqual({
type: "reject",
status: 404,
});
});
test("redirects canonical paths away from the wrong host before dispatch", () => {
@@ -5,7 +5,7 @@ export type HostRoutingRuntimeDecision =
| { type: "reject"; status: 404 }
| { type: "dispatch"; target: "api" | "web"; request: Request };
const internalWebApiProxyHeader = "x-toolctrl-internal-web-api-proxy";
const internalWebApiProxyHeader = "x-hivegrid-internal-web-api-proxy";
export function getHostRoutingRuntimeDecision(request: Request): HostRoutingRuntimeDecision {
const context = getHostRoutingContextFromRequest(request);
@@ -19,6 +19,15 @@ export function getHostRoutingRuntimeDecision(request: Request): HostRoutingRunt
};
}
const legacyAdminLoginRedirect = getLegacyAdminLoginRedirect(request, context);
if (legacyAdminLoginRedirect) {
return {
type: "redirect",
status: 308,
location: legacyAdminLoginRedirect,
};
}
if (isRemovedLegacyRoute(request, context)) {
return {
type: "reject",
@@ -49,7 +58,22 @@ function isInternalWebApiProxyRequest(request: Request, context: ReturnType<type
}
const pathname = new URL(request.url).pathname;
return pathname === "/internal/api/usage" || pathname === "/internal/api/stripe.webhooks" || pathname.startsWith("/internal/api/workflows/");
return pathname === "/internal/api/usage" || pathname === "/internal/api/billing.webhooks" || pathname.startsWith("/internal/api/workflows/");
}
function getLegacyAdminLoginRedirect(request: Request, context: ReturnType<typeof getHostRoutingContextFromRequest>) {
if (context !== "admin") {
return null;
}
const url = new URL(request.url);
const normalizedPathname = url.pathname.replace(/\/+$/g, "") || "/";
if (normalizedPathname !== "/admin/login") {
return null;
}
url.pathname = "/login";
return url.toString();
}
function isRemovedLegacyRoute(request: Request, context: ReturnType<typeof getHostRoutingContextFromRequest>) {
@@ -1,5 +1,5 @@
{
"name": "@toolctrl/server",
"name": "@hivegrid/server",
"private": true,
"type": "module"
}
@@ -15,7 +15,7 @@ describe("server runtime routing integration", () => {
});
test("uses required web config for fail-fast production startup and listen host/port", () => {
expect(serverSource).toContain('import { loadRequiredWebConfig } from "@toolctrl/config"');
expect(serverSource).toContain('import { loadRequiredWebConfig } from "@hivegrid/config"');
expect(serverSource).toContain("const webConfig = loadRequiredWebConfig()");
expect(serverSource).toContain("const PORT = webConfig.listen.port");
expect(serverSource).toContain("const HOST = webConfig.listen.host");
@@ -25,7 +25,7 @@ describe("server runtime routing integration", () => {
});
test("delegates root start to the web runtime owner", () => {
expect(rootPackage.scripts.start).toBe("pnpm --filter @toolctrl/web start");
expect(rootPackage.scripts.start).toBe("pnpm --filter @hivegrid/web start");
expect(webPackage.scripts.start).toContain("node ../../build/server-runtime/server.js");
expect(webPackage.scripts.start).not.toContain("tsx");
expect(rootPackage.scripts.start).not.toContain("tsx");
@@ -76,7 +76,7 @@ describe("server runtime routing integration", () => {
});
test("wires server diagnostics through the structured logger", () => {
expect(serverSource).toContain('import { createChildLogger, defaultLogger } from "@toolctrl/logger"');
expect(serverSource).toContain('import { createChildLogger, defaultLogger } from "@hivegrid/logger"');
expect(serverSource).toContain('const serverLogger = createChildLogger(defaultLogger, { component: "server" })');
expect(serverSource).toContain('serverLogger.error({ error }, "server request failed")');
expect(serverSource).toContain('serverLogger.info({ host: address, port: PORT }, "server listening")');
@@ -5,8 +5,8 @@ import os from "node:os";
import path from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";
import type { ServerBuild } from "react-router";
import { loadRequiredWebConfig } from "@toolctrl/config";
import { createChildLogger, defaultLogger } from "@toolctrl/logger";
import { loadRequiredWebConfig } from "@hivegrid/config";
import { createChildLogger, defaultLogger } from "@hivegrid/logger";
import { app as apiApp } from "../apps/api/src/app";
import { getHostRoutingRuntimeDecision } from "./host-routing-runtime";