Files
msd-core/tests/review-reviewer-instances-config.test.cjs
Jakub Zych a9a7a328e6 refactor: hard-fork GSD -> MSD (Make Software Done)
Mechanical rename produced by scripts/msd-rename.cjs: gsd/Gsd/GSD -> msd/Msd/MSD
across contents and paths, upstream package/repo coordinates -> @golem15/msd-core
and golem15com/msd-core. Deep links into upstream history, sibling upstream
packages, the GSD-2 import feature, CHANGELOG.md and .changeset/ are kept as-is.

Hand edits on top: MSD block-letter banner and logos, LICENSE copyright line,
package/plugin identity, regenerated lockfile, install-tree fixtures, derived
registries and benchmark baseline; migration checksum baseline re-locked
(MSD keeps its own install state, so no install had applied the old sums);
sort-order and regex-escaped expectations in tests adjusted.
2026-10-06 01:47:40 +02:00

49 lines
2.3 KiB
JavaScript

'use strict';
/**
* Config whitelist gate for review.reviewer_instances (#1517).
*
* Behavioral test (not source-grep): proves `config-set` accepts the
* review.reviewer_instances.<name>.{cli,model,agent} paths. Without the
* dynamicKeyPatterns entry in config-schema.manifest.json, config-set rejects
* the key and this test fails — that is the regression-must-fail-first signal.
*/
const { describe, test } = require('node:test');
const assert = require('node:assert/strict');
const path = require('node:path');
const fs = require('node:fs');
const { createTempProject, cleanup, runMsdTools } = require('./helpers.cjs');
describe('config-set review.reviewer_instances (#1517)', () => {
test('accepts a known-adapter cli for an instance', (t) => {
const tmpDir = createTempProject('reviewer-instances-cli');
t.after(() => cleanup(tmpDir));
const result = runMsdTools('config-set review.reviewer_instances.opencode-deepseek.cli opencode', tmpDir);
assert.ok(result.success, `config-set should accept the instance cli path: ${result.error || JSON.stringify(result)}`);
const configPath = path.join(tmpDir, '.planning', 'config.json');
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
assert.strictEqual(
config.review?.reviewer_instances?.['opencode-deepseek']?.cli,
'opencode',
'instance cli must persist',
);
});
test('accepts model and agent fields for an instance', (t) => {
const tmpDir = createTempProject('reviewer-instances-model');
t.after(() => cleanup(tmpDir));
const modelRes = runMsdTools('config-set review.reviewer_instances.opencode-deepseek.model deepseek/deepseek-v4-pro', tmpDir);
assert.ok(modelRes.success, `model set failed: ${modelRes.error}`);
const agentRes = runMsdTools('config-set review.reviewer_instances.opencode-deepseek.agent review', tmpDir);
assert.ok(agentRes.success, `agent set failed: ${agentRes.error}`);
const configPath = path.join(tmpDir, '.planning', 'config.json');
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
assert.strictEqual(config.review.reviewer_instances['opencode-deepseek'].model, 'deepseek/deepseek-v4-pro');
assert.strictEqual(config.review.reviewer_instances['opencode-deepseek'].agent, 'review');
});
});