test: destroy 9 config-schema.cjs/core.cjs source-grep tests, replace with behavioral config-set (#2696)

* test: destroy 9 config-schema.cjs/core.cjs source-grep tests, add behavioral config-set tests (#2691, #2693)

Replace source-grep theater with config-set behavioral tests:
- execute-phase-wave: config-set workflow.use_worktrees replaces VALID_CONFIG_KEYS grep
- inline-plan-threshold: delete redundant source-grep (behavioral test at L36 already covered it)
- plan-bounce: config-set for plan_bounce / plan_bounce_script / plan_bounce_passes replaces 3 key-presence greps
- code-review: config-set for code_review / code_review_depth replaces 2 greps; removes CONFIG_PATH constant
- thinking-partner: config-set features.thinking_partner replaces two greps (config-schema.cjs AND core.cjs)

Behavioral tests survive refactors (no path constants, no file reads). The config-schema.cjs →
core.cjs migration commit 990c3e64 happened because these tests groped source paths.

Add allow-test-rule: source-text-is-the-product annotations to legitimate product-content tests:
autonomous-allowed-tools, agent-frontmatter, agent-skills-awareness, bug-2334, bug-2346,
execute-phase-wave (MD reads), plan-bounce (workflow reads). Annotations explain WHY text
inspection is the right level of testing for AI instruction files.

Closes #2691
Closes #2693

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test: address CodeRabbit findings on #2696

- agent-frontmatter.test.cjs: move allow-test-rule annotation from block comment
  to standalone // line comment so rule scanners can detect it
- thinking-partner.test.cjs: strengthen config-set test with config-get read-back
  assertion to verify the value was persisted, not just accepted (exit 0)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test: tighten thinking_partner config assertion per CodeRabbit (#2696)

Replace config-get output substring check (includes('true') false-positive
risk) with a direct JSON read of .planning/config.json, asserting the
exact persisted value via strictEqual. This also validates the config file
was created, catching silent key-acceptance without persistence.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-04-25 10:50:54 -04:00
committed by GitHub
parent cd05725576
commit 7c6f8005f3
10 changed files with 93 additions and 68 deletions

View File

@@ -2,6 +2,7 @@ const { describe, test } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('fs');
const path = require('path');
const { runGsdTools, createTempProject, cleanup } = require('./helpers.cjs');
const GSD_ROOT = path.join(__dirname, '..', 'get-shit-done');
@@ -66,27 +67,24 @@ describe('Thinking Partner Integration (#1726)', () => {
// Config tests
describe('Config integration', () => {
test('features.thinking_partner is in VALID_CONFIG_KEYS', () => {
const configSrc = fs.readFileSync(
path.join(GSD_ROOT, 'bin', 'lib', 'config-schema.cjs'),
'utf-8'
);
assert.ok(
configSrc.includes("'features.thinking_partner'"),
'VALID_CONFIG_KEYS should contain features.thinking_partner'
);
});
test('features is in KNOWN_TOP_LEVEL section containers', () => {
const coreSrc = fs.readFileSync(
path.join(GSD_ROOT, 'bin', 'lib', 'core.cjs'),
'utf-8'
);
// The KNOWN_TOP_LEVEL set should include 'features' in section containers
assert.ok(
coreSrc.includes("'features'"),
'KNOWN_TOP_LEVEL should contain features as a section container'
);
test('config-set accepts features.thinking_partner', () => {
// Exercises VALID_CONFIG_KEYS membership and KNOWN_TOP_LEVEL acceptance in one call.
// Replaces two source-grep tests that read config-schema.cjs and core.cjs (see #2691).
const tmpDir = createTempProject();
try {
const setResult = runGsdTools('config-set features.thinking_partner true', tmpDir);
assert.ok(setResult.success, `config-set should accept features.thinking_partner: ${setResult.error}`);
const configPath = path.join(tmpDir, '.planning', 'config.json');
assert.ok(fs.existsSync(configPath), 'config-set should create .planning/config.json');
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
assert.strictEqual(
config.features?.thinking_partner,
true,
'config-set should persist features.thinking_partner=true'
);
} finally {
cleanup(tmpDir);
}
});
});