feat: implement distributed budget locking and database migration hea… - #173
Merged
mergekeeper[bot] merged 1 commit intoAug 31, 2026
Conversation
…lth check Closes ASTROIDX556#72: Introduce @UseBudgetLock decorator and BudgetLockInterceptor for Redis-backed distributed locking on budget mutations. Integrate distributed locks into BudgetService.allocate(), consume(), and assertWithinBudget() to prevent race conditions and double-spending when concurrent agents allocate funds or deduct from shared budgets. Lock keys are scoped per-budget with TTLs to prevent deadlocks, and lock release is guaranteed via finally blocks. Add unit tests simulating concurrent lock contention. Closes ASTROIDX556#71: Add DatabaseMigrationHealthIndicator that queries the _prisma_migrations table to detect pending migrations. Expose a GET /health/database endpoint that returns 503 when migrations are pending or the database is unreachable, critical for Kubernetes liveness/readiness probes. Include a configurable toggle (HEALTH_CHECK_MIGRATIONS_ENABLED) and unit tests for both synced and pending migration states. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
|
@Queen-T16 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
MergeKeeper review Scope: in scope for linked issue The PR successfully implements distributed budget locking via Redis and the database migration health indicator for the NestJS health module, meeting all requirements and acceptance criteria for issues #72 and #71. Reviewed commit: |
|
Merged Merged with |
lewistemple22
pushed a commit
to lewistemple22/astroid-api
that referenced
this pull request
Aug 31, 2026
…lth check (ASTROIDX556#173) Closes ASTROIDX556#72: Introduce @UseBudgetLock decorator and BudgetLockInterceptor for Redis-backed distributed locking on budget mutations. Integrate distributed locks into BudgetService.allocate(), consume(), and assertWithinBudget() to prevent race conditions and double-spending when concurrent agents allocate funds or deduct from shared budgets. Lock keys are scoped per-budget with TTLs to prevent deadlocks, and lock release is guaranteed via finally blocks. Add unit tests simulating concurrent lock contention. Closes ASTROIDX556#71: Add DatabaseMigrationHealthIndicator that queries the _prisma_migrations table to detect pending migrations. Expose a GET /health/database endpoint that returns 503 when migrations are pending or the database is unreachable, critical for Kubernetes liveness/readiness probes. Include a configurable toggle (HEALTH_CHECK_MIGRATIONS_ENABLED) and unit tests for both synced and pending migration states. 🤖 Generated with Codebuff Co-authored-by: Queen-T16 <308741155+Queen-T16@users.noreply.github.com> Co-authored-by: Codebuff <noreply@codebuff.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…lth check
Closes #72: Introduce @UseBudgetLock decorator and BudgetLockInterceptor for Redis-backed distributed locking on budget mutations. Integrate distributed locks into BudgetService.allocate(), consume(), and assertWithinBudget() to prevent race conditions and double-spending when concurrent agents allocate funds or deduct from shared budgets. Lock keys are scoped per-budget with TTLs to prevent deadlocks, and lock release is guaranteed via finally blocks. Add unit tests simulating concurrent lock contention.
Closes #71: Add DatabaseMigrationHealthIndicator that queries the _prisma_migrations table to detect pending migrations. Expose a GET /health/database endpoint that returns 503 when migrations are pending or the database is unreachable, critical for Kubernetes liveness/readiness probes. Include a configurable toggle (HEALTH_CHECK_MIGRATIONS_ENABLED) and unit tests for both synced and pending migration states.
🤖 Generated with Codebuff
Summary
Type of change
Related issue
Closes #
Checklist
npm run buildpassesnpm testpassesnpm run lintpassesnpm run typecheckpasses