Repository navigation
Vanguard: Keep batchId and accept replayed batches - #4
Merged
Merged
Conversation
The API lets a client retry POST /batches safely by sending a batchId: a retry creates only the missing jobs and answers 200 with status 'replayed' or 'partial'. The vendored spec did not describe batchId or the 200 response, so the CLI dropped batchId from the request and reported a replay as an error. The batch schemas and responses are synced from nexrender-api and the client regenerated. `batch submit` keeps batchId (and each job's batchItemId), treats 200 as success with a summary that says what the retry did, and on 503 with a batchId tells the user to run the same command again. The README explains how to make a batch retry-safe. Found by Vanguard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Synced from nexrender-api: retries are recognised for 30 days, while the batch's jobs are kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A retry can answer 200 partial while still listing jobs that could not be created; the summary now says so instead of claiming the missing jobs were created. The README and the vendored spec say to send a retry only after the previous attempt has finished, since overlapping requests with the same batchId can both create jobs, and that batchItemIds must be unique. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Synced from nexrender-api. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
POST /v2/batchescan be retried safely. The client sends abatchId(a ULID it chooses), and a second submission creates only the jobs not yet in the batch. The API then answers200with statusreplayed(nothing missing) orpartial(missing jobs created now). The CLI broke this in two ways:api.BatchCreationhad nobatchId, sobatch submitsilently dropped it from the request. Every retry became a new batch.201counted as success, so a200 replayedanswer was reported as a failure with exit code 7.Changes:
/batchesresponses are synced from nexrender/nexrender-api#188, andapi.gen.gois regenerated.BatchCreation.BatchIdnow exists, and thereplayedstatus,JSON200,JSON409andJSON503are typed.batch submit:200is a success. The summary says whether nothing new was created or which missing jobs were.503on a request that has abatchIdgets the hint to run the same command again.batchItemIdalready survives throughJobCreation's additional properties; the new test pins that.This repository only has
main, so the PR targets it. Matching retries bybatchItemIdon the server needs nexrender/nexrender-api#187 and nexrender/nexrender-database#55.Found by Vanguard, the new end-to-end suite.
Testing
TestBatchSubmitKeepsBatchIDAndAcceptsReplay: the request carriesbatchIdandbatchItemId, and a200 replayedresponse exits 0 with the replay summary. It fails without this change.go generate ./internal/api,gofmt -l(clean),go vet ./...,go test ./...,go build ./cmd/nexrender.