ryanworl opened a new pull request, #1832:
URL: https://github.com/apache/iceberg-go/pull/1832

   ## What
   
   `handleNon200` returned early when the Iceberg error-envelope JSON failed to 
decode, before applying the per-status override map. A 5xx commit response 
whose body a proxy or load balancer replaced with an HTML error page (or 
truncated JSON) therefore surfaced as a bare `ErrRESTError` decode failure 
instead of `ErrCommitStateUnknown`.
   
   Callers classify `ErrCommitStateUnknown` as an ambiguous commit — the write 
may or may not have landed — and handle it accordingly. Losing that sentinel 
turns a transient catalog/proxy fault into a fatal error after one attempt; 
transport garbling should not strip commit-state classification.
   
   On a non-EOF decode failure, `handleNon200` now looks up the caller-supplied 
`override[status]` and wraps that sentinel (else `ErrRESTError`), still 
wrapping the `errorResponse` so the HTTP status and `Retry-After` survive for 
pollers like `WaitForPlan`. Mapped 5xx commits stay `ErrCommitStateUnknown`, 
mapped 409s stay `ErrCommitFailed`, unmapped statuses still classify as 
`ErrRESTError`, and the decode failure remains in the error message.
   
   ## Tests
   
   - Table-driven `TestHandleNon200_StatusOverrideAppliesOnMalformedBody`: 
well-formed vs malformed 500 both map to `ErrCommitStateUnknown`; well-formed 
vs malformed 409 both map to `ErrCommitFailed`; unmapped malformed 404 stays 
`ErrRESTError`.
   - `TestCommitTableErrorBodyKeepsCommitStateUnknown` pins the same 
well-formed/malformed pairs end-to-end through `CommitTable` for 
500/502/503/504.
   - `go test ./catalog/...` and `golangci-lint run` are clean.
   
   Made with [Cursor](https://cursor.com)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to