Repository navigation
fix: resolve issues 2027, 2028, 2029, and 2030 - #2032
Merged
Merged
Conversation
…Crypt#2027) - Change < to <= in rateLimitService.checkRateLimit so the Nth allowed request is not blocked - Update test suite to assert Nth request allowance and blocking beyond maxRequests
…oop amount (LabsCrypt#2028) - Exclude defaulted/liquidated loans (LoanDefaulted, LoanLiquidated, CollateralLiquidated) - Add 24-hour notification deduplication check in loan due check query - Format raw stroops as decimal amount (divided by 10,000,000) in notification message - Add unit tests for loanCheckCron
…I check (LabsCrypt#2029) - Add SERVICE_UNAVAILABLE to ERROR_CODE_MESSAGES in frontend/src/app/utils/transactionErrors.ts - Fix keyRegex character class from [A_Z0-9_]+ to [A-Z0-9_]+ in check-error-code-mappings.mjs - Scope key verification specifically to ERROR_CODE_MESSAGES object body
…semantics (LabsCrypt#2030) - Update documentation to reflect actual /api/indexer/webhooks endpoints - Document { callbackUrl, eventTypes, secret } subscription schema - Update payload examples to flat IndexedLoanEvent structure - Document 30-second timeout, 4-attempt retry policy, and retry processor schedule
This was referenced Oct 18, 2026
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.
Summary
This PR addresses issues #2027, #2028, #2029, and #2030 across backend, frontend, scripts, and documentation.
Changes per Issue
1. Issue #2027: rateLimitService.checkRateLimit off-by-one
const allowed = currentCount < config.maxRequests;toconst allowed = currentCount <= config.maxRequests;inbackend/src/services/rateLimitService.ts.backend/src/services/__tests__/rateLimitService.test.tsto assert that the N-th request (whencurrentCount === maxRequests) is allowed and requests beyondmaxRequestsare rejected.2. Issue #2028: loanDueCheckCron duplicate spam and raw stroop formatting
backend/src/cron/loanCheckCron.ts, updated the selection query to:LoanDefaulted,LoanLiquidated,CollateralLiquidated).AND NOT EXISTS (SELECT 1 FROM notifications n WHERE n.loan_id = le.loan_id AND n.type = 'repayment_due' AND n.created_at > NOW() - INTERVAL '24 hours').loan.amountby dividing by10_000_000to convert raw stroops to standard units in user-facing notifications.backend/src/cron/__tests__/loanCheckCron.test.ts.3. Issue #2029: ERROR_CODE_MESSAGES missing SERVICE_UNAVAILABLE & CI guard scope
SERVICE_UNAVAILABLE: "The service is temporarily unavailable. Please try again later",toERROR_CODE_MESSAGESinfrontend/src/app/utils/transactionErrors.ts.keyRegexcharacter class inscripts/check-error-code-mappings.mjsfrom[A_Z0-9_]+to[A-Z0-9_]+.ERROR_CODE_MESSAGESobject rather than searching the whole file.4. Issue #2030: docs/webhooks.md endpoints, payload schema, and retry semantics
docs/webhooks.mdto document the actual/api/indexer/webhooksendpoints (GET /api/indexer/webhooks,POST /api/indexer/webhooks,DELETE /api/indexer/webhooks/:subscriptionId, and admin delivery/retry-status endpoints).{ callbackUrl, eventTypes, secret }.IndexedLoanEventpayload structure.5m,15m,45m).Closes #2027
Closes #2028
Closes #2029
Closes #2030