Runware retired taskType:models; all 42 daily catalog 401s come from this
deprecated endpoint. Migrated to auth+modelSearch pair per Runware's
current API. Paginator fetches up to 5 pages x 100 = 500 models, filters
client-side to io:text-to-image in capabilities[]. Uses air identifier as
model id. Cache key bumped to v2 (prautoblogger_runware_model_cache_v2)
to invalidate v1 rows that used old taskType/requiresImage shape.
Failure cooldown: sync() records prautoblogger_runware_catalog_last_failure_at
on every error path. get_models() gates re-trigger via is_in_failure_cooldown()
which reads prautoblogger_runware_catalog_failure_cooldown_seconds (default
3600s). Success clears the timestamp. Caps cascade to ~24 errors/day.
300-line rule: fetching/normalization extracted to new companion class
PRAutoBlogger_Runware_Catalog_Fetcher (class-runware-catalog-fetcher.php,
205 lines). Catalog class: 261 lines. Autoloader picks up the new file.
Tests: normalize_models against real modelSearch fixture (redacted key);
cooldown behavior (failure->active->expired); sync clears timestamp; fallback
list always served when cache empty. 328/328 PHPUnit green.
Agent-Session: prab-v0183-20260612
Three bugs in test_sync_success_caches_and_returns_models:
1. Mock data lacked taskType=imageInference so normalize_models() filtered
everything out → sync() returned false (empty result).
2. wp_remote_retrieve_response_code and wp_remote_retrieve_body not mocked
→ Brain\Monkey MissingFunctionExpectations.
3. is_wp_error not mocked.
4. get_option/update_option used separate static stores so update_option
write was invisible to the subsequent get_option in get_models().
Replace hardcoded model registry with live-sync system.
New PRAutoBlogger_Runware_Model_Catalog class fetches the Runware model
catalog daily, caches in WP options (24h TTL), and falls back to the
hardcoded 15-model list if the API is unavailable. Sync Now button
in PRAdmin for on-demand refresh. Eliminates the drift that caused
silent model fallback bugs (v0.13.8, v0.14.0).