Return 499 for canceled instance restores - #445
Merged
Conversation
sjmiller609
marked this pull request as ready for review
August 25, 2026 18:52
yummybomb
approved these changes
Aug 25, 2026
-->
✱ stlc build✅ go code · compare
✅ python code · compare
✅ typescript code · compare
Diagnostics: ❗ 0 new / 1 total error, 💡 0 new / 5 total note
Build metadata
This comment is auto-generated by stlc and is kept up to date as you push. |
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
Validation
go test ./cmd/api/api -run 'TestRestoreInstance_ErrorMapping|TestInstanceActions_ImageNotFoundMapsTo404' -count=1go test ./lib/oapi -count=1go vet ./cmd/api/api ./lib/oapigo build ./cmd/apiThe full
cmd/api/apipackage suite was attempted but requires host capabilities and tools unavailable locally (mkfs.erofs, network bridge permissions, and authenticated Docker pulls). The focused handler tests pass.Note
Low Risk
Narrow change to restore error handling and API documentation; success paths and security-sensitive logic are untouched.
Overview
Restore now treats caller cancellation as HTTP 499 (
client_closed_request) instead of a generic 500, whenRestoreInstancereturns an error wrappingcontext.Canceled. Cancellations are logged at debug rather than as internal errors.The OpenAPI spec documents the new 499 response on
POST /instances/{id}/restore, and generatedlib/oapitypes handle encoding/decoding it.TestRestoreInstance_ErrorMappinglocks in 499 vs 500 mapping; other restore error paths (404, 409, etc.) are unchanged.Reviewed by Cursor Bugbot for commit 7ca2e3d. Bugbot is set up for automated code reviews on this repo. Configure here.