* 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>
41 lines
1.5 KiB
JavaScript
41 lines
1.5 KiB
JavaScript
/**
|
|
* Regression test for #2043 — autonomous.md must include Agent in allowed-tools.
|
|
*
|
|
* The gsd-autonomous skill spawns background agents via Agent(..., run_in_background=true).
|
|
* Without Agent in allowed-tools the runtime rejects those calls silently.
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
const { describe, test } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
// allow-test-rule: source-text-is-the-product
|
|
// commands/gsd/autonomous.md is the installed command — its frontmatter is what Claude Code
|
|
// reads at runtime to enforce allowed-tools. Checking text content IS checking the contract.
|
|
describe('commands/gsd/autonomous.md allowed-tools', () => {
|
|
test('includes Agent in allowed-tools list', () => {
|
|
const filePath = path.join(__dirname, '..', 'commands', 'gsd', 'autonomous.md');
|
|
const content = fs.readFileSync(filePath, 'utf-8');
|
|
|
|
// Extract the YAML frontmatter block between the first pair of --- delimiters
|
|
const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
assert.ok(frontmatterMatch, 'autonomous.md must have YAML frontmatter');
|
|
|
|
const frontmatter = frontmatterMatch[1];
|
|
|
|
// Parse the allowed-tools list items (lines starting with " - ")
|
|
const toolLines = frontmatter
|
|
.split('\n')
|
|
.filter((line) => /^\s+-\s+/.test(line))
|
|
.map((line) => line.replace(/^\s+-\s+/, '').trim());
|
|
|
|
assert.ok(
|
|
toolLines.includes('Agent'),
|
|
`allowed-tools must include "Agent" but found: [${toolLines.join(', ')}]`
|
|
);
|
|
});
|
|
});
|