From 75d74202cc57eda8ffbbfe3f53532a2675d07b5c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Jun 2026 09:16:51 +0000 Subject: [PATCH 1/2] Initial plan From 4f77d211c4692488a9df490b6de2a588202a1dc9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Jun 2026 09:19:13 +0000 Subject: [PATCH 2/2] fix: make timestamp optional in RampEphemeralEntry, use optional chaining in sort, align test batch size - Make `timestamp` optional in `RampEphemeralEntry` for backwards compatibility with entries from older app versions - Use optional chaining (`?.timestamp ?? 0`) in eviction sort to guard against null/corrupt localStorage entries; legacy entries without a timestamp get value 0 (treated as oldest) - Update `expectedDeleteBatchSize` in base.service.test.ts from 500 to 5000 to match the production `EXPIRED_QUOTE_DELETE_BATCH_SIZE` constant --- apps/api/src/api/services/ramp/base.service.test.ts | 2 +- apps/frontend/src/contexts/rampState.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/api/src/api/services/ramp/base.service.test.ts b/apps/api/src/api/services/ramp/base.service.test.ts index 27725359d..384024c87 100644 --- a/apps/api/src/api/services/ramp/base.service.test.ts +++ b/apps/api/src/api/services/ramp/base.service.test.ts @@ -5,7 +5,7 @@ import QuoteTicket from "../../../models/quoteTicket.model"; import {BaseRampService} from "./base.service"; const transaction = { id: "cleanup-test-transaction" }; -const expectedDeleteBatchSize = 500; +const expectedDeleteBatchSize = 5000; type QuoteCleanupWhere = { expiresAt?: { diff --git a/apps/frontend/src/contexts/rampState.tsx b/apps/frontend/src/contexts/rampState.tsx index 161c401e0..871441332 100644 --- a/apps/frontend/src/contexts/rampState.tsx +++ b/apps/frontend/src/contexts/rampState.tsx @@ -21,7 +21,7 @@ const MAX_RAMP_EPHEMERALS = 50; type RampEphemeralEntry = { substrateEphemeral: EphemeralAccount; evmEphemeral: EphemeralAccount; - timestamp: number; + timestamp?: number; }; type RampEphemeralsMap = Record; @@ -32,7 +32,7 @@ export function updateRampEphemeral(rampId: string, ephemerals: RampExecutionInp const keys = Object.keys(existing); if (keys.length > MAX_RAMP_EPHEMERALS) { - const sorted = keys.sort((a, b) => (existing[a].timestamp ?? 0) - (existing[b].timestamp ?? 0)); + const sorted = keys.sort((a, b) => (existing[a]?.timestamp ?? 0) - (existing[b]?.timestamp ?? 0)); const toRemove = sorted.slice(0, sorted.length - MAX_RAMP_EPHEMERALS); for (const key of toRemove) { delete existing[key];