fix(#275): accept top-level decision gate result fields (#283)

This commit is contained in:
Tom Boucher
2026-05-26 12:07:40 -04:00
committed by GitHub
parent afba2afbe7
commit ce945ef753
3 changed files with 21 additions and 3 deletions

View File

@@ -94,13 +94,26 @@ describe('plan-phase decision-coverage gate (#2492)', () => {
assert.ok(gateIdx !== -1);
const snippet = md.slice(gateIdx, gateIdx + 800);
// Accept either an inline `|| exit 1` or a `|| { ...; exit 1; }` group.
const hasJqGuard = /jq[^\n]*passed\s*==\s*true/.test(snippet);
const hasJqGuard =
/jq[^\n]*\.data\.passed\s*==\s*true/.test(snippet) ||
/jq[^\n]*\(\.passed\s*\/\/\s*\.data\.passed\)\s*==\s*true/.test(snippet);
const hasExitOne = /\|\|\s*(?:exit\s+1|\{[\s\S]{0,200}?exit\s+1)/.test(snippet);
assert.ok(
hasJqGuard && hasExitOne,
'plan-phase gate must guard with `jq -e .passed == true || exit 1` (or `|| { ...; exit 1; }`) to actually block',
);
});
test('plan-phase gate accepts top-level .passed field from CLI output (#275)', () => {
const gateIdx = md.indexOf('check.decision-coverage-plan');
assert.ok(gateIdx !== -1, 'check.decision-coverage-plan invocation must exist');
const snippet = md.slice(gateIdx, gateIdx + 800);
assert.ok(
/\.(?:passed)\s*==\s*true\s*\|\|\s*\.data\.passed\s*==\s*true/.test(snippet) ||
/\(\.passed\s*\/\/\s*\.data\.passed\)\s*==\s*true/.test(snippet),
'plan-phase gate must explicitly check top-level .passed with a compatibility fallback to .data.passed',
);
});
});
describe('verify-phase decision-coverage gate (#2492)', () => {