feat(#1023): first phase-6 cutover — ui-review (verify:post) inline → loop.render-hooks dispatch (#1024)

Replace the inlined ui-review invocation in autonomous.md §3d.5 with a
loop.render-hooks verify:post dispatch — the first workflow to consume
render-hooks and fire a skill from it (closes the #1018 live-execution residual
as real wiring). Capability-driven, equivalence-preserving for the current
registry (only ui-review at verify:post, default on): fires gsd-ui-review under
the same precondition (UI-SPEC exists via consumes-gate + workflow.ui_review).

Gate findings (real pattern issues, fixed so every future cutover inherits them):
- bug-2643 static "Skill() references a real skill" check vs templated
  Skill(skill="gsd-${ref.skill}") dispatch → skip ${...}-templated names.
- Coverage moved, not lost: gen-capability-registry now validates
  steps[].ref.skill in skills + ref.agent in agents + rejects gsd- double-prefix.
- Tightened §3d.5 tests; markdown clarity (consumes rule, LLM-native JSON read,
  UI-REVIEW.md score hint).

gsd-ui-review skill + §3a.5/ui-phase untouched. §5.6/ui-phase cutover deferred
(#1022 step-can-halt-vs-gate model question).

Closes #1023

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-06-10 22:40:58 -04:00
committed by GitHub
parent 7eea991884
commit 2ac6592096
5 changed files with 300 additions and 32 deletions

View File

@@ -727,6 +727,169 @@ describe('Fix #4: step.ref must be exclusive skill XOR agent', () => {
});
});
describe('double-prefix guard: step.ref.skill must not start with "gsd-"', () => {
// ref.skill is an unprefixed stem (e.g. "ui-review"). Workflow dispatch prepends
// "gsd-" at runtime. A stem already starting with "gsd-" would produce "gsd-gsd-..."
// at dispatch time, silently invoking a non-existent skill.
test('ref.skill starting with "gsd-" is rejected', () => {
const cap = {
...UI_CAP,
steps: [
{
point: 'verify:post',
ref: { skill: 'gsd-ui-review' }, // wrong: stem must NOT have gsd- prefix
produces: ['UI-REVIEW.md'],
consumes: ['UI-SPEC.md'],
when: 'workflow.ui_review',
onError: 'skip',
},
],
};
const errors = validateCapability(cap, 'ui');
assert.ok(errors.length > 0, 'Expected an error for gsd-prefixed ref.skill');
assert.ok(
errors.some((e) => e.includes('gsd-') && (e.includes('double') || e.includes('unprefixed') || e.includes('must not start'))),
'Error should mention the double-prefix problem, got: ' + JSON.stringify(errors),
);
});
test('ref.skill without "gsd-" prefix is accepted (stem only)', () => {
const cap = {
...UI_CAP,
steps: [
{
point: 'verify:post',
ref: { skill: 'ui-review' }, // correct: unprefixed stem
produces: ['UI-REVIEW.md'],
consumes: ['UI-SPEC.md'],
when: 'workflow.ui_review',
onError: 'skip',
},
],
};
const prefixErrors = validateCapability(cap, 'ui').filter((e) => e.includes('gsd-') && e.includes('stem'));
assert.deepEqual(prefixErrors, [], 'No prefix errors expected for unprefixed stem, got: ' + JSON.stringify(prefixErrors));
});
test('real UI capability.json uses unprefixed ref.skill values', () => {
// Verify the live capability uses unprefixed stems and therefore passes the new guard.
const errors = validateCapability(UI_CAP, 'ui');
const prefixErrors = errors.filter((e) => e.includes('must not start with'));
assert.deepEqual(prefixErrors, [], 'Live UI capability.json should not trigger the double-prefix guard: ' + JSON.stringify(prefixErrors));
});
});
// ─── Fix: ref.skill/ref.agent membership in declared skills/agents ────────────
describe('ref membership check: step.ref.skill must be in cap.skills', () => {
// A capability declares skills: ["ui-phase", "ui-review"].
// A step with ref.skill "typo-skill" (not in skills) must be rejected.
test('step.ref.skill NOT in cap.skills is rejected', () => {
const cap = {
...UI_CAP,
steps: [
{
point: 'plan:pre',
ref: { skill: 'typo-skill' }, // not in skills: ["ui-phase", "ui-review"]
produces: ['UI-SPEC.md'],
consumes: ['CONTEXT.md'],
when: 'workflow.ui_phase',
onError: 'skip',
},
],
};
const errors = validateCapability(cap, 'ui');
assert.ok(errors.length > 0, 'Expected errors for undeclared ref.skill');
assert.ok(
errors.some((e) => e.includes('typo-skill') && e.includes('not declared')),
'Error should mention "typo-skill" and "not declared", got: ' + JSON.stringify(errors),
);
});
test('step.ref.skill IN cap.skills is accepted', () => {
const cap = {
...UI_CAP,
steps: [
{
point: 'plan:pre',
ref: { skill: 'ui-phase' }, // declared in skills: ["ui-phase", "ui-review"]
produces: ['UI-SPEC.md'],
consumes: ['CONTEXT.md'],
when: 'workflow.ui_phase',
onError: 'skip',
},
],
};
const errors = validateCapability(cap, 'ui');
const membershipErrors = errors.filter((e) => e.includes('not declared') && e.includes('ui-phase'));
assert.deepEqual(
membershipErrors, [],
'No membership errors expected for declared ref.skill, got: ' + JSON.stringify(membershipErrors),
);
});
test('real UI capability passes: ui-phase and ui-review are both in skills', () => {
// Regression guard: the real UI capability must not trigger the new membership check.
const errors = validateCapability(UI_CAP, 'ui');
const membershipErrors = errors.filter((e) => e.includes('not declared'));
assert.deepEqual(
membershipErrors, [],
'Real UI capability should pass membership check for all ref.skill values, got: ' + JSON.stringify(membershipErrors),
);
});
});
describe('ref membership check: step.ref.agent must be in cap.agents', () => {
// A capability declares agents: ["gsd-ui-checker", "gsd-ui-auditor"].
// A step with ref.agent "gsd-unknown-agent" (not in agents) must be rejected.
test('step.ref.agent NOT in cap.agents is rejected', () => {
const cap = {
...UI_CAP,
steps: [
{
point: 'plan:pre',
ref: { agent: 'gsd-unknown-agent' }, // not in agents: ["gsd-ui-checker", "gsd-ui-auditor"]
produces: ['UI-SPEC.md'],
consumes: ['CONTEXT.md'],
when: 'workflow.ui_phase',
onError: 'skip',
},
],
};
const errors = validateCapability(cap, 'ui');
assert.ok(errors.length > 0, 'Expected errors for undeclared ref.agent');
assert.ok(
errors.some((e) => e.includes('gsd-unknown-agent') && e.includes('not declared')),
'Error should mention "gsd-unknown-agent" and "not declared", got: ' + JSON.stringify(errors),
);
});
test('step.ref.agent IN cap.agents is accepted', () => {
const cap = {
...UI_CAP,
steps: [
{
point: 'plan:pre',
ref: { agent: 'gsd-ui-checker' }, // declared in agents
produces: ['UI-SPEC.md'],
consumes: ['CONTEXT.md'],
when: 'workflow.ui_phase',
onError: 'skip',
},
],
};
const errors = validateCapability(cap, 'ui');
const membershipErrors = errors.filter((e) => e.includes('not declared') && e.includes('gsd-ui-checker'));
assert.deepEqual(
membershipErrors, [],
'No membership errors expected for declared ref.agent, got: ' + JSON.stringify(membershipErrors),
);
});
});
describe('Fix: 3-node requires cycle (A→B→C→A) is detected', () => {
test('three-node requires cycle is reported as an error', () => {
const capA = {