@irogane/kaji 0.2.0-beta.11 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/README.md +112 -551
  2. package/dist/index.d.mts +253 -0
  3. package/dist/index.mjs +440 -0
  4. package/package.json +28 -166
  5. package/contracts/README.md +0 -14
  6. package/contracts/beta-core-v1.json +0 -52
  7. package/contracts/cli/init-cases-v1.json +0 -27
  8. package/contracts/errors/error-codes.json +0 -48
  9. package/contracts/errors/integration-recovery-v1.json +0 -127
  10. package/contracts/errors/provider-normalization.json +0 -111
  11. package/contracts/events/conformance-invalid.json +0 -20
  12. package/contracts/events/conformance.json +0 -511
  13. package/contracts/events/new-kaji-event-v1.schema.json +0 -1021
  14. package/contracts/events/stored-kaji-event-v1.schema.json +0 -1025
  15. package/contracts/feature-tiers-v1.json +0 -488
  16. package/contracts/integrations/abi-index-v1.json +0 -8
  17. package/contracts/integrations/conformance-invalid.json +0 -443
  18. package/contracts/integrations/conformance-valid.json +0 -121
  19. package/contracts/integrations/copy-provenance-v1.schema.json +0 -61
  20. package/contracts/integrations/echo-tool-abi-v1.json +0 -37
  21. package/contracts/integrations/github-api-conformance-v1.json +0 -644
  22. package/contracts/integrations/github-tool-abi-typescript-v1.json +0 -369
  23. package/contracts/integrations/github-tool-abi-v1.json +0 -146
  24. package/contracts/integrations/gmail-api-conformance-v1.json +0 -750
  25. package/contracts/integrations/gmail-tool-abi-v1.json +0 -62
  26. package/contracts/integrations/index.schema.json +0 -37
  27. package/contracts/integrations/manifest.schema.json +0 -119
  28. package/contracts/parity/expected-normalized.json +0 -4906
  29. package/contracts/parity/scenarios.json +0 -100
  30. package/contracts/parity/scenarios.schema.json +0 -214
  31. package/contracts/providers/cost-conformance.json +0 -112
  32. package/contracts/release/github-proof-v1.schema.json +0 -138
  33. package/contracts/release/gmail-proof-v1.schema.json +0 -138
  34. package/contracts/release/kaji-ts-consumer-handoff-v1.schema.json +0 -1289
  35. package/contracts/release/publisher-identity-receipt-v1.schema.json +0 -319
  36. package/contracts/release/typescript-onboarding-evidence-v1.schema.json +0 -740
  37. package/contracts/tools/conformance-invalid.json +0 -271
  38. package/contracts/tools/conformance-valid.json +0 -78
  39. package/contracts/tools/tool-schema-v1.schema.json +0 -18
  40. package/dist/anthropic.cjs +0 -1231
  41. package/dist/anthropic.cjs.map +0 -1
  42. package/dist/anthropic.d.cts +0 -26
  43. package/dist/anthropic.d.ts +0 -26
  44. package/dist/anthropic.js +0 -270
  45. package/dist/anthropic.js.map +0 -1
  46. package/dist/auth.cjs +0 -1507
  47. package/dist/auth.cjs.map +0 -1
  48. package/dist/auth.d.cts +0 -129
  49. package/dist/auth.d.ts +0 -129
  50. package/dist/auth.js +0 -1039
  51. package/dist/auth.js.map +0 -1
  52. package/dist/base-B9FRMcP8.d.cts +0 -140
  53. package/dist/base-nHQd1VtS.d.ts +0 -140
  54. package/dist/chunk-AAM33KAO.js +0 -4367
  55. package/dist/chunk-AAM33KAO.js.map +0 -1
  56. package/dist/chunk-KAJ6BM64.js +0 -153
  57. package/dist/chunk-KAJ6BM64.js.map +0 -1
  58. package/dist/chunk-KCAXIOZS.js +0 -308
  59. package/dist/chunk-KCAXIOZS.js.map +0 -1
  60. package/dist/chunk-LSJ4AVO2.js +0 -243
  61. package/dist/chunk-LSJ4AVO2.js.map +0 -1
  62. package/dist/chunk-TM7ZGOJX.js +0 -716
  63. package/dist/chunk-TM7ZGOJX.js.map +0 -1
  64. package/dist/cli/bin.d.ts +0 -2
  65. package/dist/cli/bin.js +0 -13
  66. package/dist/cli/bin.js.map +0 -1
  67. package/dist/cli/chunk-2RCWPRVY.js +0 -6277
  68. package/dist/cli/chunk-2RCWPRVY.js.map +0 -1
  69. package/dist/cli/chunk-SEBX54TR.js +0 -681
  70. package/dist/cli/chunk-SEBX54TR.js.map +0 -1
  71. package/dist/cli/index.d.ts +0 -232
  72. package/dist/cli/index.js +0 -11
  73. package/dist/cli/index.js.map +0 -1
  74. package/dist/cli/init-worker.d.ts +0 -2
  75. package/dist/cli/init-worker.js +0 -18
  76. package/dist/cli/init-worker.js.map +0 -1
  77. package/dist/cli/integration-copy-worker.js +0 -48
  78. package/dist/cli/integration-copy-worker.js.map +0 -1
  79. package/dist/cli/package-entry-cjs.cjs +0 -21
  80. package/dist/cli/package-entry-cjs.cjs.map +0 -1
  81. package/dist/cli/package-entry-cjs.d.cts +0 -2
  82. package/dist/cli/package-entry.d.ts +0 -2
  83. package/dist/cli/package-entry.js +0 -13
  84. package/dist/cli/package-entry.js.map +0 -1
  85. package/dist/context-BaFHrQHv.d.cts +0 -21
  86. package/dist/context-BaFHrQHv.d.ts +0 -21
  87. package/dist/context-C-YPY-GS.d.cts +0 -1538
  88. package/dist/context-C-YPY-GS.d.ts +0 -1538
  89. package/dist/index.cjs +0 -12346
  90. package/dist/index.cjs.map +0 -1
  91. package/dist/index.d.cts +0 -1560
  92. package/dist/index.d.ts +0 -1560
  93. package/dist/index.js +0 -7852
  94. package/dist/index.js.map +0 -1
  95. package/dist/integrations/github.cjs +0 -2092
  96. package/dist/integrations/github.cjs.map +0 -1
  97. package/dist/integrations/github.d.cts +0 -21
  98. package/dist/integrations/github.d.ts +0 -21
  99. package/dist/integrations/github.js +0 -2088
  100. package/dist/integrations/github.js.map +0 -1
  101. package/dist/integrations.cjs +0 -3370
  102. package/dist/integrations.cjs.map +0 -1
  103. package/dist/integrations.d.cts +0 -202
  104. package/dist/integrations.d.ts +0 -202
  105. package/dist/integrations.js +0 -2650
  106. package/dist/integrations.js.map +0 -1
  107. package/dist/observability-Cj--OkME.d.cts +0 -96
  108. package/dist/observability-Cj--OkME.d.ts +0 -96
  109. package/dist/openai.cjs +0 -1235
  110. package/dist/openai.cjs.map +0 -1
  111. package/dist/openai.d.cts +0 -32
  112. package/dist/openai.d.ts +0 -32
  113. package/dist/openai.js +0 -272
  114. package/dist/openai.js.map +0 -1
  115. package/dist/testing.cjs +0 -554
  116. package/dist/testing.cjs.map +0 -1
  117. package/dist/testing.d.cts +0 -43
  118. package/dist/testing.d.ts +0 -43
  119. package/dist/testing.js +0 -118
  120. package/dist/testing.js.map +0 -1
  121. package/registry/echo/index.ts +0 -53
  122. package/registry/echo/manifest.json +0 -53
  123. package/registry/github/LICENSE +0 -105
  124. package/registry/github/client.ts +0 -1727
  125. package/registry/github/index.ts +0 -263
  126. package/registry/github/manifest.json +0 -227
  127. package/registry/github/owner-fixtures.json +0 -10
  128. package/registry/github/tests/github.test.ts +0 -32
  129. package/registry/gmail/LICENSE +0 -105
  130. package/registry/gmail/client.ts +0 -548
  131. package/registry/gmail/index.ts +0 -165
  132. package/registry/gmail/manifest.json +0 -102
  133. package/registry/gmail/owner-fixtures.json +0 -10
  134. package/registry/gmail/tests/gmail.test.ts +0 -32
  135. package/registry/index.json +0 -21
  136. package/registry/index.schema.json +0 -37
  137. package/registry/schema.json +0 -119
@@ -1,37 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "version": "1.0.0",
4
- "namespace": "echo",
5
- "tools": [
6
- {
7
- "name": "say",
8
- "description": "Return the input string unchanged.",
9
- "parameters": {
10
- "$schema": "https://json-schema.org/draft/2020-12/schema",
11
- "type": "object",
12
- "properties": {
13
- "message": { "type": "string" }
14
- },
15
- "required": ["message"],
16
- "additionalProperties": false
17
- },
18
- "risk": "read",
19
- "parallel_safe": false
20
- },
21
- {
22
- "name": "shout",
23
- "description": "Return the input string uppercased.",
24
- "parameters": {
25
- "$schema": "https://json-schema.org/draft/2020-12/schema",
26
- "type": "object",
27
- "properties": {
28
- "message": { "type": "string" }
29
- },
30
- "required": ["message"],
31
- "additionalProperties": false
32
- },
33
- "risk": "read",
34
- "parallel_safe": false
35
- }
36
- ]
37
- }
@@ -1,644 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://kaji.dev/contracts/integrations/github-api-conformance-v1.json",
4
- "version": "1.0.0",
5
- "repository": "octo/widgets",
6
- "token": "fixture-token",
7
- "cases": [
8
- {
9
- "name": "search code",
10
- "operation": "search_code",
11
- "input": { "query": "needle", "page": 1, "per_page": 2 },
12
- "responses": [
13
- {
14
- "status": 200,
15
- "headers": { "content-type": "application/json" },
16
- "json": {
17
- "total_count": 1,
18
- "items": [
19
- {
20
- "path": "src/lib.py",
21
- "sha": "abc123",
22
- "repository": { "full_name": "octo/widgets" },
23
- "text_matches": [{ "fragment": "the needle is here" }]
24
- }
25
- ]
26
- }
27
- }
28
- ],
29
- "expected_requests": [
30
- {
31
- "method": "GET",
32
- "path_and_query": "/search/code?page=1&per_page=2&q=needle%20repo%3Aocto%2Fwidgets",
33
- "headers": {
34
- "accept": "application/vnd.github.text-match+json",
35
- "authorization": "Bearer fixture-token"
36
- },
37
- "body": null
38
- }
39
- ],
40
- "expected": {
41
- "result": {
42
- "items": [{ "fragment": "the needle is here", "path": "src/lib.py", "sha": "abc123" }],
43
- "total_count": 1
44
- }
45
- }
46
- },
47
- {
48
- "name": "get file",
49
- "operation": "get_file",
50
- "input": { "path": "src/lib.py", "ref": "main" },
51
- "responses": [
52
- {
53
- "status": 200,
54
- "headers": { "content-type": "application/json" },
55
- "json": {
56
- "type": "file",
57
- "path": "src/lib.py",
58
- "sha": "def456",
59
- "size": 6,
60
- "encoding": "base64",
61
- "content": "aGVsbG8K"
62
- }
63
- }
64
- ],
65
- "expected_requests": [
66
- {
67
- "method": "GET",
68
- "path_and_query": "/repos/octo/widgets/contents/src/lib.py?ref=main",
69
- "headers": {
70
- "accept": "application/vnd.github+json",
71
- "authorization": "Bearer fixture-token"
72
- },
73
- "body": null
74
- }
75
- ],
76
- "expected": {
77
- "result": {
78
- "content": "hello\n",
79
- "content_omitted": false,
80
- "path": "src/lib.py",
81
- "sha": "def456",
82
- "size": 6
83
- }
84
- }
85
- },
86
- {
87
- "name": "omit large file without partial content",
88
- "operation": "get_file",
89
- "input": { "path": "large.txt" },
90
- "responses": [
91
- {
92
- "status": 200,
93
- "headers": { "content-type": "application/json" },
94
- "json": {
95
- "type": "file",
96
- "path": "large.txt",
97
- "sha": "large456",
98
- "size": 49153,
99
- "encoding": "base64",
100
- "content": ""
101
- }
102
- }
103
- ],
104
- "expected_requests": [
105
- {
106
- "method": "GET",
107
- "path_and_query": "/repos/octo/widgets/contents/large.txt",
108
- "headers": {
109
- "accept": "application/vnd.github+json",
110
- "authorization": "Bearer fixture-token"
111
- },
112
- "body": null
113
- }
114
- ],
115
- "expected": {
116
- "result": {
117
- "content_omitted": true,
118
- "path": "large.txt",
119
- "sha": "large456",
120
- "size": 49153
121
- }
122
- }
123
- },
124
- {
125
- "name": "list issues",
126
- "operation": "list_issues",
127
- "input": { "state": "closed", "page": 2, "per_page": 2 },
128
- "responses": [
129
- {
130
- "status": 200,
131
- "headers": {
132
- "content-type": "application/json",
133
- "link": "<https://api.github.com/page/3>; rel=next"
134
- },
135
- "json": [
136
- { "number": 7, "state": "closed", "title": "Fixed", "body": "Issue body" },
137
- { "number": 8, "state": "open", "title": "Open", "body": null }
138
- ]
139
- }
140
- ],
141
- "expected_requests": [
142
- {
143
- "method": "GET",
144
- "path_and_query": "/repos/octo/widgets/issues?page=2&per_page=2&state=closed",
145
- "headers": {
146
- "accept": "application/vnd.github+json",
147
- "authorization": "Bearer fixture-token"
148
- },
149
- "body": null
150
- }
151
- ],
152
- "expected": {
153
- "result": {
154
- "items": [
155
- { "body_preview": "Issue body", "number": 7, "state": "closed", "title": "Fixed" },
156
- { "body_preview": "", "number": 8, "state": "open", "title": "Open" }
157
- ]
158
- }
159
- }
160
- },
161
- {
162
- "name": "get issue",
163
- "operation": "get_issue",
164
- "input": { "issue_number": 7 },
165
- "responses": [
166
- {
167
- "status": 200,
168
- "headers": { "content-type": "application/json" },
169
- "json": {
170
- "number": 7,
171
- "state": "open",
172
- "title": "Bug",
173
- "body": "Details",
174
- "html_url": "https://github.com/octo/widgets/issues/7"
175
- }
176
- }
177
- ],
178
- "expected_requests": [
179
- {
180
- "method": "GET",
181
- "path_and_query": "/repos/octo/widgets/issues/7",
182
- "headers": {
183
- "accept": "application/vnd.github+json",
184
- "authorization": "Bearer fixture-token"
185
- },
186
- "body": null
187
- }
188
- ],
189
- "expected": {
190
- "result": {
191
- "body": "Details",
192
- "number": 7,
193
- "state": "open",
194
- "title": "Bug",
195
- "url": "https://github.com/octo/widgets/issues/7"
196
- }
197
- }
198
- },
199
- {
200
- "name": "create issue",
201
- "operation": "create_issue",
202
- "input": { "title": "Bug", "body": "Details" },
203
- "responses": [
204
- {
205
- "status": 201,
206
- "headers": { "content-type": "application/json" },
207
- "json": {
208
- "number": 9,
209
- "state": "open",
210
- "title": "Bug",
211
- "body": "Details",
212
- "html_url": "https://github.com/octo/widgets/issues/9"
213
- }
214
- }
215
- ],
216
- "expected_requests": [
217
- {
218
- "method": "POST",
219
- "path_and_query": "/repos/octo/widgets/issues",
220
- "headers": {
221
- "accept": "application/vnd.github+json",
222
- "authorization": "Bearer fixture-token",
223
- "content-type": "application/json"
224
- },
225
- "body": "{\"body\":\"Details\",\"title\":\"Bug\"}"
226
- }
227
- ],
228
- "expected": {
229
- "result": {
230
- "body": "Details",
231
- "number": 9,
232
- "state": "open",
233
- "title": "Bug",
234
- "url": "https://github.com/octo/widgets/issues/9"
235
- }
236
- }
237
- },
238
- {
239
- "name": "add comment",
240
- "operation": "add_comment",
241
- "input": { "issue_number": 7, "body": "Looks good" },
242
- "responses": [
243
- {
244
- "status": 201,
245
- "headers": { "content-type": "application/json" },
246
- "json": {
247
- "id": 101,
248
- "html_url": "https://github.com/octo/widgets/issues/7#issuecomment-101",
249
- "body": "Looks good"
250
- }
251
- }
252
- ],
253
- "expected_requests": [
254
- {
255
- "method": "POST",
256
- "path_and_query": "/repos/octo/widgets/issues/7/comments",
257
- "headers": {
258
- "accept": "application/vnd.github+json",
259
- "authorization": "Bearer fixture-token",
260
- "content-type": "application/json"
261
- },
262
- "body": "{\"body\":\"Looks good\"}"
263
- }
264
- ],
265
- "expected": {
266
- "result": {
267
- "id": 101,
268
- "url": "https://github.com/octo/widgets/issues/7#issuecomment-101"
269
- }
270
- }
271
- },
272
- {
273
- "name": "empty search result",
274
- "operation": "search_code",
275
- "input": { "query": "absent", "page": 1, "per_page": 10 },
276
- "responses": [
277
- {
278
- "status": 200,
279
- "headers": { "content-type": "application/json" },
280
- "json": { "total_count": 0, "items": [] }
281
- }
282
- ],
283
- "expected_requests": [
284
- {
285
- "method": "GET",
286
- "path_and_query": "/search/code?page=1&per_page=10&q=absent%20repo%3Aocto%2Fwidgets",
287
- "headers": {
288
- "accept": "application/vnd.github.text-match+json",
289
- "authorization": "Bearer fixture-token"
290
- },
291
- "body": null
292
- }
293
- ],
294
- "expected": { "result": { "items": [], "total_count": 0 } }
295
- },
296
- {
297
- "name": "401 requires authentication",
298
- "operation": "get_issue",
299
- "input": { "issue_number": 7 },
300
- "responses": [
301
- { "status": 401, "headers": { "content-type": "application/json" }, "body": "private-auth-body" }
302
- ],
303
- "expected_requests": [
304
- {
305
- "method": "GET",
306
- "path_and_query": "/repos/octo/widgets/issues/7",
307
- "headers": {
308
- "accept": "application/vnd.github+json",
309
- "authorization": "Bearer fixture-token"
310
- },
311
- "body": null
312
- }
313
- ],
314
- "expected": { "error": { "code": "INTEGRATION_AUTH_REQUIRED", "outcome": "failed", "retryable": false } }
315
- },
316
- {
317
- "name": "permission 403 is not rate limit",
318
- "operation": "get_issue",
319
- "input": { "issue_number": 7 },
320
- "responses": [
321
- { "status": 403, "headers": { "content-type": "application/json" }, "body": "private-permission-body" }
322
- ],
323
- "expected_requests": [
324
- {
325
- "method": "GET",
326
- "path_and_query": "/repos/octo/widgets/issues/7",
327
- "headers": {
328
- "accept": "application/vnd.github+json",
329
- "authorization": "Bearer fixture-token"
330
- },
331
- "body": null
332
- }
333
- ],
334
- "expected": { "error": { "code": "INTEGRATION_API_ERROR", "outcome": "failed", "retryable": false } }
335
- },
336
- {
337
- "name": "secondary rate limit retries one read",
338
- "operation": "search_code",
339
- "input": { "query": "needle", "page": 1, "per_page": 2 },
340
- "responses": [
341
- {
342
- "status": 403,
343
- "headers": { "retry-after": "0", "x-ratelimit-remaining": "1", "x-ratelimit-reset": "1" },
344
- "body": "private-rate-body"
345
- },
346
- {
347
- "status": 200,
348
- "headers": { "content-type": "application/json" },
349
- "json": { "total_count": 0, "items": [] }
350
- }
351
- ],
352
- "expected_requests": [
353
- {
354
- "method": "GET",
355
- "path_and_query": "/search/code?page=1&per_page=2&q=needle%20repo%3Aocto%2Fwidgets",
356
- "headers": {
357
- "accept": "application/vnd.github.text-match+json",
358
- "authorization": "Bearer fixture-token"
359
- },
360
- "body": null
361
- },
362
- {
363
- "method": "GET",
364
- "path_and_query": "/search/code?page=1&per_page=2&q=needle%20repo%3Aocto%2Fwidgets",
365
- "headers": {
366
- "accept": "application/vnd.github.text-match+json",
367
- "authorization": "Bearer fixture-token"
368
- },
369
- "body": null
370
- }
371
- ],
372
- "expected_sleeps": [0],
373
- "expected": { "result": { "items": [], "total_count": 0 } }
374
- },
375
- {
376
- "name": "404 is confirmed read failure",
377
- "operation": "get_issue",
378
- "input": { "issue_number": 404 },
379
- "responses": [
380
- { "status": 404, "headers": { "content-type": "application/json" }, "body": "private-not-found" }
381
- ],
382
- "expected_requests": [
383
- {
384
- "method": "GET",
385
- "path_and_query": "/repos/octo/widgets/issues/404",
386
- "headers": {
387
- "accept": "application/vnd.github+json",
388
- "authorization": "Bearer fixture-token"
389
- },
390
- "body": null
391
- }
392
- ],
393
- "expected": { "error": { "code": "INTEGRATION_API_ERROR", "outcome": "failed", "retryable": false } }
394
- },
395
- {
396
- "name": "422 is confirmed mutation rejection",
397
- "operation": "create_issue",
398
- "input": { "title": "Bug", "body": "Details" },
399
- "responses": [
400
- { "status": 422, "headers": { "content-type": "application/json" }, "body": "private-validation" }
401
- ],
402
- "expected_requests": [
403
- {
404
- "method": "POST",
405
- "path_and_query": "/repos/octo/widgets/issues",
406
- "headers": {
407
- "accept": "application/vnd.github+json",
408
- "authorization": "Bearer fixture-token",
409
- "content-type": "application/json"
410
- },
411
- "body": "{\"body\":\"Details\",\"title\":\"Bug\"}"
412
- }
413
- ],
414
- "expected": { "error": { "code": "INTEGRATION_API_ERROR", "outcome": "failed", "retryable": false } }
415
- },
416
- {
417
- "name": "429 mutation is not retried",
418
- "operation": "add_comment",
419
- "input": { "issue_number": 7, "body": "Looks good" },
420
- "responses": [
421
- { "status": 429, "headers": { "retry-after": "0", "x-ratelimit-remaining": "0" }, "body": "private-rate" }
422
- ],
423
- "expected_requests": [
424
- {
425
- "method": "POST",
426
- "path_and_query": "/repos/octo/widgets/issues/7/comments",
427
- "headers": {
428
- "accept": "application/vnd.github+json",
429
- "authorization": "Bearer fixture-token",
430
- "content-type": "application/json"
431
- },
432
- "body": "{\"body\":\"Looks good\"}"
433
- }
434
- ],
435
- "expected_sleeps": [],
436
- "expected": { "error": { "code": "INTEGRATION_RATE_LIMITED", "outcome": "failed", "retryable": true } }
437
- },
438
- {
439
- "name": "malformed JSON read is certified read failure",
440
- "operation": "get_issue",
441
- "input": { "issue_number": 7 },
442
- "responses": [
443
- { "status": 200, "headers": { "content-type": "application/json" }, "body": "{not-json" }
444
- ],
445
- "expected_requests": [
446
- {
447
- "method": "GET",
448
- "path_and_query": "/repos/octo/widgets/issues/7",
449
- "headers": {
450
- "accept": "application/vnd.github+json",
451
- "authorization": "Bearer fixture-token"
452
- },
453
- "body": null
454
- }
455
- ],
456
- "expected": { "error": { "code": "INTEGRATION_API_ERROR", "outcome": "failed", "retryable": true } }
457
- },
458
- {
459
- "name": "malformed JSON after POST is unknown",
460
- "operation": "create_issue",
461
- "input": { "title": "Bug", "body": "Details" },
462
- "responses": [
463
- { "status": 201, "headers": { "content-type": "application/json" }, "body": "{private-not-json" }
464
- ],
465
- "expected_requests": [
466
- {
467
- "method": "POST",
468
- "path_and_query": "/repos/octo/widgets/issues",
469
- "headers": {
470
- "accept": "application/vnd.github+json",
471
- "authorization": "Bearer fixture-token",
472
- "content-type": "application/json"
473
- },
474
- "body": "{\"body\":\"Details\",\"title\":\"Bug\"}"
475
- }
476
- ],
477
- "expected": { "exception": "unknown" }
478
- },
479
- {
480
- "name": "oversize transport read is certified read failure",
481
- "operation": "get_issue",
482
- "input": { "issue_number": 7 },
483
- "responses": [{ "transport_error": "response_limit" }],
484
- "expected_requests": [
485
- {
486
- "method": "GET",
487
- "path_and_query": "/repos/octo/widgets/issues/7",
488
- "headers": {
489
- "accept": "application/vnd.github+json",
490
- "authorization": "Bearer fixture-token"
491
- },
492
- "body": null
493
- }
494
- ],
495
- "expected": { "error": { "code": "INTEGRATION_API_ERROR", "outcome": "failed", "retryable": true } }
496
- },
497
- {
498
- "name": "request cancellation propagates",
499
- "operation": "get_issue",
500
- "input": { "issue_number": 7 },
501
- "responses": [{ "transport_error": "cancelled" }],
502
- "expected_requests": [
503
- {
504
- "method": "GET",
505
- "path_and_query": "/repos/octo/widgets/issues/7",
506
- "headers": {
507
- "accept": "application/vnd.github+json",
508
- "authorization": "Bearer fixture-token"
509
- },
510
- "body": null
511
- }
512
- ],
513
- "expected": { "exception": "cancelled" }
514
- },
515
- {
516
- "name": "connection loss after write dispatch is unknown",
517
- "operation": "create_issue",
518
- "input": { "title": "Bug", "body": "Details" },
519
- "responses": [{ "transport_error": "connection" }],
520
- "expected_requests": [
521
- {
522
- "method": "POST",
523
- "path_and_query": "/repos/octo/widgets/issues",
524
- "headers": {
525
- "accept": "application/vnd.github+json",
526
- "authorization": "Bearer fixture-token",
527
- "content-type": "application/json"
528
- },
529
- "body": "{\"body\":\"Details\",\"title\":\"Bug\"}"
530
- }
531
- ],
532
- "expected": { "exception": "unknown" }
533
- },
534
- {
535
- "name": "mismatched search repository rejects whole response",
536
- "operation": "search_code",
537
- "input": { "query": "needle", "page": 1, "per_page": 10 },
538
- "responses": [
539
- {
540
- "status": 200,
541
- "headers": { "content-type": "application/json" },
542
- "json": {
543
- "total_count": 1,
544
- "items": [
545
- {
546
- "path": "private.txt",
547
- "sha": "bad",
548
- "repository": { "full_name": "other/private" },
549
- "text_matches": [{ "fragment": "private-fragment" }]
550
- }
551
- ]
552
- }
553
- }
554
- ],
555
- "expected_requests": [
556
- {
557
- "method": "GET",
558
- "path_and_query": "/search/code?page=1&per_page=10&q=needle%20repo%3Aocto%2Fwidgets",
559
- "headers": {
560
- "accept": "application/vnd.github.text-match+json",
561
- "authorization": "Bearer fixture-token"
562
- },
563
- "body": null
564
- }
565
- ],
566
- "expected": { "error": { "code": "INTEGRATION_API_ERROR", "outcome": "failed", "retryable": true } }
567
- },
568
- {
569
- "name": "scope qualifier rejected before token",
570
- "operation": "search_code",
571
- "input": { "query": "Needle ORG:other", "page": 1, "per_page": 10 },
572
- "responses": [],
573
- "expected_requests": [],
574
- "expected_token_calls": 0,
575
- "expected": { "error": { "code": "INTEGRATION_POLICY_REJECTED", "outcome": "failed", "retryable": false } }
576
- },
577
- {
578
- "name": "invalid base64 file is certified read failure",
579
- "operation": "get_file",
580
- "input": { "path": "bad.txt" },
581
- "responses": [
582
- {
583
- "status": 200,
584
- "headers": { "content-type": "application/json" },
585
- "json": {
586
- "type": "file",
587
- "path": "bad.txt",
588
- "sha": "bad64",
589
- "size": 3,
590
- "encoding": "base64",
591
- "content": "***="
592
- }
593
- }
594
- ],
595
- "expected_requests": [
596
- {
597
- "method": "GET",
598
- "path_and_query": "/repos/octo/widgets/contents/bad.txt",
599
- "headers": {
600
- "accept": "application/vnd.github+json",
601
- "authorization": "Bearer fixture-token"
602
- },
603
- "body": null
604
- }
605
- ],
606
- "expected": { "error": { "code": "INTEGRATION_API_ERROR", "outcome": "failed", "retryable": true } }
607
- },
608
- {
609
- "name": "invalid UTF-8 file is certified read failure",
610
- "operation": "get_file",
611
- "input": { "path": "binary.txt" },
612
- "responses": [
613
- {
614
- "status": 200,
615
- "headers": { "content-type": "application/json" },
616
- "json": {
617
- "type": "file",
618
- "path": "binary.txt",
619
- "sha": "badutf8",
620
- "size": 1,
621
- "encoding": "base64",
622
- "content": "/w=="
623
- }
624
- }
625
- ],
626
- "expected_requests": [
627
- {
628
- "method": "GET",
629
- "path_and_query": "/repos/octo/widgets/contents/binary.txt",
630
- "headers": {
631
- "accept": "application/vnd.github+json",
632
- "authorization": "Bearer fixture-token"
633
- },
634
- "body": null
635
- }
636
- ],
637
- "expected": { "error": { "code": "INTEGRATION_API_ERROR", "outcome": "failed", "retryable": true } }
638
- }
639
- ],
640
- "durable_result_boundaries": [
641
- { "name": "last accepted byte", "serialized_bytes": 65536, "accepted": true },
642
- { "name": "first rejected byte", "serialized_bytes": 65537, "accepted": false }
643
- ]
644
- }