spawn/test
A ea943d1583
refactor: decompose 287-line setup_mock_curl into named helpers (#718)
The mock curl heredoc script was a monolithic 287-line function with
inline arg parsing, error injection, URL routing, body validation,
fixture lookup, and state tracking all in one flow.

Extract 10 focused helper functions within the heredoc:
- _parse_args: curl argument parsing
- _maybe_inject_error: MOCK_ERROR_SCENARIO handling
- _handle_special_urls: install scripts, OpenRouter, spawn repo
- _strip_api_base: URL-to-endpoint mapping for 14 cloud APIs
- _check_fields / _validate_body: POST body validation
- _try_fixture: fixture file lookup
- _synthetic_active_response: cloud-specific GET-by-ID responses
- _respond_get / _respond_post: METHOD-based response routing
- _track_state: creation/deletion state tracking

The main logic is now a 26-line sequence of named function calls,
making the mock's control flow immediately readable.

Agent: complexity-hunter

Co-authored-by: A <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-12 15:01:41 -08:00
..
fixtures QA-Bot setup (#335) 2026-02-10 19:51:07 -08:00
mock.sh refactor: decompose 287-line setup_mock_curl into named helpers (#718) 2026-02-12 15:01:41 -08:00
qa-dry-run.sh feat: qa bot and emails (#565) 2026-02-11 20:19:45 -08:00
record.sh refactor: decompose setup_mock_agents and record_cloud into helpers (#722) 2026-02-12 15:00:56 -08:00
run.sh refactor: extract assert_equals/assert_match helpers in test/run.sh (#727) 2026-02-12 15:00:59 -08:00
update-readme.py QA-Bot setup (#335) 2026-02-10 19:51:07 -08:00