Skip to content

fix: repair red CI on main (backend tests + frontend amount conversion)#1049

Merged
ogazboiz merged 1 commit into
mainfrom
fix/main-ci-green
Jun 1, 2026
Merged

fix: repair red CI on main (backend tests + frontend amount conversion)#1049
ogazboiz merged 1 commit into
mainfrom
fix/main-ci-green

Conversation

@ogazboiz
Copy link
Copy Markdown
Contributor

@ogazboiz ogazboiz commented Jun 1, 2026

Why

main has been failing the backend and frontend CI jobs on every merge since May 29 (last green run was May 27). Contributors branching off main inherit 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

  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 "does not pick up deliveries at max attempts (circuit open)".

  2. loanEndpoints build-cancel / build-reject test — the test shipped broken: it posted to /loans/... and /admin/loans/... (missing the /api prefix) with fake tokens and no dependency mocks, so every request returned 404. Rewrote it against the real /api routes 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).

  3. notificationService.mapRow — map an absent action_url to undefined and omit it, matching how loanId is already handled, so the mapped shape is consistent. Fixes "returns null actionUrl when neither loanId nor actionUrl provided". The 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 non-XLM assets convert correctly. toStroops("12.34", 2) now yields 1234 instead of 120000034.

Verification (local)

  • Backend: 369 passed / 18 skipped; lint, typecheck, build clean.
  • Frontend: 68 passed; lint, typecheck, build clean.

Note

PR #1048 (fix/express5-validation-and-ci-green) targeted the same goal but is now ~57 commits behind main and conflicting, so its CI can't even run. This branch is cut fresh from current main and supersedes it.

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.
@ogazboiz ogazboiz merged commit e3adff0 into main Jun 1, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant