test(#3339): fold the state/phase/dispatch & model-profile issue-* cluster — Wave 7
Folds 9 legacy issue-*.test.cjs regression files (140 test() blocks) into their module's main suite, per H3 (#3315) of the test-hygiene epic (#3053). LAST of 4 issue-* waves — closes out the 74-file fix-*/issue-* backlog (pending BUG_FILE_RE extension, held for a follow-up commit until Wave 6 is confirmed merged, per the epic's own zero-backlog precondition). - issue-2828-flat-roadmap-total-phases.test.cjs (1) + issue-3204-state- writer-phase-count.test.cjs (21): both target state-document.cjs buildStateFrontmatter via different CLI entrypoints — merged jointly into state-document.test.cjs, 0 dropped. - issue-2945-phase-complete-checkbox-rollback.test.cjs (4) + issue-2949- phase-complete-stage3-sentinel.test.cjs (4): both target phase.cts cmdPhaseComplete; issue explicitly warned of overlap — verified disjoint fixtures/assertions, 0 dropped, merged into phase.test.cjs. - issue-2927-reviewer-lane-overlay-invocation.test.cjs (10) merged into review-lane-descriptor.test.cjs. - issue-2939-dispatch-flatten-maxdepth.test.cjs (9) merged into host-integration.test.cjs, 2 dropped as verified exact duplicates. - issue-2977-frontmatter-bom.test.cjs (5) merged into frontmatter.test.cjs. - issue-2045-third-party-skills-surface.test.cjs (6) merged into capability-loader.test.cjs. - issue-2517-runtime-aware-profiles.test.cjs (80, the largest single fold in the epic) merged into model-resolver.test.cjs, 1 dropped as a verified true duplicate (checked against src/model-resolver.cts logic, not just title similarity). Fixed a genuine eslint irregular-whitespace finding: a literal BOM character embedded in a doc comment (pre-existing content from the original #2977 source, illustrating what a BOM looks like) — replaced with a readable U+FEFF notation. 3 stale doc references found and fixed (docs/adr/2313, 3180, 443). Zero net test-coverage loss. No production code changed.
This commit is contained in:
@@ -2502,3 +2502,103 @@ describe('#2728 B1 — isolation degrades re-record through the single write pat
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Folded from tests/issue-2939-dispatch-flatten-maxdepth.test.cjs (H3 Wave 7,
|
||||
// issue #3339). Two of the original nine cases (maxDepth:1 → true and
|
||||
// maxDepth:2 → false, both with the full codex-like descriptor) were exact
|
||||
// duplicates of the "Phase B: shouldFlattenDispatch — contract pin" describe
|
||||
// above (lines ~1014-1029) and were dropped; the remaining seven exercise
|
||||
// input shapes (maxDepth:-1 unbounded, nested:false, non-full toolkit,
|
||||
// background:false/backgroundDispatch:false with maxDepth:5, maxDepth:0,
|
||||
// and maxDepth missing/non-number) not covered elsewhere in this file.
|
||||
// ---------------------------------------------------------------------------
|
||||
{
|
||||
const { describe: __foldDescribe } = require('node:test');
|
||||
__foldDescribe('folded:issue-2939-dispatch-flatten-maxdepth', () => {
|
||||
/** The live Codex-shaped descriptor (the #2939 bug input), with per-test depth overrides. */
|
||||
function codexLike(overrides = {}) {
|
||||
return {
|
||||
namedDispatch: true,
|
||||
nested: true,
|
||||
maxDepth: 1,
|
||||
background: true,
|
||||
subagentToolkit: 'full',
|
||||
backgroundDispatch: true,
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
test('maxDepthUnboundedBackgroundsUnchanged', () => {
|
||||
// Row 3: maxDepth:-1 (unbounded) → background permitted, unchanged.
|
||||
assert.strictEqual(
|
||||
hi.shouldFlattenDispatch(codexLike({ maxDepth: -1 })),
|
||||
false,
|
||||
'maxDepth:-1 (unbounded) → background permitted (unchanged)',
|
||||
);
|
||||
});
|
||||
|
||||
test('nestedFalseFlattensRegardlessOfDepth', () => {
|
||||
// Row 4 / acceptance #4: nested:false cannot host a nesting orchestrator →
|
||||
// flatten regardless of maxDepth.
|
||||
assert.strictEqual(
|
||||
hi.shouldFlattenDispatch(codexLike({ nested: false, maxDepth: 5 })),
|
||||
true,
|
||||
'nested:false → flatten regardless of maxDepth',
|
||||
);
|
||||
});
|
||||
|
||||
test('nonFullToolkitFlattens', () => {
|
||||
// Row 5 / acceptance #4: a non-full toolkit cannot delegate → flatten
|
||||
// regardless of maxDepth.
|
||||
assert.strictEqual(
|
||||
hi.shouldFlattenDispatch(codexLike({ subagentToolkit: 'read-only', maxDepth: 5 })),
|
||||
true,
|
||||
'subagentToolkit!=="full" → flatten regardless of maxDepth',
|
||||
);
|
||||
});
|
||||
|
||||
test('backgroundFalseStillFlattens', () => {
|
||||
// Row 6 / negative-space: background:false → flatten (the existing
|
||||
// background-boolean fail-closed path is unchanged).
|
||||
assert.strictEqual(
|
||||
hi.shouldFlattenDispatch(codexLike({ background: false, maxDepth: 5 })),
|
||||
true,
|
||||
'background:false → flatten (unchanged)',
|
||||
);
|
||||
});
|
||||
|
||||
test('backgroundDispatchFalseStillFlattens', () => {
|
||||
// Row 7 / negative-space: backgroundDispatch:false → flatten (unchanged).
|
||||
assert.strictEqual(
|
||||
hi.shouldFlattenDispatch(codexLike({ backgroundDispatch: false, maxDepth: 5 })),
|
||||
true,
|
||||
'backgroundDispatch:false → flatten (unchanged)',
|
||||
);
|
||||
});
|
||||
|
||||
test('maxDepth0Flattens', () => {
|
||||
// Row 9: maxDepth:0 (zero depth budget) → flatten.
|
||||
assert.strictEqual(
|
||||
hi.shouldFlattenDispatch(codexLike({ maxDepth: 0 })),
|
||||
true,
|
||||
'maxDepth:0 → flatten (zero depth budget)',
|
||||
);
|
||||
});
|
||||
|
||||
test('maxDepthMissingFlattens', () => {
|
||||
// Row 10: maxDepth missing/non-number → flatten (fail-closed on absent
|
||||
// budget, mirrors degradationFor treating non-finite as 0).
|
||||
assert.strictEqual(
|
||||
hi.shouldFlattenDispatch(codexLike({ maxDepth: undefined })),
|
||||
true,
|
||||
'maxDepth missing → flatten (fail-closed)',
|
||||
);
|
||||
assert.strictEqual(
|
||||
hi.shouldFlattenDispatch(codexLike({ maxDepth: 'deep' })),
|
||||
true,
|
||||
'maxDepth non-number → flatten (fail-closed)',
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user