From 0715b893a87e1be99cff635da2fb1e7bcf922781 Mon Sep 17 00:00:00 2001 From: hermes-agent Date: Sun, 20 Sep 2026 12:28:25 +0200 Subject: [PATCH 1/2] test: repair smoke suite after upstream sync (no telemetry command, optional catalog, stateless provider-add checks) Post-merge (PR #7/#9) the Source verification workflow failed test:smoke on all platforms (9 failures). Three root causes: 1. 'shared user config' probed 'mcode telemetry status', removed by the fork's telemetry-removal commit; the top-level [prompt] argument then swallowed 'status' ('too many arguments'). Probe via 'provider list --json' instead and keep the no-migration assertion (~/.minimax-code untouched). The config fixture moves off telemetry: keys, which this distribution does not parse. 2. Offline proxy children asserted a models.dev request lands in the '.managed' audit log. The catalog request is optional: with the fork's default-deny egress guard installed the ProxyAgent connect path is denied and the CLI keeps a cached catalog, so the file never exists. Adopt upstream ec38e13 (state-independent proxy assertions, NO_PROXY coverage added). 3. 'provider add' asserted no config.yaml is created, but startup seeds defaults (logLevel/defaultModel) in the fixture cwd. Adopt upstream ec38e13's replacement: data dir separated from cwd, both fresh and seeded variants, assert no custom_provider is persisted. Local: node --test test/smoke.test.mjs -> 21 tests, 20 pass, 1 skip (macOS-only chflags test), 0 fail. --- test/smoke.test.mjs | 73 ++++++++++++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 27 deletions(-) diff --git a/test/smoke.test.mjs b/test/smoke.test.mjs index c877de87b..db50766f9 100644 --- a/test/smoke.test.mjs +++ b/test/smoke.test.mjs @@ -6,6 +6,7 @@ import { tmpdir } from "node:os"; import path from "node:path"; import { fileURLToPath } from "node:url"; import Database from "better-sqlite3"; +import { parse as parseYaml } from "yaml"; import { withoutProxyEnvironment } from "./offline-environment.mjs"; const root = fileURLToPath(new URL("../", import.meta.url)); @@ -72,8 +73,8 @@ test("CLI defaults to the shared user config without migrating the old source di const config = path.join(home, ".minimax", "config.yaml"); const oldConfig = path.join(home, ".minimax-code", "config.yaml"); for (const file of [config, oldConfig]) mkdirSync(path.dirname(file)); - writeFileSync(config, "telemetry:\n enabled: true\n", { mode: 0o600 }); - const oldContents = "telemetry:\n enabled: false\n"; + writeFileSync(config, "logLevel: info\n", { mode: 0o600 }); + const oldContents = "logLevel: debug\n"; writeFileSync(oldConfig, oldContents, { mode: 0o600 }); for (const name of Object.keys(options.env)) { if (name.startsWith("__MAVIS_RUNTIME")) delete options.env[name]; @@ -83,17 +84,20 @@ test("CLI defaults to the shared user config without migrating the old source di Object.assign(options.env, { HOME: home, USERPROFILE: home, - MCODE_DISABLE_TELEMETRY: "1", }); - const result = spawnSync(process.execPath, [cli, "telemetry", "status"], { + // Fork adaptation: this distribution ships no telemetry subsystem, so the + // upstream `mcode telemetry status` probe does not exist here. Probe the + // same shared-config resolution through `provider list --json`, which must + // read ~/.minimax/config.yaml and never migrate ~/.minimax-code. + const result = spawnSync(process.execPath, [cli, "provider", "list", "--json"], { ...options, encoding: "utf8", timeout: runtimeTimeoutMs, }); assertSuccessfulChild(result); - const status = JSON.parse(result.stdout); - assert.equal(status.configFile, config); - assert.equal(status.configured, true); + const listing = JSON.parse(result.stdout); + assert.ok(Array.isArray(listing.providers), result.stdout); + assert.equal(readFileSync(config, "utf8"), "logLevel: info\n"); assert.equal(readFileSync(oldConfig, "utf8"), oldContents); }); test("provider configuration loads from an isolated data directory", (t) => { @@ -167,18 +171,22 @@ test("offline smoke children ignore ambient proxy variables", async (t) => { "HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY", + "NO_PROXY", "http_proxy", "https_proxy", "all_proxy", + "no_proxy", ]; for (const name of proxyNames) { await t.test(name, (t) => { - const environment = { + const proxyValue = name.toLowerCase() === "no_proxy" ? "*" : "http://127.0.0.1:9"; + const environment = Object.freeze({ ...process.env, ...Object.fromEntries(proxyNames.map((key) => [key, ""])), - [name]: "http://127.0.0.1:9", - }; + [name]: proxyValue, + }); const options = fixture(t, environment); + for (const key of proxyNames) assert.equal(options.env[key], ""); const result = spawnSync(process.execPath, [cli, "provider", "list"], { ...options, encoding: "utf8", @@ -186,11 +194,8 @@ test("offline smoke children ignore ambient proxy variables", async (t) => { }); assertSuccessfulChild(result); assert.match(result.stdout, /minimax/); - assert.match( - readFileSync(options.env.MCODE_TEST_NETWORK_AUDIT + ".managed", "utf8"), - /https:\/\/models\.dev\/api\.json|\/mavis\/api\/v1\/models-dev\/catalog/, - ); - assert.equal(environment[name], "http://127.0.0.1:9"); + // Catalog requests are optional; the fixture still rejects any real network access. + assert.equal(environment[name], proxyValue); }); } }); @@ -327,21 +332,35 @@ test("local plugin browsing remains available with managed services offline", (t } }); -test("provider add validates token limits before opening the runtime", (t) => { - const options = fixture(t); +test("provider add rejects invalid token limits without saving a provider", async (t) => { const args = [ "provider", "add", "--name", "Invalid limits", "--base-url", "http://127.0.0.1:1/v1", "--model", "synthetic-model", ]; - for (const flag of ["--context-limit", "--output-limit"]) { - for (const value of ["0", "-1", "1.5", "NaN", "Infinity", "9007199254740992"]) { - const result = spawnSync(process.execPath, [cli, ...args, `${flag}=${value}`], { - ...options, encoding: "utf8", timeout: 15000, - }); - assert.equal(result.status, 1, result.stderr); - assert.match(result.stderr, /positive safe integer/); - assert.ok(result.stderr.includes(flag), result.stderr); - } + for (const seeded of [false, true]) { + await t.test(seeded ? "default config already exists" : "fresh data directory", (t) => { + const options = fixture(t); + // Keep data separate from cwd so assertions must use the CLI's config location. + const dataDir = path.join(options.cwd, "data"); + mkdirSync(dataDir); + options.env.MINIMAX_DATA_DIR = dataDir; + options.env.MAVIS_DATA_DIR = dataDir; + const configPath = path.join(dataDir, "config.yaml"); + if (seeded) writeFileSync(configPath, "logLevel: info\ndefaultModel: minimax/MiniMax-M3\n", { mode: 0o600 }); + for (const flag of ["--context-limit", "--output-limit"]) { + for (const value of ["0", "-1", "1.5", "NaN", "Infinity", "9007199254740992"]) { + const result = spawnSync(process.execPath, [cli, ...args, `${flag}=${value}`], { + ...options, encoding: "utf8", timeout: 15000, + }); + assert.equal(result.error, undefined, result.stderr); + assert.equal(result.status, 1, result.stderr); + assert.match(result.stderr, /positive safe integer/); + assert.ok(result.stderr.includes(flag), result.stderr); + // Startup may seed defaults; only persisting a custom provider is a failure. + const config = existsSync(configPath) ? parseYaml(readFileSync(configPath, "utf8")) : {}; + assert.deepEqual(config?.custom_provider ?? {}, {}); + } + } + }); } - assert.equal(existsSync(path.join(options.cwd, "config.yaml")), false); }); From 0d1249e0f49930690f8341f6736ba236980dd273 Mon Sep 17 00:00:00 2001 From: hermes-agent Date: Sun, 20 Sep 2026 13:04:16 +0200 Subject: [PATCH 2/2] test: drop optional managed-catalog assertion from offline BYOK children MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test:byok failed on all three platforms since the e26 sync (PR #9 brought upstream #172's 'offline BYOK ignores ambient proxies' group): each subtest reads network-audit.log.managed and expects a models.dev / models-dev catalog request to have been logged. On this fork the request never reaches the offline fixture: the CLI entry point installs the default-deny egress guard (PR #1/#4) before any product module loads, and the catalog descriptor lives on an always-refused managed host (agent.minimax.*). The guard rejects in-process, so the fixture's .managed log is never created (ENOENT). Upstream passes because its CLI has no guard and its network-deny fixture logs the attempt. Upstream itself ruled this assertion unreliable in ec38e13 ('Catalog requests are optional'). Keep the meaningful assertions — the local provider must still receive the request and the strict deny-log must stay empty — and drop only the managed-catalog delta. Local: MCODE_TEST_MANAGED_OFFLINE byok suite -> 11 tests, 11 pass, 0 fail. --- test/byok.test.mjs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/byok.test.mjs b/test/byok.test.mjs index 64dba7eed..b9fd5e4b3 100644 --- a/test/byok.test.mjs +++ b/test/byok.test.mjs @@ -271,17 +271,15 @@ test( for (const name of proxyNames) assert.equal(isolated[name], ""); assert.equal(isolated.PATH, environment.PATH); const beforeRequests = requests.length; - const managedAudit = `${networkAudit}.managed`; - const beforeManaged = readFileSync(managedAudit, "utf8").length; await run([ "provider", "test", selected.providerId, "--model", "fixture-model", ], environment); assert.ok(requests.length > beforeRequests, "The local provider must receive the request"); assert.equal(requests[beforeRequests].body.model, "fixture-model"); - assert.match( - readFileSync(managedAudit, "utf8").slice(beforeManaged), - /https:\/\/models\.dev\/api\.json|\/mavis\/api\/v1\/models-dev\/catalog/, - ); + // Fork adaptation: the default-deny egress guard refuses managed-service + // hosts before the offline fixture can log a managed catalog attempt, and + // that catalog request is optional (upstream ec38e13). Only the strict + // deny-log assertion remains meaningful here. assert.equal(existsSync(networkAudit), false, "No outbound network attempt is allowed"); for (const [name, value] of Object.entries(proxies)) assert.equal(environment[name], value); });