Repository navigation
fix(backend): dispute body, provider latency, dedup cap and k6 routes (#800, #801, #732, #819) - #842
Merged
meshackyaro merged 5 commits intoOct 24, 2026
Conversation
…/dispute (Closes trustflow-protocol#800) RaiseDisputeSchema required escrowId and signerAddress, which the route never receives. The escrow comes from the :id path parameter and the initiator from the JWT, so every documented request failed validation with a 400. The schema now validates only reason and evidenceUrl. The dispute controller spec used one-letter reasons that the schema rejects, referenced a notification method the saga does not call, and did not provide ArweaveArchiveService. Those are fixed in the spec.
…ustflow-protocol#801) Every health call passed a hard-coded 5000ms, so averageLatencyMs was always 5000 for every provider. Each provider attempt is now timed and the measured duration is recorded on success and on failure, in pin() and in the background cross-pin. New spec checks that the recorded value tracks the provider's real delay.
…rustflow-protocol#732) The eviction ran before the new entry was inserted, so the cache could reach LOCAL_MAX_ENTRIES + 1. Eviction now makes room for the entry being added. New spec covers the cap and checks that the oldest entries are evicted first.
…Closes trustflow-protocol#819) The k6 script posted to /api/v1/escrow and /api/v1/webhooks/register, which do not exist, and sent a body the global ValidationPipe rejects. It now uses /v1/escrows with depositor, beneficiary and amountXLM, /v1/webhooks with id, url and events, and the matching status path.
…rustflow-protocol#800) A caller may omit reason; the dispute controller then records 'No reason provided'. Any reason that is given must still be 10 to 500 characters.
dev-susa
force-pushed
the
fix/800-801-819-732-trustflow-backend
branch
from
October 24, 2026 09:32
152a138 to
96d7ee6
Compare
5 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.
Description
Four open issues in the backend, fixed in one PR as agreed. Each is its own commit.
POST /escrows/:id/disputealways returned 400.RaiseDisputeSchemarequiredescrowIdandsignerAddress, which the route never receives. The schema now validates onlyreason(optional, 10 to 500 characters when given) andevidenceUrl. Omitted reasons are recorded as "No reason provided".pin()and in the background cross-pin.LOCAL_MAX_ENTRIES + 1, because eviction ran before the insert. Eviction now makes room for the new entry first. A new spec covers the cap and oldest-first eviction./v1/escrowswithdepositor,beneficiaryandamountXLM,/v1/webhookswithid,urlandevents, and the matching status path.Closes #800
Closes #801
Closes #732
Closes #819
Type of Change
Component
Testing
Rebased onto current
main. Run locally with Node 20 (.nvmrc), with ts-jest diagnostics turned off for the specs below. The diagnostics are off becausemainalready has type errors that block some specs (see below).ipfs-pinning/ipfs-provider-latency.spec.ts(new, #801)milestone-notifications/event-dedup.service.spec.ts(new, #732)dispute/escrow-dispute.controller.spec.ts(#800)escrow/escrow.controller.spec.tsTotal: 35 passed, 35 total across these four suites.
k6 runwas not run against a live server. The script passes a syntax check, and its routes and bodies were checked against the controllers and DTOs.Known issues (not introduced by this PR)
These fail on
upstream/mainas well. They are not in this PR.tsc --noEmit) fails onmain: syntax errors insrc/common/rate-limit/rate-limit.guard.tsandsrc/ipfs-pinning/ipfs-pinning.controller.ts, and type errors insrc/dispute/arweave-archive.service.ts. The arweave errors also stop the dispute spec from compiling under the default ts-jest config.main:eslint "src/**/*.ts"reports 320 errors, including unused variables inipfs-pinning.service.ts.src/escrow/escrow.controller.spec.tsalready failsprettier --checkonmain.provider-health.service.spec.tsfails because its test module doesn't provideREDIS_CLIENT.ipfs-failover.spec.tsfails in Jest's transform step.Reviewer Notes
RaiseDisputeSchemachange narrows the body type used by the dispute controller.event-dedup.service.ts: the eviction loop moved intoevictOldest(limit).pruneLocalstill uses the cap at the start of each claim, and the new call before the insert keeps the size at or below the cap.