Skip to content

Fix budget reservation safety across storage backends#58

Merged
Abiorh001 merged 2 commits into
mainfrom
fix/budget-reservation-redis-safety
May 28, 2026
Merged

Fix budget reservation safety across storage backends#58
Abiorh001 merged 2 commits into
mainfrom
fix/budget-reservation-redis-safety

Conversation

@Abiorh001
Copy link
Copy Markdown
Contributor

@Abiorh001 Abiorh001 commented May 28, 2026

Summary

  • make budget reservations single-use and storage-atomic for memory, file, and Redis backends
  • align BudgetGuard check/read paths with the active period counters
  • remove old BudgetGuard reservation-token compatibility so unsupported token formats fail closed
  • fix Redis numeric counter get/query behavior and exact decimal boundary checks for money comparisons
  • update guard docs/examples and add focused regression tests for concurrency, idempotency, Redis, and scalar query handling

Verification

  • uv run pre-commit run --all-files
  • uv run pytest tests/test_guards.py::TestBudgetGuard tests/test_redis_storage.py tests/test_storage_query.py -q
  • uv run pytest tests/test_guards.py::TestBudgetGuard tests/test_payment_concurrency.py tests/test_guard_edge_cases.py tests/test_sdk_events.py::TestBudgetGuardEvents tests/test_redis_storage.py tests/test_storage_query.py -q
  • uv run pytest -q

@Abiorh001 Abiorh001 requested a review from abiorh-claw May 28, 2026 11:59
@Abiorh001 Abiorh001 merged commit 2594880 into main May 28, 2026
5 checks passed
@Abiorh001 Abiorh001 deleted the fix/budget-reservation-redis-safety branch May 28, 2026 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants