refactor: add session and environment relationships to scenario run

- add sessionId optional column to ScenarioRunEntity
- add ManyToOne relationship to EnvironmentEntity (with eager loading)
- add ManyToOne relationship to SessionEntity (optional)
- update ScenarioRun client types to include session and environment data
- add environment name and session link to RunDetailPage
- update UI to display save session, environment, and session info
This commit is contained in:
2026-04-14 19:29:48 +03:00
parent 80d9af42b5
commit 5ec9fd0bc3
6 changed files with 30 additions and 6 deletions
+1 -1
View File
@@ -703,7 +703,7 @@ export class McpService {
inputSchema: {
id: z.uuid().describe("Scenario ID to run"),
environmentId: z.uuid().describe("Environment ID to run the scenario in"),
saveSession: z.boolean().optional().describe("Save session for explore mode after run completes"),
saveSession: z.boolean().optional().describe("Save session after run completes"),
},
},
async ({ id, environmentId, saveSession }) => {
@@ -10,6 +10,8 @@ import {
} from "typeorm";
import { ScenarioRunStepEntity } from "./scenario-run-step.entity";
import { ScenarioEntity } from "./scenario.entity";
import { EnvironmentEntity } from "../environment/environment.entity";
import { SessionEntity } from "../session/session.entity";
export type RunStatus = "pending" | "in_progress" | "pass" | "fail";
@@ -28,6 +30,17 @@ export class ScenarioRunEntity {
@JoinColumn({ name: "scenarioId" })
scenario: ScenarioEntity;
@ManyToOne(() => EnvironmentEntity, { onDelete: "SET NULL", nullable: true })
@JoinColumn({ name: "environmentId" })
environment: EnvironmentEntity;
@Column("text", { nullable: true, default: null })
sessionId: string | null;
@ManyToOne(() => SessionEntity, { onDelete: "SET NULL", nullable: true })
@JoinColumn({ name: "sessionId" })
session: SessionEntity | null;
@Column({ type: "text", default: "pending" })
status: RunStatus;