fix: migrate Runware catalog to modelSearch; failure cooldown (v0.18.3 R4)
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
This commit is contained in:
131
tests/fixtures/runware-model-search-page1.json
vendored
Normal file
131
tests/fixtures/runware-model-search-page1.json
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"taskType": "modelSearch",
|
||||
"taskUUID": "aabbccdd-0000-0000-0000-000000000001",
|
||||
"totalResults": 5,
|
||||
"results": [
|
||||
{
|
||||
"air": "runware:100@1",
|
||||
"name": "FLUX.1 schnell",
|
||||
"nameContent": "FLUX.1 schnell",
|
||||
"comment": "Fast 4-step text-to-image model",
|
||||
"category": "checkpoint",
|
||||
"private": false,
|
||||
"capabilities": ["io:text-to-image", "form:checkpoint"],
|
||||
"tags": [],
|
||||
"heroImage": "",
|
||||
"version": "",
|
||||
"architecture": "",
|
||||
"nsfwLevel": null,
|
||||
"downloadCount": 0,
|
||||
"inferenceCount24h": 0,
|
||||
"rating": 0,
|
||||
"ratingCount": 0,
|
||||
"thumbsUpCount": 0,
|
||||
"thumbsDownCount": 0,
|
||||
"featured": 1,
|
||||
"addedUnixTimestamp": 0,
|
||||
"updatedDateUnixTimestamp": 0,
|
||||
"source": "curated"
|
||||
},
|
||||
{
|
||||
"air": "runware:101@1",
|
||||
"name": "FLUX.1 dev",
|
||||
"nameContent": "FLUX.1 dev",
|
||||
"comment": "High fidelity 28-step text-to-image model",
|
||||
"category": "checkpoint",
|
||||
"private": false,
|
||||
"capabilities": ["io:text-to-image", "form:checkpoint"],
|
||||
"tags": [],
|
||||
"heroImage": "",
|
||||
"version": "",
|
||||
"architecture": "",
|
||||
"nsfwLevel": null,
|
||||
"downloadCount": 0,
|
||||
"inferenceCount24h": 0,
|
||||
"rating": 0,
|
||||
"ratingCount": 0,
|
||||
"thumbsUpCount": 0,
|
||||
"thumbsDownCount": 0,
|
||||
"featured": 0,
|
||||
"addedUnixTimestamp": 0,
|
||||
"updatedDateUnixTimestamp": 0,
|
||||
"source": "curated"
|
||||
},
|
||||
{
|
||||
"air": "some-text-model:llm@1",
|
||||
"name": "Some Text LLM",
|
||||
"nameContent": "Some Text LLM",
|
||||
"comment": "A text-to-text model that should be excluded",
|
||||
"category": "text",
|
||||
"private": false,
|
||||
"capabilities": ["io:text-to-text", "form:checkpoint"],
|
||||
"tags": [],
|
||||
"heroImage": "",
|
||||
"version": "",
|
||||
"architecture": "",
|
||||
"nsfwLevel": null,
|
||||
"downloadCount": 0,
|
||||
"inferenceCount24h": 0,
|
||||
"rating": 0,
|
||||
"ratingCount": 0,
|
||||
"thumbsUpCount": 0,
|
||||
"thumbsDownCount": 0,
|
||||
"featured": 0,
|
||||
"addedUnixTimestamp": 0,
|
||||
"updatedDateUnixTimestamp": 0,
|
||||
"source": "curated"
|
||||
},
|
||||
{
|
||||
"air": "runware:400@2",
|
||||
"name": "FLUX.2 klein 9B",
|
||||
"nameContent": "FLUX.2 klein 9B",
|
||||
"comment": "Compact 9B text-to-image model",
|
||||
"category": "checkpoint",
|
||||
"private": false,
|
||||
"capabilities": ["io:text-to-image", "form:checkpoint"],
|
||||
"tags": [],
|
||||
"heroImage": "",
|
||||
"version": "",
|
||||
"architecture": "",
|
||||
"nsfwLevel": null,
|
||||
"downloadCount": 0,
|
||||
"inferenceCount24h": 0,
|
||||
"rating": 0,
|
||||
"ratingCount": 0,
|
||||
"thumbsUpCount": 0,
|
||||
"thumbsDownCount": 0,
|
||||
"featured": 0,
|
||||
"addedUnixTimestamp": 0,
|
||||
"updatedDateUnixTimestamp": 0,
|
||||
"source": "curated"
|
||||
},
|
||||
{
|
||||
"air": "upscale-model:upscaler@1",
|
||||
"name": "Upscale Model",
|
||||
"nameContent": "Upscale Model",
|
||||
"comment": "Image upscaler — should be excluded from t2i list",
|
||||
"category": "checkpoint",
|
||||
"private": false,
|
||||
"capabilities": ["io:image-to-image", "op:upscale", "form:checkpoint"],
|
||||
"tags": [],
|
||||
"heroImage": "",
|
||||
"version": "",
|
||||
"architecture": "",
|
||||
"nsfwLevel": null,
|
||||
"downloadCount": 0,
|
||||
"inferenceCount24h": 0,
|
||||
"rating": 0,
|
||||
"ratingCount": 0,
|
||||
"thumbsUpCount": 0,
|
||||
"thumbsDownCount": 0,
|
||||
"featured": 0,
|
||||
"addedUnixTimestamp": 0,
|
||||
"updatedDateUnixTimestamp": 0,
|
||||
"source": "curated"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user