spawn/shared
A 6e47cb597f
refactor: Extract generic_cloud_api retry logic into helper functions (#78)
Split the 66-line generic_cloud_api function into focused helpers to reduce
complexity and eliminate duplication:

- _parse_api_response: Extracts HTTP code and response body (10 lines)
- _make_api_request: Builds curl args and executes request (27 lines)
- _handle_api_transient_error: Centralizes retry logic for all error types (24 lines)

Main function reduced from 66 to 41 lines (38% reduction). Behavior unchanged:
still retries on network errors and transient HTTP codes (429, 503), with
exponential backoff. All test assertions pass.

This extraction pattern makes it clearer how retry logic flows and easier to
modify error handling in the future without duplicating patterns.

Co-authored-by: A <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-09 03:57:40 -08:00
..
common.sh refactor: Extract generic_cloud_api retry logic into helper functions (#78) 2026-02-09 03:57:40 -08:00