e64cf52f23
Finish-sync guards now accept SEO/GEO disk enrichment instead of requiring byte-identical HTML, and fragment writes no longer duplicate doctype. Users canary mode keeps the full native pool while routing allowlisted identities to :18015 without overriding memory settings. Co-authored-by: Cursor <cursoragent@cursor.com>
72 lines
2.4 KiB
JavaScript
72 lines
2.4 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 keeps full pool and adds v149', () => {
|
|
const config = resolveGooseApiTargetsFromEnv({
|
|
TKMIND_GOOSE_CANARY: 'users',
|
|
TKMIND_GOOSE_CANARY_USER_IDS: 'user-1',
|
|
TKMIND_API_TARGETS: 'https://127.0.0.1:18006,https://127.0.0.1:18007,https://127.0.0.1:18008',
|
|
TKMIND_API_TARGET_V149: 'https://127.0.0.1:18015',
|
|
});
|
|
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:18007',
|
|
'https://127.0.0.1:18008',
|
|
'https://127.0.0.1:18015',
|
|
]);
|
|
});
|
|
|
|
test('resolveGooseTargetForIdentity routes canary users to v149 only', () => {
|
|
const config = resolveGooseApiTargetsFromEnv({
|
|
TKMIND_GOOSE_CANARY: 'users',
|
|
TKMIND_GOOSE_CANARY_USER_IDS: 'user-abc',
|
|
TKMIND_API_TARGET_V149: 'https://127.0.0.1:18015',
|
|
});
|
|
assert.equal(
|
|
resolveGooseTargetForIdentity({ id: 'user-abc' }, config),
|
|
'https://127.0.0.1:18015',
|
|
);
|
|
assert.equal(resolveGooseTargetForIdentity({ id: 'other-user' }, config), null);
|
|
});
|
|
|
|
test('assertLoopbackGooseTarget refuses production hosts', () => {
|
|
assert.throws(
|
|
() => assertLoopbackGooseTarget('https://114.85.107.50: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');
|
|
});
|