commit ed3cf3495b9a199bbe64a27be0734c9a6ae9dddc
parent 31dfc61dca653a0e338e18334da2289be8a51478
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 13 Oct 2026 23:00:12 -0400
editor: e2e — a teaser drafted through the real editor job on the fake API, the build's validator loaded in its process; the test runner's paths opt out of tracing
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 46 insertions(+), 5 deletions(-)
diff --git a/common/testing/draft/runMediaStep.ts b/common/testing/draft/runMediaStep.ts
@@ -18,8 +18,8 @@ import { startFakeOllama } from "../llm/fakeOllama.mjs";
import { isStepTask } from "../../lib/generationSettings";
import { loadDeckChecks, runTask, type TaskInput } from "../../lib/report/draft/tasks/index";
-const HERE = path.dirname(fileURLToPath(import.meta.url));
-const ROOT = path.resolve(HERE, "../../..");
+const HERE = path.dirname(/* turbopackIgnore: true */ fileURLToPath(import.meta.url));
+const ROOT = path.resolve(/* turbopackIgnore: true */ HERE, "../../..");
const argv = process.argv.slice(2);
const flag = (name: string) => {
@@ -36,7 +36,7 @@ if (!isStepTask(task) || !article || !Number.isInteger(n) || !articlesDir || !pr
process.exit(2);
}
-const run = JSON.parse(await readFile(path.join(HERE, "runs", `${task}.json`), "utf8")) as { model: string; turns: unknown[] };
+const run = JSON.parse(await readFile(path.join(/* turbopackIgnore: true */ HERE, "runs", `${task}.json`), "utf8")) as { model: string; turns: unknown[] };
const ol = await startFakeOllama();
ol.push(...(run.turns as never[]));
const exportIndexDir = path.join(articlesDir, "..", ".export-index-media-draft");
diff --git a/editor/e2e/report-draft.spec.ts b/editor/e2e/report-draft.spec.ts
@@ -1,11 +1,11 @@
import { test, expect, type APIRequestContext } from "@playwright/test";
-import { chmod, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
+import { chmod, mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
import os from "node:os";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
// By relative path, as digest.spec.ts imports common: the test kit's fakes and
// the synthetic corpus are plain .mjs.
-import { FAKE_KEY, startFakeAnthropic, textTurn, type FakeAnthropic } from "../../common/testing/llm/fakeAnthropic.mjs";
+import { FAKE_KEY, startFakeAnthropic, textTurn, toolTurn, type FakeAnthropic } from "../../common/testing/llm/fakeAnthropic.mjs";
import { ORIGIN, writeDraftCorpus } from "../../common/testing/draft/corpus.mjs";
import { baseUrl } from "./baseUrl";
import { resetData, testPaths, writeSettings } from "./helpers";
@@ -157,3 +157,44 @@ test("the daily cap: a job that would start past the day's API total is refused,
expect(body.error).toContain("$4.00 daily cap");
await expect(readFile(join(testPaths().transcriptsDir, "reports", "synth-daily", "iterations", "1", "iteration.json"))).rejects.toThrow(/ENOENT/);
});
+
+test("a media draft (release 28 M3): a teaser on the API, a step on the done iteration, checked by the build's own validator loaded in the editor", async ({ request }) => {
+ test.setTimeout(120_000);
+ await setup();
+ // A done sweep iteration whose project holds the kit's basic cut and report.
+ const kit = join(RUNS, "..");
+ const article = "synth-teaser";
+ const project = join(keyDir, "projects", article, "i1");
+ const report = JSON.parse(await readFile(join(kit, "reports", "basic.report.json"), "utf8"));
+ const itDir = join(testPaths().transcriptsDir, "reports", article, "iterations", "1");
+ await mkdir(itDir, { recursive: true });
+ await mkdir(project, { recursive: true });
+ const at = new Date().toISOString();
+ await writeFile(
+ join(itDir, "iteration.json"),
+ JSON.stringify({
+ format: "archilyzer-iteration", version: 1, article, n: 1, kind: "sweep", parent: null, copyOf: null, model: "claude-sonnet-5-5",
+ question: "q", scope: { channels: ["synth-kitchen"] }, status: "done", usage: {}, steps: [], projectDir: project, createdAt: at, updatedAt: at, endedAt: at,
+ }),
+ );
+ await writeFile(join(itDir, "report.json"), JSON.stringify(report));
+ await writeFile(join(project, "report.json"), JSON.stringify(report));
+ await writeFile(join(project, "video.manifest.json"), await readFile(join(kit, "manifests", "basic.video.manifest.json"), "utf8"));
+ api.push(toolTurn("answer", { lines: ["Synth Kitchen", "The bakery", "The contest", "What the baker says"] }));
+ const { status, body } = await draft(request, { task: "teaser", article, iteration: 1, model: "claude-sonnet-5-5" });
+ expect(status, body.error).toBe(200);
+ expect(body.iteration).toBe(1);
+ const job = await jobUntil(request, body.jobId!, (s) => ["done", "failed", "cancelled"].includes(s));
+ expect(job.job?.status ?? job.status, JSON.stringify(job.tail)).toBe("done");
+ expect((job.job as { progress?: unknown } | undefined)?.progress).toMatchObject({ metric: "entries", initial: 0, current: 1, target: 1 });
+ const it = await iterationJson(article, 1);
+ expect(it.steps.find((s: { task: string }) => s.task === "teaser")).toMatchObject({ status: "done", jobId: body.jobId });
+ const m = JSON.parse(await readFile(join(project, "video.manifest.json"), "utf8"));
+ expect(m.timeline.at(-1)).toMatchObject({ type: "teaser", id: "teaser", lines: ["Synth Kitchen", "The bakery", "The contest", "What the baker says"] });
+ expect(m.timeline.at(-1).drafted.lines).toMatchObject({ task: "teaser", model: "claude-sonnet-5-5", iteration: 1, attempt: 1 });
+ // The editor ran the build's validateTeaser (a teaser it cannot check is not written).
+ const draftFile = JSON.parse(await readFile(join(project, "teaser-draft.json"), "utf8"));
+ expect(draftFile.units.teaser.applied).toBe("applied");
+ expect(api.remaining()).toBe(0);
+});
+