Files
memind/scripts/check-goosed-v149-thinking-preservation.mjs
T
john 716ef407fe feat(goose): add local v1.49 canary routing, smoke gates, and migration docs
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>
2026-09-08 21:10:20 +08:00

72 lines
2.3 KiB
JavaScript

#!/usr/bin/env node
/**
* Phase 2: run v1.49 agent integration tests for DeepSeek/Kimi reasoning preservation.
*/
import fs from 'node:fs';
import path from 'node:path';
import { spawnSync } from 'node:child_process';
import { fileURLToPath } from 'node:url';
const memindRoot = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
const v149Root = process.env.GOOSED_V149_ROOT || '/Users/john/Project/tkmind_go-v149';
const THINKING_TESTS = [
'test_deepseek_thinking_preserved_in_tool_call_message',
'test_kimi_thinking_preserved_in_tool_call_message',
'test_reasoning_preserved_when_combined_with_tool_call',
'test_multi_tool_response_preserves_reasoning_and_message_id_correlation',
];
function runTest(testName) {
const result = spawnSync(
'cargo',
['test', '--test', 'agent', testName, '--quiet', '--', '--nocapture'],
{
cwd: v149Root,
encoding: 'utf8',
env: process.env,
},
);
const output = `${result.stdout ?? ''}${result.stderr ?? ''}`.trim();
const passed = /test result: ok\. 1 passed/.test(output);
return { testName, ok: result.status === 0 && passed, output: output.split('\n').slice(-4).join('\n') };
}
function main() {
if (!fs.existsSync(v149Root)) {
throw new Error(`missing v1.49 worktree: ${v149Root}`);
}
const results = THINKING_TESTS.map(runTest);
const failed = results.filter((item) => !item.ok);
if (failed.length) {
const detail = failed.map((item) => `${item.testName}:\n${item.output}`).join('\n\n');
throw new Error(`thinking preservation tests failed:\n${detail}`);
}
const outputDir = path.join(memindRoot, 'docs', 'baselines');
fs.mkdirSync(outputDir, { recursive: true });
const evidencePath = path.join(outputDir, 'goose-v149-thinking-preservation-latest.json');
fs.writeFileSync(
evidencePath,
`${JSON.stringify({
schemaVersion: 'goose-v149-thinking-preservation-v1',
capturedAt: new Date().toISOString(),
worktree: v149Root,
tests: results.map((item) => item.testName),
passed: results.length,
}, null, 2)}\n`,
'utf8',
);
console.log(`GOOSE_V149_THINKING_PRESERVATION_OK: ${results.length} tests passed`);
console.log(` evidence=${evidencePath}`);
}
try {
main();
} catch (error) {
console.error(`GOOSE_V149_THINKING_PRESERVATION_FAIL: ${error.message}`);
process.exit(1);
}