conversation-session-composer-draft-switching.json 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-composer-draft-switching",
  4. "spec": "./test/e2e/conversation-session/conversation-session-composer-draft-switching.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "upstream-composer-draft-completed-seed-final",
  8. "description": "R01 completed task 草稿作用域的 seed turn 固定回复。",
  9. "metadata": {
  10. "kind": "main",
  11. "timingPolicy": "fast-text",
  12. "source": "synthetic",
  13. "syntheticReason": "该响应只需要稳定形成 completed task,后续断言聚焦 composer 草稿正文和附件的 taskId 作用域恢复。"
  14. },
  15. "maxMatches": 1,
  16. "match": {
  17. "method": "POST",
  18. "pathIncludes": "/messages",
  19. "bodyIncludes": ["E2E_COMPOSER_DRAFT_COMPLETED_SEED"],
  20. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  21. "lastUserMessageIncludes": ["E2E_COMPOSER_DRAFT_COMPLETED_SEED"]
  22. },
  23. "response": {
  24. "statusCode": 200,
  25. "text": {
  26. "id": "upstream-e2e-composer-draft-completed-seed-final",
  27. "inputTokens": 128,
  28. "outputTokens": 12,
  29. "text": "upstream-e2e-ok"
  30. }
  31. }
  32. },
  33. {
  34. "id": "upstream-composer-draft-running-seed-slow-stream",
  35. "description": "R02 running task 草稿作用域的慢流响应,稳定制造 task 切换窗口。",
  36. "metadata": {
  37. "kind": "main",
  38. "timingPolicy": "controlled-stream",
  39. "source": "synthetic",
  40. "syntheticReason": "running task 草稿恢复必须在 assistant 仍可能 streaming 时验证;真实 provider 可能过快完成,导致无法稳定覆盖 inactive stream 更新。"
  41. },
  42. "maxMatches": 1,
  43. "match": {
  44. "method": "POST",
  45. "pathIncludes": "/messages",
  46. "bodyIncludes": ["E2E_SLOW_STREAM", "E2E_COMPOSER_DRAFT_RUNNING_SEED"],
  47. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  48. "lastUserMessageIncludes": ["E2E_COMPOSER_DRAFT_RUNNING_SEED"]
  49. },
  50. "response": {
  51. "statusCode": 200,
  52. "statusMessage": "OK",
  53. "headers": {
  54. "cache-control": "no-cache",
  55. "content-type": "text/event-stream; charset=utf-8"
  56. },
  57. "events": [
  58. {
  59. "sequence": 0,
  60. "offsetMs": 0,
  61. "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"upstream-e2e-composer-draft-running-seed-slow-stream\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":120,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0,\"service_tier\":\"standard\"}}}\n\n"
  62. },
  63. {
  64. "sequence": 1,
  65. "offsetMs": 250,
  66. "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n"
  67. },
  68. {
  69. "sequence": 2,
  70. "offsetMs": 8000,
  71. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"deep\"}}\n\n"
  72. },
  73. {
  74. "sequence": 3,
  75. "offsetMs": 16000,
  76. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"seek\"}}\n\n"
  77. },
  78. {
  79. "sequence": 4,
  80. "offsetMs": 24000,
  81. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"-e2e-ok\"}}\n\n"
  82. },
  83. {
  84. "sequence": 5,
  85. "offsetMs": 90000,
  86. "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n"
  87. },
  88. {
  89. "sequence": 6,
  90. "offsetMs": 90100,
  91. "text": "event: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":120,\"output_tokens\":12,\"service_tier\":\"standard\"}}\n\n"
  92. },
  93. {
  94. "sequence": 7,
  95. "offsetMs": 90200,
  96. "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n"
  97. }
  98. ]
  99. }
  100. },
  101. {
  102. "id": "upstream-composer-draft-completed-text-should-not-send",
  103. "description": "R01 completed task 的未发送 composer 草稿正文不应触发 provider 请求。",
  104. "metadata": {
  105. "kind": "ignore",
  106. "timingPolicy": "fast-text",
  107. "source": "synthetic",
  108. "syntheticReason": "composer 草稿正文只应保存在本地 draft scope;切换 task 不应把草稿内容作为 user prompt 发送给 provider。"
  109. },
  110. "maxMatches": 0,
  111. "match": {
  112. "method": "POST",
  113. "pathIncludes": "/messages",
  114. "bodyIncludes": ["E2E_COMPOSER_DRAFT_COMPLETED_TEXT"],
  115. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  116. },
  117. "response": {
  118. "statusCode": 200,
  119. "text": {
  120. "id": "upstream-e2e-composer-draft-completed-text-should-not-send",
  121. "inputTokens": 128,
  122. "outputTokens": 12,
  123. "text": "upstream-e2e-ok"
  124. }
  125. }
  126. },
  127. {
  128. "id": "upstream-composer-draft-running-text-should-not-send",
  129. "description": "R02 running task 的未发送 composer 草稿正文不应触发 provider 请求。",
  130. "metadata": {
  131. "kind": "ignore",
  132. "timingPolicy": "fast-text",
  133. "source": "synthetic",
  134. "syntheticReason": "running task 切换期间 composer 草稿正文只应保存在本地 draft scope;inactive stream 更新不应把草稿内容发送给 provider。"
  135. },
  136. "maxMatches": 0,
  137. "match": {
  138. "method": "POST",
  139. "pathIncludes": "/messages",
  140. "bodyIncludes": ["E2E_COMPOSER_DRAFT_RUNNING_TEXT"],
  141. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  142. },
  143. "response": {
  144. "statusCode": 200,
  145. "text": {
  146. "id": "upstream-e2e-composer-draft-running-text-should-not-send",
  147. "inputTokens": 128,
  148. "outputTokens": 12,
  149. "text": "upstream-e2e-ok"
  150. }
  151. }
  152. },
  153. {
  154. "id": "upstream-composer-draft-unsent-text-should-not-send",
  155. "description": "R03 未发送 new task 草稿正文不应触发 provider 请求。",
  156. "metadata": {
  157. "kind": "ignore",
  158. "timingPolicy": "fast-text",
  159. "source": "synthetic",
  160. "syntheticReason": "未发送的新 task 草稿只应保存在 __draft__ scope;切换到已有 task 再返回不应触发 provider 请求。"
  161. },
  162. "maxMatches": 0,
  163. "match": {
  164. "method": "POST",
  165. "pathIncludes": "/messages",
  166. "bodyIncludes": ["E2E_COMPOSER_DRAFT_UNSENT_TEXT"],
  167. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  168. },
  169. "response": {
  170. "statusCode": 200,
  171. "text": {
  172. "id": "upstream-e2e-composer-draft-unsent-text-should-not-send",
  173. "inputTokens": 128,
  174. "outputTokens": 12,
  175. "text": "upstream-e2e-ok"
  176. }
  177. }
  178. }
  179. ]
  180. }