Commit 744b8f5
* fix(metadata-protocol,spec): report NOT_ATTEMPTED for a stopped bulk write's tail, and make the counters reconcile (#7539)
A non-atomic `/batch` that stopped at the first failure answered with a
truncated `results` array and counters that did not add up: two results for
three records, no entry for the un-attempted record, and
`succeeded + failed != total`. The skipped record was invisible twice over —
no `results[]` entry and counted in neither bucket — so the arithmetic
mismatch was its only trace.
`buildBatchDataResponse` read `total` from the request while `results`,
`succeeded` and `failed` came from a loop that had stopped early.
`buildUpdateManyResponse` and `buildDeleteManyResponse` under-reported the
same way. All three now share one reconciler that pads the outcome out to the
request length with `NOT_ATTEMPTED` rows — the registered ADR-0112 code the
atomic arm has emitted since #4793 — and returns `failed` as the count of
every non-success row, so `succeeded + failed === total === results.length`
on both arms.
The stop itself is unchanged, per `BatchOptionsSchema.continueOnError` ("If
true (and atomic=false), continue processing remaining records after errors")
and ADR-0119 D4, whose test plan holds non-atomic batches to "behave exactly
as before". This is a reporting fix; `continueOnError` remains the flag that
buys continuation.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016gd2bypaK4KYs78q8RP38G
* docs(api): describe the stopped-batch NOT_ATTEMPTED tail on the non-atomic arm (#7539)
`data-api.mdx` described `atomic: false` as "sequential best-effort, stopping
at the first failure" without saying what the response contains for the
records it never reached — the shape the fix makes explicit. `batch.mdx` is
regenerated from the two `.describe()` strings this change touches.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016gd2bypaK4KYs78q8RP38G
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent c168688 commit 744b8f5
11 files changed
Lines changed: 516 additions & 16 deletions
File tree
- .changeset
- content/docs
- api
- references/api
- packages
- metadata-protocol/src
- spec/src/api
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
| 244 | + | |
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
287 | | - | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
288 | 290 | | |
289 | 291 | | |
290 | 292 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| |||
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
258 | | - | |
259 | 258 | | |
260 | 259 | | |
261 | | - | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
262 | 271 | | |
263 | 272 | | |
264 | 273 | | |
| |||
0 commit comments