* test(#3338): fold the verify/validate & workflow-text issue-* cluster — Wave 6 Folds 10 legacy issue-*.test.cjs regression files (75 test() blocks) into their module's main suite, per H3 (#3315) of the test-hygiene epic (#3053). Third of 4 issue-* waves. - issue-2701-nul-corrupted-validators.test.cjs (9) + issue-429-comment- text-gate.test.cjs (31, incl. fast-check property tests): both target verify.cjs/validate.cjs via different calling styles (CLI vs direct- require) — merged jointly into verify.test.cjs, 0 dropped. - issue-2762-plan-reviews-chunked.test.cjs (3) merged into plan-phase-drift-guard.test.cjs. - issue-2771-advisor-subagent-type.test.cjs (1) + issue-2772-discuss- phase-text-inconsistencies.test.cjs (6) merged jointly into discuss-phase-power.test.cjs. - issue-498-update-backup-runtime-dir.test.cjs (3, rename basis) + issue-815-update-next-channel.test.cjs (7, merged in): both concern update.md workflow-text contracts, now update-workflow.test.cjs. - issue-498-update-context.test.cjs (13): pure rename to update-context.test.cjs, sole comprehensive suite for its module. - issue-2765-brace-expansion-lockfile.test.cjs (1, rename basis) + issue-3238-js-yaml-lockfile.test.cjs (1, merged in): two distinct CVE regression pins against package-lock.json, now lockfile-cve-audit.test.cjs, shared ROOT/npmLs helpers deduped instead of double-declared. Ratchet upkeep to keep this wave's own gates green: pruned 3 stale allow-test-rule allowlist entries, cited 2 previously-uncited comments that surfaced in the folded content (#3338), tightened the exemption-file ceiling 305 -> 297. Fixed one stale filename reference in production code (src/init.cts) plus one in docs/reference/workflow-fragments.md. Zero net test-coverage loss. No production code BEHAVIOR changed. * test(#3338): fix orthogonal-review findings — Wave 6 fold Standards-axis review found a real structural defect in two files, both the same root cause and both fixed here: - tests/update-workflow.test.cjs: the folded:issue-815-update-next-channel wrapper's closing brace was placed after the file's pre-existing tail instead of before it, making the already-established folded:bug-2470 and folded:bug-3130 wrappers CHILDREN of issue-815's block in the test hierarchy instead of independent siblings — confirmed via an actual node --test run showing the mislabeled TAP nesting. Moved the closing brace to the correct position; all three fold wrappers are now top-level siblings again (verified via node --test, TAP hierarchy correct, 10/10 tests, 5 suites, identical count before and after). - tests/plan-phase-drift-guard.test.cjs: same mistake in the other direction — folded:issue-2762-plan-reviews-chunked was spliced inside the pre-existing folded:bug-2492-context-coverage-gate wrapper instead of after it. Fixed the same way (227/227 tests, 38 suites, identical count before and after). - Reverted unnecessary 815-suffixed local renames (assert815/fs815/etc.) introduced by the fold — the wrapper is genuinely block-scoped once correctly closed, so no collision existed (same class as Wave 4's __foldSetNested finding). No test() count changed in either file. No production code touched. --------- Co-authored-by: sim <sim@local>
This commit is contained in:
@@ -1744,3 +1744,72 @@ describe('runtime wiring for #2492 gates', () => {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// ────────────────────────────────────────────────────────────────────────
|
||||
// Folded from tests/issue-2762-plan-reviews-chunked.test.cjs — H3 Wave 6 (#3338)
|
||||
// ────────────────────────────────────────────────────────────────────────
|
||||
{
|
||||
const { describe: __foldDescribe } = require('node:test');
|
||||
__foldDescribe('folded:issue-2762-plan-reviews-chunked', () => {
|
||||
// allow-test-rule: structural-implementation-guard (#2762)
|
||||
// Regression guard for #2762: /gsd-plan-phase --reviews was a silent no-op in chunked
|
||||
// mode. Two defects in plan-phase.md §8.5:
|
||||
// A. §8.5.1 outline resume-check greps for a marker the agent only RETURNED (never
|
||||
// wrote to the file) → outline always re-ran/overwrote (broke crash-resume).
|
||||
// B. §8.5.2 per-plan resume-check skipped any plan with frontmatter, with no
|
||||
// --reviews exception → --reviews skipped 100% of plans (contradicted §6's
|
||||
// "go straight to replanning" contract).
|
||||
|
||||
const { test } = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
// #2993 fragmentization moved §8.5 (chunked planning mode, including §8.5.1 /
|
||||
// §8.5.2) out of plan-phase.md into gsd-core/workflows/plan-phase/steps/chunked-planning-mode.md.
|
||||
// Read that step file directly — it is the sole remaining source of the §8.5.1/§8.5.2
|
||||
// content these regression guards assert on.
|
||||
const MD = path.join(__dirname, '..', 'gsd-core', 'workflows', 'plan-phase', 'steps', 'chunked-planning-mode.md');
|
||||
const read = () => fs.readFileSync(MD, 'utf8');
|
||||
|
||||
test('§8.5.1 outline agent writes the resume marker into the file (#2762 defect A)', () => {
|
||||
const src = read();
|
||||
// The outline prompt must instruct writing ## OUTLINE COMPLETE into PLAN-OUTLINE.md
|
||||
// (the §8.5.1 resume-check greps for it in the file).
|
||||
const outlineSection = src.slice(src.indexOf('### 8.5.1'), src.indexOf('### 8.5.2'));
|
||||
assert.ok(
|
||||
/outline|PLAN-OUTLINE/i.test(outlineSection) && /End the file.*## OUTLINE COMPLETE|write.*## OUTLINE COMPLETE.*file/i.test(outlineSection.replace(/\s+/g, ' ')),
|
||||
'the outline agent prompt must instruct writing ## OUTLINE COMPLETE into the file (the resume-check greps the file for it) (#2762)'
|
||||
);
|
||||
});
|
||||
|
||||
test('§8.5.2 per-plan resume-check does NOT skip under --reviews (#2762 defect B)', () => {
|
||||
const src = read();
|
||||
const perPlanSection = src.slice(src.indexOf('### 8.5.2'));
|
||||
// The resume-check bash must gate the skip on --reviews being ABSENT.
|
||||
const bashMatch = perPlanSection.match(/PLAN_FILE=[\s\S]*?fi\s*\n/);
|
||||
assert.ok(bashMatch, '§8.5.2 must contain the per-plan resume-check bash block');
|
||||
const bash = bashMatch[0];
|
||||
assert.ok(
|
||||
/--reviews/.test(bash),
|
||||
'the per-plan resume-check must reference --reviews so it does NOT skip when replanning with review feedback (#2762)'
|
||||
);
|
||||
// The skip must be conditional on --reviews being ABSENT (e.g. ARGUMENTS != *"--reviews"*).
|
||||
assert.ok(
|
||||
/!=\s*\*"--reviews"\*|!~.*--reviews|--reviews.*absent|not.*--reviews/i.test(bash),
|
||||
'the resume-check skip must be gated on --reviews being ABSENT (so --reviews overwrites/replans) (#2762)'
|
||||
);
|
||||
});
|
||||
|
||||
test('§8.5.2 crash-resume (non-reviews) still skips written plans (#2762 negative space)', () => {
|
||||
const src = read();
|
||||
const perPlanSection = src.slice(src.indexOf('### 8.5.2'));
|
||||
const bashMatch = perPlanSection.match(/PLAN_FILE=[\s\S]*?fi\s*\n/);
|
||||
const bash = bashMatch ? bashMatch[0] : '';
|
||||
assert.ok(
|
||||
/head -1.*grep.*\^---|frontmatter/i.test(bash + perPlanSection.slice(0, 400)),
|
||||
'crash-resume (non-reviews) must still skip plans with valid frontmatter (resume safety preserved) (#2762)'
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user