test(#1976): consolidate 17 agent regression tests into agent-contract suites
Fold 17 issue-named agent-markdown regression files into their canonical agent suites: agent-frontmatter (shared agent-body-contract catch-all: read-loop guards, retired-slash-ref bans, sycophancy hardening, doc-writer/code-fixer/review-fix/mapper contracts, write-truncation), planner-language-regression (planner directive/grep/phase contract), executor-mvp-tdd-section, verifier-behavior-unverified, intel, and research-agent-profiles. Verbatim block-scoped describe wrappers; 98 subtests conserved 1:1. All unit (markdown-content) tests — no CLI/env surface. No new files. Regenerates regression-name allowlist (222->207), ratchets file-count allowlist (intel entry removed, phase 4->3), makes 13 relocated allow-test-rule exemptions issue-ref- compliant (ADR-456; prunes stale ids). No CONTEXT.md/ADR refs named the moved files. lint:ci green. Part of epic #1969. Closes #1976. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -311,3 +311,124 @@ describe('bug #222 recurrence: orchestrator self-heals when synthesizer returns
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// ────────────────────────────────────────────────────────────────────────
|
||||
// Folded from tests/bug-2419-project-researcher-agent.test.cjs — consolidation epic #1969 (B7 #1976)
|
||||
// ────────────────────────────────────────────────────────────────────────
|
||||
{
|
||||
const { describe: __foldDescribe } = require('node:test');
|
||||
__foldDescribe("folded:bug-2419-project-researcher-agent (consolidation epic #1969 B7 #1976)", () => {
|
||||
// allow-test-rule: source-text-is-the-product (see #2419)
|
||||
// Reads .md/.json/.yml product files whose deployed text IS what the
|
||||
// runtime loads — testing text content tests the deployed contract.
|
||||
|
||||
/**
|
||||
* Bug #2419: gsd-project-researcher agent type not found
|
||||
*
|
||||
* When gsd-new-project spawns gsd-project-researcher subagents, it fails with
|
||||
* "agent type not found" if the user has a local-only install (agents in
|
||||
* .claude/agents/ of a different project, not the global ~/.claude/agents/).
|
||||
*
|
||||
* Fix: new-project.md and new-milestone.md must parse agents_installed from
|
||||
* the init JSON and warn the user (rather than silently failing) when agents
|
||||
* are missing.
|
||||
*/
|
||||
|
||||
const { describe, test } = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const NEW_PROJECT_PATH = path.join(__dirname, '..', 'gsd-core', 'workflows', 'new-project.md');
|
||||
const NEW_MILESTONE_PATH = path.join(__dirname, '..', 'gsd-core', 'workflows', 'new-milestone.md');
|
||||
const AGENTS_DIR = path.join(__dirname, '..', 'agents');
|
||||
|
||||
describe('gsd-project-researcher agent registration (#2419)', () => {
|
||||
test('gsd-project-researcher.md exists in agents source dir', () => {
|
||||
const agentFile = path.join(AGENTS_DIR, 'gsd-project-researcher.md');
|
||||
assert.ok(
|
||||
fs.existsSync(agentFile),
|
||||
'agents/gsd-project-researcher.md must exist in the source agents directory'
|
||||
);
|
||||
});
|
||||
|
||||
test('gsd-project-researcher.md has correct name in frontmatter', () => {
|
||||
const content = fs.readFileSync(path.join(AGENTS_DIR, 'gsd-project-researcher.md'), 'utf-8');
|
||||
assert.ok(
|
||||
content.includes('name: gsd-project-researcher'),
|
||||
'agents/gsd-project-researcher.md must have name: gsd-project-researcher in frontmatter'
|
||||
);
|
||||
});
|
||||
|
||||
test('new-project.md parses agents_installed from init JSON', () => {
|
||||
const content = fs.readFileSync(NEW_PROJECT_PATH, 'utf-8');
|
||||
assert.ok(
|
||||
content.includes('agents_installed'),
|
||||
'new-project.md must parse agents_installed from the init JSON to detect missing agents'
|
||||
);
|
||||
});
|
||||
|
||||
test('new-project.md warns user when agents_installed is false', () => {
|
||||
const content = fs.readFileSync(NEW_PROJECT_PATH, 'utf-8');
|
||||
assert.ok(
|
||||
content.includes('agents_installed') && content.includes('agent type not found') ||
|
||||
content.includes('agents_installed') && content.includes('missing') ||
|
||||
content.includes('agents_installed') && content.includes('not installed'),
|
||||
'new-project.md must warn the user when agents are not installed (agents_installed is false)'
|
||||
);
|
||||
});
|
||||
|
||||
test('new-project.md reports required-agent and skill-payload diagnostics separately', () => {
|
||||
const content = fs.readFileSync(NEW_PROJECT_PATH, 'utf-8');
|
||||
assert.ok(content.includes('required_agents_installed'),
|
||||
'new-project.md must parse required_agents_installed from init JSON');
|
||||
assert.ok(content.includes('missing_required_agents'),
|
||||
'new-project.md must report missing required new-project agents separately');
|
||||
assert.ok(content.includes('agent_skill_payloads_available'),
|
||||
'new-project.md must distinguish skill payload availability from agent definitions');
|
||||
assert.ok(content.includes('agents_dir'),
|
||||
'new-project.md must show which agents directory was checked');
|
||||
});
|
||||
|
||||
test('new-milestone.md parses agents_installed from init JSON', () => {
|
||||
const content = fs.readFileSync(NEW_MILESTONE_PATH, 'utf-8');
|
||||
assert.ok(
|
||||
content.includes('agents_installed'),
|
||||
'new-milestone.md must parse agents_installed from the init JSON to detect missing agents'
|
||||
);
|
||||
});
|
||||
|
||||
test('new-milestone.md warns user when agents_installed is false', () => {
|
||||
const content = fs.readFileSync(NEW_MILESTONE_PATH, 'utf-8');
|
||||
assert.ok(
|
||||
content.includes('agents_installed') && (
|
||||
content.includes('agent type not found') ||
|
||||
content.includes('missing') ||
|
||||
content.includes('not installed')
|
||||
),
|
||||
'new-milestone.md must warn the user when agents are not installed (agents_installed is false)'
|
||||
);
|
||||
});
|
||||
|
||||
test('new-project.md lists gsd-project-researcher in available_agent_types', () => {
|
||||
const content = fs.readFileSync(NEW_PROJECT_PATH, 'utf-8');
|
||||
const agentTypesMatch = content.match(/<available_agent_types>([\s\S]*?)<\/available_agent_types>/);
|
||||
assert.ok(agentTypesMatch, 'new-project.md must have <available_agent_types> section');
|
||||
assert.ok(
|
||||
agentTypesMatch[1].includes('gsd-project-researcher'),
|
||||
'new-project.md <available_agent_types> must list gsd-project-researcher'
|
||||
);
|
||||
});
|
||||
|
||||
test('new-milestone.md lists gsd-project-researcher in available_agent_types', () => {
|
||||
const content = fs.readFileSync(NEW_MILESTONE_PATH, 'utf-8');
|
||||
const agentTypesMatch = content.match(/<available_agent_types>([\s\S]*?)<\/available_agent_types>/);
|
||||
assert.ok(agentTypesMatch, 'new-milestone.md must have <available_agent_types> section');
|
||||
assert.ok(
|
||||
agentTypesMatch[1].includes('gsd-project-researcher'),
|
||||
'new-milestone.md <available_agent_types> must list gsd-project-researcher'
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user