From 0bed44fec81b9a2e19231a906d533f348f24f9e4 Mon Sep 17 00:00:00 2001 From: iamtoruk Date: Mon, 17 Aug 2026 00:09:38 -0700 Subject: [PATCH] test(serve): pin the output memo to returning the stored string A memo hit must not re-render. The generated stamp is minted per render, so asserting it is unchanged across the hit states that contract directly instead of leaving it implied by byte equality. --- tests/serve-stdio.test.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/serve-stdio.test.ts b/tests/serve-stdio.test.ts index bbc230fe..66a26145 100644 --- a/tests/serve-stdio.test.ts +++ b/tests/serve-stdio.test.ts @@ -281,6 +281,11 @@ describe('codeburn serve --stdio', () => { const sameBytes = await request(110, args) expect(sameBytes['ok']).toBe(true) expect(sameBytes['output']).toBe(memoized!['output']) + // `generated` is minted per render, so an unchanged stamp is the proof + // that a memo hit returns the stored string instead of re-rendering. + const stamp = (res: Record): string => + (JSON.parse(res['output'] as string) as { generated: string }).generated + expect(stamp(sameBytes)).toBe(stamp(memoized!)) // Same byte length as USD: a size-only fingerprint would miss this. await writeFile(configPath, JSON.stringify({ currency: { code: 'EUR' } }), 'utf8')