fix(falai): bound pricing lookups and correct result handling
Merged
WA
4d ago+996+996+012345678901234567890123456789-156-156-012345678901234567890123456789
Summary
- Coalesce and cache historical fal prices per credential and endpoint, respect rate-limit cooldowns, and verify exact receipts belong to the requested job.
- Distinguish terminal queue failures from failed delivery. Start exact receipt tracking at terminal queue status, bound result retrieval, and retain interrupted-delivery reconciliation without estimating charges for explicit model failures. Report bounded, redacted provider error types.
- Allow remote generated images up to the existing 100 MiB buffered-transfer limit while retaining inline-image and JSON limits.
Type of Change
- Bug fix
Testing
Passed 98 focused provider-boundary tests; full root bun run test with VITEST_MAX_WORKERS=6 (3,455 app files, 39,525 app tests); lint; all 62 audits; workspace type-check; test-type ratchet; block-registry check; and generated-artifact checks. Regression cases cover concurrent pricing, credential isolation, cache expiry, Retry-After recovery, cancellation, receipt identity, rejected results, and declared/streamed image limits. Twelve guard-removal checks and reproduced cancellation, terminal queue-error, and concurrent-cooldown regressions demonstrate that the regressions fail when their corresponding protections are removed.
Checklist
- Code follows project style guidelines
- Self-reviewed my changes
- Tests added/updated and passing (new tests pass the
test-auditauthoring gate) - No new warnings introduced
- I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)