Files
OmniRoute/tests/unit/vertex-oauth-scopes.test.ts
Diego Rodrigues de Sa e Souza 81a37b67ed Release v3.8.26 (#3875)
OmniRoute v3.8.26 — see CHANGELOG.md [3.8.26] for the full notes.

Highlights: Vertex AI media generation (#3929), GLM-5.2 effort-tier routing (#3885),
sticky round-robin combos (#3846), OpenRouter connection presets (#3878), compression
prompt-cache fix (#3936/#3890), and a security pass (form-data/vite + workflow hardening, #3949).

Co-authored-by: artickc <artickc@users.noreply.github.com>
Co-authored-by: rdself <rdself@users.noreply.github.com>
Co-authored-by: herjarsa <herjarsa@users.noreply.github.com>
Co-authored-by: Jack Smith <16862258+YunyunZhai@users.noreply.github.com>
Co-authored-by: dhaern <dhaern@users.noreply.github.com>
Co-authored-by: adivekar-utexas <adivekar-utexas@users.noreply.github.com>
Co-authored-by: megamen32 <megamen32@users.noreply.github.com>
Co-authored-by: zhiru <zhiru@users.noreply.github.com>
Co-authored-by: insoln <insoln@users.noreply.github.com>
Co-authored-by: diego-anselmo <diego-anselmo@users.noreply.github.com>
2026-06-16 01:00:40 -03:00

32 lines
1.3 KiB
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
// #3922 — the Vertex SA access token must carry BOTH cloud-platform (chat/image
// execution on aiplatform.googleapis.com) AND generative-language.retriever
// (live model discovery on generativelanguage.googleapis.com). Dropping the
// second scope makes discovery return 403 ACCESS_TOKEN_SCOPE_INSUFFICIENT and
// silently fall back to the static ~10-model registry list. This guards both.
const { VERTEX_OAUTH_SCOPES } = await import("../../open-sse/executors/vertex.ts");
test("Vertex OAuth scopes include cloud-platform (execution)", () => {
assert.ok(
VERTEX_OAUTH_SCOPES.includes("https://www.googleapis.com/auth/cloud-platform"),
"cloud-platform scope is required for Vertex AI execution"
);
});
test("Vertex OAuth scopes include generative-language.retriever (discovery)", () => {
assert.ok(
VERTEX_OAUTH_SCOPES.includes("https://www.googleapis.com/auth/generative-language.retriever"),
"generative-language.retriever scope is required for live model discovery"
);
});
test("Vertex OAuth scopes serialize as a space-delimited string for the JWT", () => {
const serialized = VERTEX_OAUTH_SCOPES.join(" ");
assert.equal(
serialized,
"https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/generative-language.retriever"
);
});