Repository navigation
Push channel, API quota ledger, recurring invoices and DR promotion drill - #1601
Merged
github-actions[bot] merged 11 commits intoNov 24, 2026
Conversation
|
@kingdiggydoe-lab is attempting to deploy a commit to the smartdevs17's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@kingdiggydoe-lab 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! 🚀 |
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.
Closes #1344
Closes #1346
Closes #1340
Closes #1348
What this adds
backend/src/services/pushChannel.ts). Pushes to every registered device of a user, retrying transient transport failures in the background with capped exponential backoff and jitter. The user is told only the final outcome. Permanent failures are not retried. A token the provider reports as unregistered is removed, and the other devices still get the message.no_devicesis reported separately fromfailed, so the caller can fall back to another channel. Tokens never appear in observability events; only a hash hint does.backend/src/services/quotaLedger.ts). Charges units per API key against a weekly cap. Weeks run Monday 00:00 UTC to the next Monday. A request that would exceed the cap is rejected and charges nothing. A replayed idempotency key returns the original result and charges nothing more. The check and the write are one atomic store call.backend/src/services/recurringInvoices.ts). Issues one invoice per due period, in the invoice currency, converted at the rate for that issue date, with an optional FX spread in basis points. The rate and its date are stored on each invoice. The key<templateId>:<issueDate>makes runs idempotent. If no usable rate is available, the period is left for the next run; it is never issued at a zero or stale rate.scripts/dr-drill.sh,infra/dr/). Checks that the standby is in recovery and within a replay-lag budget. With--executeand an explicit confirmation, promotes it, checks that it accepts a write, and checks the time against an RTO budget. It refuses identical primary and standby URLs. The runbook is ininfra/dr/README.md, anddocs/DISASTER_RECOVERY.mdlinks to it. It is separate from the existing restore-from-backup drill.Tests: Vitest suites for the three services (
*.test.ts), andscripts/dr-drill.test.mjsfor the drill's refusal guards, which run without Postgres.Not done or not verified
node --testhave not been executed on this branch.bash.scripts/dr-drill.test.mjsruns withnode --test scripts/dr-drill.test.mjs. It is not added topackage.json.