Fix null handling, add error redaction, price loading state, payment empty state - #1
Open
WebDeveloper-Jose wants to merge 9 commits into
Open
Fix null handling, add error redaction, price loading state, payment empty state#1WebDeveloper-Jose wants to merge 9 commits into
WebDeveloper-Jose wants to merge 9 commits into
Conversation
Standardized null/undefined handling using `== null` for validation and `??` for defaulting values. Updated multiple functions to use the new null handling approach.
This file contains unit tests for the priceOracleService, verifying source failover, cache behavior, and handling of stale data.
Tests error handling in reputationRoutes, ensuring specific error messages are returned and sensitive information is redacted.
Tests the empty state behavior of the listByAddress method in paymentController, ensuring it returns an explicit empty state with actionable copy when no payments exist, and correctly wraps non-empty payment lists.
Added error context handling and sensitive data redaction for reputation routes.
Updated controller methods to use next() for error handling instead of sending responses directly.
Enhance payment history response with empty state details for better user feedback.
Add tests for null/undefined handling in reputationService
This service fetches XLM/USD prices from multiple sources with failover and caching mechanisms.
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
reputationService.jsKCEE0901/trustchain-escrow#287: standardized null/undefined handling inreputationService.js— replaced a truthy fallback with??, added== nullguards to the write operations that previously hit Prisma unvalidatedreputationRoutes.jsKCEE0901/trustchain-escrow#285:reputationRoutes.jsnow surfaces contextual, credential-redacted error messages (e.g. "Fetching leaderboard failed: ...") instead of letting raw errors (including potential DB connection-string leaks) reach the client unfilteredpriceOracleService.jsKCEE0901/trustchain-escrow#286: addedpriceOracleService.js(missing fromdevelop— pulled from canonical upstream) with astatus: 'loading'placeholder instead of a barenullwhen no price is cached yetpaymentService.jsKCEE0901/trustchain-escrow#288:paymentController.listByAddressnow returns explicit empty-state metadata (isEmpty,emptyState.title/description) matching the copy style of the existingEmptyState.jsxcomponentFiles changed
backend/services/reputationService.jsbackend/tests/reputationService.test.jsbackend/api/routes/reputationRoutes.jsbackend/api/controllers/reputationController.jsbackend/tests/reputationRoutes.test.jsbackend/services/priceOracleService.jsbackend/tests/unit/priceOracleService.test.jsbackend/api/controllers/paymentController.jsbackend/tests/paymentController.emptyState.test.jsNote for reviewers:
priceOracleService.jsand its test were pulled from the canonical upstream (Stellar-Trust-Escrow/stellar-trust-escrow) since this repo'sdevelopwas missing the file entirely.Test plan
reputationService.jsorreputationRoutes.js