fix: phone validation, API parser fuzz tests, and transaction query/index optimizations - #1871
Merged
Merged
Conversation
…ndex optimizations - Implement full phone number formatting, parsing, and provider validation (sublime247#1844) - Add comprehensive property-based fuzz testing suite for API parser inputs (sublime247#1845) - Optimize database query performance and pagination on transaction history logs (sublime247#1846) - Optimize B-tree index checks and sequence queries on transaction reference numbers (sublime247#1853) closes sublime247#1844, closes sublime247#1845, closes sublime247#1846, closes sublime247#1853
|
@mallison031 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.
Summary
This pull request addresses and resolves issues #1844, #1845, #1846, and #1853 across the Mobile Money ↔ Stellar bridge service.
1. [Testing] Validate phone number formatting and parsing libraries (#1844)
parseFlexiblePhoneNumber: parses raw user inputs handling missing '+', leading zeros, double zeros, spaces, dashes, and parentheses.validatePhoneNumber: extractsParsedPhoneInfo(validity, countryCallingCode, country, e164, international, national, rfc3966 formats).isValidPhoneNumber: boolean check for validity against standard and regional formats.formatPhoneNumber: supports formatting toe164,national,international, andrfc3966.detectProvider: detects mobile network operators (mtn,airtel,orange,vodacom,tigo) from MSISDN prefixes.validatePhoneProviderMatch&formatPhoneForProvider: ensures compliance with provider-specific payload requirements (e.g. Airtel national MSISDN formatting).2. [Testing] Add fuzz testing to API parser inputs (#1845)
fast-checkand boundary attack string pools.parseStatusFilter,validateTransactionFilters,getPaginationInfo)ISO_8601_UTC_REGEX)parseFlexiblePhoneNumber,formatPhoneForProvider,validatePhoneProviderMatch)isStrictStellarGAddress,assertStrictStellarGAddress)isValidReferenceNumber,checkReferenceExists)3. [Refactor] Optimize database query performance on transaction history logs (#1846)
userIdinTransactionListFiltersandbuildListWhereto leverage composite indexidx_transactions_user_created_id (user_id, created_at DESC, id DESC).list()andcount()query execution plans to leverage existing keyset and composite indexes (status, created_at DESC, id DESC,provider, created_at DESC, id DESC).listTransactionsHandlerin transactionController.ts:findByStatuses+countByStatusesrunning immediately beforelist()).Promise.alland direct filter forwarding.4. [Refactor] Optimize index checks on transaction reference numbers (#1853)
checkReferenceExists(referenceNumber)andisReferenceAvailable(referenceNumber)performing index-onlyEXISTS (SELECT 1 FROM transactions WHERE reference_number = $1)queries againstidx_transactions_reference_number.generateReferenceNumber()to use prefix range conditions (reference_number >= $1 AND reference_number < $2), enabling strict B-tree index scans.isValidReferenceNumberto support standard system reference formats (TXN-,WTH-,DEP-,REF-).TransactionModel.checkReferenceExists()and addedLIMIT 1tofindByReferenceNumber()for single-row index scan optimization.Issues Closed