test(#1973): consolidate 48 workflow regression tests into workflow-aspect suites
Fold 48 issue-named workflow-markdown regression files into the canonical test that owns each workflow aspect (execute-phase-*, plan-phase-*, quick-*, discuss-*, worktree-cleanup, secure-phase, verify, update, settings, etc.), across 32 existing suites. Verbatim block-scoped describe wrappers; 281 subtests conserved 1:1. No new test files. Host-env pre-check: only gsd-settings-advanced spawns CLI and it sets no GSD_WORKSTREAM/GSD_PROJECT value — no leak risk. Regenerates regression-name allowlist (222->181), ratchets file-count allowlist (verify 11->10), makes 30 relocated allow-test-rule exemptions issue-ref-compliant (ADR-456; prunes 30 stale ids). lint:ci green. Part of epic #1969. Closes #1973. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -138,3 +138,105 @@ describe('reference files contain key content from original mode sections', () =
|
||||
assert.ok(hasReviewsContent, 'planner-reviews.md must contain reviews mode content');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// ────────────────────────────────────────────────────────────────────────
|
||||
// Folded from tests/bug-3320-planner-deep-work-rules.test.cjs — consolidation epic #1969 (B4 #1973)
|
||||
// ────────────────────────────────────────────────────────────────────────
|
||||
{
|
||||
const { describe: __foldDescribe } = require('node:test');
|
||||
__foldDescribe("folded:bug-3320-planner-deep-work-rules (consolidation epic #1969 B4 #1973)", () => {
|
||||
'use strict';
|
||||
|
||||
// allow-test-rule: source-text-is-product [#3320]
|
||||
// The bug is a contradiction in prompt/workflow source text. These assertions
|
||||
// intentionally pin the contract words that planner agents consume.
|
||||
|
||||
const { describe, test } = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const ROOT = path.join(__dirname, '..');
|
||||
const PLANNER_AGENT = path.join(ROOT, 'agents', 'gsd-planner.md');
|
||||
const PLAN_PHASE_WORKFLOW = path.join(ROOT, 'gsd-core', 'workflows', 'plan-phase.md');
|
||||
|
||||
function read(relativePath) {
|
||||
return fs.readFileSync(path.join(ROOT, relativePath), 'utf8');
|
||||
}
|
||||
|
||||
function extractDeepWorkRules() {
|
||||
const workflow = fs.readFileSync(PLAN_PHASE_WORKFLOW, 'utf8');
|
||||
const match = workflow.match(/<deep_work_rules>[\s\S]*?<\/deep_work_rules>/);
|
||||
assert.ok(match, 'plan-phase.md must contain a deep_work_rules block');
|
||||
return match[0];
|
||||
}
|
||||
|
||||
describe('bug #3320 planner action contract', () => {
|
||||
test('planner agent explicitly keeps implementation code out of action blocks', () => {
|
||||
const planner = fs.readFileSync(PLANNER_AGENT, 'utf8');
|
||||
|
||||
assert.match(
|
||||
planner,
|
||||
/NEVER place fenced code blocks \(```\) inside `<action>`/,
|
||||
'gsd-planner.md must explicitly forbid fenced implementation code in <action>'
|
||||
);
|
||||
assert.match(
|
||||
planner,
|
||||
/Code excerpts belong in `<read_first>` source files or referenced context/,
|
||||
'gsd-planner.md must route code excerpts to context/read-first material'
|
||||
);
|
||||
});
|
||||
|
||||
test('plan-phase deep_work_rules no longer requires self-sufficient code dumps', () => {
|
||||
const deepWorkRules = extractDeepWorkRules();
|
||||
|
||||
assert.doesNotMatch(
|
||||
deepWorkRules,
|
||||
/copy them into the action verbatim/,
|
||||
'deep_work_rules must not tell planners to copy source material verbatim into <action>'
|
||||
);
|
||||
assert.doesNotMatch(
|
||||
deepWorkRules,
|
||||
/complete the task from the action text alone/,
|
||||
'deep_work_rules must not make <action> self-sufficient without read_first/context'
|
||||
);
|
||||
assert.match(
|
||||
deepWorkRules,
|
||||
/Do not include full file contents, fenced code blocks, or complete implementations in `<action>`/,
|
||||
'deep_work_rules must explicitly bound concrete values to avoid code dumping'
|
||||
);
|
||||
});
|
||||
|
||||
test('plan-phase acceptance criteria allow behavior and test assertions', () => {
|
||||
const deepWorkRules = extractDeepWorkRules();
|
||||
|
||||
assert.match(
|
||||
deepWorkRules,
|
||||
/behavior assertion/,
|
||||
'acceptance criteria must allow behavior assertions, not just grep checks'
|
||||
);
|
||||
assert.match(
|
||||
deepWorkRules,
|
||||
/test command/,
|
||||
'acceptance criteria must allow test-command assertions'
|
||||
);
|
||||
});
|
||||
|
||||
test('quality gate matches the reconciled planner contract', () => {
|
||||
const workflow = read('gsd-core/workflows/plan-phase.md');
|
||||
|
||||
assert.match(
|
||||
workflow,
|
||||
/Every task has `<acceptance_criteria>` with behavior, test-command, CLI, or source assertions/,
|
||||
'quality gate must not narrow acceptance criteria back to grep-only checks'
|
||||
);
|
||||
assert.match(
|
||||
workflow,
|
||||
/Every `<action>` contains concrete identifiers without fenced code blocks or full implementations/,
|
||||
'quality gate must enforce concrete prose without implementation dumps'
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user