Browse Source

test(session-snapshot): close pin-turn step before replacement

The current Session relationship validator correctly rejects a second step/start while the previous step remains open. Both replay and refresh of the synthetic pin-turn scenario failed after the stricter master validation landed.

Add the missing step/end to the owning scripted behavior and resequence its later events. Regenerate only the current pin-turn fixture through defineAcpSnapshotSuite refresh mode. Preserve both system messages, replacement provenance, and all three request headers; do not relax migration validation or normalization.

Validation: reproduced both pin-turn failures with the focused suite filter; owning refresh passed; pnpm exec vitest run packages/test-support/session-snapshot/tests/suite.spec.ts passed (140 tests, one intentional record skip). Full build and doc-sync also passed before this fixture-only repair.
Tianyi Cui 1 month ago
parent
commit
dac85fada1

+ 5 - 4
packages/test-support/session-snapshot/tests/fixtures/suite/pin-turn/behavior.json

@@ -9,10 +9,11 @@
         {"type":"step/start","seq":1,"time":100,"data":{"turn":1,"step":1}},
         {"type":"step/start","seq":1,"time":100,"data":{"turn":1,"step":1}},
         {"type":"system/message","seq":2,"time":100,"data":{"turn":1,"step":1,"message":{"id":"aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa","role":"system","content":[{"type":"text","text":"SYS PROMPT"}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt"}}},"surfaceOp":"append"},
         {"type":"system/message","seq":2,"time":100,"data":{"turn":1,"step":1,"message":{"id":"aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa","role":"system","content":[{"type":"text","text":"SYS PROMPT"}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt"}}},"surfaceOp":"append"},
         {"type":"request/header","seq":3,"time":100,"data":{"header":{"config":{"provider":"fake","model":"fake"},"tools":[{"name":"t1","description":"D1","parameters":{"type":"object"}}]},"reason":"initial"}},
         {"type":"request/header","seq":3,"time":100,"data":{"header":{"config":{"provider":"fake","model":"fake"},"tools":[{"name":"t1","description":"D1","parameters":{"type":"object"}}]},"reason":"initial"}},
-        {"type":"step/start","seq":4,"time":100,"data":{"turn":1,"step":2}},
-        {"type":"system/message","seq":5,"time":100,"data":{"turn":1,"step":2,"message":{"id":"bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb","role":"system","content":[{"type":"text","text":"SYS PROMPT\n\nNEW PROMPT LINE"}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt"}}},"surfaceOp":{"op":"replace","start":2,"end":2},"sourceEventSeqs":[2]},
-        {"type":"request/header","seq":6,"time":100,"data":{"header":{"config":{"provider":"fake","model":"fake"},"tools":[{"name":"t1","description":"D1","parameters":{"type":"object"}}]},"reason":"series"}},
-        {"type":"request/header","seq":7,"time":100,"data":{"header":{"config":{"provider":"fake","model":"fake"},"tools":[{"name":"t1","description":"D1","parameters":{"type":"object"}},{"name":"t2","description":"D2","parameters":{"type":"object"}}]},"reason":"change"}}
+        {"type":"step/end","seq":4,"time":100,"data":{"turn":1,"step":1}},
+        {"type":"step/start","seq":5,"time":100,"data":{"turn":1,"step":2}},
+        {"type":"system/message","seq":6,"time":100,"data":{"turn":1,"step":2,"message":{"id":"bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb","role":"system","content":[{"type":"text","text":"SYS PROMPT\n\nNEW PROMPT LINE"}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt"}}},"surfaceOp":{"op":"replace","start":2,"end":2},"sourceEventSeqs":[2]},
+        {"type":"request/header","seq":7,"time":100,"data":{"header":{"config":{"provider":"fake","model":"fake"},"tools":[{"name":"t1","description":"D1","parameters":{"type":"object"}}]},"reason":"series"}},
+        {"type":"request/header","seq":8,"time":100,"data":{"header":{"config":{"provider":"fake","model":"fake"},"tools":[{"name":"t1","description":"D1","parameters":{"type":"object"}},{"name":"t2","description":"D2","parameters":{"type":"object"}}]},"reason":"change"}}
       ]
       ]
     }
     }
   ]
   ]

+ 1 - 0
packages/test-support/session-snapshot/tests/fixtures/suite/pin-turn/session.v2.jsonl

@@ -3,6 +3,7 @@
 {"type":"step/start","data":{"turn":1,"step":1}}
 {"type":"step/start","data":{"turn":1,"step":1}}
 {"type":"system/message","data":{"turn":1,"step":1,"message":{"id":"{{message:1}}","role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt"}}},"surfaceOp":"append"}
 {"type":"system/message","data":{"turn":1,"step":1,"message":{"id":"{{message:1}}","role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt"}}},"surfaceOp":"append"}
 {"type":"request/header","data":{"header":{"config":{"provider":"fake","model":"fake"},"tools":"{{tools}}"},"reason":"initial"}}
 {"type":"request/header","data":{"header":{"config":{"provider":"fake","model":"fake"},"tools":"{{tools}}"},"reason":"initial"}}
+{"type":"step/end","data":{"turn":1,"step":1}}
 {"type":"step/start","data":{"turn":1,"step":2}}
 {"type":"step/start","data":{"turn":1,"step":2}}
 {"type":"system/message","data":{"turn":1,"step":2,"message":{"id":"{{message:2}}","role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt"}}},"surfaceOp":{"op":"replace","start":2,"end":2},"sourceEventSeqs":[2]}
 {"type":"system/message","data":{"turn":1,"step":2,"message":{"id":"{{message:2}}","role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt"}}},"surfaceOp":{"op":"replace","start":2,"end":2},"sourceEventSeqs":[2]}
 {"type":"request/header","data":{"header":{"config":{"provider":"fake","model":"fake"},"tools":"{{tools}}"},"reason":"series"}}
 {"type":"request/header","data":{"header":{"config":{"provider":"fake","model":"fake"},"tools":"{{tools}}"},"reason":"series"}}