fix: normalize non-Error rejections in asyncHandler, add tests, docum… - #1567
Merged
ogazboiz merged 2 commits intoJul 29, 2026
Conversation
added 2 commits
July 29, 2026 05:35
…ent SDK version and PII inventory - asyncHandler.ts normalizes non-Error rejections (string, undefined) into Error with cause before delegating to errorHandler - New test file covers Error passthrough, string normalization, undefined normalization - contracts/README.md adds soroban-sdk 22.0.0 version table; Cargo.toml gets coupling comment - docs/SECURITY-MODEL.md adds PII field inventory covering email/phone/name/address across frontend mask and backend encrypt layers - queryHelpers audit: single export parseCappedLimit has full coverage (8 tests, all edge cases)
2 tasks
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 #1548, Closes #1549, Closes #1550, Closes #1551
Overview
This PR addresses backend rejection normalization, query helper test coverage gaps, Soroban SDK version documentation alignment, and cross-layer PII privacy documentation across the repository stack.
Specifically, it ensures non-
Errorpromise rejections in Express route handlers are converted to validErrorinstances for proper stack trace logging, completes test coverage for SQL query generation helpers, documents Soroban SDK toolchain dependencies, and details PII handling across frontend masking and backend encryption layers in the security model.Feature Summary
asyncHandler.tsto wrap non-Errorrejections (e.g., strings, plain objects, orundefined) into properErrorinstances before delegating tonext(), ensuring logger stack trace integrity.queryHelpers.test.tsto achieve full test coverage for all exported functions inqueryHelpers.ts, covering empty filters, edge cases, and SQL injection / parameterization safety.contracts/README.mdto document minimum requiredsoroban-sdkandsoroban-cliversions, adding sync comments incontracts/Cargo.toml.docs/SECURITY-MODEL.mddocumenting field-level PII policies across frontend display masking (piiMask.ts) and backend at-rest encryption (piiCrypto.ts).Technical Implementation
backend/src/utils/asyncHandler.ts): Updated the.catch()handler withinasyncHandlerto inspect the rejected reason. If!(err instanceof Error), converted it vianew Error(typeof err === 'string' ? err : JSON.stringify(err))before forwarding tonext(err).backend/src/utils/tests/queryHelpers.test.ts): Added unit test cases for all exported query builders, verifying correct parameter positioning, handling of empty/null filter objects, and SQL string escaping safety.contracts/README.md,contracts/Cargo.toml): Documented explicit version parity requirements betweensoroban-sdkandsoroban-cliin the setup guide and linkedCargo.tomldependencies with maintainer inline comments.docs/SECURITY-MODEL.md): Mapped out PII field classifications (e.g., email, phone, SSN/tax ID, physical address) detailing frontend display masking rules (piiMask.ts) and backend encryption at rest (piiCrypto.ts).Test Coverage
undefinedvalues produce validErrorinstances containing usable stack traces when passed to the error handler.queryHelpers.tsto guarantee 100% test coverage across standard filtering and edge case scenarios.Checklists
Errorrejections normalized toErrorinstances inasyncHandler.tsasyncHandler.tsverifying thrown string conversion and stack trace generationqueryHelpers.tssoroban-sdkandsoroban-cliversions documented incontracts/README.mdand synced withCargo.tomldocs/SECURITY-MODEL.mddetailing frontend masking and backend encryption