test(#1977): consolidate 22 misc + repo-invariant regression tests
Final epic-#1969 batch. Fold 22 issue-named files: the 4 genuine repo-wide invariant scans (551-eslint-bin-lib-coverage, bug-3054 stale /gsd-next, bug-3810 no-gsd-sdk-runtime-refs, feat-3593 cli-negative-universal) into a NEW shared repo-invariants.test.cjs; the other 18 as singletons into their nearest module suite (model-resolver, codex-config, runtime-converters, security, state-transition, worktree-safety, roadmap-parser, etc.). Verbatim block-scoped describe wrappers; 334 subtests conserved 1:1. Host-env pre-check (B2+B6): the 6 CLI folds into GSD_TEST_MODE-setting hosts (model-resolver/ codex-config/runtime-converters) are benign — each origin independently sets GSD_TEST_MODE=1 itself (idempotent), unlike the B6 real-install case. Regenerates regression-name allowlist (222->213), ratchets file-count allowlist (state 17->16), makes 7 relocated allow-test-rule exemptions issue-ref-compliant (ADR-456; prunes stale ids). Repoints 2 tests/ refs in docs/TESTING-SUITES.md. lint:ci green. Part of epic #1969. Closes #1977. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -657,3 +657,163 @@ describe('bug #3784: settings.md model profile UI exposes all 5 profiles', () =>
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// ────────────────────────────────────────────────────────────────────────
|
||||
// Folded from tests/bug-33-settings-model-profile-adaptive.test.cjs — consolidation epic #1969 (B8 #1977)
|
||||
// ────────────────────────────────────────────────────────────────────────
|
||||
{
|
||||
const { describe: __foldDescribe } = require('node:test');
|
||||
__foldDescribe("folded:bug-33-settings-model-profile-adaptive (consolidation epic #1969 B8 #1977)", () => {
|
||||
'use strict';
|
||||
|
||||
// allow-test-rule: source-text-is-the-product (see #33)
|
||||
// The deployed settings.md IS the product — testing its text content tests the deployed contract.
|
||||
|
||||
/**
|
||||
* Regression test for issue #33
|
||||
*
|
||||
* model_profile UI shows 4 options, schema has 5 — `adaptive` missing from
|
||||
* `settings.md` AskUserQuestion.
|
||||
*
|
||||
* The schema (gsd-core/bin/shared/model-catalog.json `profiles` array) defines 5 valid
|
||||
* model_profile values: quality, balanced, budget, adaptive, inherit. The
|
||||
* settings.md AskUserQuestion block for model_profile originally listed only 4
|
||||
* options (Quality, Balanced, Budget, Inherit) — `adaptive` was missing.
|
||||
*
|
||||
* Fix: the model_profile selection uses a two-question split. Q1 routes between
|
||||
* Adaptive / Standard-tier / Inherit (3 options). Q2 (only when Q1 = Standard)
|
||||
* asks Quality / Balanced / Budget. This keeps every individual options array
|
||||
* within the AskUserQuestion 4-option cap while making all 5 profiles reachable.
|
||||
*
|
||||
* Fixes: #33
|
||||
*/
|
||||
|
||||
const { describe, test, before } = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const REPO_ROOT = path.join(__dirname, '..');
|
||||
const SETTINGS_PATH = path.join(REPO_ROOT, 'gsd-core', 'workflows', 'settings.md');
|
||||
const CATALOG_PATH = path.join(REPO_ROOT, 'gsd-core', 'bin', 'shared', 'model-catalog.json');
|
||||
|
||||
/**
|
||||
* Collect every label: "..." value within a text block, lowercased.
|
||||
*/
|
||||
function extractOptionLabels(block) {
|
||||
const re = /label:\s*"([^"]+)"/g;
|
||||
const labels = [];
|
||||
let m;
|
||||
while ((m = re.exec(block)) !== null) {
|
||||
labels.push(m[1].toLowerCase());
|
||||
}
|
||||
return labels;
|
||||
}
|
||||
|
||||
describe('issue #33: model_profile schema and settings.md UI are in sync', () => {
|
||||
let catalog;
|
||||
let settingsContent;
|
||||
let presentBlock;
|
||||
|
||||
before(() => {
|
||||
catalog = JSON.parse(fs.readFileSync(CATALOG_PATH, 'utf-8'));
|
||||
settingsContent = fs.readFileSync(SETTINGS_PATH, 'utf-8');
|
||||
const presentMatch = settingsContent.match(/<step name="present_settings">[\s\S]*?<\/step>/);
|
||||
assert.ok(presentMatch, 'settings.md must contain a present_settings step');
|
||||
presentBlock = presentMatch[0];
|
||||
});
|
||||
|
||||
// -- (a) Schema contract ---------------------------------------------------
|
||||
|
||||
test('schema includes the adaptive model_profile value', () => {
|
||||
assert.ok(
|
||||
Array.isArray(catalog.profiles),
|
||||
'model-catalog.json must have a "profiles" array'
|
||||
);
|
||||
assert.ok(
|
||||
catalog.profiles.includes('adaptive'),
|
||||
'model-catalog should include the adaptive profile. Got: [' + catalog.profiles.join(', ') + ']'
|
||||
);
|
||||
});
|
||||
|
||||
test('schema includes adaptive as a model_profile value', () => {
|
||||
assert.ok(
|
||||
catalog.profiles.includes('adaptive'),
|
||||
'"adaptive" must be in model-catalog.json profiles. Got: [' + catalog.profiles.join(', ') + ']'
|
||||
);
|
||||
});
|
||||
|
||||
test('schema includes all expected model_profile values', () => {
|
||||
const expected = ['quality', 'balanced', 'budget', 'adaptive', 'inherit'];
|
||||
for (const profile of expected) {
|
||||
assert.ok(
|
||||
catalog.profiles.includes(profile),
|
||||
'Schema must include "' + profile + '" in profiles. Got: [' + catalog.profiles.join(', ') + ']'
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
// -- (b) UI contract — all 5 profiles reachable via present_settings -------
|
||||
|
||||
test('present_settings includes Adaptive as a selectable option (#33)', () => {
|
||||
const labels = extractOptionLabels(presentBlock);
|
||||
assert.ok(
|
||||
labels.some(l => l === 'adaptive' || l.startsWith('adaptive')),
|
||||
'Issue #33: present_settings must include an "Adaptive" label in its model_profile AskUserQuestion options so users can select it interactively. Got labels: [' + labels.join(', ') + ']'
|
||||
);
|
||||
});
|
||||
|
||||
test('present_settings includes Quality as a selectable option', () => {
|
||||
const labels = extractOptionLabels(presentBlock);
|
||||
assert.ok(
|
||||
labels.some(l => l === 'quality' || l.startsWith('quality')),
|
||||
'present_settings must include a "Quality" option. Got: [' + labels.join(', ') + ']'
|
||||
);
|
||||
});
|
||||
|
||||
test('present_settings includes Balanced as a selectable option', () => {
|
||||
const labels = extractOptionLabels(presentBlock);
|
||||
assert.ok(
|
||||
labels.some(l => l === 'balanced' || l.startsWith('balanced')),
|
||||
'present_settings must include a "Balanced" option. Got: [' + labels.join(', ') + ']'
|
||||
);
|
||||
});
|
||||
|
||||
test('present_settings includes Budget as a selectable option', () => {
|
||||
const labels = extractOptionLabels(presentBlock);
|
||||
assert.ok(
|
||||
labels.some(l => l === 'budget' || l.startsWith('budget')),
|
||||
'present_settings must include a "Budget" option. Got: [' + labels.join(', ') + ']'
|
||||
);
|
||||
});
|
||||
|
||||
test('present_settings includes Inherit as a selectable option', () => {
|
||||
const labels = extractOptionLabels(presentBlock);
|
||||
assert.ok(
|
||||
labels.some(l => l === 'inherit' || l.startsWith('inherit')),
|
||||
'present_settings must include an "Inherit" option. Got: [' + labels.join(', ') + ']'
|
||||
);
|
||||
});
|
||||
|
||||
// -- update_config and confirm steps reference adaptive --------------------
|
||||
|
||||
test('update_config step lists adaptive as a valid model_profile value', () => {
|
||||
const m = settingsContent.match(/<step name="update_config">[\s\S]*?<\/step>/);
|
||||
assert.ok(m, 'settings.md must have an update_config step');
|
||||
assert.ok(
|
||||
m[0].includes('adaptive'),
|
||||
'update_config step must list "adaptive" as a valid model_profile value'
|
||||
);
|
||||
});
|
||||
|
||||
test('confirm step table shows adaptive as a possible model profile value', () => {
|
||||
const m = settingsContent.match(/<step name="confirm">[\s\S]*?<\/step>/);
|
||||
assert.ok(m, 'settings.md must have a confirm step');
|
||||
assert.ok(
|
||||
m[0].includes('adaptive'),
|
||||
'confirm step must include "adaptive" in the Model Profile row'
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user