716ef407fe
Wire Portal and TKMind proxy to loopback Goose v1.49 via canary env blocks, with verification scripts, Phase 2/3 evidence baselines, and rollback runbooks so local upgrade stays isolated from stable 1.41 and production. Co-authored-by: Cursor <cursoragent@cursor.com>
67 lines
2.1 KiB
JavaScript
67 lines
2.1 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
|
|
import {
|
|
assertLoopbackGooseTarget,
|
|
describeGooseCanaryConfig,
|
|
parseGooseCanaryMode,
|
|
resolveGooseApiTargetsFromEnv,
|
|
resolveGooseTargetForIdentity,
|
|
} from './goose-v149-canary.mjs';
|
|
|
|
test('parseGooseCanaryMode defaults to off', () => {
|
|
assert.equal(parseGooseCanaryMode({}), 'off');
|
|
assert.equal(parseGooseCanaryMode({ TKMIND_GOOSE_CANARY: 'all' }), 'all');
|
|
});
|
|
|
|
test('resolveGooseApiTargetsFromEnv all mode pins Portal to v149', () => {
|
|
const config = resolveGooseApiTargetsFromEnv({
|
|
TKMIND_GOOSE_CANARY: 'all',
|
|
TKMIND_API_TARGET_STABLE: 'https://127.0.0.1:18006',
|
|
TKMIND_API_TARGET_V149: 'https://127.0.0.1:18049',
|
|
});
|
|
assert.equal(config.mode, 'all');
|
|
assert.equal(config.primary, 'https://127.0.0.1:18049');
|
|
assert.deepEqual(config.targets, ['https://127.0.0.1:18049']);
|
|
});
|
|
|
|
test('resolveGooseApiTargetsFromEnv users mode exposes dual targets', () => {
|
|
const config = resolveGooseApiTargetsFromEnv({
|
|
TKMIND_GOOSE_CANARY: 'users',
|
|
TKMIND_GOOSE_CANARY_USER_IDS: 'user-1',
|
|
});
|
|
assert.equal(config.mode, 'users');
|
|
assert.equal(config.primary, 'https://127.0.0.1:18006');
|
|
assert.deepEqual(config.targets, ['https://127.0.0.1:18006', 'https://127.0.0.1:18049']);
|
|
});
|
|
|
|
test('resolveGooseTargetForIdentity routes canary users to v149', () => {
|
|
const config = resolveGooseApiTargetsFromEnv({
|
|
TKMIND_GOOSE_CANARY: 'users',
|
|
TKMIND_GOOSE_CANARY_USER_IDS: 'user-abc',
|
|
});
|
|
assert.equal(
|
|
resolveGooseTargetForIdentity({ id: 'user-abc' }, config),
|
|
'https://127.0.0.1:18049',
|
|
);
|
|
assert.equal(
|
|
resolveGooseTargetForIdentity({ id: 'other-user' }, config),
|
|
'https://127.0.0.1:18006',
|
|
);
|
|
});
|
|
|
|
test('assertLoopbackGooseTarget refuses production hosts', () => {
|
|
assert.throws(
|
|
() => assertLoopbackGooseTarget('https://58.38.22.103:18006'),
|
|
/refuses production host/,
|
|
);
|
|
});
|
|
|
|
test('describeGooseCanaryConfig reports disabled when off', () => {
|
|
const summary = describeGooseCanaryConfig({
|
|
TKMIND_API_TARGET: 'https://127.0.0.1:18006',
|
|
});
|
|
assert.equal(summary.enabled, false);
|
|
assert.equal(summary.mode, 'off');
|
|
});
|