diff --git a/.env.example b/.env.example
index 8f7ffc0d56..b1533a441f 100644
--- a/.env.example
+++ b/.env.example
@@ -831,7 +831,8 @@ REDIS_URL=redis://redis:6379 # REQUIRED for the self-host review
# Token broker (optional): get GitHub tokens from the central Orb (you installed the Orb App) instead of running
# your own GitHub App. Set the enrollment secret the operator issued for your install; unset = use your own App key.
# ORB_ENROLLMENT_SECRET= # one-time enrollment secret (a secret — keep it out of version control)
-# ORB_BROKER_URL=https://api.loopover.ai # the Orb broker base (default; override for a private deployment)
+# ORB_BROKER_URL= # required with ORB_ENROLLMENT_SECRET: your broker's origin (no default;
+# # the hosted broker at api.loopover.ai is retired)
# ORB_RELAY_MODE=push # push | pull. push registers a public relay URL the broker calls;
# # pull is the right fit behind NAT/tailnet — your instance drains
# # events outbound instead of exposing an inbound endpoint. Default: push.
diff --git a/README.md b/README.md
index aaa36a9c35..3abb3636e8 100644
--- a/README.md
+++ b/README.md
@@ -105,11 +105,16 @@ See [Tuning your reviews](https://loopover.ai/docs/tuning) for the full flag, se
```sh
npm install -g @loopover/mcp@latest
+export LOOPOVER_API_URL=https://reviews.example.com # your self-hosted instance
loopover-mcp login
loopover-mcp doctor
loopover-mcp --stdio
```
+`LOOPOVER_API_URL` is required: the hosted API at `api.loopover.ai` was retired on 2026-11-30. The next
+`@loopover/mcp` release has no default API URL and says so when none is set; the release on npm today still
+falls back to the retired host, so set the variable either way.
+
Print editor/client snippets:
```sh
diff --git a/apps/loopover-ui/content/docs/contributor-relationships.mdx b/apps/loopover-ui/content/docs/contributor-relationships.mdx
index b3a852641f..bbd8c8e616 100644
--- a/apps/loopover-ui/content/docs/contributor-relationships.mdx
+++ b/apps/loopover-ui/content/docs/contributor-relationships.mdx
@@ -110,9 +110,11 @@ Every verdict is independently verifiable without asking anyone's permission and
credentials. Start at [verify this review](/docs/verify-this-review), or run:
```bash
-npx -p @loopover/mcp loopover-verify
+npx -p @loopover/mcp loopover-verify --base-url https://reviews.example.com
```
+Replace the URL with the instance that reviewed your pull request.
+
This is the first stop for "I think this is wrong", and it is deliberately first: it does not depend
on anyone agreeing with you. If a published commitment does not recompute, that is a fact you can
demonstrate rather than a position you have to argue.
diff --git a/apps/loopover-ui/content/docs/mcp-clients.mdx b/apps/loopover-ui/content/docs/mcp-clients.mdx
index e57d138b57..57aace1b06 100644
--- a/apps/loopover-ui/content/docs/mcp-clients.mdx
+++ b/apps/loopover-ui/content/docs/mcp-clients.mdx
@@ -6,9 +6,10 @@ eyebrow: Get started
The hosted MCP server at `https://api.loopover.ai/mcp` was retired on 2026-11-30. The remote blocks
- below are what `init-client --mode remote` prints; to use them, replace `https://api.loopover.ai`
- with your self-hosted instance's origin, and set `LOOPOVER_API_URL` to that origin so the stdio
- gateway mounts its remote tools from the same place.
+ below use the placeholder `https://reviews.example.com`: replace it with your self-hosted instance's
+ origin, and set `LOOPOVER_API_URL` to that origin so the stdio gateway mounts its remote tools from
+ the same place. The next `@loopover/mcp` release prints these blocks and has no default API URL; the
+ release on npm today still prints and falls back to `api.loopover.ai`.
{/* GENERATED:MCP-CLIENT-CONFIG:BEGIN — edit packages/loopover-contract/src/client-config.ts, then `npm run mcp:client-config` */}
@@ -39,7 +40,7 @@ loopover-mcp init-client --print vscode --mode miner`}
The recommended default. Runs `loopover-mcp` on your machine, keeps auth and git analysis local, and — once you have run `loopover-mcp login` — mounts the remote tool set too, so one entry serves every tool your session entitles you to.
-- Run `loopover-mcp login` before starting the client; without a session you get the local-git tools only, plus an advisory resource explaining how to get the rest.
+- Set `LOOPOVER_API_URL` to your self-hosted instance and run `loopover-mcp login` before starting the client; without a session you get the local-git tools only, plus an advisory resource explaining how to get the rest.
- Pass `--no-remote` to keep the server purely local and skip the remote mount entirely.
- Assumes `loopover-mcp` is on your PATH; pass `--command /absolute/path/to/loopover-mcp` if your client does not inherit your shell PATH.
@@ -116,7 +117,7 @@ args = ["--stdio"]`}
## Remote streamable-http
-For agents that run in the cloud, or anywhere you do not want a local Node process. Connects straight to the hosted server; the local-git tools are not available over this transport because there is no local checkout to read.
+For agents that run in the cloud, or anywhere you do not want a local Node process. Connects straight to your self-hosted instance (replace `https://reviews.example.com` with its origin); the local-git tools are not available over this transport because there is no local checkout to read.
- Authenticates with a bearer token read from `LOOPOVER_API_TOKEN` — the same variable the CLI honors. Set it in the environment your client starts in; never paste the token into the config file.
- Tools whose work is a local git operation are absent here by design. Use the stdio mode if you need them.
@@ -127,7 +128,7 @@ For agents that run in the cloud, or anywhere you do not want a local Node proce
filename="~/.codex/config.toml"
lang="toml"
code={`[mcp_servers.loopover]
-url = "https://api.loopover.ai/mcp"
+url = "https://reviews.example.com/mcp"
bearer_token_env_var = "LOOPOVER_API_TOKEN"`}
/>
@@ -142,7 +143,7 @@ Codex releases before its RMCP client became the default also need `experimental
"mcpServers": {
"loopover": {
"type": "http",
- "url": "https://api.loopover.ai/mcp",
+ "url": "https://reviews.example.com/mcp",
"headers": {
"Authorization": "Bearer \${LOOPOVER_API_TOKEN}"
}
@@ -160,7 +161,7 @@ Codex releases before its RMCP client became the default also need `experimental
"mcpServers": {
"loopover": {
"type": "http",
- "url": "https://api.loopover.ai/mcp",
+ "url": "https://reviews.example.com/mcp",
"headers": {
"Authorization": "Bearer \${LOOPOVER_API_TOKEN}"
}
@@ -178,7 +179,7 @@ Codex releases before its RMCP client became the default also need `experimental
"servers": {
"loopover": {
"type": "http",
- "url": "https://api.loopover.ai/mcp",
+ "url": "https://reviews.example.com/mcp",
"headers": {
"Authorization": "Bearer \${LOOPOVER_API_TOKEN}"
}
@@ -189,7 +190,7 @@ Codex releases before its RMCP client became the default also need `experimental
## Miner stdio
-AMS's own local state-visibility tools, as a separate stdio server. It stays separate on purpose: it reads this machine's SQLite state and shares no code or network path with the hosted server.
+AMS's own local state-visibility tools, as a separate stdio server. It stays separate on purpose: it reads this machine's SQLite state and shares no code or network path with the API server.
- Takes no flags and needs no login — everything it reads is already on this machine.
- A dual-role operator runs this alongside the stdio gateway; the two entries coexist in one client config.
diff --git a/apps/loopover-ui/src/lib/selfhost-env-reference.ts b/apps/loopover-ui/src/lib/selfhost-env-reference.ts
index 5dc45cf7df..f8767077f7 100644
--- a/apps/loopover-ui/src/lib/selfhost-env-reference.ts
+++ b/apps/loopover-ui/src/lib/selfhost-env-reference.ts
@@ -475,7 +475,7 @@ export const SELFHOST_ENV_REFERENCE_ROWS: SelfHostEnvReferenceRow[] = [
},
{
name: "ORB_BROKER_URL",
- firstReference: "src/server.ts",
+ firstReference: "src/selfhost/preflight.ts",
},
{
name: "ORB_COLLECTOR_INSTANCE_SECRET",
@@ -847,7 +847,7 @@ export const SELFHOST_ENV_REFERENCE_MARKDOWN = [
"| `ORB_AIR_GAP` | `src/selfhost/orb-collector.ts` |",
"| `ORB_ANONYMIZE` | `src/selfhost/orb-collector.ts` |",
"| `ORB_APP_ID` | `src/selfhost/orb-collector.ts` |",
- "| `ORB_BROKER_URL` | `src/server.ts` |",
+ "| `ORB_BROKER_URL` | `src/selfhost/preflight.ts` |",
"| `ORB_COLLECTOR_INSTANCE_SECRET` | `src/selfhost/orb-collector.ts` |",
"| `ORB_COLLECTOR_TOKEN` | `src/selfhost/orb-collector.ts` |",
"| `ORB_COLLECTOR_URL` | `src/selfhost/orb-collector.ts` |",
diff --git a/docker-compose.yml b/docker-compose.yml
index 1ce0d0cb74..32f6c93dc4 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -174,7 +174,7 @@ services:
# BROKERED mode — use the central LoopOver Orb App instead of creating your own GitHub App. Install the
# Orb App on your repos + set ORB_ENROLLMENT_SECRET in .env (loaded above); the engine then brokers
# short-lived GitHub tokens from the Orb on demand (no own App private key). See .env.example.
- # ORB_BROKER_URL: https://api.loopover.ai # override only for a private Orb deployment
+ # ORB_BROKER_URL: https://broker.example # required in brokered mode: your broker (the hosted one is retired)
volumes:
- loopover-data:/data
# Container-private per-repo config dir (read-only). Create ./loopover-config/{owner}__{repo}/.loopover.yml
diff --git a/docs/validator-eval-interface.md b/docs/validator-eval-interface.md
index 19fe578eb2..0dd6c3434e 100644
--- a/docs/validator-eval-interface.md
+++ b/docs/validator-eval-interface.md
@@ -115,15 +115,12 @@ validator diffing two records sees the version move, without depending on having
One command. No credentials, no account, no coordination with us:
```bash
-npx -p @loopover/mcp loopover-verify
+npx -p @loopover/mcp loopover-verify --base-url https://reviews.example.com
```
+`--base-url` names the instance to verify (the hosted API was retired on 2026-11-30, so there is no default).
It fetches the public surfaces, **recomputes** every commitment locally, and exits non-zero if any claim
fails. It never calls back to ask whether we passed — a deployment cannot pass by asserting that it passed.
-Since #9724 we run it against ourselves nightly, from a runner holding no credentials of any kind, so the
-tool is exercised against production continuously rather than only when someone thinks to look. If it is
-failing, there is an open issue saying which claim broke.
-
**What a validator must trust:** our published signing key, and that the corpus we publish is the corpus we
scored. The second is exactly what `corpusChecksum` is for — and why the #9962 fix mattered.
diff --git a/packages/loopover-contract/README.md b/packages/loopover-contract/README.md
index 865c7c6395..fef6b05f9e 100644
--- a/packages/loopover-contract/README.md
+++ b/packages/loopover-contract/README.md
@@ -12,6 +12,15 @@ responses were consumed as `any`.
This package is the one place those contracts live. **A shape declared here is never restated
elsewhere.**
+## No hosted defaults
+
+Nothing here defaults to LoopOver's hosted API or Orb broker (`https://api.loopover.ai`), which were retired on
+2026-11-30. `resolveLoopoverApiUrl` returns `null` when no URL is configured, with
+`MISSING_LOOPOVER_API_URL_MESSAGE` for callers to report, and `orbBrokerBaseUrl` throws
+`MISSING_ORB_BROKER_URL_MESSAGE` when `ORB_BROKER_URL` is unset. The generated client config uses the
+self-hosted placeholder `https://reviews.example.com`. The next release carries this; the version on npm today
+still exports the old defaults.
+
## Why a separate package
It is a **leaf**: its only runtime dependency is `zod`, and it imports no node builtins, so it is
diff --git a/packages/loopover-contract/src/cli-config.ts b/packages/loopover-contract/src/cli-config.ts
index 82a7677436..3fbbf8c7be 100644
--- a/packages/loopover-contract/src/cli-config.ts
+++ b/packages/loopover-contract/src/cli-config.ts
@@ -22,15 +22,30 @@
* repo built locally, and CI failed on a module that had never been committed. Do not rename it back.
*/
-export const DEFAULT_LOOPOVER_API_URL = "https://api.loopover.ai";
+/**
+ * LoopOver's hosted API, retired on 2026-11-30. It was the shipped default; nothing defaults to an API URL
+ * now, because the only LoopOver API left to call is one an operator runs themselves.
+ */
+export const RETIRED_LOOPOVER_API_URL = "https://api.loopover.ai";
+
+/** The placeholder origin the docs use for a self-hosted instance. It only fills examples; nothing calls it. */
+export const SELF_HOSTED_API_URL_PLACEHOLDER = "https://reviews.example.com";
+
+/** What a CLI says when it needs the API and no URL is configured. */
+export const MISSING_LOOPOVER_API_URL_MESSAGE =
+ `No LoopOver API URL is configured. The hosted API (${RETIRED_LOOPOVER_API_URL}) was retired on 2026-11-30, so ` +
+ `set LOOPOVER_API_URL to your self-hosted instance's origin (for example ${SELF_HOSTED_API_URL_PLACEHOLDER}), ` +
+ "or save it as a profile's apiUrl.";
/**
* API URLs that used to be the shipped default. A config still naming one is a stale artifact of an
- * older install, not a deliberate override, so resolution SKIPS them rather than honoring them.
+ * older install, not a deliberate override, so resolution SKIPS them rather than honoring them. The
+ * retired hosted API is one: a login saved against it can no longer reach anything.
*/
export const LEGACY_LOOPOVER_API_URLS: ReadonlySet = new Set([
"https://gittensory-api.zeronode.workers.dev",
"https://gittensory-api.aethereal.dev",
+ RETIRED_LOOPOVER_API_URL,
]);
export const DEFAULT_PROFILE_NAME = "default";
@@ -121,7 +136,9 @@ export function profileSessionToken(profile: LoopoverConfigProfile | undefined):
/**
* The API URL to call: LOOPOVER_API_URL, else the active profile's apiUrl, else the config's top-level
- * apiUrl, else the default -- skipping any LEGACY_LOOPOVER_API_URLS entry at every step.
+ * apiUrl -- skipping any LEGACY_LOOPOVER_API_URLS entry at every step -- else null. There is no default:
+ * a caller that needs the API reports MISSING_LOOPOVER_API_URL_MESSAGE instead of calling a host that
+ * no longer answers.
*
* The fall-THROUGH matters and is the behavior the two copies had drifted on (#9521). @loopover/mcp
* picked the profile apiUrl if present and fell straight to the default when it was legacy, so a stale
@@ -133,7 +150,7 @@ export function resolveLoopoverApiUrl(
env: LoopoverConfigEnv,
config: LoopoverConfig,
profile: LoopoverConfigProfile | undefined,
-): string {
+): string | null {
if (env.LOOPOVER_API_URL) return env.LOOPOVER_API_URL.replace(/\/+$/, "");
for (const candidate of [profile?.apiUrl, config.apiUrl]) {
if (typeof candidate === "string" && candidate.trim()) {
@@ -141,5 +158,5 @@ export function resolveLoopoverApiUrl(
if (!LEGACY_LOOPOVER_API_URLS.has(normalized)) return normalized;
}
}
- return DEFAULT_LOOPOVER_API_URL;
+ return null;
}
diff --git a/packages/loopover-contract/src/client-config.ts b/packages/loopover-contract/src/client-config.ts
index fd2c93257c..02c37e12ed 100644
--- a/packages/loopover-contract/src/client-config.ts
+++ b/packages/loopover-contract/src/client-config.ts
@@ -9,7 +9,7 @@
// So the grid lives here, as data, and every surface renders it: `init-client --print` reads this, and
// scripts/gen-mcp-client-config.ts writes the docs and README blocks from it under a --check drift guard.
// Adding a host or a mode is one entry in this file, and every surface that describes it moves together.
-import { DEFAULT_LOOPOVER_API_URL } from "./cli-config.js";
+import { SELF_HOSTED_API_URL_PLACEHOLDER } from "./cli-config.js";
/** How a client reaches LoopOver. Ordered as a reader should consider them: local default first. */
export const CONNECTION_MODES = ["stdio", "remote", "miner"] as const;
@@ -84,8 +84,11 @@ export type ConnectionModeSpec = {
notes: readonly string[];
};
-/** The remote endpoint. Same origin the server card advertises, so the two can never disagree. */
-export const REMOTE_MCP_URL = `${DEFAULT_LOOPOVER_API_URL}/mcp`;
+/**
+ * The remote endpoint, on the docs' placeholder origin: a self-hosted instance serves it at `/mcp`, and a
+ * reader replaces the origin with their instance's. The hosted endpoint this used to name is retired.
+ */
+export const REMOTE_MCP_URL = `${SELF_HOSTED_API_URL_PLACEHOLDER}/mcp`;
/**
* The env var the remote endpoint's bearer token comes from.
@@ -106,7 +109,7 @@ export const CONNECTION_MODE_SPEC: Record =
command: "loopover-mcp",
args: ["--stdio"],
notes: [
- "Run `loopover-mcp login` before starting the client; without a session you get the local-git tools only, plus an advisory resource explaining how to get the rest.",
+ "Set `LOOPOVER_API_URL` to your self-hosted instance and run `loopover-mcp login` before starting the client; without a session you get the local-git tools only, plus an advisory resource explaining how to get the rest.",
"Pass `--no-remote` to keep the server purely local and skip the remote mount entirely.",
"Assumes `loopover-mcp` is on your PATH; pass `--command /absolute/path/to/loopover-mcp` if your client does not inherit your shell PATH.",
],
@@ -114,7 +117,7 @@ export const CONNECTION_MODE_SPEC: Record =
remote: {
title: "Remote streamable-http",
summary:
- "For agents that run in the cloud, or anywhere you do not want a local Node process. Connects straight to the hosted server; the local-git tools are not available over this transport because there is no local checkout to read.",
+ "For agents that run in the cloud, or anywhere you do not want a local Node process. Connects straight to your self-hosted instance (replace `https://reviews.example.com` with its origin); the local-git tools are not available over this transport because there is no local checkout to read.",
serverKey: "loopover",
transport: "http",
args: [],
@@ -126,7 +129,7 @@ export const CONNECTION_MODE_SPEC: Record =
miner: {
title: "Miner stdio",
summary:
- "AMS's own local state-visibility tools, as a separate stdio server. It stays separate on purpose: it reads this machine's SQLite state and shares no code or network path with the hosted server.",
+ "AMS's own local state-visibility tools, as a separate stdio server. It stays separate on purpose: it reads this machine's SQLite state and shares no code or network path with the API server.",
serverKey: "loopover-miner",
transport: "stdio",
command: "loopover-miner-mcp",
diff --git a/packages/loopover-contract/src/discovery.ts b/packages/loopover-contract/src/discovery.ts
index c690f77405..ff79717296 100644
--- a/packages/loopover-contract/src/discovery.ts
+++ b/packages/loopover-contract/src/discovery.ts
@@ -79,7 +79,7 @@ export type ServerCardInput = {
/** The server's semantic version. Sourced from @loopover/mcp's package.json — never hand-bumped here. */
version: string;
deployment: DiscoveryDeployment;
- /** Absolute base URL this deployment answers on, e.g. `https://api.loopover.ai`. */
+ /** Absolute base URL this deployment answers on, e.g. `https://reviews.example.com`. */
baseUrl: string;
tools: readonly McpToolDefinition[];
/**
diff --git a/packages/loopover-contract/src/orb-broker.ts b/packages/loopover-contract/src/orb-broker.ts
index 226ccdf990..ce5356c3a5 100644
--- a/packages/loopover-contract/src/orb-broker.ts
+++ b/packages/loopover-contract/src/orb-broker.ts
@@ -16,8 +16,14 @@
* must stay Workers-safe (see its tsconfig's `"types": []`).
*/
-/** The Orb's hosted broker base; override (ORB_BROKER_URL) only to point at a private loopover deployment. */
-export const DEFAULT_ORB_BROKER_URL = "https://api.loopover.ai";
+/**
+ * What a brokered caller is told when ORB_BROKER_URL is unset. The hosted broker it used to default to
+ * (https://api.loopover.ai) was retired on 2026-11-30, so there is no default: brokered mode needs a broker
+ * the operator names.
+ */
+export const MISSING_ORB_BROKER_URL_MESSAGE =
+ "ORB_BROKER_URL is not set. LoopOver's hosted broker (https://api.loopover.ai) was retired on 2026-11-30, so " +
+ "set ORB_BROKER_URL to a broker you run, or use a Direct GitHub App instead of brokered mode.";
/**
* The broker's cold token mint can take many seconds when GitHub is throttling the App; allow headroom
@@ -38,7 +44,8 @@ function isLocalBrokerHost(hostname: string): boolean {
* or fragment, and https unless it targets localhost development.
*/
export function orbBrokerBaseUrl(env: { ORB_BROKER_URL?: string | undefined }): string {
- const raw = env.ORB_BROKER_URL ?? DEFAULT_ORB_BROKER_URL;
+ const raw = env.ORB_BROKER_URL;
+ if (!raw) throw new Error(MISSING_ORB_BROKER_URL_MESSAGE);
let url: URL;
try {
url = new URL(raw);
diff --git a/packages/loopover-mcp/README.md b/packages/loopover-mcp/README.md
index 95cfd68df8..7600210600 100644
--- a/packages/loopover-mcp/README.md
+++ b/packages/loopover-mcp/README.md
@@ -14,9 +14,15 @@ Public npm:
```sh
npm install -g @loopover/mcp@latest
+export LOOPOVER_API_URL=https://reviews.example.com # your self-hosted instance
loopover-mcp login
```
+There is no default API URL. LoopOver's hosted API (`https://api.loopover.ai`) was retired on 2026-11-30, so set
+`LOOPOVER_API_URL`, or save an `apiUrl` in your profile, to the instance you run; a command that needs the API
+without one stops and says so, and a saved `apiUrl` naming the retired host is ignored. `loopover-verify` likewise
+needs `--base-url`. This lands in the next release: the version on npm today still falls back to the retired host.
+
From a local checkout:
```sh
@@ -355,13 +361,13 @@ Claude Desktop / Claude Code, in `claude_desktop_config.json`:
}
```
-- Run `loopover-mcp login` before starting the client; without a session you get the local-git tools only, plus an advisory resource explaining how to get the rest.
+- Set `LOOPOVER_API_URL` to your self-hosted instance and run `loopover-mcp login` before starting the client; without a session you get the local-git tools only, plus an advisory resource explaining how to get the rest.
- Pass `--no-remote` to keep the server purely local and skip the remote mount entirely.
- Assumes `loopover-mcp` is on your PATH; pass `--command /absolute/path/to/loopover-mcp` if your client does not inherit your shell PATH.
#### Remote streamable-http
-For agents that run in the cloud, or anywhere you do not want a local Node process. Connects straight to the hosted server; the local-git tools are not available over this transport because there is no local checkout to read.
+For agents that run in the cloud, or anywhere you do not want a local Node process. Connects straight to your self-hosted instance (replace `https://reviews.example.com` with its origin); the local-git tools are not available over this transport because there is no local checkout to read.
Claude Desktop / Claude Code, in `.mcp.json`:
@@ -370,7 +376,7 @@ Claude Desktop / Claude Code, in `.mcp.json`:
"mcpServers": {
"loopover": {
"type": "http",
- "url": "https://api.loopover.ai/mcp",
+ "url": "https://reviews.example.com/mcp",
"headers": {
"Authorization": "Bearer ${LOOPOVER_API_TOKEN}"
}
@@ -382,7 +388,7 @@ Claude Desktop / Claude Code, in `.mcp.json`:
- Authenticates with a bearer token read from `LOOPOVER_API_TOKEN` — the same variable the CLI honors. Set it in the environment your client starts in; never paste the token into the config file.
- Tools whose work is a local git operation are absent here by design. Use the stdio mode if you need them.
-The remote endpoint is `https://api.loopover.ai/mcp` — the same URL `/.well-known/mcp.json` advertises.
+The remote endpoint is `/mcp` on your self-hosted instance (`https://reviews.example.com/mcp` above) — the same URL its `/.well-known/mcp.json` advertises.
diff --git a/packages/loopover-mcp/bin/loopover-mcp.ts b/packages/loopover-mcp/bin/loopover-mcp.ts
index c733a5e96f..acaeb8d041 100644
--- a/packages/loopover-mcp/bin/loopover-mcp.ts
+++ b/packages/loopover-mcp/bin/loopover-mcp.ts
@@ -14,7 +14,7 @@ import {
type ParameterisedApiResponse,
type ValidatedApiPath,
} from "@loopover/contract/api-schemas";
-import type { LoopoverConfig } from "@loopover/contract/cli-config";
+import { LEGACY_LOOPOVER_API_URLS, MISSING_LOOPOVER_API_URL_MESSAGE, type LoopoverConfig } from "@loopover/contract/cli-config";
import { branchEligibilityFields, validateFocusManifestSchema } from "@loopover/contract/api-requests";
import {
CLIENT_HOSTS,
@@ -204,11 +204,6 @@ function resolveOwnPackageFile(specifier: string): string {
// literals, so a release bump never has a second place to forget.
const ownPackageJson = JSON.parse(readFileSync(resolveOwnPackageFile("@loopover/mcp/package.json"), "utf8"));
-const defaultApiUrl = "https://api.loopover.ai";
-const legacyDefaultApiUrls = new Set([
- "https://gittensory-api.zeronode.workers.dev",
- "https://gittensory-api.aethereal.dev",
-]);
const packageName = ownPackageJson.name;
const packageVersion = ownPackageJson.version;
const npmRegistryUrl = (process.env.LOOPOVER_NPM_REGISTRY_URL ?? "https://registry.npmjs.org").replace(/\/+$/, "");
@@ -519,7 +514,9 @@ const requestedProfileName = cliOptionValue(cliArgs, "profile") ?? process.env.L
const activeProfileName = selectProfileName(config, requestedProfileName);
const activeProfile = config.profiles?.[activeProfileName] ?? {};
const configuredApiUrl = typeof activeProfile.apiUrl === "string" ? activeProfile.apiUrl.replace(/\/+$/, "") : typeof config.apiUrl === "string" ? config.apiUrl.replace(/\/+$/, "") : undefined;
-const apiUrl = (process.env.LOOPOVER_API_URL ?? (configuredApiUrl && !legacyDefaultApiUrls.has(configuredApiUrl) ? configuredApiUrl : defaultApiUrl)).replace(/\/+$/, "");
+// No default: the hosted API this once fell back to (api.loopover.ai) is retired, and a saved URL naming it or an
+// older default is skipped as stale. Empty means unset; apiFetch refuses with MISSING_LOOPOVER_API_URL_MESSAGE.
+const apiUrl = (process.env.LOOPOVER_API_URL ?? (configuredApiUrl && !LEGACY_LOOPOVER_API_URLS.has(configuredApiUrl) ? configuredApiUrl : "")).replace(/\/+$/, "");
// #7756: stdio mirror of the remote loopover_get_repo_onboarding_pack shape (src/mcp/server.ts) + the
@@ -4618,7 +4615,7 @@ async function logout(options: CliOptions) {
if (hasPersistedConfigState(nextConfig)) saveConfig(nextConfig);
else if (existsSync(configPath)) rmSync(configPath, { force: true });
const decisionPackCache = clearDecisionPackCache();
- const payload = { status: "logged_out", profile: all ? "all" : profileName, apiUrl, remote: remote.length > 0 ? remote : null, decisionPackCache };
+ const payload = { status: "logged_out", profile: all ? "all" : profileName, apiUrl: apiUrl || null, remote: remote.length > 0 ? remote : null, decisionPackCache };
if (options.json) process.stdout.write(`${JSON.stringify(payload, null, 2)}\n`);
else process.stdout.write(all ? "Logged out all profiles.\n" : `Logged out profile ${profileName}.\n`);
}
@@ -4741,7 +4738,7 @@ async function status(options: CliOptions) {
const apiCompatibility = compatibility.evaluation;
const decisionPackCache = inspectDecisionPackCache();
const payload = {
- apiUrl,
+ apiUrl: apiUrl || null,
package: pkg,
apiCompatibility,
compatibility: compatibility.report,
@@ -4757,7 +4754,7 @@ async function status(options: CliOptions) {
if (options.json) process.stdout.write(`${JSON.stringify(payload, null, 2)}\n`);
else {
process.stdout.write(`${packageName}: ${packageVersion}${pkg.latestVersion ? ` (latest ${pkg.latestVersion})` : ""}\n`);
- process.stdout.write(`API: ${apiUrl}\n`);
+ process.stdout.write(`API: ${apiUrl || "(not set)"}\n`);
process.stdout.write(`Profile: ${activeProfileName}\n`);
process.stdout.write(`API health: ${health?.status ?? "unknown"}\n`);
process.stdout.write(`Auth: ${auth.status}${auth.login ? ` (${auth.login})` : ""}\n`);
@@ -4938,7 +4935,7 @@ async function doctor(options: CliOptions) {
const nextCommand = checklist.find((group) => group.id === "next_command")?.nextCommand;
const payload = {
status: statusValue,
- apiUrl,
+ apiUrl: apiUrl || null,
profile: profilePublicState(activeProfileName),
config: { configured: existsSync(configPath), activeProfile: activeProfileName, profileCount: profileList(config).length },
decisionPackCache,
@@ -5208,10 +5205,10 @@ function selectProfileName(currentConfig: LoopoverConfig, requestedName: any) {
function resolvedApiUrlSource() {
if (process.env.LOOPOVER_API_URL) return "environment";
const profileApiUrl = typeof activeProfile.apiUrl === "string" ? activeProfile.apiUrl.replace(/\/+$/, "") : undefined;
- if (profileApiUrl && !legacyDefaultApiUrls.has(profileApiUrl)) return "profile";
+ if (profileApiUrl && !LEGACY_LOOPOVER_API_URLS.has(profileApiUrl)) return "profile";
const globalApiUrl = typeof config.apiUrl === "string" ? config.apiUrl.replace(/\/+$/, "") : undefined;
- if (globalApiUrl && !legacyDefaultApiUrls.has(globalApiUrl)) return "config";
- return "default";
+ if (globalApiUrl && !LEGACY_LOOPOVER_API_URLS.has(globalApiUrl)) return "config";
+ return "unset";
}
function resolvedConfigPathSource() {
@@ -5252,7 +5249,7 @@ function telemetryState(currentConfig = config) {
// and which source supplied it?".
function configCommand(options: CliOptions) {
const payload = {
- apiUrl,
+ apiUrl: apiUrl || null,
apiUrlSource: resolvedApiUrlSource(),
activeProfile: activeProfileName,
profileCount: profileList(config).length,
@@ -5269,7 +5266,7 @@ function configCommand(options: CliOptions) {
process.stdout.write(`${JSON.stringify(payload, null, 2)}\n`);
return;
}
- process.stdout.write(`API URL: ${payload.apiUrl} (${payload.apiUrlSource})\n`);
+ process.stdout.write(`API URL: ${payload.apiUrl ?? "(not set)"} (${payload.apiUrlSource})\n`);
process.stdout.write(`Active profile: ${payload.activeProfile} (${payload.profileCount} configured)\n`);
process.stdout.write(`Config file: ${payload.configured ? "present" : "absent"} (location: ${payload.configPathSource})\n`);
process.stdout.write(`Cache dir: ${payload.cacheDirSource}\n`);
@@ -5991,6 +5988,11 @@ async function apiDelete(path: string, body: unknown) {
* auth/device endpoints whose 200s the document still describes inline (#9531).
*/
async function apiFetch(path: string, init: RequestInit, options: { token?: string; auth?: boolean; timeoutMs?: number } = {}): Promise {
+ if (!apiUrl) {
+ const error: any = new Error(MISSING_LOOPOVER_API_URL_MESSAGE);
+ error.code = "missing_api_url";
+ throw error;
+ }
const token = options.token ?? getApiToken();
if (options.auth !== false && !token) {
const error: any = new Error("Run `loopover-mcp login`, or set LOOPOVER_API_TOKEN, LOOPOVER_MCP_TOKEN, or LOOPOVER_TOKEN before starting the MCP wrapper.");
diff --git a/packages/loopover-mcp/bin/loopover-verify.ts b/packages/loopover-mcp/bin/loopover-verify.ts
index 4904b71654..c600be9136 100644
--- a/packages/loopover-mcp/bin/loopover-verify.ts
+++ b/packages/loopover-mcp/bin/loopover-verify.ts
@@ -26,7 +26,11 @@ import {
type VerifiableEvalRecord,
} from "../lib/verify-public-claims.js";
-const defaultApiUrl = "https://api.loopover.ai";
+/** What a run with no `--base-url` is told. There is no default: the hosted API it once verified
+ * (https://api.loopover.ai) was retired on 2026-11-30, so the instance to verify has to be named. */
+export const MISSING_BASE_URL_MESSAGE =
+ "--base-url is required: LoopOver's hosted API (https://api.loopover.ai) was retired on 2026-11-30, so name " +
+ "the instance to verify, for example --base-url https://reviews.example.com";
/** Per-request timeout. A verifier that hangs forever on one unreachable surface is worse than one that
* reports that surface as unreachable and carries on with the rest. */
@@ -41,7 +45,7 @@ function usage(): string {
"Usage: npx -p @loopover/mcp loopover-verify [options]",
"",
"Options:",
- " --base-url API base to verify (default: " + defaultApiUrl + ")",
+ " --base-url API base to verify (required, e.g. https://reviews.example.com)",
" --json emit machine-readable results instead of a table",
" --help show this message",
"",
@@ -50,10 +54,11 @@ function usage(): string {
].join("\n");
}
-/** Read `--base-url`, normalising away a trailing slash so path joins cannot double up. */
-export function parseBaseUrl(args: readonly string[], fallback = defaultApiUrl): { ok: true; baseUrl: string } | { ok: false; error: string } {
+/** Read `--base-url` (else `fallback`, else a usage error), normalising away a trailing slash so path joins
+ * cannot double up. */
+export function parseBaseUrl(args: readonly string[], fallback?: string): { ok: true; baseUrl: string } | { ok: false; error: string } {
const index = args.indexOf("--base-url");
- if (index === -1) return { ok: true, baseUrl: fallback.replace(/\/+$/, "") };
+ if (index === -1) return fallback ? { ok: true, baseUrl: fallback.replace(/\/+$/, "") } : { ok: false, error: MISSING_BASE_URL_MESSAGE };
const value = args[index + 1];
if (value === undefined || value.startsWith("--")) return { ok: false, error: "--base-url requires a URL" };
try {
@@ -103,7 +108,7 @@ export async function runVerify(args: readonly string[], baseUrlOverride?: strin
process.stdout.write(`${usage()}\n`);
return 0;
}
- const parsed = parseBaseUrl(args, baseUrlOverride ?? defaultApiUrl);
+ const parsed = parseBaseUrl(args, baseUrlOverride);
if (!parsed.ok) return reportCliFailure(wantsJson, parsed.error);
const { baseUrl } = parsed;
diff --git a/packages/loopover-mcp/lib/gateway.ts b/packages/loopover-mcp/lib/gateway.ts
index 9dd763c3a7..36a4c37ece 100644
--- a/packages/loopover-mcp/lib/gateway.ts
+++ b/packages/loopover-mcp/lib/gateway.ts
@@ -1,8 +1,8 @@
// Gateway mode: the stdio server mounts the REMOTE server's tools (#9526).
//
// One stdio entry, every tool a session entitles you to. Without this a contributor configures the stdio
-// server for local-git tools and separately points something at `https://api.loopover.ai/mcp` for the rest —
-// two configs for what is one product.
+// server for local-git tools and separately points something at their instance's `/mcp` for the rest — two
+// configs for what is one product.
//
// Name collisions cannot happen by construction, and that is a property of #9518's registry rather than a
// check here: post-migration a tool name is either locality `local-git` (served locally) or `remote`
@@ -14,6 +14,8 @@
// tools and one advisory — never a server that fails to start. That is the whole reason the mount is
// best-effort: the gateway is an enhancement, and an enhancement that can break startup is a liability.
+import { MISSING_LOOPOVER_API_URL_MESSAGE } from "@loopover/contract/cli-config";
+
/** The subset of a remote `tools/list` entry this needs. Schemas come across the wire; nothing is duplicated. */
export type RemoteToolDescriptor = {
name: string;
@@ -31,6 +33,7 @@ export type GatewayFetch = (
) => Promise<{ ok: boolean; status: number; json: () => Promise }>;
export type GatewayMountInput = {
+ /** The configured API origin. Empty ⇒ no instance to ask (there is no hosted default), no request attempted. */
apiUrl: string;
/** The session token from `loopover-mcp login`. Absent ⇒ local tools only, no request attempted. */
token: string | null;
@@ -49,6 +52,8 @@ export type GatewayMountResult =
export const GATEWAY_UNAUTHENTICATED_ADVISORY =
"Remote tools are not mounted: no LoopOver session on this machine. Run `loopover-mcp login` and restart your client to use the full tool set. Local tools are available now.";
+export const GATEWAY_NO_API_URL_ADVISORY = `Remote tools are not mounted: ${MISSING_LOOPOVER_API_URL_MESSAGE} Local tools are available now.`;
+
export const GATEWAY_DISABLED_ADVISORY =
"Remote tools are not mounted: gateway mode was disabled with --no-remote. Local tools are available; drop the flag and restart your client to mount the remote tool set.";
@@ -66,6 +71,7 @@ const DEFAULT_TIMEOUT_MS = 5_000;
* remote-controlled and has no business in a local advisory string.
*/
export async function discoverRemoteTools(input: GatewayMountInput): Promise {
+ if (!input.apiUrl) return { status: "unavailable", advisory: GATEWAY_NO_API_URL_ADVISORY };
if (!input.token) return { status: "unauthenticated", advisory: GATEWAY_UNAUTHENTICATED_ADVISORY };
let response: Awaited>;
diff --git a/packages/loopover-miner/lib/github-token-resolution.ts b/packages/loopover-miner/lib/github-token-resolution.ts
index 21e1db41c5..b04c8364e5 100644
--- a/packages/loopover-miner/lib/github-token-resolution.ts
+++ b/packages/loopover-miner/lib/github-token-resolution.ts
@@ -62,20 +62,24 @@ function loopoverSessionToken(env: NodeJS.ProcessEnv): string | null {
return profileSessionToken(activeLoopoverProfile(env));
}
-function loopoverApiUrl(env: NodeJS.ProcessEnv): string {
+/** The configured LoopOver API origin, or null when none is set (the hosted default it once had is retired). */
+function loopoverApiUrl(env: NodeJS.ProcessEnv): string | null {
return resolveLoopoverApiUrl(env, readLoopoverConfig(env), activeLoopoverProfile(env));
}
/**
* Same loopover-mcp session + API URL posture `resolveGitHubToken` uses for backend calls (#6487).
- * Returns null when there is no session token on disk (fully-standalone AMS / no `loopover-mcp login`).
+ * Returns null when there is no session token on disk (fully-standalone AMS / no `loopover-mcp login`) or no
+ * API URL configured (LOOPOVER_API_URL or the profile's apiUrl).
*/
export function resolveLoopoverBackendSession(
env: NodeJS.ProcessEnv = process.env,
): { apiUrl: string; sessionToken: string } | null {
const sessionToken = loopoverSessionToken(env);
if (!sessionToken) return null;
- return { apiUrl: loopoverApiUrl(env), sessionToken };
+ const apiUrl = loopoverApiUrl(env);
+ if (!apiUrl) return null;
+ return { apiUrl, sessionToken };
}
async function fetchLiveGitHubTokenFromSession(
@@ -105,9 +109,9 @@ let cachedToken: string | undefined;
/**
* Resolve a GitHub token for AMS's git operations (#6116). Returns null when nothing is available: no
- * GITHUB_TOKEN override, no loopover-mcp session on disk, or the session-token fetch fails for any reason --
- * callers already treat a missing token as "git operations requiring auth will fail," the same failure mode
- * as before this feature existed.
+ * GITHUB_TOKEN override, no loopover-mcp session on disk, no API URL configured, or the session-token fetch
+ * fails for any reason -- callers already treat a missing token as "git operations requiring auth will fail,"
+ * the same failure mode as before this feature existed.
*/
export async function resolveGitHubToken(
env: NodeJS.ProcessEnv = process.env,
@@ -117,8 +121,10 @@ export async function resolveGitHubToken(
if (cachedToken) return cachedToken;
const sessionToken = loopoverSessionToken(env);
if (!sessionToken) return null;
+ const apiUrl = loopoverApiUrl(env);
+ if (!apiUrl) return null;
const fetchImpl = options.fetchImpl ?? (fetch as GitHubTokenResolutionFetch);
- const fetched = await fetchLiveGitHubTokenFromSession(sessionToken, loopoverApiUrl(env), fetchImpl);
+ const fetched = await fetchLiveGitHubTokenFromSession(sessionToken, apiUrl, fetchImpl);
if (fetched) cachedToken = fetched;
return fetched;
}
@@ -130,11 +136,11 @@ export function resetGitHubTokenResolutionForTesting(): void {
/**
* Offline-only check: does resolveGitHubToken have ANYTHING to try (a GITHUB_TOKEN override, or a
- * loopover-mcp session recorded on disk), without making the network call resolveGitHubToken itself would
+ * loopover-mcp session recorded on disk with an API URL to use it against), without making the network call resolveGitHubToken itself would
* make to actually verify it still works. For `doctor`/`status`-style diagnostics (status.js's
* checkGitHubTokenPresent), which are deliberately offline-only -- a genuinely expired or revoked session
* still reports "present" here; only an actual attempt (or resolveGitHubToken itself) discovers that.
*/
export function hasGitHubTokenSource(env: NodeJS.ProcessEnv = process.env): boolean {
- return Boolean(env.GITHUB_TOKEN) || Boolean(loopoverSessionToken(env));
+ return Boolean(env.GITHUB_TOKEN) || (Boolean(loopoverSessionToken(env)) && Boolean(loopoverApiUrl(env)));
}
diff --git a/scripts/branding-drift-baseline.json b/scripts/branding-drift-baseline.json
index 19a2ead573..f7def2d53a 100644
--- a/scripts/branding-drift-baseline.json
+++ b/scripts/branding-drift-baseline.json
@@ -1,7 +1,6 @@
{
"packages/loopover-contract/src/cli-config.ts": 2,
"packages/loopover-engine/src/signals/engine.ts": 2,
- "packages/loopover-mcp/bin/loopover-mcp.ts": 2,
"src/api/routes.ts": 2,
"src/db/repositories.ts": 1,
"src/env.d.ts": 3,
diff --git a/scripts/gen-mcp-client-config.ts b/scripts/gen-mcp-client-config.ts
index 202e93eab6..3bafa4fd92 100644
--- a/scripts/gen-mcp-client-config.ts
+++ b/scripts/gen-mcp-client-config.ts
@@ -103,7 +103,9 @@ export function stdioReadmeSection(): string {
for (const note of spec.notes) lines.push(`- ${note}`);
lines.push("");
}
- lines.push(`The remote endpoint is \`${REMOTE_MCP_URL}\` — the same URL \`/.well-known/mcp.json\` advertises.`);
+ lines.push(
+ `The remote endpoint is \`/mcp\` on your self-hosted instance (\`${REMOTE_MCP_URL}\` above) — the same URL its \`/.well-known/mcp.json\` advertises.`,
+ );
return lines.join("\n");
}
diff --git a/src/selfhost/preflight.ts b/src/selfhost/preflight.ts
index 682f498120..49cae2c7be 100644
--- a/src/selfhost/preflight.ts
+++ b/src/selfhost/preflight.ts
@@ -1,4 +1,5 @@
import { createPrivateKey } from "node:crypto";
+import { MISSING_ORB_BROKER_URL_MESSAGE } from "@loopover/contract/orb-broker";
import { CRON_INTERVAL_MIN_MS } from "./cron-alignment";
import { currentAnchorKey, parseAnchorPublicKeys } from "../review/ledger-anchor";
import { parseLedgerContentWaiver, parseLedgerUnchainedWaiver } from "../review/decision-record";
@@ -347,6 +348,10 @@ export function preflightEnv(env: SelfHostPreflightEnv): SelfHostPreflightResult
}
const hasOrbBroker = Boolean(nonBlank(env.ORB_ENROLLMENT_SECRET));
+ // Brokered mode exchanges with ORB_BROKER_URL on every token mint; it has no default since the hosted broker
+ // retired, so an enrollment without one would fail every GitHub call. Say so at boot instead.
+ if (hasOrbBroker && !nonBlank(env.ORB_BROKER_URL))
+ addProblem(problems, "ORB_BROKER_URL", MISSING_ORB_BROKER_URL_MESSAGE);
if (!hasPartialGitHubApp && !hasOrbBroker) {
if (!nonBlank(env.SELFHOST_SETUP_TOKEN))
addProblem(
diff --git a/test/helpers/d1.ts b/test/helpers/d1.ts
index ff620b0cff..fac53e07a2 100644
--- a/test/helpers/d1.ts
+++ b/test/helpers/d1.ts
@@ -194,6 +194,9 @@ export function createTestEnv(overrides: Partial = {}): Env {
// manifest resolution, silently merging the bundled autonomy:{...auto} block into that test's settings.
// Tests that DO want self-repo matching set this explicitly to their own fixture's repo name.
LOOPOVER_DRIFT_ISSUE_REPO: "test-harness/no-self-repo-match",
+ // The Orb broker a brokered test (ORB_ENROLLMENT_SECRET set) exchanges with: ORB_BROKER_URL has no default
+ // since the hosted broker at api.loopover.ai retired, and an unset one fails before any fetch.
+ ORB_BROKER_URL: "https://broker.example",
PUBLIC_API_ORIGIN: "https://api.loopover.ai",
PUBLIC_SITE_ORIGIN: "https://loopover.ai",
INTERNAL_JOB_TOKEN: "dev-internal-token",
diff --git a/test/unit/contract-cli-config.test.ts b/test/unit/contract-cli-config.test.ts
index 772a78f9d8..aa9764cfb0 100644
--- a/test/unit/contract-cli-config.test.ts
+++ b/test/unit/contract-cli-config.test.ts
@@ -1,7 +1,10 @@
import { describe, expect, it } from "vitest";
import {
- DEFAULT_LOOPOVER_API_URL,
DEFAULT_PROFILE_NAME,
+ LEGACY_LOOPOVER_API_URLS,
+ MISSING_LOOPOVER_API_URL_MESSAGE,
+ RETIRED_LOOPOVER_API_URL,
+ SELF_HOSTED_API_URL_PLACEHOLDER,
canonicalProfileName,
loopoverConfigPath,
parseLoopoverConfig,
@@ -117,24 +120,36 @@ describe("resolveLoopoverApiUrl", () => {
expect(resolveLoopoverApiUrl({}, { apiUrl: "https://config.example" }, {})).toBe("https://config.example");
});
- it("REGRESSION: keeps looking past a LEGACY profile apiUrl instead of dropping to the default", () => {
+ it("REGRESSION: keeps looking past a LEGACY profile apiUrl instead of stopping at it", () => {
// The divergence the two hand-copies had (#8854/#9521): @loopover/mcp stopped at the legacy value
// and returned the default, masking a perfectly good top-level override.
expect(resolveLoopoverApiUrl({}, { apiUrl: "https://config.example" }, { apiUrl: "https://gittensory-api.aethereal.dev" })).toBe("https://config.example");
});
- it("returns the default when every candidate is legacy", () => {
+ it("returns null when every candidate is legacy", () => {
expect(
resolveLoopoverApiUrl({}, { apiUrl: "https://gittensory-api.zeronode.workers.dev" }, { apiUrl: "https://gittensory-api.aethereal.dev" }),
- ).toBe(DEFAULT_LOOPOVER_API_URL);
+ ).toBeNull();
+ });
+
+ it("skips a login saved against the retired hosted API, which no longer answers", () => {
+ expect(LEGACY_LOOPOVER_API_URLS.has(RETIRED_LOOPOVER_API_URL)).toBe(true);
+ expect(resolveLoopoverApiUrl({}, {}, { apiUrl: "https://api.loopover.ai/" })).toBeNull();
+ expect(resolveLoopoverApiUrl({}, { apiUrl: "https://config.example" }, { apiUrl: RETIRED_LOOPOVER_API_URL })).toBe("https://config.example");
});
it.each([
["a non-string apiUrl", { apiUrl: 42 }],
["a whitespace-only apiUrl", { apiUrl: " " }],
["an undefined profile", undefined],
- ])("skips %s and returns the default when nothing else is configured", (_label, profile) => {
- expect(resolveLoopoverApiUrl({}, {}, profile)).toBe(DEFAULT_LOOPOVER_API_URL);
+ ])("skips %s and returns null when nothing else is configured: there is no default host", (_label, profile) => {
+ expect(resolveLoopoverApiUrl({}, {}, profile)).toBeNull();
+ });
+
+ it("names the retired host, the variable to set and the placeholder in its missing-URL message", () => {
+ expect(MISSING_LOOPOVER_API_URL_MESSAGE).toContain(RETIRED_LOOPOVER_API_URL);
+ expect(MISSING_LOOPOVER_API_URL_MESSAGE).toContain("LOOPOVER_API_URL");
+ expect(MISSING_LOOPOVER_API_URL_MESSAGE).toContain(SELF_HOSTED_API_URL_PLACEHOLDER);
});
it("exposes 'default' as the default profile name both bins fall back to", () => {
diff --git a/test/unit/contract-orb-broker.test.ts b/test/unit/contract-orb-broker.test.ts
index 5c4eefc820..3c8d299d8c 100644
--- a/test/unit/contract-orb-broker.test.ts
+++ b/test/unit/contract-orb-broker.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from "vitest";
import {
- DEFAULT_ORB_BROKER_URL,
+ MISSING_ORB_BROKER_URL_MESSAGE,
ORB_BROKER_TIMEOUT_MS,
fetchBrokeredStoredSecret,
orbBrokerBaseUrl,
@@ -10,13 +10,17 @@ import {
// used to own a copy of this. The copies had already drifted on the local-host list, in a function whose
// entire job is deciding where a bootstrap credential may be sent -- so it is pinned here directly.
+const BROKER = "https://broker.example";
+
function jsonResponse(body: unknown, init: { status?: number } = {}) {
return new Response(JSON.stringify(body), { status: init.status ?? 200, headers: { "content-type": "application/json" } });
}
describe("orbBrokerBaseUrl", () => {
- it("defaults to the hosted broker when ORB_BROKER_URL is unset", () => {
- expect(orbBrokerBaseUrl({})).toBe(DEFAULT_ORB_BROKER_URL);
+ it("refuses an unset or empty ORB_BROKER_URL, naming the retired hosted broker: there is no default", () => {
+ expect(() => orbBrokerBaseUrl({})).toThrow(MISSING_ORB_BROKER_URL_MESSAGE);
+ expect(() => orbBrokerBaseUrl({ ORB_BROKER_URL: "" })).toThrow(MISSING_ORB_BROKER_URL_MESSAGE);
+ expect(MISSING_ORB_BROKER_URL_MESSAGE).toContain("https://api.loopover.ai");
});
it("returns the bare origin for a root-path URL, with no trailing slash", () => {
@@ -62,7 +66,7 @@ describe("fetchBrokeredStoredSecret", () => {
it("defaults secretType to an empty string when the broker omits it", async () => {
const fetchImpl = vi.fn(async () => jsonResponse({ secretValue: "v" }));
- await expect(fetchBrokeredStoredSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl as unknown as typeof fetch)).resolves.toEqual({
+ await expect(fetchBrokeredStoredSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "t", ORB_BROKER_URL: BROKER }, fetchImpl as unknown as typeof fetch)).resolves.toEqual({
secretValue: "v",
secretType: "",
});
@@ -70,21 +74,21 @@ describe("fetchBrokeredStoredSecret", () => {
it("sends an empty bearer rather than the string 'undefined' when no token is configured", async () => {
const fetchImpl = vi.fn(async () => jsonResponse({ secretValue: "v", secretType: "t" }));
- await fetchBrokeredStoredSecret({}, fetchImpl as unknown as typeof fetch);
+ await fetchBrokeredStoredSecret({ ORB_BROKER_URL: BROKER }, fetchImpl as unknown as typeof fetch);
const [, init] = fetchImpl.mock.calls[0] as unknown as [string, RequestInit];
expect((init.headers as Record).authorization).toBe("Bearer ");
});
it("throws with the status on a non-OK exchange, leaking no body", async () => {
const fetchImpl = vi.fn(async () => jsonResponse({ error: "enrollment revoked" }, { status: 403 }));
- await expect(fetchBrokeredStoredSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl as unknown as typeof fetch)).rejects.toThrow(
+ await expect(fetchBrokeredStoredSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "t", ORB_BROKER_URL: BROKER }, fetchImpl as unknown as typeof fetch)).rejects.toThrow(
"Orb broker stored-secret exchange failed (403).",
);
});
it("throws when a 200 body carries no secretValue", async () => {
const fetchImpl = vi.fn(async () => jsonResponse({ secretType: "tenant_db_credential" }));
- await expect(fetchBrokeredStoredSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl as unknown as typeof fetch)).rejects.toThrow(
+ await expect(fetchBrokeredStoredSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "t", ORB_BROKER_URL: BROKER }, fetchImpl as unknown as typeof fetch)).rejects.toThrow(
"did not include a secretValue",
);
});
diff --git a/test/unit/gen-mcp-client-config-script.test.ts b/test/unit/gen-mcp-client-config-script.test.ts
index 9f235e699e..8b88c039c1 100644
--- a/test/unit/gen-mcp-client-config-script.test.ts
+++ b/test/unit/gen-mcp-client-config-script.test.ts
@@ -52,7 +52,8 @@ describe("the generated README sections (#9526)", () => {
const section = stdioReadmeSection();
expect(section).toContain(CONNECTION_MODE_SPEC.stdio.title);
expect(section).toContain(CONNECTION_MODE_SPEC.remote.title);
- expect(section).toContain("https://api.loopover.ai/mcp");
+ expect(section).toContain("https://reviews.example.com/mcp");
+ expect(section).not.toContain("api.loopover.ai");
});
it("the miner README's combined block registers BOTH servers and stays valid JSON", () => {
diff --git a/test/unit/github-issues.test.ts b/test/unit/github-issues.test.ts
index a9ab95b5a0..a7e7797819 100644
--- a/test/unit/github-issues.test.ts
+++ b/test/unit/github-issues.test.ts
@@ -56,7 +56,7 @@ describe("createInstallationIssue", () => {
const url = input.toString();
const method = init?.method ?? "GET";
calls.push(`${method} ${url}`);
- if (url === "https://api.loopover.ai/v1/orb/token") {
+ if (url === "https://broker.example/v1/orb/token") {
return Response.json({ token: "brokered-token", installationId: 123, expiresAt: new Date(Date.now() + 3_600_000).toISOString(), permissions: {} });
}
if (url.endsWith("/repos/JSONbored/loopover/issues") && method === "POST") {
@@ -71,7 +71,7 @@ describe("createInstallationIssue", () => {
const result = await createInstallationIssue(env, 123, "JSONbored/loopover", { title: "t", body: "b" });
expect(result).toEqual({ number: 777, url: "https://github.com/JSONbored/loopover/issues/777" });
- expect(calls.some((call) => call === "POST https://api.loopover.ai/v1/orb/token")).toBe(true);
+ expect(calls.some((call) => call === "POST https://broker.example/v1/orb/token")).toBe(true);
});
it("omits the labels field when none are provided", async () => {
diff --git a/test/unit/loopover-verify-cli.test.ts b/test/unit/loopover-verify-cli.test.ts
index f777fc1147..4fb95aceee 100644
--- a/test/unit/loopover-verify-cli.test.ts
+++ b/test/unit/loopover-verify-cli.test.ts
@@ -41,9 +41,12 @@ afterEach(() => {
});
describe("parseBaseUrl", () => {
- it("defaults, strips a trailing slash, and accepts an explicit http(s) base", async () => {
+ it("requires a base, strips a trailing slash, and accepts an explicit http(s) base", async () => {
const { parseBaseUrl } = await loadCli();
- expect(parseBaseUrl([])).toEqual({ ok: true, baseUrl: "https://api.loopover.ai" });
+ const missing = parseBaseUrl([]);
+ expect(missing.ok).toBe(false);
+ expect(!missing.ok && missing.error).toMatch(/--base-url is required: .*api\.loopover\.ai\) was retired/);
+ expect(parseBaseUrl([], "https://fallback.test/")).toEqual({ ok: true, baseUrl: "https://fallback.test" });
expect(parseBaseUrl(["--base-url", "https://example.test/"])).toEqual({ ok: true, baseUrl: "https://example.test" });
expect(parseBaseUrl(["--base-url", "http://localhost:8787"])).toEqual({ ok: true, baseUrl: "http://localhost:8787" });
});
@@ -60,6 +63,17 @@ describe("parseBaseUrl", () => {
});
describe("runVerify", () => {
+ it("exits 2 without touching the network when no --base-url is given", async () => {
+ const { runVerify } = await loadCli();
+ const fetchSpy = vi.fn();
+ vi.stubGlobal("fetch", fetchSpy);
+ const errors = vi.spyOn(console, "error").mockImplementation(() => undefined);
+ const code = await runVerify([]);
+ expect(code).toBe(2);
+ expect(fetchSpy).not.toHaveBeenCalled();
+ expect(String(errors.mock.calls[0]?.[0])).toContain("--base-url is required");
+ });
+
it("prints usage and exits 0 for --help without touching the network", async () => {
const { runVerify } = await loadCli();
const fetchSpy = vi.fn();
diff --git a/test/unit/mcp-cli-basics.test.ts b/test/unit/mcp-cli-basics.test.ts
index ce5616b828..ad87f7ff43 100644
--- a/test/unit/mcp-cli-basics.test.ts
+++ b/test/unit/mcp-cli-basics.test.ts
@@ -53,7 +53,7 @@ describe("loopover-mcp CLI — basics", () => {
process.env.LOOPOVER_SKIP_NPM_VERSION_CHECK = "1";
mod = (await import(BIN_MODULE)) as unknown as BinModule;
// ...and delete the module-load ones right after import: the kept subprocess tests below assert DEFAULT
- // config provenance (apiUrlSource "default"), which an inherited LOOPOVER_API_URL would break.
+ // config provenance (apiUrlSource "unset"), which an inherited LOOPOVER_API_URL would break.
delete process.env.LOOPOVER_API_URL;
delete process.env.LOOPOVER_CONFIG_DIR;
}, 120_000);
@@ -351,7 +351,7 @@ describe("loopover-mcp CLI — basics", () => {
it("reports resolved configuration provenance via config", () => {
const payload = JSON.parse(run(["config", "--json"])) as {
- apiUrl: string;
+ apiUrl: string | null;
apiUrlSource: string;
activeProfile: string;
profileCount: number;
@@ -362,9 +362,10 @@ describe("loopover-mcp CLI — basics", () => {
tokenSource: string;
sourceUpload: { default: boolean; enabled: boolean; source: string; supported: boolean };
};
- // The run() harness sets LOOPOVER_CONFIG_DIR but no API URL or token.
- expect(payload.apiUrl).toBe("https://api.loopover.ai");
- expect(payload.apiUrlSource).toBe("default");
+ // The run() harness sets LOOPOVER_CONFIG_DIR but no API URL or token, and there is no default API URL
+ // since the hosted one retired.
+ expect(payload.apiUrl).toBeNull();
+ expect(payload.apiUrlSource).toBe("unset");
expect(payload.activeProfile).toBe("default");
expect(payload.profileCount).toBeGreaterThanOrEqual(1);
expect(payload.configured).toBe(false);
diff --git a/test/unit/mcp-gateway-proxy.test.ts b/test/unit/mcp-gateway-proxy.test.ts
index 77fa95d0e8..ba6b262a74 100644
--- a/test/unit/mcp-gateway-proxy.test.ts
+++ b/test/unit/mcp-gateway-proxy.test.ts
@@ -39,6 +39,8 @@ let client: Client;
beforeAll(async () => {
vi.stubEnv("LOOPOVER_API_TOKEN", "test-session-token");
+ // Read once at module load; there is no default API URL since the hosted one retired.
+ vi.stubEnv("LOOPOVER_API_URL", "https://reviews.example.com");
vi.stubGlobal(
"fetch",
vi.fn(async () => ({
diff --git a/test/unit/mcp-gateway.test.ts b/test/unit/mcp-gateway.test.ts
index 7981114a26..484391229a 100644
--- a/test/unit/mcp-gateway.test.ts
+++ b/test/unit/mcp-gateway.test.ts
@@ -1,6 +1,7 @@
import { describe, expect, it, vi } from "vitest";
import {
GATEWAY_DISABLED_ADVISORY,
+ GATEWAY_NO_API_URL_ADVISORY,
GATEWAY_UNAUTHENTICATED_ADVISORY,
discoverRemoteTools,
gatewayAdvisoryResource,
@@ -25,7 +26,7 @@ function respondingWith(payload: unknown, init: { ok?: boolean; status?: number
function input(overrides: Partial[0]> = {}) {
return {
- apiUrl: "https://api.loopover.ai",
+ apiUrl: "https://reviews.example.com",
token: "session-token",
localToolNames: new Set(),
fetchImpl: respondingWith({ result: { tools: REMOTE_TOOLS } }),
@@ -49,6 +50,17 @@ describe("discovery requires a session (#9526)", () => {
});
});
+describe("discovery requires an API URL", () => {
+ it("reports unavailable WITHOUT making a request when no API URL is configured, saying how to set one", async () => {
+ const fetchImpl = respondingWith({ result: { tools: [] } });
+ const result = await discoverRemoteTools(input({ apiUrl: "", fetchImpl }));
+ expect(result).toEqual({ status: "unavailable", advisory: GATEWAY_NO_API_URL_ADVISORY });
+ expect(fetchImpl, "there is no hosted default to call").not.toHaveBeenCalled();
+ expect(GATEWAY_NO_API_URL_ADVISORY).toContain("LOOPOVER_API_URL");
+ expect(GATEWAY_NO_API_URL_ADVISORY).toContain("Local tools are available");
+ });
+});
+
describe("a successful mount (#9526)", () => {
it("returns the remote tools and calls the remote's own tools/list with the session bearer", async () => {
const fetchImpl = respondingWith({ result: { tools: REMOTE_TOOLS } });
@@ -60,15 +72,15 @@ describe("a successful mount (#9526)", () => {
]);
const [url, init] = (fetchImpl as unknown as { mock: { calls: [string, { headers: Record; body: string }][] } }).mock.calls[0]!;
- expect(url).toBe("https://api.loopover.ai/mcp");
+ expect(url).toBe("https://reviews.example.com/mcp");
expect(init.headers.authorization).toBe("Bearer session-token");
expect(JSON.parse(init.body).method).toBe("tools/list");
});
it("trims a trailing slash rather than requesting a doubled path", async () => {
const fetchImpl = respondingWith({ result: { tools: [] } });
- await discoverRemoteTools(input({ apiUrl: "https://api.loopover.ai/", fetchImpl }));
- expect((fetchImpl as unknown as { mock: { calls: [string][] } }).mock.calls[0]![0]).toBe("https://api.loopover.ai/mcp");
+ await discoverRemoteTools(input({ apiUrl: "https://reviews.example.com/", fetchImpl }));
+ expect((fetchImpl as unknown as { mock: { calls: [string][] } }).mock.calls[0]![0]).toBe("https://reviews.example.com/mcp");
});
it("SKIPS a remote tool whose name the local server already serves — local wins", async () => {
diff --git a/test/unit/miner-cli-doctor-checks.test.ts b/test/unit/miner-cli-doctor-checks.test.ts
index 5f5831a4eb..f708d74c4e 100644
--- a/test/unit/miner-cli-doctor-checks.test.ts
+++ b/test/unit/miner-cli-doctor-checks.test.ts
@@ -375,7 +375,7 @@ describe("loopover-miner doctor — credential presence checks (#5170)", () => {
const root = tempRoot();
writeFileSync(
join(root, "config.json"),
- JSON.stringify({ profiles: { default: { session: { token: "session-token" } } } }),
+ JSON.stringify({ profiles: { default: { apiUrl: "https://reviews.example.com", session: { token: "session-token" } } } }),
);
const check = checkGitHubTokenPresent({ LOOPOVER_CONFIG_DIR: root });
expect(check).toMatchObject({
diff --git a/test/unit/miner-github-token-resolution.test.ts b/test/unit/miner-github-token-resolution.test.ts
index 678b7c612b..4f9069ba09 100644
--- a/test/unit/miner-github-token-resolution.test.ts
+++ b/test/unit/miner-github-token-resolution.test.ts
@@ -9,6 +9,9 @@ import {
resolveLoopoverBackendSession,
} from "../../packages/loopover-miner/lib/github-token-resolution";
+/** A self-hosted instance's origin: the hosted API these tests once fell back to is retired, so none is implied. */
+const API = "https://reviews.example.com";
+
function writeConfig(dir: string, config: unknown) {
writeFileSync(join(dir, "config.json"), JSON.stringify(config), { mode: 0o600 });
}
@@ -28,14 +31,14 @@ describe("resolveGitHubToken (#6116)", () => {
it("uses the real global fetch when no fetchImpl is injected", async () => {
dir = mkdtempSync(join(tmpdir(), "loopover-miner-github-token-realfetch-"));
- writeConfig(dir, { profiles: { default: { session: { token: "session-token" } } } });
+ writeConfig(dir, { profiles: { default: { apiUrl: API, session: { token: "session-token" } } } });
let capturedUrl: string | undefined;
vi.stubGlobal("fetch", async (url: string) => {
capturedUrl = url;
return Response.json({ token: "live-token" });
});
await expect(resolveGitHubToken(configuredEnv(dir))).resolves.toBe("live-token");
- expect(capturedUrl).toBe("https://api.loopover.ai/v1/auth/github/token");
+ expect(capturedUrl).toBe("https://reviews.example.com/v1/auth/github/token");
});
it("an explicit GITHUB_TOKEN env override wins outright, no filesystem or network access", async () => {
@@ -97,7 +100,7 @@ describe("resolveGitHubToken (#6116)", () => {
writeConfig(dir, {
activeProfile: "work",
profiles: {
- default: { session: { token: "default-session" } },
+ default: { apiUrl: API, session: { token: "default-session" } },
work: { apiUrl: "https://work.example", session: { token: "work-session" } },
},
});
@@ -122,16 +125,12 @@ describe("resolveGitHubToken (#6116)", () => {
expect(capturedUrl).toBe("https://env-override.example/v1/auth/github/token");
});
- it("falls back to the default API URL when neither an env override nor a profile apiUrl is set", async () => {
+ it("returns null without fetching when neither an env override nor a profile or global apiUrl is set", async () => {
dir = mkdtempSync(join(tmpdir(), "loopover-miner-github-token-default-url-"));
writeConfig(dir, { profiles: { default: { session: { token: "session-token" } } } });
- let capturedUrl: string | undefined;
- const fetchImpl = async (url: string) => {
- capturedUrl = url;
- return Response.json({ token: "live-token" });
- };
- await resolveGitHubToken(configuredEnv(dir), { fetchImpl });
- expect(capturedUrl).toBe("https://api.loopover.ai/v1/auth/github/token");
+ const fetchImpl = vi.fn();
+ await expect(resolveGitHubToken(configuredEnv(dir), { fetchImpl })).resolves.toBeNull();
+ expect(fetchImpl).not.toHaveBeenCalled();
});
it("falls back to the top-level/global config.apiUrl when the active profile has none (#8854)", async () => {
@@ -162,33 +161,33 @@ describe("resolveGitHubToken (#6116)", () => {
expect(capturedUrl).toBe("https://profile.example/v1/auth/github/token");
});
- it("treats a legacy default API URL stored in the profile as absent, falling through to the current default", async () => {
+ it("treats a legacy default API URL (gittensory-api.zeronode.workers.dev) stored in the profile as absent", async () => {
dir = mkdtempSync(join(tmpdir(), "loopover-miner-github-token-legacy-url-"));
writeConfig(dir, { profiles: { default: { apiUrl: "https://gittensory-api.zeronode.workers.dev", session: { token: "session-token" } } } });
- let capturedUrl: string | undefined;
- const fetchImpl = async (url: string) => {
- capturedUrl = url;
- return Response.json({ token: "live-token" });
- };
- await resolveGitHubToken(configuredEnv(dir), { fetchImpl });
- expect(capturedUrl).toBe("https://api.loopover.ai/v1/auth/github/token");
+ const fetchImpl = vi.fn();
+ await expect(resolveGitHubToken(configuredEnv(dir), { fetchImpl })).resolves.toBeNull();
+ expect(fetchImpl).not.toHaveBeenCalled();
});
- it("treats the retired gittensory-api.aethereal.dev default as legacy too, falling through to the current default", async () => {
+ it("treats a legacy default API URL (gittensory-api.aethereal.dev) stored in the profile as absent", async () => {
dir = mkdtempSync(join(tmpdir(), "loopover-miner-github-token-legacy-aethereal-url-"));
writeConfig(dir, { profiles: { default: { apiUrl: "https://gittensory-api.aethereal.dev", session: { token: "session-token" } } } });
- let capturedUrl: string | undefined;
- const fetchImpl = async (url: string) => {
- capturedUrl = url;
- return Response.json({ token: "live-token" });
- };
- await resolveGitHubToken(configuredEnv(dir), { fetchImpl });
- expect(capturedUrl).toBe("https://api.loopover.ai/v1/auth/github/token");
+ const fetchImpl = vi.fn();
+ await expect(resolveGitHubToken(configuredEnv(dir), { fetchImpl })).resolves.toBeNull();
+ expect(fetchImpl).not.toHaveBeenCalled();
+ });
+
+ it("treats the retired hosted API (api.loopover.ai) stored in the profile as absent", async () => {
+ dir = mkdtempSync(join(tmpdir(), "loopover-miner-github-token-retired-hosted-url-"));
+ writeConfig(dir, { profiles: { default: { apiUrl: "https://api.loopover.ai", session: { token: "session-token" } } } });
+ const fetchImpl = vi.fn();
+ await expect(resolveGitHubToken(configuredEnv(dir), { fetchImpl })).resolves.toBeNull();
+ expect(fetchImpl).not.toHaveBeenCalled();
});
it("returns null (not throw) when the fetch itself rejects", async () => {
dir = mkdtempSync(join(tmpdir(), "loopover-miner-github-token-neterror-"));
- writeConfig(dir, { profiles: { default: { session: { token: "session-token" } } } });
+ writeConfig(dir, { profiles: { default: { apiUrl: API, session: { token: "session-token" } } } });
const fetchImpl = async () => {
throw new Error("network down");
};
@@ -197,28 +196,28 @@ describe("resolveGitHubToken (#6116)", () => {
it("returns null when the response is not ok", async () => {
dir = mkdtempSync(join(tmpdir(), "loopover-miner-github-token-notok-"));
- writeConfig(dir, { profiles: { default: { session: { token: "session-token" } } } });
+ writeConfig(dir, { profiles: { default: { apiUrl: API, session: { token: "session-token" } } } });
const fetchImpl = async () => Response.json({ error: "github_token_unavailable" }, { status: 404 });
await expect(resolveGitHubToken(configuredEnv(dir), { fetchImpl })).resolves.toBeNull();
});
it("returns null when the response body is not valid JSON", async () => {
dir = mkdtempSync(join(tmpdir(), "loopover-miner-github-token-badjson-"));
- writeConfig(dir, { profiles: { default: { session: { token: "session-token" } } } });
+ writeConfig(dir, { profiles: { default: { apiUrl: API, session: { token: "session-token" } } } });
const fetchImpl = async () => new Response("{", { status: 200 });
await expect(resolveGitHubToken(configuredEnv(dir), { fetchImpl })).resolves.toBeNull();
});
it("returns null when the response is ok but has no token field", async () => {
dir = mkdtempSync(join(tmpdir(), "loopover-miner-github-token-notoken-"));
- writeConfig(dir, { profiles: { default: { session: { token: "session-token" } } } });
+ writeConfig(dir, { profiles: { default: { apiUrl: API, session: { token: "session-token" } } } });
const fetchImpl = async () => Response.json({});
await expect(resolveGitHubToken(configuredEnv(dir), { fetchImpl })).resolves.toBeNull();
});
it("caches a SUCCESSFUL resolution for the process lifetime -- a second call does not re-fetch", async () => {
dir = mkdtempSync(join(tmpdir(), "loopover-miner-github-token-cache-"));
- writeConfig(dir, { profiles: { default: { session: { token: "session-token" } } } });
+ writeConfig(dir, { profiles: { default: { apiUrl: API, session: { token: "session-token" } } } });
let calls = 0;
const fetchImpl = async () => {
calls += 1;
@@ -232,7 +231,7 @@ describe("resolveGitHubToken (#6116)", () => {
it("does NOT cache a failed resolution -- the next call retries (self-heals from a transient failure)", async () => {
dir = mkdtempSync(join(tmpdir(), "loopover-miner-github-token-retry-"));
- writeConfig(dir, { profiles: { default: { session: { token: "session-token" } } } });
+ writeConfig(dir, { profiles: { default: { apiUrl: API, session: { token: "session-token" } } } });
let calls = 0;
const fetchImpl = async () => {
calls += 1;
@@ -246,7 +245,7 @@ describe("resolveGitHubToken (#6116)", () => {
it("resetGitHubTokenResolutionForTesting clears a cached successful resolution", async () => {
dir = mkdtempSync(join(tmpdir(), "loopover-miner-github-token-reset-"));
- writeConfig(dir, { profiles: { default: { session: { token: "session-token" } } } });
+ writeConfig(dir, { profiles: { default: { apiUrl: API, session: { token: "session-token" } } } });
let calls = 0;
const fetchImpl = async () => {
calls += 1;
@@ -275,7 +274,7 @@ describe("resolveGitHubToken (#6116)", () => {
dir = mkdtempSync(join(tmpdir(), "loopover-miner-github-token-xdg-"));
const loopoverConfigDir = join(dir, "loopover");
mkdirSync(loopoverConfigDir, { recursive: true });
- writeConfig(loopoverConfigDir, { profiles: { default: { session: { token: "session-token" } } } });
+ writeConfig(loopoverConfigDir, { profiles: { default: { apiUrl: API, session: { token: "session-token" } } } });
const fetchImpl = async () => Response.json({ token: "live-token" });
await expect(
resolveGitHubToken({ XDG_CONFIG_HOME: dir } as unknown as NodeJS.ProcessEnv, { fetchImpl }),
@@ -285,14 +284,14 @@ describe("resolveGitHubToken (#6116)", () => {
it("LOOPOVER_CONFIG_PATH reaches a specific file directly, independent of LOOPOVER_CONFIG_DIR", async () => {
dir = mkdtempSync(join(tmpdir(), "loopover-miner-github-token-configpath-"));
const file = join(dir, "custom-config.json");
- writeFileSync(file, JSON.stringify({ profiles: { default: { session: { token: "session-token" } } } }), { mode: 0o600 });
+ writeFileSync(file, JSON.stringify({ profiles: { default: { apiUrl: API, session: { token: "session-token" } } } }), { mode: 0o600 });
const fetchImpl = async () => Response.json({ token: "live-token" });
await expect(resolveGitHubToken({ LOOPOVER_CONFIG_PATH: file, LOOPOVER_CONFIG_DIR: "" } as unknown as NodeJS.ProcessEnv, { fetchImpl })).resolves.toBe("live-token");
});
it("an invalid LOOPOVER_PROFILE name falls back to the default profile rather than throwing", async () => {
dir = mkdtempSync(join(tmpdir(), "loopover-miner-github-token-badprofile-"));
- writeConfig(dir, { profiles: { default: { session: { token: "default-session" } } } });
+ writeConfig(dir, { profiles: { default: { apiUrl: API, session: { token: "default-session" } } } });
let capturedAuth: string | undefined;
const fetchImpl = async (_url: string, init?: { headers?: Record }) => {
capturedAuth = init?.headers?.authorization;
@@ -304,7 +303,7 @@ describe("resolveGitHubToken (#6116)", () => {
it("an invalid activeProfile IN THE CONFIG also falls back to default, not just an invalid env one", async () => {
dir = mkdtempSync(join(tmpdir(), "loopover-miner-github-token-badactive-"));
- writeConfig(dir, { activeProfile: "Not A Valid Name!!", profiles: { default: { session: { token: "default-session" } } } });
+ writeConfig(dir, { activeProfile: "Not A Valid Name!!", profiles: { default: { apiUrl: API, session: { token: "default-session" } } } });
let capturedAuth: string | undefined;
const fetchImpl = async (_url: string, init?: { headers?: Record }) => {
capturedAuth = init?.headers?.authorization;
@@ -316,7 +315,7 @@ describe("resolveGitHubToken (#6116)", () => {
it("an activeProfile naming a profile that does not exist falls back to default", async () => {
dir = mkdtempSync(join(tmpdir(), "loopover-miner-github-token-ghostprofile-"));
- writeConfig(dir, { activeProfile: "ghost", profiles: { default: { session: { token: "default-session" } } } });
+ writeConfig(dir, { activeProfile: "ghost", profiles: { default: { apiUrl: API, session: { token: "default-session" } } } });
let capturedAuth: string | undefined;
const fetchImpl = async (_url: string, init?: { headers?: Record }) => {
capturedAuth = init?.headers?.authorization;
@@ -358,6 +357,12 @@ describe("resolveLoopoverBackendSession (#6487)", () => {
sessionToken: "session-token",
});
});
+
+ it("returns null when a session token is on disk but no API URL is configured", () => {
+ dir = mkdtempSync(join(tmpdir(), "loopover-miner-backend-session-no-url-"));
+ writeConfig(dir, { profiles: { default: { session: { token: "session-token" } } } });
+ expect(resolveLoopoverBackendSession(configuredEnv(dir))).toBeNull();
+ });
});
describe("hasGitHubTokenSource (#6116)", () => {
@@ -374,10 +379,16 @@ describe("hasGitHubTokenSource (#6116)", () => {
it("is true when no GITHUB_TOKEN is set but a loopover-mcp session token is recorded", () => {
dir = mkdtempSync(join(tmpdir(), "loopover-miner-github-token-source-session-"));
- writeConfig(dir, { profiles: { default: { session: { token: "session-token" } } } });
+ writeConfig(dir, { profiles: { default: { apiUrl: API, session: { token: "session-token" } } } });
expect(hasGitHubTokenSource(configuredEnv(dir))).toBe(true);
});
+ it("is false when a loopover-mcp session is recorded but no API URL is configured to use it against", () => {
+ dir = mkdtempSync(join(tmpdir(), "loopover-miner-github-token-source-no-url-"));
+ writeConfig(dir, { profiles: { default: { session: { token: "session-token" } } } });
+ expect(hasGitHubTokenSource(configuredEnv(dir))).toBe(false);
+ });
+
it("is false when neither GITHUB_TOKEN nor a loopover-mcp session is available", () => {
dir = mkdtempSync(join(tmpdir(), "loopover-miner-github-token-source-none-"));
expect(hasGitHubTokenSource(configuredEnv(dir))).toBe(false);
diff --git a/test/unit/miner-tenant-credential-resolution.test.ts b/test/unit/miner-tenant-credential-resolution.test.ts
index de920106dc..09051ed739 100644
--- a/test/unit/miner-tenant-credential-resolution.test.ts
+++ b/test/unit/miner-tenant-credential-resolution.test.ts
@@ -7,6 +7,10 @@
// still say "Secret", matching src/orb/broker-client.ts's own naming for the function this duplicates.
import { describe, expect, it, vi } from "vitest";
import { fetchTenantSecret, resolveTenantSecret } from "../../packages/loopover-miner/lib/tenant-credential-resolution";
+import { MISSING_ORB_BROKER_URL_MESSAGE } from "@loopover/contract/orb-broker";
+
+/** ORB_BROKER_URL has no default since the hosted broker retired, so every exchange here names one. */
+const BROKER = "https://broker.example";
/** A fetch stub that records the URL + init and returns a fixed response. */
function captureFetch(resp: Response): { fetchImpl: typeof fetch; calls: { url: string; init?: RequestInit | undefined }[] } {
@@ -19,11 +23,11 @@ function captureFetch(resp: Response): { fetchImpl: typeof fetch; calls: { url:
}
describe("fetchTenantSecret (#8246)", () => {
- it("exchanges the tenant secret token for a stored secret (default broker URL + Bearer token)", async () => {
+ it("exchanges the tenant secret token for a stored secret (broker URL + Bearer token)", async () => {
const { fetchImpl, calls } = captureFetch(Response.json({ secretValue: "postgres://tenant-acme:hunter2@neon/acme", secretType: "tenant_db_credential" }));
- const out = await fetchTenantSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "orbsec_x" }, fetchImpl);
+ const out = await fetchTenantSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "orbsec_x" }, fetchImpl);
expect(out).toEqual({ secretValue: "postgres://tenant-acme:hunter2@neon/acme", secretType: "tenant_db_credential" });
- expect(calls[0]?.url).toBe("https://api.loopover.ai/v1/orb/token");
+ expect(calls[0]?.url).toBe("https://broker.example/v1/orb/token");
expect((calls[0]?.init?.headers as Record).authorization).toBe("Bearer orbsec_x");
expect(calls[0]?.init?.method).toBe("POST");
});
@@ -58,24 +62,24 @@ describe("fetchTenantSecret (#8246)", () => {
it("sends an empty Bearer when no token is set (defensive ?? branch)", async () => {
const { fetchImpl, calls } = captureFetch(Response.json({ secretValue: "v", secretType: "t" }));
- await fetchTenantSecret({}, fetchImpl);
+ await fetchTenantSecret({ ORB_BROKER_URL: BROKER }, fetchImpl);
expect((calls[0]?.init?.headers as Record).authorization).toBe("Bearer ");
});
it("defaults secretType to an empty string when the broker response omits it (defensive ?? branch)", async () => {
const { fetchImpl } = captureFetch(Response.json({ secretValue: "v" }));
- const out = await fetchTenantSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "s" }, fetchImpl);
+ const out = await fetchTenantSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "s" }, fetchImpl);
expect(out).toEqual({ secretValue: "v", secretType: "" });
});
it("throws on a non-OK broker response (e.g. 401 invalid_enrollment)", async () => {
const fetchImpl = (async () => new Response("nope", { status: 401 })) as typeof fetch;
- await expect(fetchTenantSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "s" }, fetchImpl)).rejects.toThrow(/401/);
+ await expect(fetchTenantSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "s" }, fetchImpl)).rejects.toThrow(/401/);
});
it("throws when the broker response has no secretValue", async () => {
const fetchImpl = (async () => Response.json({ secretType: "tenant_db_credential" })) as typeof fetch;
- await expect(fetchTenantSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "s" }, fetchImpl)).rejects.toThrow(/did not include a secretValue/);
+ await expect(fetchTenantSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "s" }, fetchImpl)).rejects.toThrow(/did not include a secretValue/);
});
});
@@ -96,7 +100,7 @@ describe("resolveTenantSecret (#8246)", () => {
it("returns the real exchanged secret when a token is set and the exchange succeeds", async () => {
const { fetchImpl } = captureFetch(Response.json({ secretValue: "postgres://tenant-acme@neon/acme", secretType: "tenant_db_credential" }));
- const out = await resolveTenantSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "orbsec_x" }, fetchImpl);
+ const out = await resolveTenantSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "orbsec_x" }, fetchImpl);
expect(out).toEqual({ secretValue: "postgres://tenant-acme@neon/acme", secretType: "tenant_db_credential" });
});
@@ -104,7 +108,7 @@ describe("resolveTenantSecret (#8246)", () => {
const warn = vi.spyOn(console, "warn").mockImplementation(() => undefined);
const fetchImpl = (async () => new Response("nope", { status: 503 })) as typeof fetch;
- const out = await resolveTenantSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "orbsec_x" }, fetchImpl);
+ const out = await resolveTenantSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "orbsec_x" }, fetchImpl);
expect(out).toBeNull();
expect(warn).toHaveBeenCalledTimes(1);
@@ -114,13 +118,26 @@ describe("resolveTenantSecret (#8246)", () => {
warn.mockRestore();
});
+ it("returns null without fetching when a token is set but ORB_BROKER_URL is not, logging why", async () => {
+ const warn = vi.spyOn(console, "warn").mockImplementation(() => undefined);
+ const fetchImpl = vi.fn();
+
+ const out = await resolveTenantSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "orbsec_x" }, fetchImpl as unknown as typeof fetch);
+
+ expect(out).toBeNull();
+ expect(fetchImpl).not.toHaveBeenCalled();
+ const logged = JSON.parse((warn.mock.calls[0] as [string])[0]) as { message: string };
+ expect(logged.message).toBe(MISSING_ORB_BROKER_URL_MESSAGE);
+ warn.mockRestore();
+ });
+
it("swallows a non-Error rejection from the exchange too", async () => {
const warn = vi.spyOn(console, "warn").mockImplementation(() => undefined);
const fetchImpl = (async () => {
throw "a plain string rejection";
}) as unknown as typeof fetch;
- const out = await resolveTenantSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "orbsec_x" }, fetchImpl);
+ const out = await resolveTenantSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "orbsec_x" }, fetchImpl);
expect(out).toBeNull();
const logged = JSON.parse((warn.mock.calls[0] as [string])[0]) as { message: string };
diff --git a/test/unit/orb-broker-client.test.ts b/test/unit/orb-broker-client.test.ts
index c19164934d..13250aab2c 100644
--- a/test/unit/orb-broker-client.test.ts
+++ b/test/unit/orb-broker-client.test.ts
@@ -12,6 +12,10 @@ import {
registerOrbRelayTarget,
registerOrbRelayTargetWithRetry,
} from "../../src/orb/broker-client";
+import { MISSING_ORB_BROKER_URL_MESSAGE } from "@loopover/contract/orb-broker";
+
+/** The broker every brokered call here names: ORB_BROKER_URL has no default since the hosted one retired. */
+const BROKER = "https://broker.example";
/** A fetch stub that records the URL + init and returns a fixed response. */
function captureFetch(resp: Response): { fetchImpl: typeof fetch; calls: { url: string; init?: RequestInit | undefined }[] } {
@@ -31,11 +35,11 @@ describe("isOrbBrokerMode", () => {
});
describe("fetchBrokeredInstallationToken", () => {
- it("exchanges the secret for a token + parses the expiry (default broker URL + Bearer secret)", async () => {
+ it("exchanges the secret for a token + parses the expiry (broker URL + Bearer secret)", async () => {
const { fetchImpl, calls } = captureFetch(Response.json({ token: "ghs_x", installationId: 42, expiresAt: "2026-06-25T09:00:00Z", permissions: { contents: "write" } }));
- const out = await fetchBrokeredInstallationToken({ ORB_ENROLLMENT_SECRET: "orbsec_x" }, fetchImpl);
+ const out = await fetchBrokeredInstallationToken({ ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "orbsec_x" }, fetchImpl);
expect(out).toEqual({ token: "ghs_x", installationId: 42, expiresAtMs: Date.parse("2026-06-25T09:00:00Z"), permissions: { contents: "write" } });
- expect(calls[0]?.url).toBe("https://api.loopover.ai/v1/orb/token");
+ expect(calls[0]?.url).toBe("https://broker.example/v1/orb/token");
expect((calls[0]?.init?.headers as Record).authorization).toBe("Bearer orbsec_x");
expect(calls[0]?.init?.method).toBe("POST");
expect(calls[0]?.init?.body).toBeUndefined();
@@ -43,7 +47,7 @@ describe("fetchBrokeredInstallationToken", () => {
it("asks the broker to force-refresh when retrying a stale permission scope", async () => {
const { fetchImpl, calls } = captureFetch(Response.json({ token: "ghs_x", installationId: 42, expiresAt: "2026-06-25T09:00:00Z" }));
- await fetchBrokeredInstallationToken({ ORB_ENROLLMENT_SECRET: "orbsec_x" }, fetchImpl, { forceRefresh: true });
+ await fetchBrokeredInstallationToken({ ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "orbsec_x" }, fetchImpl, { forceRefresh: true });
expect((calls[0]?.init?.headers as Record)["content-type"]).toBe("application/json");
expect(JSON.parse(String(calls[0]?.init?.body))).toEqual({ forceRefresh: true });
});
@@ -61,7 +65,7 @@ describe("fetchBrokeredInstallationToken", () => {
it("falls back to the ~50min default when expiresAt is present but unparseable (no NaN into the token cache)", async () => {
const { fetchImpl } = captureFetch(Response.json({ token: "ghs_z", installationId: 7, expiresAt: "not-a-date" }));
const before = Date.now();
- const out = await fetchBrokeredInstallationToken({ ORB_ENROLLMENT_SECRET: "s" }, fetchImpl);
+ const out = await fetchBrokeredInstallationToken({ ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s" }, fetchImpl);
expect(Number.isFinite(out.expiresAtMs)).toBe(true); // a malformed expiry must not poison the cache with NaN
expect(out.expiresAtMs).toBeGreaterThanOrEqual(before + 49 * 60_000);
expect(out.token).toBe("ghs_z");
@@ -69,7 +73,7 @@ describe("fetchBrokeredInstallationToken", () => {
it("sends an empty Bearer when no secret is set (defensive ?? branch)", async () => {
const { fetchImpl, calls } = captureFetch(Response.json({ token: "t" }));
- await fetchBrokeredInstallationToken({}, fetchImpl);
+ await fetchBrokeredInstallationToken({ ORB_BROKER_URL: BROKER }, fetchImpl);
expect((calls[0]?.init?.headers as Record).authorization).toBe("Bearer ");
});
@@ -107,12 +111,12 @@ describe("fetchBrokeredInstallationToken", () => {
it("throws on a non-OK broker response (e.g. 403 installation_not_eligible)", async () => {
const fetchImpl = (async () => new Response("nope", { status: 403 })) as typeof fetch;
- await expect(fetchBrokeredInstallationToken({ ORB_ENROLLMENT_SECRET: "s" }, fetchImpl)).rejects.toThrow(/403/);
+ await expect(fetchBrokeredInstallationToken({ ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s" }, fetchImpl)).rejects.toThrow(/403/);
});
it("throws when the broker response has no token", async () => {
const fetchImpl = (async () => Response.json({ installationId: 1 })) as typeof fetch;
- await expect(fetchBrokeredInstallationToken({ ORB_ENROLLMENT_SECRET: "s" }, fetchImpl)).rejects.toThrow(/did not include a token/);
+ await expect(fetchBrokeredInstallationToken({ ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s" }, fetchImpl)).rejects.toThrow(/did not include a token/);
});
});
@@ -131,7 +135,7 @@ describe("fetchBrokeredInstallationToken samples clock skew from the broker resp
{ token: "ghs_x", installationId: 42, expiresAt: "2026-06-25T09:00:00Z" },
{ headers: { date: "Mon, 06 Jul 2026 12:00:00 GMT" } },
)) as typeof fetch;
- await fetchBrokeredInstallationToken({ ORB_ENROLLMENT_SECRET: "s" }, fetchImpl);
+ await fetchBrokeredInstallationToken({ ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s" }, fetchImpl);
expect(clockSkewSecondsSample()).toBe(300); // 5 minutes ahead of the broker's clock
});
@@ -139,17 +143,17 @@ describe("fetchBrokeredInstallationToken samples clock skew from the broker resp
vi.useFakeTimers();
vi.setSystemTime(new Date("2026-07-06T12:00:00.000Z"));
const fetchImpl = (async () => new Response("nope", { status: 403, headers: { date: "Mon, 06 Jul 2026 12:02:00 GMT" } })) as typeof fetch;
- await expect(fetchBrokeredInstallationToken({ ORB_ENROLLMENT_SECRET: "s" }, fetchImpl)).rejects.toThrow(/403/);
+ await expect(fetchBrokeredInstallationToken({ ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s" }, fetchImpl)).rejects.toThrow(/403/);
expect(clockSkewSecondsSample()).toBe(-120); // 2 minutes behind, even though the exchange itself failed
});
});
describe("fetchBrokeredStoredSecret (#8202)", () => {
- it("exchanges the tenant secret token for a stored secret (default broker URL + Bearer token)", async () => {
+ it("exchanges the tenant secret token for a stored secret (broker URL + Bearer token)", async () => {
const { fetchImpl, calls } = captureFetch(Response.json({ secretValue: "postgres://tenant-acme:hunter2@neon/acme", secretType: "tenant_db_credential" }));
- const out = await fetchBrokeredStoredSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "orbsec_x" }, fetchImpl);
+ const out = await fetchBrokeredStoredSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "orbsec_x" }, fetchImpl);
expect(out).toEqual({ secretValue: "postgres://tenant-acme:hunter2@neon/acme", secretType: "tenant_db_credential" });
- expect(calls[0]?.url).toBe("https://api.loopover.ai/v1/orb/token");
+ expect(calls[0]?.url).toBe("https://broker.example/v1/orb/token");
expect((calls[0]?.init?.headers as Record).authorization).toBe("Bearer orbsec_x");
expect(calls[0]?.init?.method).toBe("POST");
});
@@ -169,31 +173,31 @@ describe("fetchBrokeredStoredSecret (#8202)", () => {
it("sends an empty Bearer when no token is set (defensive ?? branch)", async () => {
const { fetchImpl, calls } = captureFetch(Response.json({ secretValue: "v", secretType: "t" }));
- await fetchBrokeredStoredSecret({}, fetchImpl);
+ await fetchBrokeredStoredSecret({ ORB_BROKER_URL: BROKER }, fetchImpl);
expect((calls[0]?.init?.headers as Record).authorization).toBe("Bearer ");
});
it("defaults secretType to an empty string when the broker response omits it (defensive ?? branch)", async () => {
const { fetchImpl } = captureFetch(Response.json({ secretValue: "v" }));
- const out = await fetchBrokeredStoredSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "s" }, fetchImpl);
+ const out = await fetchBrokeredStoredSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "s" }, fetchImpl);
expect(out).toEqual({ secretValue: "v", secretType: "" });
});
it("throws on a non-OK broker response (e.g. 401 invalid_enrollment)", async () => {
const fetchImpl = (async () => new Response("nope", { status: 401 })) as typeof fetch;
- await expect(fetchBrokeredStoredSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "s" }, fetchImpl)).rejects.toThrow(/401/);
+ await expect(fetchBrokeredStoredSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "s" }, fetchImpl)).rejects.toThrow(/401/);
});
it("throws when the broker response has no secretValue", async () => {
const fetchImpl = (async () => Response.json({ secretType: "tenant_db_credential" })) as typeof fetch;
- await expect(fetchBrokeredStoredSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "s" }, fetchImpl)).rejects.toThrow(/did not include a secretValue/);
+ await expect(fetchBrokeredStoredSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "s" }, fetchImpl)).rejects.toThrow(/did not include a secretValue/);
});
});
describe("registerOrbRelayTarget", () => {
it("skips unless broker mode AND a public origin are configured", async () => {
expect(await registerOrbRelayTarget({})).toEqual({ status: "skipped" }); // not broker mode
- expect(await registerOrbRelayTarget({ ORB_ENROLLMENT_SECRET: "s" })).toEqual({ status: "skipped" }); // no PUBLIC_API_ORIGIN
+ expect(await registerOrbRelayTarget({ ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s" })).toEqual({ status: "skipped" }); // no PUBLIC_API_ORIGIN
});
it("POSTs the relay URL (origin + /v1/orb/relay) to the broker with the enrollment secret; trailing slashes stripped", async () => {
@@ -204,10 +208,13 @@ describe("registerOrbRelayTarget", () => {
expect(JSON.parse(String(calls[0]?.init?.body))).toEqual({ relayUrl: "https://me.example/v1/orb/relay", mode: "push" }); // PUBLIC_API_ORIGIN trailing slash stripped
});
- it("uses the default broker base when ORB_BROKER_URL is unset", async () => {
+ it("fails without fetching when ORB_BROKER_URL is unset: the hosted broker it once defaulted to is retired", async () => {
const { fetchImpl, calls } = captureFetch(new Response("ok"));
- await registerOrbRelayTarget({ ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" }, fetchImpl);
- expect(calls[0]?.url).toBe("https://api.loopover.ai/v1/orb/relay/register");
+ expect(await registerOrbRelayTarget({ ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" }, fetchImpl)).toEqual({
+ status: "failed",
+ reason: MISSING_ORB_BROKER_URL_MESSAGE,
+ });
+ expect(calls).toHaveLength(0);
});
it("fails closed without registering when the broker URL is unsafe", async () => {
@@ -219,7 +226,7 @@ describe("registerOrbRelayTarget", () => {
});
it("returns failed on a non-ok response or a thrown fetch (never blocks boot)", async () => {
- const cfg = { ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
+ const cfg = { ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
expect(await registerOrbRelayTarget(cfg, (async () => new Response("no", { status: 403 })) as typeof fetch)).toEqual({ status: "failed", reason: "http_403" });
expect(await registerOrbRelayTarget(cfg, (async () => { throw new Error("down"); }) as typeof fetch)).toEqual({ status: "failed", reason: "down" });
});
@@ -227,12 +234,12 @@ describe("registerOrbRelayTarget", () => {
it("pull mode (ORB_RELAY_MODE=pull) registers with NO relay URL and works without a public origin (NAT/tailnet)", async () => {
const { fetchImpl, calls } = captureFetch(new Response("ok"));
// No PUBLIC_API_ORIGIN — push would skip, but pull doesn't need an inbound URL.
- expect(await registerOrbRelayTarget({ ORB_ENROLLMENT_SECRET: "s", ORB_RELAY_MODE: "pull" }, fetchImpl)).toEqual({ status: "registered" });
+ expect(await registerOrbRelayTarget({ ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s", ORB_RELAY_MODE: "pull" }, fetchImpl)).toEqual({ status: "registered" });
expect(JSON.parse(String(calls[0]?.init?.body))).toEqual({ relayUrl: "", mode: "pull" });
});
it("surfaces a sanitized error/message hint from a JSON failure body without leaking raw bytes", async () => {
- const cfg = { ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
+ const cfg = { ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
const errBody = (async () => Response.json({ error: "database unavailable" }, { status: 500 })) as typeof fetch;
expect(await registerOrbRelayTarget(cfg, errBody)).toEqual({ status: "failed", reason: "http_500: database unavailable" });
@@ -245,7 +252,7 @@ describe("registerOrbRelayTarget", () => {
});
it("falls back to the bare status when the failure body is not JSON or has no error/message string", async () => {
- const cfg = { ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
+ const cfg = { ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
expect(await registerOrbRelayTarget(cfg, (async () => new Response("", { status: 502 })) as typeof fetch)).toEqual({ status: "failed", reason: "http_502" });
expect(await registerOrbRelayTarget(cfg, (async () => new Response("gateway error", { status: 502 })) as typeof fetch)).toEqual({
status: "failed",
@@ -258,14 +265,14 @@ describe("registerOrbRelayTarget", () => {
});
it("truncates an overlong error hint instead of logging an unbounded body", async () => {
- const cfg = { ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
+ const cfg = { ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
const longMessage = "x".repeat(500);
const result = await registerOrbRelayTarget(cfg, (async () => Response.json({ error: longMessage }, { status: 500 })) as typeof fetch);
expect(result.reason).toBe(`http_500: ${"x".repeat(200)}`);
});
it("does not read relay registration failure bodies whose Content-Length exceeds the diagnostic cap", async () => {
- const cfg = { ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
+ const cfg = { ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
let canceled = false;
const body = new ReadableStream({
pull(controller) {
@@ -292,13 +299,13 @@ describe("registerOrbRelayTarget", () => {
it("falls back to the bare status when the diagnostic response has no body", async () => {
- const cfg = { ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
+ const cfg = { ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
const result = await registerOrbRelayTarget(cfg, (async () => new Response(null, { status: 500 })) as typeof fetch);
expect(result).toEqual({ status: "failed", reason: "http_500" });
});
it("truncates and cancels a single oversized diagnostic stream chunk", async () => {
- const cfg = { ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
+ const cfg = { ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
let canceled = false;
const body = new ReadableStream({
pull(controller) {
@@ -316,7 +323,7 @@ describe("registerOrbRelayTarget", () => {
});
it("stream-reads at most the relay registration diagnostic cap and cancels the remainder", async () => {
- const cfg = { ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
+ const cfg = { ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
let pulls = 0;
let canceled = false;
const boundedJson = '{"error":"bounded_broker_error"}';
@@ -348,7 +355,7 @@ describe("registerOrbRelayTargetWithRetry", () => {
it("attempts, marks registered on success, and never attempts again", async () => {
const state = createOrbRelayRegistrationState();
const { fetchImpl, calls } = captureFetch(new Response("ok"));
- const cfg = { ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
+ const cfg = { ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
const first = await registerOrbRelayTargetWithRetry(cfg, state, 1_000, fetchImpl);
expect(first).toEqual({ status: "registered" });
@@ -361,7 +368,7 @@ describe("registerOrbRelayTargetWithRetry", () => {
it("backs off after a failure and only retries once the backoff window elapses", async () => {
const state = createOrbRelayRegistrationState();
- const cfg = { ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
+ const cfg = { ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
const failThenSucceed = (async () => new Response("no", { status: 500 })) as typeof fetch;
const first = await registerOrbRelayTargetWithRetry(cfg, state, 0, failThenSucceed);
@@ -391,7 +398,7 @@ describe("registerOrbRelayTargetWithRetry", () => {
it("passes through a skipped result from the underlying attempt (e.g. push mode with no public origin) without arming backoff", async () => {
const state = createOrbRelayRegistrationState();
- const result = await registerOrbRelayTargetWithRetry({ ORB_ENROLLMENT_SECRET: "s" }, state, 500);
+ const result = await registerOrbRelayTargetWithRetry({ ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s" }, state, 500);
expect(result).toEqual({ status: "skipped" });
// skipped still counts as an attempt (it went through the backoff gate), but never registers.
expect(state.registered).toBe(false);
@@ -402,7 +409,7 @@ describe("registerOrbRelayTargetWithRetry", () => {
it("grows the consecutive-failure streak across repeated failures and resets it to 0 on the next success", async () => {
const state = createOrbRelayRegistrationState();
- const cfg = { ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
+ const cfg = { ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
const failing = (async () => new Response("no", { status: 500 })) as typeof fetch;
let nowMs = 0;
@@ -423,7 +430,7 @@ describe("registerOrbRelayTargetWithRetry", () => {
it("counts a thrown fetch (not just a non-ok response) towards the consecutive-failure streak", async () => {
const state = createOrbRelayRegistrationState();
- const cfg = { ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
+ const cfg = { ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s", PUBLIC_API_ORIGIN: "https://me.example" };
const throwing = (async () => {
throw new Error("network down");
}) as typeof fetch;
@@ -451,12 +458,12 @@ describe("drainOrbRelay (pull-mode drain)", () => {
],
}),
);
- const out = await drainOrbRelay({ ORB_ENROLLMENT_SECRET: "s" }, ["prev-1"], fetchImpl);
+ const out = await drainOrbRelay({ ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s" }, ["prev-1"], fetchImpl);
expect(out).toEqual([
{ deliveryId: "d1", eventName: "pull_request", rawBody: "{\"a\":1}", kind: "config_push" },
{ deliveryId: "d2", eventName: "check_suite", rawBody: "{}", kind: "github_webhook" }, // #7523 fallback
]);
- expect(calls[0]?.url).toBe("https://api.loopover.ai/v1/orb/relay/pull");
+ expect(calls[0]?.url).toBe("https://broker.example/v1/orb/relay/pull");
expect((calls[0]?.init?.headers as Record).authorization).toBe("Bearer s");
expect(JSON.parse(String(calls[0]?.init?.body))).toEqual({ ack: ["prev-1"] });
expect(counterValue("loopover_orb_relay_malformed_events_total")).toBe(1);
@@ -467,13 +474,13 @@ describe("drainOrbRelay (pull-mode drain)", () => {
});
it("tolerates a missing events array (?? [] arm)", async () => {
- expect(await drainOrbRelay({ ORB_ENROLLMENT_SECRET: "s" }, [], (async () => Response.json({})) as typeof fetch)).toEqual([]);
+ expect(await drainOrbRelay({ ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s" }, [], (async () => Response.json({})) as typeof fetch)).toEqual([]);
});
it("throws on non-ok / thrown / unsafe-URL so the monitor does not record false progress", async () => {
- await expect(drainOrbRelay({ ORB_ENROLLMENT_SECRET: "s" }, [], (async () => new Response("no", { status: 403 })) as typeof fetch)).rejects.toThrow("orb_relay_drain_http_403");
- await expect(drainOrbRelay({ ORB_ENROLLMENT_SECRET: "s" }, [], (async () => { throw new Error("down"); }) as typeof fetch)).rejects.toThrow("down");
+ await expect(drainOrbRelay({ ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s" }, [], (async () => new Response("no", { status: 403 })) as typeof fetch)).rejects.toThrow("orb_relay_drain_http_403");
+ await expect(drainOrbRelay({ ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s" }, [], (async () => { throw new Error("down"); }) as typeof fetch)).rejects.toThrow("down");
await expect(drainOrbRelay({ ORB_ENROLLMENT_SECRET: "s", ORB_BROKER_URL: "http://broker.example" }, [], (async () => { throw new Error("unsafe should not fetch"); }) as typeof fetch)).rejects.toThrow(/must use https/);
- await expect(drainOrbRelay({ ORB_ENROLLMENT_SECRET: "s" }, [], (async () => Promise.reject("down")) as typeof fetch)).rejects.toThrow("orb_relay_drain_failed");
+ await expect(drainOrbRelay({ ORB_BROKER_URL: BROKER, ORB_ENROLLMENT_SECRET: "s" }, [], (async () => Promise.reject("down")) as typeof fetch)).rejects.toThrow("orb_relay_drain_failed");
});
});
diff --git a/test/unit/orb-hosted-webhook-secret.test.ts b/test/unit/orb-hosted-webhook-secret.test.ts
index 66095da9f7..8b1e5eeab4 100644
--- a/test/unit/orb-hosted-webhook-secret.test.ts
+++ b/test/unit/orb-hosted-webhook-secret.test.ts
@@ -5,6 +5,9 @@
import { beforeEach, describe, expect, it } from "vitest";
import { resetHostedWebhookSecretCacheForTests, resolveOrbWebhookSecret } from "../../src/orb/hosted-webhook-secret";
+/** ORB_BROKER_URL has no default since the hosted broker retired, so every exchange here names one. */
+const BROKER = "https://broker.example";
+
function captureFetch(handler: (url: string) => Response | Promise): { fetchImpl: typeof fetch; calls: string[] } {
const calls: string[] = [];
const fetchImpl = (async (url: RequestInfo | URL) => {
@@ -46,10 +49,10 @@ describe("resolveOrbWebhookSecret", () => {
Response.json({ secretValue: JSON.stringify({ database: { host: "h" }, orbWebhookSecret: "whsec_brokered" }), secretType: "tenant_db_credential" }),
);
- const secret = await resolveOrbWebhookSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "orbsec_tenant" }, fetchImpl);
+ const secret = await resolveOrbWebhookSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "orbsec_tenant" }, fetchImpl);
expect(secret).toBe("whsec_brokered");
- expect(calls).toEqual(["https://api.loopover.ai/v1/orb/token"]);
+ expect(calls).toEqual(["https://broker.example/v1/orb/token"]);
});
it("caches a successful resolution -- a second call never hits the broker again", async () => {
@@ -57,8 +60,8 @@ describe("resolveOrbWebhookSecret", () => {
Response.json({ secretValue: JSON.stringify({ database: {}, orbWebhookSecret: "whsec_cached" }) }),
);
- const first = await resolveOrbWebhookSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl);
- const second = await resolveOrbWebhookSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl);
+ const first = await resolveOrbWebhookSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl);
+ const second = await resolveOrbWebhookSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl);
expect(first).toBe("whsec_cached");
expect(second).toBe("whsec_cached");
@@ -72,8 +75,8 @@ describe("resolveOrbWebhookSecret", () => {
});
const { fetchImpl, calls } = captureFetch(() => pendingResponse);
- const first = resolveOrbWebhookSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl);
- const second = resolveOrbWebhookSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl);
+ const first = resolveOrbWebhookSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl);
+ const second = resolveOrbWebhookSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl);
resolveResponse(Response.json({ secretValue: JSON.stringify({ database: {}, orbWebhookSecret: "whsec_concurrent" }) }));
expect(await first).toBe("whsec_concurrent");
@@ -90,8 +93,8 @@ describe("resolveOrbWebhookSecret", () => {
: Response.json({ secretValue: JSON.stringify({ database: {}, orbWebhookSecret: "whsec_recovered" }) });
});
- const first = await resolveOrbWebhookSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl);
- const second = await resolveOrbWebhookSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl);
+ const first = await resolveOrbWebhookSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl);
+ const second = await resolveOrbWebhookSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl);
expect(first).toBeUndefined(); // fails closed, matching handleOrbWebhook's own convention -- never throws
expect(second).toBe("whsec_recovered");
@@ -101,7 +104,7 @@ describe("resolveOrbWebhookSecret", () => {
it("resolves to undefined (fails closed) when the bundled payload is not valid JSON", async () => {
const { fetchImpl } = captureFetch(() => Response.json({ secretValue: "not json at all" }));
- const secret = await resolveOrbWebhookSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl);
+ const secret = await resolveOrbWebhookSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl);
expect(secret).toBeUndefined();
});
@@ -109,7 +112,7 @@ describe("resolveOrbWebhookSecret", () => {
it("resolves to undefined (fails closed) when the bundled payload has no orbWebhookSecret (e.g. an AMS tenant's own bundle)", async () => {
const { fetchImpl } = captureFetch(() => Response.json({ secretValue: JSON.stringify({ database: { host: "h" } }) }));
- const secret = await resolveOrbWebhookSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl);
+ const secret = await resolveOrbWebhookSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl);
expect(secret).toBeUndefined();
});
@@ -117,17 +120,26 @@ describe("resolveOrbWebhookSecret", () => {
it("resolves to undefined (fails closed) when the bundled orbWebhookSecret is present but not a string", async () => {
const { fetchImpl } = captureFetch(() => Response.json({ secretValue: JSON.stringify({ orbWebhookSecret: 12345 }) }));
- const secret = await resolveOrbWebhookSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl);
+ const secret = await resolveOrbWebhookSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl);
expect(secret).toBeUndefined();
});
+ it("resolves to undefined (fails closed) with no network call when a token is set but ORB_BROKER_URL is not", async () => {
+ const { fetchImpl, calls } = captureFetch(() => {
+ throw new Error("fetch should never be called without a broker to call");
+ });
+
+ await expect(resolveOrbWebhookSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl)).resolves.toBeUndefined();
+ expect(calls).toEqual([]);
+ });
+
it("resolves to undefined (fails closed), never throws, when the broker itself is unreachable", async () => {
const fetchImpl = (async () => {
throw new Error("network down");
}) as typeof fetch;
- await expect(resolveOrbWebhookSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl)).resolves.toBeUndefined();
+ await expect(resolveOrbWebhookSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl)).resolves.toBeUndefined();
});
it("resolves to undefined (fails closed), never throws, when a non-Error value is thrown (defensive ?? branch)", async () => {
@@ -137,17 +149,17 @@ describe("resolveOrbWebhookSecret", () => {
throw "not an Error instance";
}) as typeof fetch;
- await expect(resolveOrbWebhookSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl)).resolves.toBeUndefined();
+ await expect(resolveOrbWebhookSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl)).resolves.toBeUndefined();
});
it("resetHostedWebhookSecretCacheForTests clears a cached value so the NEXT call re-exchanges (test hygiene)", async () => {
const { fetchImpl, calls } = captureFetch(() => Response.json({ secretValue: JSON.stringify({ orbWebhookSecret: "whsec_a" }) }));
- await resolveOrbWebhookSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl);
+ await resolveOrbWebhookSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl);
expect(calls.length).toBe(1);
resetHostedWebhookSecretCacheForTests();
- await resolveOrbWebhookSecret({ LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl);
+ await resolveOrbWebhookSecret({ ORB_BROKER_URL: BROKER, LOOPOVER_TENANT_SECRET_TOKEN: "t" }, fetchImpl);
expect(calls.length).toBe(2);
});
});
diff --git a/test/unit/selfhost-monitored-work.test.ts b/test/unit/selfhost-monitored-work.test.ts
index fddbd40dc8..e18bb647f3 100644
--- a/test/unit/selfhost-monitored-work.test.ts
+++ b/test/unit/selfhost-monitored-work.test.ts
@@ -357,7 +357,7 @@ describe("self-host monitored recurring work", () => {
await expect(
drainOrbRelayWithMonitor({
state,
- relayEnv: { ORB_ENROLLMENT_SECRET: "s" },
+ relayEnv: { ORB_ENROLLMENT_SECRET: "s", ORB_BROKER_URL: "https://orb.example" },
env: {} as Env,
drain: (relayEnv, ack) => drainOrbRelay(relayEnv, ack, (async () => new Response("down", { status: 503 })) as typeof fetch),
enqueue: vi.fn(),
diff --git a/test/unit/selfhost-preflight.test.ts b/test/unit/selfhost-preflight.test.ts
index 915b9c5c11..52820f2b11 100644
--- a/test/unit/selfhost-preflight.test.ts
+++ b/test/unit/selfhost-preflight.test.ts
@@ -1,5 +1,7 @@
import { generateKeyPairSync } from "node:crypto";
+import { MISSING_ORB_BROKER_URL_MESSAGE } from "@loopover/contract/orb-broker";
+
import {
assertSelfHostPreflight,
formatSelfHostPreflightError,
@@ -75,10 +77,20 @@ describe("self-host environment preflight (#2080)", () => {
preflightEnv({
REDIS_URL: "redis://redis:6379",
ORB_ENROLLMENT_SECRET: "orb-secret",
+ ORB_BROKER_URL: "https://broker.example",
}),
).toEqual({ ok: true, problems: [] });
});
+ it("requires ORB_BROKER_URL with an Orb broker enrollment, since the hosted broker it defaulted to is retired", () => {
+ expect(
+ preflightEnv({
+ REDIS_URL: "redis://redis:6379",
+ ORB_ENROLLMENT_SECRET: "orb-secret",
+ }),
+ ).toEqual({ ok: false, problems: [{ var: "ORB_BROKER_URL", message: MISSING_ORB_BROKER_URL_MESSAGE }] });
+ });
+
it("requires PUBLIC_API_ORIGIN to be a parseable bare HTTPS origin", () => {
for (const PUBLIC_API_ORIGIN of [
"not-a-url",