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>
84 lines
2.6 KiB
JavaScript
84 lines
2.6 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Phase 2: compare provider message sanitize unit tests (v1.41 baseline vs v1.49).
|
|
*/
|
|
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 v141Root =
|
|
process.env.GOOSED_V141_ROOT || '/Users/john/Project/tkmind_go-v141-prod-prep';
|
|
|
|
function runSanitizeTests(root, label) {
|
|
if (!fs.existsSync(root)) {
|
|
return { label, ok: false, skipped: true, reason: `missing worktree: ${root}` };
|
|
}
|
|
const result = spawnSync(
|
|
'cargo',
|
|
['test', '-p', 'goose-providers', 'sanitize', '--quiet', '--', '--nocapture'],
|
|
{
|
|
cwd: root,
|
|
encoding: 'utf8',
|
|
env: process.env,
|
|
},
|
|
);
|
|
const output = `${result.stdout ?? ''}${result.stderr ?? ''}`.trim();
|
|
const match = output.match(/test result: ok\. (\d+) passed/);
|
|
const passed = match ? Number(match[1]) : null;
|
|
return {
|
|
label,
|
|
root,
|
|
ok: result.status === 0,
|
|
passed,
|
|
output: output.split('\n').slice(-6).join('\n'),
|
|
};
|
|
}
|
|
|
|
function main() {
|
|
const v149 = runSanitizeTests(v149Root, 'v1.49');
|
|
const v141 = runSanitizeTests(v141Root, 'v1.41');
|
|
|
|
if (v149.skipped) {
|
|
throw new Error(v149.reason);
|
|
}
|
|
if (!v149.ok || v149.passed == null) {
|
|
throw new Error(`v1.49 sanitize tests failed:\n${v149.output}`);
|
|
}
|
|
|
|
const outputDir = path.join(memindRoot, 'docs', 'baselines');
|
|
fs.mkdirSync(outputDir, { recursive: true });
|
|
const evidencePath = path.join(outputDir, 'goose-v149-message-sanitize-latest.json');
|
|
const evidence = {
|
|
schemaVersion: 'goose-v149-message-sanitize-v1',
|
|
capturedAt: new Date().toISOString(),
|
|
v149: { passed: v149.passed, root: v149Root },
|
|
v141: v141.skipped
|
|
? { skipped: true, reason: v141.reason }
|
|
: { passed: v141.passed, ok: v141.ok, root: v141Root },
|
|
equivalent:
|
|
!v141.skipped
|
|
&& v141.ok
|
|
&& v141.passed != null
|
|
&& v141.passed === v149.passed,
|
|
};
|
|
fs.writeFileSync(evidencePath, `${JSON.stringify(evidence, null, 2)}\n`, 'utf8');
|
|
|
|
console.log(`GOOSE_V149_MESSAGE_SANITIZE_OK: v149=${v149.passed} passed`);
|
|
if (!v141.skipped) {
|
|
console.log(` v141=${v141.passed} passed equivalent=${evidence.equivalent}`);
|
|
} else {
|
|
console.log(` v141=skipped (${v141.reason})`);
|
|
}
|
|
console.log(` evidence=${evidencePath}`);
|
|
}
|
|
|
|
try {
|
|
main();
|
|
} catch (error) {
|
|
console.error(`GOOSE_V149_MESSAGE_SANITIZE_FAIL: ${error.message}`);
|
|
process.exit(1);
|
|
}
|