Browse Source

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.
Tianyi Cui 1 month ago
parent
commit
1616c99dae
1 changed files with 2 additions and 2 deletions
  1. 2 2
      snapshots/session/headless.snapshot.ts

+ 2 - 2
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', () => {