conversation-session-file-tools-atomic-write.json 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-file-tools-atomic-write",
  4. "spec": "./test/e2e/conversation-session/conversation-session-file-tools-atomic-write.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "upstream-conversation-file-tools-atomic-write-title",
  8. "description": "File tools atomic write case 的标题生成固定响应。",
  9. "metadata": {
  10. "kind": "common",
  11. "timingPolicy": "fast-text",
  12. "source": "synthetic",
  13. "syntheticReason": "标题不属于 file tools 权限语义,只需要稳定返回,避免标题请求误命中业务 fixture。"
  14. },
  15. "match": {
  16. "method": "POST",
  17. "pathIncludes": "/messages",
  18. "bodyIncludes": ["Generate a concise title", "E2E_FILE_TOOLS_ATOMIC_WRITE"]
  19. },
  20. "response": {
  21. "statusCode": 200,
  22. "statusMessage": "OK",
  23. "headers": {
  24. "content-type": "application/json; charset=utf-8"
  25. },
  26. "body": "{\"id\":\"upstream-e2e-file-tools-atomic-write-title\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"{\\\"title\\\":\\\"File Tools Atomic Write E2E\\\"}\"}],\"stop_reason\":\"end_turn\",\"stop_sequence\":null,\"usage\":{\"input_tokens\":125,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":24,\"service_tier\":\"standard\"}}"
  27. }
  28. },
  29. {
  30. "id": "upstream-conversation-file-tools-atomic-write-read-write",
  31. "description": "首段响应:先读取 write.sh,让后续 Write 覆盖已有可执行文件时通过 read-before-write guard。",
  32. "metadata": {
  33. "kind": "main",
  34. "timingPolicy": "fast-text",
  35. "source": "synthetic",
  36. "syntheticReason": "真实 provider 不一定稳定先 Read 再 Write;本响应固定触发已读既有可执行文件的覆盖路径。"
  37. },
  38. "maxMatches": 1,
  39. "match": {
  40. "method": "POST",
  41. "pathIncludes": "/messages",
  42. "lastUserMessageIncludes": ["E2E_FILE_TOOLS_ATOMIC_WRITE"],
  43. "bodyIncludes": ["E2E_FILE_TOOLS_ATOMIC_WRITE", "file-tools-atomic-write-e2e/write.sh"],
  44. "bodyExcludes": ["Generate a concise title", "toolu_e2e_file_tools_atomic_write_read_write"]
  45. },
  46. "response": {
  47. "statusCode": 200,
  48. "toolUse": {
  49. "id": "toolu_e2e_file_tools_atomic_write_read_write",
  50. "messageId": "msg_e2e_file_tools_atomic_write_read_write",
  51. "name": "Read",
  52. "input": {
  53. "file_path": "file-tools-atomic-write-e2e/write.sh"
  54. }
  55. }
  56. }
  57. },
  58. {
  59. "id": "upstream-conversation-file-tools-atomic-write-write",
  60. "description": "第二段响应:覆盖已读过的 write.sh,验证 Write 走 atomic overwrite。",
  61. "metadata": {
  62. "kind": "main",
  63. "timingPolicy": "fast-text",
  64. "source": "synthetic",
  65. "syntheticReason": "真实 provider 不一定稳定选择 Write;本响应固定触发已有脚本的完整覆盖写入。"
  66. },
  67. "maxMatches": 1,
  68. "match": {
  69. "method": "POST",
  70. "pathIncludes": "/messages",
  71. "bodyIncludes": ["E2E_FILE_TOOLS_ATOMIC_WRITE", "old-write"],
  72. "bodyExcludes": ["Generate a concise title", "toolu_e2e_file_tools_atomic_write_write"]
  73. },
  74. "response": {
  75. "statusCode": 200,
  76. "toolUse": {
  77. "id": "toolu_e2e_file_tools_atomic_write_write",
  78. "messageId": "msg_e2e_file_tools_atomic_write_write",
  79. "name": "Write",
  80. "input": {
  81. "file_path": "file-tools-atomic-write-e2e/write.sh",
  82. "content": "#!/usr/bin/env bash\necho new-write\n"
  83. }
  84. }
  85. }
  86. },
  87. {
  88. "id": "upstream-conversation-file-tools-atomic-write-read-edit",
  89. "description": "第三段响应:读取 edit.sh,让后续 Edit 覆盖已有可执行文件时通过 read-before-write guard。",
  90. "metadata": {
  91. "kind": "main",
  92. "timingPolicy": "fast-text",
  93. "source": "synthetic",
  94. "syntheticReason": "真实 provider 不一定稳定在 Edit 前读取目标;本响应固定触发已读既有可执行文件的编辑路径。"
  95. },
  96. "maxMatches": 1,
  97. "match": {
  98. "method": "POST",
  99. "pathIncludes": "/messages",
  100. "bodyIncludes": ["E2E_FILE_TOOLS_ATOMIC_WRITE", "The file file-tools-atomic-write-e2e/write.sh has been updated successfully"],
  101. "bodyExcludes": ["Generate a concise title"]
  102. },
  103. "response": {
  104. "statusCode": 200,
  105. "toolUse": {
  106. "id": "toolu_e2e_file_tools_atomic_write_read_edit",
  107. "messageId": "msg_e2e_file_tools_atomic_write_read_edit",
  108. "name": "Read",
  109. "input": {
  110. "file_path": "file-tools-atomic-write-e2e/edit.sh"
  111. }
  112. }
  113. }
  114. },
  115. {
  116. "id": "upstream-conversation-file-tools-atomic-write-edit",
  117. "description": "第四段响应:编辑已读过的 edit.sh,验证 Edit 走 atomic overwrite。",
  118. "metadata": {
  119. "kind": "main",
  120. "timingPolicy": "fast-text",
  121. "source": "synthetic",
  122. "syntheticReason": "真实 provider 不一定稳定选择 Edit;本响应固定触发已有脚本的局部编辑写入。"
  123. },
  124. "maxMatches": 1,
  125. "match": {
  126. "method": "POST",
  127. "pathIncludes": "/messages",
  128. "bodyIncludes": [
  129. "E2E_FILE_TOOLS_ATOMIC_WRITE",
  130. "toolu_e2e_file_tools_atomic_write_read_edit",
  131. "old-edit"
  132. ],
  133. "bodyExcludes": ["Generate a concise title", "toolu_e2e_file_tools_atomic_write_edit"]
  134. },
  135. "response": {
  136. "statusCode": 200,
  137. "toolUse": {
  138. "id": "toolu_e2e_file_tools_atomic_write_edit",
  139. "messageId": "msg_e2e_file_tools_atomic_write_edit",
  140. "name": "Edit",
  141. "input": {
  142. "file_path": "file-tools-atomic-write-e2e/edit.sh",
  143. "old_string": "old-edit",
  144. "new_string": "new-edit"
  145. }
  146. }
  147. }
  148. },
  149. {
  150. "id": "upstream-conversation-file-tools-atomic-write-final",
  151. "description": "最终响应:Edit 成功后结束 case。",
  152. "metadata": {
  153. "kind": "main",
  154. "timingPolicy": "fast-text",
  155. "source": "synthetic",
  156. "syntheticReason": "最终 marker 只用于稳定结束窗口级 replay;真实 provider 回复内容不影响文件权限语义。"
  157. },
  158. "maxMatches": 1,
  159. "match": {
  160. "method": "POST",
  161. "pathIncludes": "/messages",
  162. "bodyIncludes": [
  163. "E2E_FILE_TOOLS_ATOMIC_WRITE",
  164. "The file file-tools-atomic-write-e2e/edit.sh has been updated successfully"
  165. ],
  166. "bodyExcludes": ["Generate a concise title"]
  167. },
  168. "response": {
  169. "statusCode": 200,
  170. "statusMessage": "OK",
  171. "text": {
  172. "id": "upstream-e2e-file-tools-atomic-write-final",
  173. "inputTokens": 240,
  174. "outputTokens": 12,
  175. "text": "E2E_FILE_TOOLS_ATOMIC_WRITE_OK"
  176. }
  177. }
  178. }
  179. ]
  180. }