From 1616c99dae156eef119d058e7276553f7eb40edc Mon Sep 17 00:00:00 2001 From: Tianyi Cui <53024+tianyicui@users.noreply.github.com> Date: Sun, 6 Sep 2026 13:04:52 +0800 Subject: [PATCH] test(snapshot): expect rejection of invalid historical citations The historical-comparison negative control replaces title.messageSeqs with [0], which cites a non-human event. The current Session validator correctly rejects this before normalization; comparing the malformed result for inequality made the otherwise passing built snapshot lane fail. Assert the specific earlier-human-message validation error for that malformed control. Keep the valid prompt and model difference comparisons, every citation field, and all production restoration and normalization logic unchanged. Validation: full DSH_EXAMPLE_MODE=lib DSH_SNAPSHOT=replay pnpm exec vitest run --config vitest.snapshot.config.ts reproduced the lone negative-control failure, then passed all 6 files and 126 tests after repair (2 existing PowerShell availability skips). PATH used the existing uv Python 3.14.5 bin; no software installed. --- snapshots/session/headless.snapshot.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snapshots/session/headless.snapshot.ts b/snapshots/session/headless.snapshot.ts index 5681a6dfbb..ed2f5b360d 100644 --- a/snapshots/session/headless.snapshot.ts +++ b/snapshots/session/headless.snapshot.ts @@ -645,10 +645,10 @@ describe('headless recorded-session snapshots', () => { const header = rows.find(row => row.type === 'request/header')?.data as JsonObject ;((header.header as JsonObject).config as JsonObject).model = 'different-model' })).not.toEqual(baseline) - expect(changed(rows => { + expect(() => changed(rows => { const title = rows.find(row => row.type === 'session/title')?.data as JsonObject title.messageSeqs = [0] - })).not.toEqual(baseline) + })).toThrow('messageSeqs must cite earlier human user/message events') }) it('recognizes the supported OS-assigned listener forms', () => {