From 9ac57bf8cf4224706381d62acba679ba85a84841 Mon Sep 17 00:00:00 2001 From: Sushobhit Dua <38429226+sushobhit-lt@users.noreply.github.com> Date: Fri, 24 Apr 2026 20:22:08 +0530 Subject: [PATCH 1/2] feat(TE-4324): propagate testName from session capabilities to snapshot options Add testIdTestNameMap cache parallel to sessionTestIdMap so that testName is restored on subsequent LTMS-fallback cache hits. Populate snapshot.options.testName from LSRS getSmartUICapabilities response across all 3 resolution paths (Redis-success, sessionCapabilitiesMap cache-hit, LTMS-fallback). Co-Authored-By: Claude Opus 4.7 (1M context) --- src/lib/ctx.ts | 1 + src/lib/server.ts | 23 ++++++++++++++++++++++- src/types.ts | 2 ++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/lib/ctx.ts b/src/lib/ctx.ts index 42c3a68..c0bafc5 100644 --- a/src/lib/ctx.ts +++ b/src/lib/ctx.ts @@ -295,6 +295,7 @@ export default (options: Record): Context => { isSnapshotCaptured: false, sessionCapabilitiesMap: new Map(), sessionTestIdMap: new Map(), + testIdTestNameMap: new Map(), buildToSnapshotCountMap: new Map(), sessionIdToSnapshotNameMap: new Map(), fetchResultsForBuild: new Array, diff --git a/src/lib/server.ts b/src/lib/server.ts index 441fb8f..6aff699 100644 --- a/src/lib/server.ts +++ b/src/lib/server.ts @@ -96,18 +96,36 @@ export default async (ctx: Context): Promise; sessionTestIdMap?: Map; + testIdTestNameMap?: Map; buildToSnapshotCountMap?: Map; fetchResultsForBuild?: Array; sessionIdToSnapshotNameMap?: Map; @@ -189,6 +190,7 @@ export interface Snapshot { ignoreType?: string[], sessionId?: string testId?: string + testName?: string sync?: boolean; contextId?: string; useExtendedViewport?: boolean; From 096a939e254ed061ebe368817213894796492d3b Mon Sep 17 00:00:00 2001 From: Sushobhit Dua <38429226+sushobhit-lt@users.noreply.github.com> Date: Fri, 24 Apr 2026 23:33:26 +0530 Subject: [PATCH 2/2] fix(TE-4324): carry testName through processSnapshot/prepareSnapshot The option-processing step built processedOptions from an explicit allowlist that only forwarded sessionId and testId, silently dropping testName. Add testName propagation in both prepareSnapshot and processSnapshot, mirroring the testId resolution order: inline option, then testIdTestNameMap lookup, then sessionCapabilitiesMap.name fallback. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/lib/processSnapshot.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/lib/processSnapshot.ts b/src/lib/processSnapshot.ts index 581240c..1b697c4 100644 --- a/src/lib/processSnapshot.ts +++ b/src/lib/processSnapshot.ts @@ -89,6 +89,16 @@ export async function prepareSnapshot(snapshot: Snapshot, ctx: Context): Promise processedOptions.testId = sessionCapabilities.id; } } + if (options.testName) { + processedOptions.testName = options.testName; + } else if (processedOptions.testId && ctx.testIdTestNameMap?.has(processedOptions.testId)) { + processedOptions.testName = ctx.testIdTestNameMap.get(processedOptions.testId); + } else if (ctx.sessionCapabilitiesMap && ctx.sessionCapabilitiesMap.has(sessionId)) { + const sessionCapabilities = ctx.sessionCapabilitiesMap.get(sessionId); + if (sessionCapabilities && sessionCapabilities.name) { + processedOptions.testName = sessionCapabilities.name; + } + } } if (options.web && Object.keys(options.web).length) { @@ -578,6 +588,16 @@ export default async function processSnapshot(snapshot: Snapshot, ctx: Context): processedOptions.testId = sessionCapabilities.id; } } + if (options.testName) { + processedOptions.testName = options.testName; + } else if (processedOptions.testId && ctx.testIdTestNameMap?.has(processedOptions.testId)) { + processedOptions.testName = ctx.testIdTestNameMap.get(processedOptions.testId); + } else if (ctx.sessionCapabilitiesMap && ctx.sessionCapabilitiesMap.has(sessionId)) { + const sessionCapabilities = ctx.sessionCapabilitiesMap.get(sessionId); + if (sessionCapabilities && sessionCapabilities.name) { + processedOptions.testName = sessionCapabilities.name; + } + } } if (options.web && Object.keys(options.web).length) {