Files
memind/scripts/goose-v149-real-llm-gate.test.mjs
T
john 67220a14ea fix(goose-v149): block unattended real LLM smokes by default
Prevent phase2/phase3/all reruns from burning DashScope tokens unless
GOOSE_V149_ALLOW_REAL_LLM=1 is explicitly set with human approval.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 22:08:39 +08:00

30 lines
1.0 KiB
JavaScript

import assert from 'node:assert/strict';
import test from 'node:test';
import {
applyRealLlmSkipDefaults,
isRealLlmAllowed,
realLlmGateMessage,
} from './goose-v149-real-llm-gate.mjs';
test('real LLM smokes blocked unless GOOSE_V149_ALLOW_REAL_LLM=1', () => {
assert.equal(isRealLlmAllowed({}), false);
assert.equal(isRealLlmAllowed({ GOOSE_V149_ALLOW_REAL_LLM: '1' }), true);
});
test('applyRealLlmSkipDefaults forces portal/page/resume skip when blocked', () => {
const env = applyRealLlmSkipDefaults({});
assert.equal(env.GOOSE_V149_PORTAL_SMOKE_SKIP, '1');
assert.equal(env.GOOSE_V149_PAGE_E2E_SKIP, '1');
assert.equal(env.GOOSE_V149_PORTAL_RESUME_SKIP, '1');
});
test('applyRealLlmSkipDefaults leaves skip flags unset when allowed', () => {
const env = applyRealLlmSkipDefaults({ GOOSE_V149_ALLOW_REAL_LLM: '1' });
assert.equal(env.GOOSE_V149_PORTAL_SMOKE_SKIP, undefined);
});
test('gate message mentions opt-in env', () => {
assert.match(realLlmGateMessage('test'), /GOOSE_V149_ALLOW_REAL_LLM=1/);
});