WIP 2.0.0: message drafts use event placeholders only with an event

Found by the first real eval run (Sonnet 5.5 through the local Hub,
19/19 checks): without an event the drafts still used {{event.title}}
and added an event-details block. The instructions now offer those
placeholders only when an event is given; the eval checks for it, and
adds up split themes when counting feedback. Route tests for the five
AI helpers in v2.test.ts; the eval script loads backend/.env.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ls1vMeckMWrKPfc1MMyMJF
This commit is contained in:
2026-10-30 18:25:57 +02:00
co-authored by Claude Opus 5.5
parent 4924d1ed76
commit ba121118ea
4 changed files with 105 additions and 5 deletions
@@ -110,6 +110,15 @@ describe('what the helpers send', () => {
expect(r.message).toEqual({ subject: '', body: 'Hi {{name}}!' });
expect(mockRun.mock.calls[0][2].input).toBe('Note: bring a sleeping bag\n\nEvent: Youth Camp, Friday 14 March 2027, 18:00, at Camp Wartburg');
expect(mockRun.mock.calls[0][2].system).toContain('WhatsApp');
expect(mockRun.mock.calls[0][2].system).toContain('{{event.title}}');
});
test('draft a message without an event: no event placeholders offered', async () => {
mockRun.mockResolvedValue({ output: { subject: 'S', body: 'Hi {{name}}' }, status });
await draftMessage('u1', { channel: 'email', note: 'the breakfast moves to the hotel' }, now);
const system = mockRun.mock.calls[0][2].system;
expect(system).toContain('Use no other {{…}} placeholders');
expect(system).not.toContain('{{event.title}}');
});
test('improve text: the mode and where it goes shape the instructions', async () => {