Fix #7: non-dev roles (test-design) are never treated as a dev (0.5.1)

A test-design brief (Pipeline-Role: test-design, Clone: ... (Role: test-design))
that mentioned the dev clone was read as a dev in that clone: it got a T number
and a "no verification: dev ran on Opus" line, also after a resume.

- Role comes from Pipeline-Role:, then (Role: ...) on the Clone: line, then
  the folder name, which must end in -dev, -review or -test. Any other role,
  or a Clone: line the router cannot place, is a non-dev role.
- A non-dev Pipeline-Role never falls back to other clone paths in the brief.
- Non-dev roles and the 0.5.0 gate types (test-designer, release-reviewer):
  named model kept, never Haiku, Opus when none; no hand-back line, no
  verification, no savings record. A gate agent type is never a dev, whatever
  clone paths its brief names.
- T numbers for dev agents only; other agents get A1, A2, ...
- /router log shows the role as written (test-design, test-designer).
- 0.5.0 test updated: a -design clone is now a non-dev role, not "no role".

102 tests; 16 mutations of the new rules, all caught.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MdqPWvuDpbpRvDEdURoAwo
This commit is contained in:
2026-11-17 21:47:25 +01:00
co-authored by Claude Opus 5.5
parent 3cd69762be
commit c88884c54a
6 changed files with 197 additions and 40 deletions
+107 -2
View File
@@ -66,6 +66,46 @@ test('fix 2: several clones and no Clone: line gives no role, and routes to opus
expect(parseBrief(`Work in ${DEV}/. Commit in ${DEV}.`).role).toBe('dev')
})
// ---------- non-dev roles (#7, EV-05) ----------
const EV05_DEV = '/home/homelab/projects/goodwe/clones/EV-05-dev'
const EV05_DESIGN = '/home/homelab/projects/goodwe/clones/EV-05-design'
const designBrief = (devClone = EV05_DEV) =>
`Pipeline-Role: test-design\nClone: ${EV05_DESIGN} (Role: test-design)\n\n` +
`Design the EV-05 tests. The developer works in ${devClone}/; do not touch it.`
test('#7: a test-design brief is a non-dev role, even when it names the dev clone', async () => {
expect(parseBrief(designBrief())).toMatchObject({ clone: EV05_DESIGN, role: 'other', roleName: 'test-design' })
// the header alone: other paths in the brief are never read for a role
const b = parseBrief(`Pipeline-Role: test-design\nThe developer works in ${EV05_DEV}/.`)
expect(b.role).toBe('other')
expect(b.clone).toBe(undefined)
})
test('#7: Pipeline-Role decides over (Role: ...) and the path', async () => {
expect(parseBrief(`Pipeline-Role: review\nClone: ${EV05_DEV} (Role: dev)`).role).toBe('review')
expect(parseBrief(`Pipeline-Role: dev\nClone: ${EV05_DESIGN}`).role).toBe('dev')
expect(parseBrief(`Pipeline-Role: Dev\nWork in ${EV05_DEV}/.`).role).toBe('dev')
// without the header, (Role: ...) still wins over the path
expect(parseBrief(`Clone: ${EV05_DEV} (Role: test-design)`)).toMatchObject({ role: 'other', roleName: 'test-design' })
})
test('#7: the role must end the folder name', async () => {
expect(parseBrief('Work in /x/clones/EV-05-test-design/.').role).toBe(undefined)
expect(parseBrief('Work in /x/clones/EV-05-dev-notes/.').role).toBe(undefined)
expect(parseBrief('Work in /x/clones/EV-05-dev/.').role).toBe('dev')
// a Clone: line the router cannot place keeps its model, unverified
expect(parseBrief('Clone: /x/clones/EV-05-test-design').role).toBe('other')
})
test('#7: other roles keep the named model, opus when none is named, and are never verified', async () => {
expect(decide({ role: 'other', roleName: 'test-design', named: 'sonnet', prompt: 'x', respectExplicit: false }))
.toEqual({ kind: 'fixed', tier: 'sonnet', reason: 'named model kept for test-design' })
expect(decide({ role: 'other', prompt: 'x', respectExplicit: false })).toMatchObject({ kind: 'fixed', tier: 'opus' })
expect(decide({ role: 'other', roleName: 'test-design', named: 'haiku', prompt: 'x', respectExplicit: false })).toMatchObject({ tier: 'opus' })
expect(skipReason({ role: 'other', clone: EV05_DESIGN, tier: 'sonnet' }, 'answer')).toBe('non-dev-agent')
})
// ---------- who picks the writer (C4) ----------
test('C4: review and test agents keep the model they are given', async () => {
@@ -1146,8 +1186,8 @@ test('pipeline: a test designer keeps Opus; a named Sonnet is kept, Haiku never'
expect(decide({ subagentType: 'test-designer', prompt: 'Write the test plan', respectExplicit: false })).toEqual({ kind: 'fixed', tier: 'opus', reason: 'test-designer default' })
expect(decide({ subagentType: 'test-designer', named: 'sonnet', prompt: 'x', respectExplicit: false }).kind).toBe('fixed')
expect(decide({ subagentType: 'test-designer', named: 'haiku', prompt: 'find x', respectExplicit: false })).toEqual({ kind: 'fixed', tier: 'opus', reason: 'test-designer default' })
// a design clone path carries no role: no record, so never verified as dev work
expect(parseBrief('Clone: /home/homelab/projects/goodwe/clones/EV-15-design').role).toBe(undefined)
// a design clone path is no dev clone: a non-dev role, so never verified as dev work (0.5.1: was no role)
expect(parseBrief('Clone: /home/homelab/projects/goodwe/clones/EV-15-design').role).toBe('other')
})
test('pipeline: the verifier is told to check every T-id and N-id of the test plan', async ($, on) => {
@@ -1159,3 +1199,68 @@ test('pipeline: the verifier is told to check every T-id and N-id of the test pl
expect(w.verifierSystems[0]).toContain('every T-id must be implemented')
expect(w.verifierPrompts[0]).toContain('## Test plan')
})
// ---------- non-dev roles end to end (#7, EV-05) ----------
test('#7 acceptance: the test designer gets no line, also after a resume; the real dev gets T1 and a verdict', async ($, on) => {
const w = fresh()
w.diffs = ['diff --git a/ev.py']
const clock = world(on, w)
// the mock git answers in DEV only: the designer names that clone, so a misread would diff it
const d = await $.agent.spawn({ prompt: designBrief(DEV), description: 'EV-05 test design', model: 'opus' } as never)
expect(w.spawned[0]?.model).toBe('opus')
await finish($, clock, d.agentId as string, 'claude-opus-5-5')
await resume($, d.agentId as string, 'Add a case for a missing meter.')
await finish($, clock, d.agentId as string, 'claude-opus-5-5')
expect(w.all).toEqual([])
expect(w.verifier).toEqual([])
const dev = await $.agent.spawn({
prompt: `Pipeline-Role: dev\nClone: ${DEV} (Role: dev)\nBase branch: release/1.0.\nEV-05: add the meter staleness check as specified.`,
description: 'EV-05 dev',
} as never)
expect(w.spawned[1]?.model).toBe('sonnet')
await finish($, clock, dev.agentId as string, 'claude-sonnet-5-5')
expect(w.all[0]).toBe('[model-router] T1 verifying on Opus...')
expect(w.all[1]).toContain('PASS from verifier opus')
expect(w.all.length).toBe(2)
})
test('#7: a test-designer agent type that only names the dev clone is no dev either', async ($, on) => {
const w = fresh()
w.diffs = ['diff']
const clock = world(on, w)
const d = await $.agent.spawn({ prompt: `Write the tests for the work in ${DEV}/.`, description: 'design', subagentType: 'test-designer', model: 'haiku' } as never)
expect(w.spawned[0]?.model).toBe('opus') // never Haiku
await finish($, clock, d.agentId as string, 'claude-opus-5-5')
expect(w.all).toEqual([])
expect(w.verifier).toEqual([])
const log = (await $.command.run({ command: 'router', args: '' } as never)).text ?? ''
expect(log).toContain('A1')
expect(log).toContain('A1 test-designer opus')
expect(log).not.toMatch(/\bother\b/)
})
test('#7: an unnamed test designer runs on opus, unverified', async ($, on) => {
const w = fresh()
w.diffs = ['diff']
const clock = world(on, w)
const d = await $.agent.spawn({ prompt: designBrief(), description: 'EV-05 test design' } as never)
expect(w.spawned[0]?.model).toBe('opus')
await finish($, clock, d.agentId as string, 'claude-sonnet-5-5')
expect(w.all).toEqual([])
expect(w.verifier).toEqual([])
})
test('#7: a test designer is no saving and gets an A number; the log shows its role', async ($, on) => {
const w = fresh()
const clock = world(on, w)
const d = await $.agent.spawn({ prompt: designBrief(), description: 'EV-05 test design', model: 'opus' } as never)
await finish($, clock, d.agentId as string, 'claude-opus-5-5')
const savings = (await $.command.run({ command: 'router', args: 'savings' } as never)).text ?? ''
expect(savings).toBe('savings: no agent runs recorded yet.')
const log = (await $.command.run({ command: 'router', args: '' } as never)).text ?? ''
expect(log).toContain('A1')
expect(log).toContain('test-design')
expect(log).not.toContain('T1')
})