diff --git a/CHANGELOG.md b/CHANGELOG.md index 089da7f..f5d0851 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,25 @@ All notable changes to this project will be documented in this file. +## 1.16.0 - 2026-09-30 + +Changes since 1.15.0: + +### Added + +- Scenarios and snippets are now versioned, starting at version 1. A scenario's version goes up when its name, description, default environment, timeout or steps change; a snippet's when its alias, title, description or code changes. Saving without changes does not create a new version. Credential assignments and scenario files are not versioned. +- Each run records the scenario version it runs. The run modal has a version picker (latest by default), `POST /scenarios/:id/run` and the `run_scenario` MCP tool accept an optional `version`, and "Repeat run" reuses the run's version. +- `context.runSnippet("alias@N")` pins version N of a snippet; `runSnippet("alias")` keeps using the latest. The scenario page's "Used Snippets" section shows which snippets are pinned. +- Version numbers are shown on the scenario, snippet and run pages and in the scenario and run lists. +- Added `GET /scenarios/:id/versions[/:version]` and `GET /snippets/:id/versions[/:version]`, and the `list_scenario_versions`, `get_scenario_version`, `list_snippet_versions` and `get_snippet_version` MCP tools. +- Scenario and snippet exports accept `?version=N` (the `export_scenario` MCP tool takes `version`). + +### Changed + +- **Breaking:** scenario and snippet exports now include `version`, and imports require it. An import restores that exact version by id + version: an existing version is left untouched, and a new one is stored under its number and becomes the latest when it is higher than the current latest. Export files from earlier releases need a `version` field added before they can be imported. +- Scenario exports now include scenario and step timeouts. +- Runs keep their own copy of the steps they were created with. Editing or deleting a step no longer changes past runs, and deleting a step no longer deletes its results from past runs. Existing run steps are backfilled from the current steps on startup. + ## 1.15.0 - 2026-09-30 Changes since 1.14.0: diff --git a/client/src/api/client.ts b/client/src/api/client.ts index 72266fd..7dd7f8a 100644 --- a/client/src/api/client.ts +++ b/client/src/api/client.ts @@ -12,8 +12,11 @@ import type { ScenarioRunDetail, ScenarioRunStep, ScenarioStep, + ScenarioVersion, Snippet, + SnippetVersion, TraceMode, + UsedSnippet, } from './types'; import { emitApiErrorToast } from '../lib/toast-events'; @@ -122,6 +125,9 @@ export const snippets = { remove(id: string): Promise { return request(`/snippets/${id}`, { method: 'DELETE' }); }, + versions(id: string): Promise { + return request(`/snippets/${id}/versions`); + }, exportSnippet(id: string): Promise { return request(`/snippets/${id}/export`); }, @@ -229,12 +235,17 @@ export const scenarios = { environmentId: string, saveSession?: boolean, traceMode?: TraceMode, + /** Scenario version to run; omit for the latest. */ + version?: number, ): Promise { return request(`/scenarios/${id}/run`, { method: 'POST', - body: JSON.stringify({ environmentId, saveSession, traceMode }), + body: JSON.stringify({ environmentId, saveSession, traceMode, version }), }); }, + versions(id: string): Promise { + return request(`/scenarios/${id}/versions`); + }, runDefaults(): Promise { return request('/scenarios/run-defaults'); }, @@ -274,7 +285,7 @@ export const scenarios = { exportE2eTestUrl(id: string): string { return `${BASE_URL}/scenarios/${id}/export-e2e`; }, - usedSnippets(id: string): Promise { + usedSnippets(id: string): Promise { return request(`/scenarios/${id}/used-snippets`); }, }; diff --git a/client/src/api/types.ts b/client/src/api/types.ts index 2ee0241..9eaf945 100644 --- a/client/src/api/types.ts +++ b/client/src/api/types.ts @@ -41,10 +41,29 @@ export interface Snippet { title: string; description: string | null; code: string; + /** Latest version number. */ + version: number; createdAt: string; updatedAt: string; } +export interface SnippetVersion { + id: string; + snippetId: string; + version: number; + alias: string; + title: string; + description: string | null; + code: string; + createdAt: string; +} + +/** A snippet referenced by a scenario's steps. */ +export interface UsedSnippet extends Snippet { + /** Version pinned via runSnippet('alias@N'), or null for the latest. */ + pinnedVersion: number | null; +} + // ── Sessions ────────────────────────────────────────────────────────────────── export type SessionStatus = 'open' | 'closed'; @@ -87,6 +106,8 @@ export interface Scenario { description?: string; environmentId?: string | null; timeoutSeconds?: number | null; + /** Latest version number. */ + version: number; environment?: Pick; steps?: ScenarioStep[]; scenarioCredentials?: ScenarioCredential[]; @@ -96,6 +117,26 @@ export interface Scenario { updatedAt: string; } +export interface ScenarioStepSnapshot { + id: string | null; + order: number; + title: string | null; + execCode: string | null; + timeoutSeconds: number | null; +} + +export interface ScenarioVersion { + id: string; + scenarioId: string; + version: number; + name: string; + description: string | null; + environmentId: string | null; + timeoutSeconds: number | null; + steps: ScenarioStepSnapshot[]; + createdAt: string; +} + export type ScenarioRunStatus = 'pending' | 'in_progress' | 'pass' | 'fail'; export type TraceMode = 'on' | 'retain-on-failure' | 'off'; @@ -115,6 +156,8 @@ export interface ScenarioRun { sessionId?: string | null; saveSession: boolean; traceMode: TraceMode | null; + /** Scenario version the run executes; null for runs created before versioning. */ + scenarioVersion: number | null; scenario?: Pick; environment?: Pick; session?: { id: string; sessionName: string }; @@ -127,8 +170,12 @@ export interface ScenarioRun { export interface ScenarioRunStep { id: string; runId: string; - scenarioStepId: string; - scenarioStep: ScenarioStep; + /** Live step this run step came from; null once that step is deleted. */ + scenarioStepId: string | null; + // Step content as of the run's scenario version + title: string | null; + execCode: string | null; + timeoutSeconds: number | null; status: RunStepStatus; order: number; description: string | null; diff --git a/client/src/components/modals/RunScenarioModal.tsx b/client/src/components/modals/RunScenarioModal.tsx index 9c181f6..1e3027c 100644 --- a/client/src/components/modals/RunScenarioModal.tsx +++ b/client/src/components/modals/RunScenarioModal.tsx @@ -1,7 +1,7 @@ import { useTranslation } from 'react-i18next'; import { X, Play } from 'lucide-react'; import { Modal, Button, Select } from '../../ui'; -import type { Environment, TraceMode } from '../../api'; +import type { Environment, ScenarioVersion, TraceMode } from '../../api'; const TRACE_MODES: TraceMode[] = ['on', 'retain-on-failure', 'off']; @@ -12,6 +12,11 @@ export interface RunScenarioModalProps { onEnvSelect: (envId: string) => void; saveSessionFlag: boolean; onSaveSessionChange: (flag: boolean) => void; + /** Scenario versions, newest first; empty while loading. */ + versions: Pick[]; + /** Selected version, or null for the latest. */ + selectedVersion: number | null; + onVersionChange: (version: number | null) => void; traceMode: TraceMode; defaultTraceMode: TraceMode | null; onTraceModeChange: (mode: TraceMode) => void; @@ -28,6 +33,9 @@ export function RunScenarioModal({ onEnvSelect, saveSessionFlag, onSaveSessionChange, + versions, + selectedVersion, + onVersionChange, traceMode, defaultTraceMode, onTraceModeChange, @@ -66,6 +74,25 @@ export function RunScenarioModal({ onChange={(e) => onEnvSelect(e.target.value)} options={environments.map((env) => ({ value: env.id, label: env.name }))} /> +
+