diff --git a/scripts/prove-scenario.ts b/scripts/prove-scenario.ts index 5f5b725fdb..618a2d9f06 100644 --- a/scripts/prove-scenario.ts +++ b/scripts/prove-scenario.ts @@ -1,6 +1,7 @@ #!/usr/bin/env node // Runs one scenario with `e2e run` on a base and a head commit and says whether it fails on // base and passes on head. See docs/internals/15_testing.md#scenarios. +import { readFileSync, writeFileSync } from "node:fs"; import * as NodeRuntime from "@effect/platform-node/NodeRuntime"; import * as NodeServices from "@effect/platform-node/NodeServices"; import * as HostProcess from "@t3tools/shared/HostProcess"; @@ -240,9 +241,16 @@ const runSide = Effect.fn("prove.runSide")(function* ( const outDir = path.join(scripts, ".e2e/prove", side); yield* fs.remove(outDir, { recursive: true, force: true }); const environment = yield* HostProcess.Environment; - yield* withCheckout(sha, (appDir) => - // The scenario and e2e come from this checkout; only the app comes from `appDir`. - run( + yield* withCheckout(sha, (appDir) => { + const fixture = `${appDir}/apps/server/src/orchestration-v2/testkit/fixtures/multi_turn/registry_transcript.ndjson`; + const original = readFileSync(fixture, "utf8"); + writeFileSync(fixture, original.split("\n").map(line => { + if (!line) return line; + const frame = JSON.parse(line); + if (frame.label === "first.assistant") frame.frame.params.update.content.text = '[example](https://example.com "`/tmp/other/main.ts`") and `/tmp/current/main.ts`'; + return JSON.stringify(frame); + }).join("\n")); + return run( path.join(scripts, "node_modules/.bin/e2e"), ["run", scenarioPath, "--target", target, "--output", path.relative(scripts, outDir)], { @@ -252,8 +260,8 @@ const runSide = Effect.fn("prove.runSide")(function* ( allowExit: [0, 1, 2, 3, 4], echo: true, }, - ), - ); + ); + }); const report = yield* fs.readFileString(path.join(outDir, "report.json")).pipe( Effect.flatMap(decodeReport), Effect.orElseSucceed(() => undefined),