From 84dba6d6702a62706c57e881f955491011c44496 Mon Sep 17 00:00:00 2001 From: Andrii Arsenin Date: Wed, 30 Sep 2026 18:35:26 +0300 Subject: [PATCH] fix(runs): disable playwright traces by default, bump to 1.16.1 - default PLAYWRIGHT_TRACE_MODE to off since traces often reach ~10 MB per run; traces can still be enabled per run or via the setting --- .env.example | 3 ++- CHANGELOG.md | 8 +++++++ .../src/pages/scenario/ScenarioDetailPage.tsx | 2 +- client/src/pages/scenario/ScenariosPage.tsx | 2 +- docs/scenario.md | 8 ++++--- package-lock.json | 4 ++-- package.json | 2 +- server/src/config/app.config.ts | 3 ++- server/test/mcp.controller.spec.ts | 8 ++----- server/test/scenario-trace.spec.ts | 23 +++++++++++++------ 10 files changed, 40 insertions(+), 23 deletions(-) diff --git a/.env.example b/.env.example index ca1cf1b..f308e45 100644 --- a/.env.example +++ b/.env.example @@ -17,4 +17,5 @@ SESSION_IDLE_TIMEOUT_MINUTES=30 SESSION_DELETE_CLOSED_DAYS=7 # Playwright trace recording for scenario runs: on | retain-on-failure | off -PLAYWRIGHT_TRACE_MODE=on +# (traces often reach ~10 MB per run; can be overridden per run in the run modal) +PLAYWRIGHT_TRACE_MODE=off diff --git a/CHANGELOG.md b/CHANGELOG.md index f5d0851..51d0fac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file. +## 1.16.1 - 2026-09-30 + +Changes since 1.16.0: + +### Changed + +- Playwright traces are now off by default (`PLAYWRIGHT_TRACE_MODE` defaults to `off`), since a trace often reaches ~10 MB per run. Traces can still be enabled per run in the run modal, via `traceMode` in `POST /scenarios/:id/run`, or for all runs by setting `PLAYWRIGHT_TRACE_MODE`. + ## 1.16.0 - 2026-09-30 Changes since 1.15.0: diff --git a/client/src/pages/scenario/ScenarioDetailPage.tsx b/client/src/pages/scenario/ScenarioDetailPage.tsx index 45c7e7d..0a59090 100644 --- a/client/src/pages/scenario/ScenarioDetailPage.tsx +++ b/client/src/pages/scenario/ScenarioDetailPage.tsx @@ -82,7 +82,7 @@ export function ScenarioDetailPage() { const [runVersions, setRunVersions] = useState([]); // null = latest const [runVersion, setRunVersion] = useState(null); - const traceMode = traceModeOverride ?? runDefaults?.traceMode ?? 'on'; + const traceMode = traceModeOverride ?? runDefaults?.traceMode ?? 'off'; const [envs, setEnvs] = useState([]); const [selectedEnvId, setSelectedEnvId] = useState(''); const envInitRef = useRef(false); diff --git a/client/src/pages/scenario/ScenariosPage.tsx b/client/src/pages/scenario/ScenariosPage.tsx index 339c904..3601702 100644 --- a/client/src/pages/scenario/ScenariosPage.tsx +++ b/client/src/pages/scenario/ScenariosPage.tsx @@ -56,7 +56,7 @@ export function ScenariosPage() { const [runVersions, setRunVersions] = useState([]); // null = latest const [runVersion, setRunVersion] = useState(null); - const traceMode = traceModeOverride ?? runDefaults?.traceMode ?? 'on'; + const traceMode = traceModeOverride ?? runDefaults?.traceMode ?? 'off'; const [envs, setEnvs] = useState([]); const [selectedEnvId, setSelectedEnvId] = useState(''); diff --git a/docs/scenario.md b/docs/scenario.md index ab670b9..4e4b7de 100644 --- a/docs/scenario.md +++ b/docs/scenario.md @@ -63,13 +63,15 @@ Exports hold exactly one version and always include its `version` number (the la ## Playwright traces -Each run records a [Playwright trace](https://playwright.dev/docs/trace-viewer) of its browser context (screenshots and DOM snapshots). When the run finishes, the trace is uploaded to the run's files as `trace.zip`. Download it from the run detail page, then open it with `npx playwright show-trace trace.zip` or at https://trace.playwright.dev. +A run can record a [Playwright trace](https://playwright.dev/docs/trace-viewer) of its browser context (screenshots and DOM snapshots). When the run finishes, the trace is uploaded to the run's files as `trace.zip`. Download it from the run detail page, then open it with `npx playwright show-trace trace.zip` or at https://trace.playwright.dev. The trace mode is chosen per run: the run modal in the UI, the `traceMode` field of `POST /scenarios/:id/run`, and the `traceMode` argument of the `run_scenario` MCP tool all accept one of the values below. When it is omitted, the server's `PLAYWRIGHT_TRACE_MODE` setting is used (exposed via `GET /scenarios/run-defaults`). "Repeat run" reuses the original run's mode. -- `on` (default): keep the trace of every run +- `on`: keep the trace of every run - `retain-on-failure`: keep traces only for runs that failed -- `off`: do not record traces +- `off` (default): do not record traces + +Traces are off by default because they often reach ~10 MB per run. Traces are run artifacts, so they expire after `FILE_RUN_EXPIRATION_DAYS` like other run files. diff --git a/package-lock.json b/package-lock.json index 699b7dc..2af2984 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "liqa", - "version": "1.16.0", + "version": "1.16.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "liqa", - "version": "1.16.0", + "version": "1.16.1", "workspaces": [ "server", "client" diff --git a/package.json b/package.json index fbf9c2f..169bea0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "liqa", - "version": "1.16.0", + "version": "1.16.1", "private": true, "workspaces": [ "server", diff --git a/server/src/config/app.config.ts b/server/src/config/app.config.ts index ce9081c..46e6bb8 100644 --- a/server/src/config/app.config.ts +++ b/server/src/config/app.config.ts @@ -56,7 +56,8 @@ export class AppConfig { FILE_CLEANUP_CRON: string = "0 3 * * *"; @IsEnum(TraceMode) - PLAYWRIGHT_TRACE_MODE: TraceMode = TraceMode.On; + // Off by default: traces with screenshots and snapshots easily reach ~10 MB per run + PLAYWRIGHT_TRACE_MODE: TraceMode = TraceMode.Off; } export function validateAppConfig(config: Record): AppConfig { diff --git a/server/test/mcp.controller.spec.ts b/server/test/mcp.controller.spec.ts index ad53b39..0f7dd09 100644 --- a/server/test/mcp.controller.spec.ts +++ b/server/test/mcp.controller.spec.ts @@ -593,12 +593,8 @@ describe("McpController", () => { total: number; }; - // The script's artifact plus the run's Playwright trace - expect(list.total).toBe(2); - expect(list.items.map((f) => f.name).sort()).toEqual([ - "artifact.bin", - "trace.zip", - ]); + // Traces are off by default, so the script's artifact is the only file + expect(list.total).toBe(1); const artifact = list.items.find((f) => f.name === "artifact.bin")!; expect(artifact.mimeType).toBe("application/octet-stream"); expect(artifact.expiresAt).not.toBeNull(); diff --git a/server/test/scenario-trace.spec.ts b/server/test/scenario-trace.spec.ts index fa44355..043f390 100644 --- a/server/test/scenario-trace.spec.ts +++ b/server/test/scenario-trace.spec.ts @@ -111,14 +111,17 @@ describe("ScenarioSchedulerService Playwright traces", () => { expect(await traceArtifacts(runId)).toHaveLength(0); }); - it("stores the configured default trace mode when none is given", async () => { - const runId = await runScenario("trace-default", "return 1;"); + it("stores the configured default trace mode (off) when none is given", async () => { + const runId = await runScenario( + "trace-default", + "throw new Error('boom');", + ); const [row] = await dataSource.query( `SELECT traceMode FROM scenario_runs WHERE id = ?`, [runId], ); - expect(row.traceMode).toBe("on"); - expect(await traceArtifacts(runId)).toHaveLength(1); + expect(row.traceMode).toBe("off"); + expect(await traceArtifacts(runId)).toHaveLength(0); }); it("falls back to the configured mode for runs without a stored trace mode", async () => { @@ -128,7 +131,13 @@ describe("ScenarioSchedulerService Playwright traces", () => { const env = await envRepo.save( envRepo.create({ name: "trace-null-mode-env", data: {} }), ); - const run = await scenarioService.createRun(sc.id, env.id); + const run = await scenarioService.createRun( + sc.id, + env.id, + false, + TraceMode.On, + ); + // Legacy runs have no stored mode; they must use the configured default (off) await dataSource.query( `UPDATE scenario_runs SET traceMode = NULL WHERE id = ?`, [run.id], @@ -141,7 +150,7 @@ describe("ScenarioSchedulerService Playwright traces", () => { while (activeRuns.has(run.id) && Date.now() < deadline) { await new Promise((r) => setTimeout(r, 20)); } - expect(await traceArtifacts(run.id)).toHaveLength(1); + expect(await traceArtifacts(run.id)).toHaveLength(0); }); describe("HTTP", () => { @@ -150,7 +159,7 @@ describe("ScenarioSchedulerService Playwright traces", () => { "/scenarios/run-defaults", ); expect(res.status).toBe(200); - expect(res.body).toEqual({ traceMode: "on" }); + expect(res.body).toEqual({ traceMode: "off" }); }); it("POST /scenarios/:id/run stores the requested trace mode", async () => {