mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 04:12:10 +03:00
* chore(ci): add .mergify.yml to main — Mergify only reads config from the default branch (#7168)
* fix(ci): add the auto-enqueue pull_request_rule to the Mergify config (queue_conditions alone are eligibility-only) (#7179)
* fix(ci): migrate Mergify auto-enqueue to merge_protections_settings.auto_merge_conditions (rules-based path is EOL 2026-07-16) (#7216)
* fix(ci): drop Mergify batch settings (batching is a paid-tier feature; free plan queue is serial) (#7220)
* fix(ci): merge queue tolerates the advisory dast-smoke failure (its GH-hosted build hang dequeued every attempt) (#7225)
* test(ci): make the #6634 selfref guard hermetic — main's copy hard-fails every PR (#7341)
main's copy of this test still does git I/O inside a unit test:
const baseSrc = git(['show', 'origin/main:' + FILE]);
Runners check out a shallow single ref, so origin/main does not resolve and the
test dies with 'fatal: invalid object name origin/main'. Every PR into main
fails Unit Tests (7/8) on it — today that is #7313, #7315, #7316, #7334, #7336
and #7337, six PRs red on a defect none of them introduced. #7313 has no other
red at all.
release/v3.8.49 already carries a fix (2e42b8efc, #7174: try/catch, fetch
origin/main on demand, t.skip() when unreachable), but it only reaches main at
release time — so main stays broken for the whole cycle. Cherry-picking it would
also import a new problem: PR Test Policy classifies t.skip() as a silenced
assertion, which we watched it correctly catch on #7300 today.
This is the hermetic version instead (ported from #7327, which does the same for
the release branch): read the file straight off disk, compare against an empty
base so baseTaut/baseExtTaut are 0 — the strictest possible comparison point —
and call evaluateMasking() directly. No git ref, no fetch, no skip, nothing the
runner's checkout depth can break.
The #6634 regression stays covered: the guard's logic lives in
SELF_TEST_FIXTURE_RE (check-test-masking.mjs:337), not in the test. Proven both
ways on main before committing — neutralise SELF_TEST_FIXTURE_RE to /$^/ and
the test FAILS; restore it and it passes 2/2, with check-test-masking.mjs left
byte-identical.
Co-authored-by: growab <nekron@icloud.com>
* chore(quality): tighten main's coverage baseline to the CI's real numbers (#7347)
main's ratchet had been failing --require-tighten on every PR: 11 metrics
improved but the baseline was never tightened. Same class as the #6634
selfref guard — an infra fix that lands only on the release branch leaves
main red for the whole cycle, and every PR into main pays for it.
Values are the merged-coverage numbers from a run on main itself (a local
run measures ~68% vs CI's ~80%; the baseline's own note warns about that
gap). Only the 11 coverage values change — gitleaks and semgrepFindings
keep main's own state.
No changelog fragment: #7326 carries it on release/v3.8.49, and a second
one here would double the entry at release time.
* feat(providers): add xAI OAuth PKCE
* docs(changelog): note xAI OAuth provider
* test(xai): assert OAuth refresh client id
* refactor(oauth): rebaseline OAuthModal wiring note (file-size cap)
Correct the file-size-baseline.json annotation for the xai-oauth PKCE
provider-switch branch in OAuthModal.tsx (993->998, +5) to match the
modal's existing historical-progression annotation style (969->989->
993->998; structural shrink tracked in #3501). The frozen value (998)
stays unchanged — only the annotation text is corrected.
tests/unit/oauth-providers-config.test.ts already sits exactly at its
frozen cap (845) after registering xai-oauth in the shared provider
enumerations (import, EXPECTED_PROVIDER_KEYS, EXPECTED_CONFIG_BY_PROVIDER,
REQUIRED_FIELDS_BY_PROVIDER). check:file-size reports 0 violations for
it, so no test move or baseline bump was needed.
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
* test(oauth): compact required-field arrays (file-size budget on frozen oauth-providers-config suite)
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
---------
Co-authored-by: Diego Rodrigues de Sa e Souza <8016841+diegosouzapw@users.noreply.github.com>
Co-authored-by: growab <nekron@icloud.com>
Co-authored-by: alexey.nazarov@softmg.ru <alexey.nazarov@softmg.ru>
Co-authored-by: Alex <4217955+fenix007@users.noreply.github.com>
119 lines
4.8 KiB
TypeScript
119 lines
4.8 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import { XaiExecutor } from "../../open-sse/executors/xai.ts";
|
|
import { getExecutor, hasSpecializedExecutor } from "../../open-sse/executors/index.ts";
|
|
import { xaiProvider } from "../../open-sse/config/providers/registry/xai/index.ts";
|
|
|
|
// Real xai catalog ids (open-sse/config/providers/registry/xai/index.ts):
|
|
// grok-4.3 — plain, reasoning-capable
|
|
// grok-build-0.1 — build/tool model, no reasoning mode
|
|
// grok-4.20-multi-agent-0309 — neutral (not in either allow/deny list)
|
|
// grok-4.20-0309-reasoning — already encodes reasoning in the id
|
|
// grok-4.20-0309-non-reasoning — already encodes non-reasoning in the id
|
|
|
|
const credentials = { apiKey: "test-key" };
|
|
|
|
test("XaiExecutor is registered under the 'xai' key and set as the registry executor", () => {
|
|
assert.equal(hasSpecializedExecutor("xai"), true);
|
|
assert.ok(getExecutor("xai") instanceof XaiExecutor);
|
|
assert.equal(xaiProvider.executor, "xai");
|
|
});
|
|
|
|
test("XaiExecutor can target the separate xAI OAuth provider config", () => {
|
|
const executor = new XaiExecutor("xai-oauth");
|
|
assert.equal(executor.getProvider(), "xai-oauth");
|
|
assert.equal(executor.buildUrl("grok-4.5", false), "https://api.x.ai/v1/chat/completions");
|
|
});
|
|
|
|
test("strips a -{level} suffix from an allow-listed model and sets reasoning_effort", () => {
|
|
const executor = new XaiExecutor();
|
|
|
|
for (const level of ["low", "medium", "high", "xhigh"] as const) {
|
|
const body = { model: `grok-4.3-${level}`, messages: [] };
|
|
const out = executor.transformRequest(`grok-4.3-${level}`, body, false, credentials) as Record<
|
|
string,
|
|
unknown
|
|
>;
|
|
assert.equal(out.model, "grok-4.3", `level=${level} should strip suffix from model id`);
|
|
assert.equal(out.reasoning_effort, level, `level=${level} should set reasoning_effort`);
|
|
}
|
|
});
|
|
|
|
test("suffix parsing also applies to the explicit -reasoning variant without double-mutating it", () => {
|
|
const executor = new XaiExecutor();
|
|
const body = { model: "grok-4.20-0309-reasoning-high", messages: [] };
|
|
const out = executor.transformRequest(
|
|
"grok-4.20-0309-reasoning-high",
|
|
body,
|
|
false,
|
|
credentials
|
|
) as Record<string, unknown>;
|
|
|
|
assert.equal(out.model, "grok-4.20-0309-reasoning");
|
|
assert.equal(out.reasoning_effort, "high");
|
|
});
|
|
|
|
test("strips reasoning_effort for a deny-listed model (grok-build-0.1)", () => {
|
|
const executor = new XaiExecutor();
|
|
const body = { model: "grok-build-0.1", reasoning_effort: "high", messages: [] };
|
|
const out = executor.transformRequest("grok-build-0.1", body, false, credentials) as Record<
|
|
string,
|
|
unknown
|
|
>;
|
|
|
|
assert.equal(out.model, "grok-build-0.1");
|
|
assert.equal(out.reasoning_effort, undefined);
|
|
});
|
|
|
|
test("strips reasoning_effort for the explicit -non-reasoning variant (already encodes reasoning state)", () => {
|
|
const executor = new XaiExecutor();
|
|
const body = {
|
|
model: "grok-4.20-0309-non-reasoning",
|
|
reasoning_effort: "high",
|
|
messages: [],
|
|
};
|
|
const out = executor.transformRequest(
|
|
"grok-4.20-0309-non-reasoning",
|
|
body,
|
|
false,
|
|
credentials
|
|
) as Record<string, unknown>;
|
|
|
|
assert.equal(out.model, "grok-4.20-0309-non-reasoning");
|
|
assert.equal(out.reasoning_effort, undefined);
|
|
});
|
|
|
|
test("leaves a plain, unlisted model id and body unchanged (no suffix, not allow/deny listed)", () => {
|
|
const executor = new XaiExecutor();
|
|
const body = { model: "grok-4.20-multi-agent-0309", messages: [{ role: "user", content: "hi" }] };
|
|
const out = executor.transformRequest(
|
|
"grok-4.20-multi-agent-0309",
|
|
body,
|
|
false,
|
|
credentials
|
|
) as Record<string, unknown>;
|
|
|
|
assert.equal(out.model, "grok-4.20-multi-agent-0309");
|
|
assert.equal(out.reasoning_effort, undefined);
|
|
assert.deepEqual(out.messages, body.messages);
|
|
});
|
|
|
|
// Port of decolua/9router#2439 (author: @ryanngit): xAI ships a native
|
|
// `/v1/responses` endpoint. grok-4.20-multi-agent-0309 is tagged
|
|
// targetFormat: "openai-responses" in the registry (upstream's own tag) — it
|
|
// must resolve to xAI's native Responses URL, not the chat-completions
|
|
// bridge, mirroring the gh executor's targetFormat-driven routing (9router#102)
|
|
// and the "openai" -pro heuristic in open-sse/executors/default.ts.
|
|
test("XaiExecutor.buildUrl routes the Responses-tagged model (grok-4.20-multi-agent-0309) to xAI's native /v1/responses endpoint", () => {
|
|
const executor = new XaiExecutor();
|
|
const url = executor.buildUrl("grok-4.20-multi-agent-0309", true);
|
|
assert.equal(url, "https://api.x.ai/v1/responses");
|
|
});
|
|
|
|
test("XaiExecutor.buildUrl keeps a plain chat model (grok-4.3) on /v1/chat/completions", () => {
|
|
const executor = new XaiExecutor();
|
|
const url = executor.buildUrl("grok-4.3", true);
|
|
assert.equal(url, "https://api.x.ai/v1/chat/completions");
|
|
});
|