fix: repair red CI on main (backend tests + frontend amount conversion)#1049
Merged
Conversation
main has been failing the backend and frontend CI jobs. Four distinct
problems, all fixed here:
1. webhookService.processRetries: add a defensive circuit-breaker guard so a
delivery already at MAX_RETRY_ATTEMPTS is never re-sent even if it slips
past the SQL filter. Fixes the "does not pick up deliveries at max
attempts" test.
2. loanEndpoints build-cancel/build-reject test: the test shipped broken —
it hit /loans/... and /admin/loans/... (missing the /api prefix) with
unsigned fake tokens and no dependency mocks, so every request 404'd.
Rewrote it against the real /api routes with a proper db/soroban/cache
mock harness and JWTs minted for the loan owner and an admin wallet.
3. notificationService.mapRow: map an absent action_url to undefined and omit
it, matching how loanId is already handled, so the returned shape is
consistent. Fixes the "returns null actionUrl when neither loanId nor
actionUrl provided" test. Frontend does not reference actionUrl, so the
serialized shape change is safe.
4. amount.toStroops: scale the whole part by 10**decimals instead of the
fixed 10**7 stroop scale, so 2-decimal assets convert correctly
(toStroops("12.34", 2) now yields 1234, not 120000034).
Verified locally: backend 369 passed / 18 skipped, typecheck + lint + build
clean; frontend 68 passed, lint + typecheck + build clean.
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.
Why
mainhas been failing the backend and frontend CI jobs on every merge since May 29 (last green run was May 27). Contributors branching offmaininherit a red pipeline. The contracts, env-docs, and supply-chain jobs are unaffected.CI showed 6 failing backend tests and 1 failing frontend test. This PR fixes all of them.
Fixes
webhookService.processRetries— add a defensive circuit-breaker guard so a delivery already atMAX_RETRY_ATTEMPTSis never re-sent even if it slips past the SQL filter. Fixes "does not pick up deliveries at max attempts (circuit open)".loanEndpointsbuild-cancel / build-reject test — the test shipped broken: it posted to/loans/...and/admin/loans/...(missing the/apiprefix) with fake tokens and no dependency mocks, so every request returned 404. Rewrote it against the real/apiroutes with a proper db / sorobanService / cache mock harness and JWTs minted for the loan owner and an admin wallet. Now exercises the real cancel/reject endpoints (200 happy paths, 400 for non-cancellable loan and too-short reason).notificationService.mapRow— map an absentaction_urltoundefinedand omit it, matching howloanIdis already handled, so the mapped shape is consistent. Fixes "returns null actionUrl when neither loanId nor actionUrl provided". The frontend does not referenceactionUrl, so the serialized-shape change is safe.amount.toStroops— scale the whole part by10 ** decimalsinstead of the fixed10 ** 7stroop scale, so non-XLM assets convert correctly.toStroops("12.34", 2)now yields1234instead of120000034.Verification (local)
lint,typecheck,buildclean.lint,typecheck,buildclean.Note
PR #1048 (
fix/express5-validation-and-ci-green) targeted the same goal but is now ~57 commits behindmainand conflicting, so its CI can't even run. This branch is cut fresh from currentmainand supersedes it.