fix: guard timestamp recording against cross-session contamination

If recording is stopped and restarted inside the same execute() call,
the finally block could append an interval from the old recording into
the new recording's executionTimestamps. Fix by comparing against the
snapshotted recordingStartedAt instead of just checking non-null.
This commit is contained in:
Tommy D. Rossi
2026-02-25 13:16:51 +01:00
parent a0b7af1adb
commit 5637a13003
+3 -1
View File
@@ -1050,7 +1050,9 @@ export class PlaywrightExecutor {
} finally {
// Record timestamp even on error — the execution still occupied real time
// that should not be sped up in the demo video.
if (recordingStartSnapshot !== null && execStartSec >= 0 && this.recordingStartedAt !== null) {
// Compare against snapshot to avoid cross-session contamination if
// recording was stopped and restarted inside the same execute() call.
if (recordingStartSnapshot !== null && execStartSec >= 0 && this.recordingStartedAt === recordingStartSnapshot) {
const execEndSec = (Date.now() - recordingStartSnapshot) / 1000
this.executionTimestamps.push({ start: execStartSec, end: execEndSec })
}