Go: map HTTP 400 to validation (not api_error)

Merged
JE
4mo ago
+28-7

Problem

SPEC.md §6 prescribes 400 → validation to match the other five SDKs, but Go's checkResponse had no case http.StatusBadRequest, so 400 Bad Request fell through to the default arm and was mislabeled api_error. The SPEC self-tagged this as a [CONFLICT]/[static] carve-out with no conformance coverage.

Fix

  • Add case http.StatusBadRequest → CodeValidation (retryable: false) to go/pkg/basecamp/helpers.go. This is a code/message correction, not a retry-behavior change.
  • Resolve the SPEC carve-outs: mark the error-code table row, the mapping-algorithm step, the non-retryable-errors note, and Appendix D as [conformance]-verified; drop the stale "Go currently maps 400 to api_error" note.
  • Add a 400 → validation case to the shared conformance fixture conformance/tests/error-mapping.json and a 400 row to helpers_test.go.

Tests / Verify

  • helpers_test.go 400 row proven to fail pre-fix (api_error != validation).
  • The new fixture case is green across all five conformance runners (Go, Kotlin, TypeScript, Ruby, Python) and passes conformance-fixtures-check.

Part of the retry-contract follow-up (#456 / #460 / #461 / #476). Independent of the other two PRs in the series (no shared files).


Summary by cubic

Maps HTTP 400 to validation in the Go SDK to align with SPEC §6 and other SDKs. Adds conformance coverage and a unit test; 400 remains non-retryable.

  • Bug Fixes
    • Go: map 400 → validation in go/pkg/basecamp/helpers.go (retryable: false).
    • Tests: add 400 case to conformance/tests/error-mapping.json and helpers_test.go.
    • Spec: mark 400 mapping and non-retryable note as [conformance]; clarify mapping algorithm fallbacks.