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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-file-tools-atomic-write",
  4. "spec": "./test/e2e/conversation-session/tools/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": [
  101. "E2E_FILE_TOOLS_ATOMIC_WRITE",
  102. "The file file-tools-atomic-write-e2e/write.sh has been updated successfully"
  103. ],
  104. "bodyExcludes": ["Generate a concise title"]
  105. },
  106. "response": {
  107. "statusCode": 200,
  108. "toolUse": {
  109. "id": "toolu_e2e_file_tools_atomic_write_read_edit",
  110. "messageId": "msg_e2e_file_tools_atomic_write_read_edit",
  111. "name": "Read",
  112. "input": {
  113. "file_path": "file-tools-atomic-write-e2e/edit.sh"
  114. }
  115. }
  116. }
  117. },
  118. {
  119. "id": "upstream-conversation-file-tools-atomic-write-edit",
  120. "description": "第四段响应:编辑已读过的 edit.sh,验证 Edit 走 atomic overwrite。",
  121. "metadata": {
  122. "kind": "main",
  123. "timingPolicy": "fast-text",
  124. "source": "synthetic",
  125. "syntheticReason": "真实 provider 不一定稳定选择 Edit;本响应固定触发已有脚本的局部编辑写入。"
  126. },
  127. "maxMatches": 1,
  128. "match": {
  129. "method": "POST",
  130. "pathIncludes": "/messages",
  131. "bodyIncludes": [
  132. "E2E_FILE_TOOLS_ATOMIC_WRITE",
  133. "toolu_e2e_file_tools_atomic_write_read_edit",
  134. "old-edit"
  135. ],
  136. "bodyExcludes": ["Generate a concise title", "toolu_e2e_file_tools_atomic_write_edit"]
  137. },
  138. "response": {
  139. "statusCode": 200,
  140. "toolUse": {
  141. "id": "toolu_e2e_file_tools_atomic_write_edit",
  142. "messageId": "msg_e2e_file_tools_atomic_write_edit",
  143. "name": "Edit",
  144. "input": {
  145. "file_path": "file-tools-atomic-write-e2e/edit.sh",
  146. "old_string": "old-edit",
  147. "new_string": "new-edit"
  148. }
  149. }
  150. }
  151. },
  152. {
  153. "id": "upstream-conversation-file-tools-atomic-write-final",
  154. "description": "最终响应:Edit 成功后结束 case。",
  155. "metadata": {
  156. "kind": "main",
  157. "timingPolicy": "fast-text",
  158. "source": "synthetic",
  159. "syntheticReason": "最终 marker 只用于稳定结束窗口级 replay;真实 provider 回复内容不影响文件权限语义。"
  160. },
  161. "maxMatches": 1,
  162. "match": {
  163. "method": "POST",
  164. "pathIncludes": "/messages",
  165. "bodyIncludes": [
  166. "E2E_FILE_TOOLS_ATOMIC_WRITE",
  167. "The file file-tools-atomic-write-e2e/edit.sh has been updated successfully"
  168. ],
  169. "bodyExcludes": ["Generate a concise title"]
  170. },
  171. "response": {
  172. "statusCode": 200,
  173. "statusMessage": "OK",
  174. "text": {
  175. "id": "upstream-e2e-file-tools-atomic-write-final",
  176. "inputTokens": 240,
  177. "outputTokens": 12,
  178. "text": "E2E_FILE_TOOLS_ATOMIC_WRITE_OK"
  179. }
  180. }
  181. }
  182. ]
  183. }