fix(mothership): retry a job dispatch whose usage read failed instead of skipping the run
Merged
WA
5d ago+92+92+01234567890123456789-12-12-01234567890123456789
Summary
Fixes the review findings on the v0.9.33 release PR (#9339) that hold up in the scheduled-jobs lane.
- Usage outage:
checkAttributedUsageLimitsalso refuses withreason: 'usage_unavailable'when the payer's usage can't be read. Dispatch closed such an occurrence permanently asskipped_budget("The usage limit was reached."). It now counts it as a failed dispatch attempt through the existing bounded retry (retryDispatch: the reconciler retries, and the last allowed attempt ends the run as failed), the way workflow admission treats the same reason as retryable. - Billing refusals: a run skipped for billing (a blocked account, a payer or member limit) records billing's own message as its summary.
- Test teardown: the job lane suite closes open connections before stopping its fake worker, so a test that fails before ending its stream can't hang
afterAll.
Type of Change
- Bug fix
Testing
bun run test:integration lane.integration (real Postgres and Redis): 20 pass. The new test (an outage leaves the occurrence queued with one counted failure; a blocked account records billing's message) fails on the previous dispatch code. tsc --noEmit is clean; job unit tests pass.
Checklist
- Code follows project style guidelines
- Self-reviewed my changes
- Tests added/updated and passing
- No new warnings introduced
- I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)