From 8751464cb9b65f2d27eba90abbc4c825f86da962 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Fri, 1 May 2026 08:25:52 -0700 Subject: [PATCH] fix(ci): satisfy rtt lint rules --- scripts/e2e/npm-telegram-rtt-driver.mjs | 17 +++++++++-------- scripts/lib/rtt-harness.ts | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/scripts/e2e/npm-telegram-rtt-driver.mjs b/scripts/e2e/npm-telegram-rtt-driver.mjs index d9800db8043..3900a4ad87f 100755 --- a/scripts/e2e/npm-telegram-rtt-driver.mjs +++ b/scripts/e2e/npm-telegram-rtt-driver.mjs @@ -16,12 +16,13 @@ const maxWarmFailures = Number( process.env.OPENCLAW_NPM_TELEGRAM_MAX_FAILURES ?? String(warmSampleCount), ); const successMarker = process.env.OPENCLAW_NPM_TELEGRAM_SUCCESS_MARKER ?? "OPENCLAW_E2E_OK"; -const scenarioIds = ( - process.env.OPENCLAW_NPM_TELEGRAM_SCENARIOS ?? "telegram-mentioned-message-reply" -) - .split(",") - .map((value) => value.trim()) - .filter(Boolean); +const scenarioIds = new Set( + process.env.OPENCLAW_NPM_TELEGRAM_SCENARIOS ?? + "telegram-mentioned-message-reply" + .split(",") + .map((value) => value.trim()) + .filter(Boolean), +); if (!groupId || !driverToken || !sutToken) { throw new Error( @@ -203,7 +204,7 @@ function percentile(sortedValues, percentileValue) { function summarizeSamples(samples) { const passed = samples.filter((sample) => sample.status === "pass" && sample.rttMs !== undefined); - const sorted = passed.map((sample) => sample.rttMs).sort((a, b) => a - b); + const sorted = passed.map((sample) => sample.rttMs).toSorted((a, b) => a - b); const sum = sorted.reduce((total, value) => total + value, 0); return { total: samples.length, @@ -309,7 +310,7 @@ async function main() { }); scenarios.push(canary); - if (scenarioIds.includes("telegram-mentioned-message-reply")) { + if (scenarioIds.has("telegram-mentioned-message-reply")) { scenarios.push( await runWarmScenario({ id: "telegram-mentioned-message-reply", diff --git a/scripts/lib/rtt-harness.ts b/scripts/lib/rtt-harness.ts index ddb81715919..19b957e8760 100644 --- a/scripts/lib/rtt-harness.ts +++ b/scripts/lib/rtt-harness.ts @@ -107,7 +107,7 @@ export function extractRtt(summary: TelegramQaSummary) { const mention = scenarios.find((scenario) => scenario.id === "telegram-mentioned-message-reply"); const warmSamples = mention?.samples ?.filter((sample) => sample.status === "pass" && sample.rttMs !== undefined) - .sort((left, right) => (left.index ?? 0) - (right.index ?? 0)) + .toSorted((left, right) => (left.index ?? 0) - (right.index ?? 0)) .flatMap((sample) => (sample.rttMs === undefined ? [] : [sample.rttMs])); const rtt: RttResult["rtt"] = { canaryMs: scenarios.find((scenario) => scenario.id === "telegram-canary")?.rttMs,