Files
memind/scripts/run-goosed-v149-phase3-offline.mjs
T
john 478c33376c
Memind CI / Test, build, and release guards (push) Has been cancelled
feat(context): add offline shadow profile and local dev gate
Provide context-runtime-profile simulation for gateway shadow events,
run-context-runtime-offline.mjs for zero-LLM verification, and a local
dev guide for user-led shadow self-tests later.

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

115 lines
3.3 KiB
JavaScript

#!/usr/bin/env node
/**
* Phase 3 offline closeout: unit tests + manifest drift only (no real LLM).
* Use when DashScope quota is exhausted or unattended smokes must stay blocked.
*
* Full portal/page/memory smokes still require:
* GOOSE_V149_ALLOW_REAL_LLM=1 node scripts/run-goosed-v149-phase3.mjs
*/
import { spawnSync } from 'node:child_process';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { prepareGooseV149CheckEnv } from './goose-v149-canary.mjs';
import { checkPassed, classifyCheckResult } from './goose-v149-check-result.mjs';
const root = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
const checkEnv = prepareGooseV149CheckEnv({ ...process.env }, root);
const checks = [
{
name: 'real-llm-gate-unit',
command: [process.execPath, '--test', 'scripts/goose-v149-real-llm-gate.test.mjs'],
required: true,
},
{
name: 'deepseek-parity',
command: [process.execPath, '--test', 'release-gate/deepseek-production-parity.test.mjs'],
required: true,
},
{
name: 'goose-canary-unit',
command: [process.execPath, '--test', 'scripts/goose-v149-canary.test.mjs'],
required: true,
},
{
name: 'memory-manifest-unit',
command: [process.execPath, '--test', 'scripts/compare-goose-v149-memory-manifest.test.mjs'],
required: true,
},
{
name: 'memory-drift',
script: 'compare-goose-v149-memory-manifest.mjs',
required: true,
},
{
name: 'memory-failopen',
script: 'check-goosed-v149-memory-failopen.mjs',
required: true,
},
{
name: 'context-runtime-offline',
script: 'run-context-runtime-offline.mjs',
required: true,
},
];
function runScript(script, extraEnv = {}) {
const result = spawnSync(process.execPath, [path.join(root, 'scripts', script)], {
cwd: root,
env: { ...checkEnv, ...extraEnv },
encoding: 'utf8',
});
return {
ok: checkPassed(result),
outcome: classifyCheckResult(result),
status: result.status,
stdout: result.stdout?.trim() ?? '',
stderr: result.stderr?.trim() ?? '',
};
}
function runCommand(command, extraEnv = {}) {
const [bin, ...args] = command;
const result = spawnSync(bin, args, {
cwd: root,
env: { ...checkEnv, ...extraEnv },
encoding: 'utf8',
});
return {
ok: checkPassed(result),
outcome: classifyCheckResult(result),
status: result.status,
stdout: result.stdout?.trim() ?? '',
stderr: result.stderr?.trim() ?? '',
};
}
function main() {
const results = [];
for (const check of checks) {
const item = {
...check,
...(check.script
? runScript(check.script, check.extraEnv ?? {})
: runCommand(check.command, check.extraEnv ?? {})),
};
results.push(item);
console.log(`[goose-v149-offline] ${item.outcome} ${check.name}`);
if (item.stdout) console.log(item.stdout);
if (!item.ok && item.stderr) console.error(item.stderr);
}
const failedRequired = results.filter((item) => item.required && !item.ok);
if (failedRequired.length) {
console.error(`GOOSE_V149_PHASE3_OFFLINE_FAIL: ${failedRequired.map((item) => item.name).join(', ')}`);
process.exit(1);
}
console.log('GOOSE_V149_PHASE3_OFFLINE_OK');
console.log(' note: portal/page/memory smokes skipped; see docs/goose-v149-real-llm-gate.md');
}
main();