Arcp::Runtime::LeaseManager#try_spend! currently treats a missing currency as unlimited spend. At lib/arcp/runtime/lease_manager.rb:64, the method returns true whenever the counter has no key for the requested currency and the synthetic remaining amount is zero. That contradicts the nearby comment that BudgetExhausted should be raised when no balance covers the amount, and it allows a job with a budget such as USD:1.00 to spend any amount in EUR or another unlisted currency without decrementing any counter.
Fix prompt: Remove the missing-currency success path and make try_spend! raise Arcp::Errors::BudgetExhausted when the job has a budget counter but the requested currency is absent or has insufficient balance. Preserve the intended behavior for jobs with no lease or no budget at all if unbudgeted jobs are meant to be unrestricted. Add tests for spending an unlisted currency, spending exactly the remaining amount, spending after exhaustion, and spending when no budget exists.
Arcp::Runtime::LeaseManager#try_spend!currently treats a missing currency as unlimited spend. Atlib/arcp/runtime/lease_manager.rb:64, the method returns true whenever the counter has no key for the requested currency and the synthetic remaining amount is zero. That contradicts the nearby comment thatBudgetExhaustedshould be raised when no balance covers the amount, and it allows a job with a budget such asUSD:1.00to spend any amount inEURor another unlisted currency without decrementing any counter.Fix prompt: Remove the missing-currency success path and make
try_spend!raiseArcp::Errors::BudgetExhaustedwhen the job has a budget counter but the requested currency is absent or has insufficient balance. Preserve the intended behavior for jobs with no lease or no budget at all if unbudgeted jobs are meant to be unrestricted. Add tests for spending an unlisted currency, spending exactly the remaining amount, spending after exhaustion, and spending when no budget exists.