commit d38e974bebb30a0ef9046c445c2d764def9db8ff
parent 165548d8decf4e06178c379e786c113676f83531
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 13 Oct 2026 16:53:33 -0400
umtool e2e: article-delete — an iteration refused (current, parent) and deleted (a leaf), an article in the making deleted, a take refused and deleted, a project deleted
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
3 files changed, 226 insertions(+), 0 deletions(-)
diff --git a/umtool/e2e/article-delete.spec.ts b/umtool/e2e/article-delete.spec.ts
@@ -0,0 +1,122 @@
+import { test, expect, type Page } from "@playwright/test";
+import { existsSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import { WARM_TIMEOUT, warm } from "./warm";
+
+// ---------------------------------------------------------------------------
+// Deleting (release 27 follow-up): every delete shows its PLAN — what goes,
+// with sizes, what is kept, what refuses — and acts only on "Confirm delete".
+// The fixture's own (e2e/fixtures/delete-fixture.mjs), so no other spec's
+// article or project is touched:
+//
+// omega a draft: i1 (a parent), i2 (the current article),
+// i3 (a copy of i1, with a project) — i3 goes
+// psi an article in the making — it goes
+// reports/delete-fixture a project with takes keep (the project's own
+// manifest: refused) and drop — drop goes, then the
+// project
+// ---------------------------------------------------------------------------
+
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+const FIXTURE = path.join(HERE, "..", ".e2e-song");
+const ARTICLES = path.join(FIXTURE, "articles");
+const PROJECTS = path.join(FIXTURE, "gen-projects");
+const PROJECT = path.join(FIXTURE, "reports", "delete-fixture");
+
+test.beforeAll(async ({ playwright }) => {
+ test.setTimeout(WARM_TIMEOUT);
+ await warm(playwright, [
+ "/articles/omega?tab=iterations",
+ "/articles/psi",
+ "/articles",
+ "/browse/reports/delete-fixture",
+ "/browse/reports/delete-fixture/takes",
+ "/browse",
+ ]);
+});
+
+const card = (page: Page, n: number) => page.locator(`[data-iteration='${n}']`);
+
+test("an iteration: the current one and a parent are refused with the reason; a leaf goes with its project", async ({ page }) => {
+ await page.goto("/articles/omega?tab=iterations");
+ await expect(page.getByRole("region", { name: "iterations", exact: true })).toHaveAttribute("data-iterations", "3");
+
+ // The current article: refused, and nothing to confirm.
+ await card(page, 2).getByRole("button", { name: "Delete i2" }).click();
+ const current = page.getByRole("region", { name: "delete i2" });
+ await expect(current.getByRole("list", { name: "refused" })).toContainText("i2 is the current article");
+ await expect(current.getByRole("button", { name: "Confirm delete" })).toBeDisabled();
+ await expect(current.getByRole("checkbox", { name: "delete anyway" })).toHaveCount(0);
+ await current.getByRole("button", { name: "Keep it" }).click();
+ await expect(current).toHaveCount(0);
+
+ // A parent: the iterations that name it are said.
+ await card(page, 1).getByRole("button", { name: "Delete i1" }).click();
+ const parent = page.getByRole("region", { name: "delete i1" });
+ await expect(parent.getByRole("list", { name: "refused" })).toContainText("i2 revises it; i3 is a copy of it");
+ await expect(parent.getByRole("button", { name: "Confirm delete" })).toBeDisabled();
+ await parent.getByRole("button", { name: "Keep it" }).click();
+
+ // A leaf: the plan names its directory and its project, then it goes.
+ await card(page, 3).getByRole("button", { name: "Delete i3" }).click();
+ const leaf = page.getByRole("region", { name: "delete i3" });
+ const goes = leaf.getByRole("list", { name: "what goes" });
+ await expect(goes).toContainText("reports/omega/iterations/3/");
+ await expect(goes).toContainText("gen-projects/omega/i3/");
+ await expect(leaf).toHaveAttribute("data-delete-blocked", "no");
+ expect(existsSync(path.join(ARTICLES, "omega", "iterations", "3")), "the plan removes nothing").toBe(true);
+ await leaf.getByRole("button", { name: "Confirm delete" }).click();
+
+ await expect(page.getByRole("region", { name: "iterations", exact: true }).getByRole("status")).toContainText("i3 deleted");
+ await expect(card(page, 3)).toHaveCount(0);
+ await expect(page.getByRole("region", { name: "iterations", exact: true })).toHaveAttribute("data-iterations", "2");
+ expect(existsSync(path.join(ARTICLES, "omega", "iterations", "3"))).toBe(false);
+ expect(existsSync(path.join(PROJECTS, "omega", "i3"))).toBe(false);
+ expect(existsSync(path.join(PROJECTS, "omega", "i1", "video.manifest.json"))).toBe(true);
+ expect(existsSync(path.join(ARTICLES, "omega", "report.json"))).toBe(true);
+});
+
+test("an article in the making is deleted from its page, and /articles says so", async ({ page }) => {
+ await page.goto("/articles/psi");
+ await expect(page.locator("[data-article-meta] [data-status]")).toHaveAttribute("data-status", "pending");
+ await page.getByRole("button", { name: "Delete article" }).click();
+ const plan = page.getByRole("region", { name: "delete the article psi" });
+ await expect(plan.getByRole("list", { name: "what goes" })).toContainText("reports/psi/");
+ await plan.getByRole("button", { name: "Confirm delete" }).click();
+
+ await expect(page).toHaveURL(/\/articles\?deleted=psi/);
+ await expect(page.locator("[data-deleted='psi']")).toContainText("Deleted psi");
+ await expect(page.locator("[data-pending-article='psi']")).toHaveCount(0);
+ expect(existsSync(path.join(ARTICLES, "psi"))).toBe(false);
+});
+
+test("a take the project's manifest is, is refused until forced; another take and then the project go", async ({ page }) => {
+ await page.goto("/browse/reports/delete-fixture/takes");
+ const keep = page.locator("[data-take='keep']");
+ await keep.getByRole("button", { name: "Delete take keep" }).click();
+ const refused = page.getByRole("region", { name: "delete take keep" });
+ await expect(refused.getByRole("list", { name: "refused" })).toContainText("the deliverable is built from it");
+ await expect(refused.getByRole("button", { name: "Confirm delete" })).toBeDisabled();
+ await expect(refused.getByRole("checkbox", { name: "delete anyway" })).toBeVisible();
+ await refused.getByRole("button", { name: "Keep it" }).click();
+
+ await page.locator("[data-take='drop']").getByRole("button", { name: "Delete take drop" }).click();
+ const drop = page.getByRole("region", { name: "delete take drop" });
+ await expect(drop.getByRole("list", { name: "what goes" })).toContainText("reports/delete-fixture/takes/drop/");
+ await drop.getByRole("button", { name: "Confirm delete" }).click();
+ await expect(page.locator("[data-take='drop']")).toHaveCount(0);
+ await expect(keep).toBeVisible();
+ expect(existsSync(path.join(PROJECT, "takes", "drop"))).toBe(false);
+ expect(existsSync(path.join(PROJECT, "takes", "keep", "take.json"))).toBe(true);
+
+ await page.goto("/browse/reports/delete-fixture");
+ await page.getByRole("button", { name: "Delete project" }).click();
+ const plan = page.getByRole("region", { name: "delete the project reports/delete-fixture" });
+ await expect(plan.getByRole("list", { name: "what goes" })).toContainText("reports/delete-fixture");
+ await plan.getByRole("button", { name: "Confirm delete" }).click();
+ await expect(page).toHaveURL(/\/browse\?deleted=reports%2Fdelete-fixture/);
+ await expect(page.locator("[data-deleted='reports/delete-fixture']")).toContainText("Deleted reports/delete-fixture");
+ await expect(page.locator("[data-project='reports/delete-fixture']")).toHaveCount(0);
+ expect(existsSync(PROJECT)).toBe(false);
+});
diff --git a/umtool/e2e/fixtures/delete-fixture.mjs b/umtool/e2e/fixtures/delete-fixture.mjs
@@ -0,0 +1,100 @@
+// What article-delete.spec.ts deletes (release 27 follow-up): its own, so the
+// other specs' fixtures (zeta, the report projects) are never touched.
+//
+// articles/omega/ a DRAFT article (report.json) with iterations:
+// iterations/1 sweep, done; project gen-projects/omega/i1
+// iterations/2 revise-report of i1, done: the CURRENT article
+// iterations/3 a copy of i1, done; project gen-projects/omega/i3
+// iterations/current.json report i2
+// articles/psi/ an article IN THE MAKING: i1 only
+// reports/delete-fixture/ a report-video project with out/ and two takes:
+// takes/keep/ its manifest IS the project's (refused)
+// takes/drop/ another (deleted)
+//
+// Synthetic, like every fixture: invented text, the fixture's own channel.
+import { mkdirSync, writeFileSync } from "node:fs";
+import path from "node:path";
+
+const put = (file, value) => {
+ mkdirSync(path.dirname(file), { recursive: true });
+ writeFileSync(file, typeof value === "string" ? value : JSON.stringify(value, null, 2) + "\n");
+};
+
+const AT = "2026-10-13T10:00:00.000Z";
+const CITE = { kind: "video", channel: "sitechan", id: "sv1", start: 3, end: 6, quote: "The vote was rigged and everybody knew.", speaker: "Site Channel", date: "2024-03-15" };
+
+const report = (id, title) => ({
+ format: "archilyzer-report",
+ version: 1,
+ id,
+ kind: "sweep",
+ title,
+ citations: { c1: CITE },
+ sections: [{ id: "s1", title: "The claim", body: "She said [the vote was rigged](cite:c1) in the first stream." }],
+});
+
+const iteration = (article, n, extra) => ({
+ format: "archilyzer-iteration",
+ version: 1,
+ article,
+ n,
+ parent: null,
+ copyOf: null,
+ status: "done",
+ model: "qwen3:8b",
+ question: "What did the channel say about the vote?",
+ scope: { channels: ["sitechan"] },
+ usage: {},
+ steps: [],
+ createdAt: AT,
+ updatedAt: AT,
+ endedAt: AT,
+ ...extra,
+});
+
+const videoManifest = (title) => ({
+ title,
+ provenance: { siteOrigin: "https://archive.example" }, // /browse scans every project: no origin is a BLOCKING defect
+ timeline: [
+ { type: "card", id: "t0", heading: title, narration: { text: "What the channel said about the vote." } },
+ { type: "clip", id: "a1", video: "sv1", channel: "sitechan", start: 3, end: 6, quote: "The vote was rigged" },
+ ],
+});
+
+export function makeDeleteFixture({ dest, articles, reports }) {
+ const projects = path.join(dest, "gen-projects");
+ const its = (id, n) => path.join(articles, id, "iterations", String(n));
+
+ // omega: a draft with three iterations, i2 current.
+ put(path.join(articles, "omega", "report.json"), report("omega", "Omega: the vote, revised"));
+ put(path.join(its("omega", 1), "iteration.json"), iteration("omega", 1, { kind: "sweep", projectDir: path.join(projects, "omega", "i1") }));
+ put(path.join(its("omega", 1), "report.json"), report("omega", "Omega: the vote"));
+ put(path.join(its("omega", 2), "iteration.json"), iteration("omega", 2, { kind: "revise-report", parent: 1, feedback: "Say when.", question: undefined }));
+ put(path.join(its("omega", 2), "report.json"), report("omega", "Omega: the vote, revised"));
+ put(path.join(its("omega", 3), "iteration.json"), iteration("omega", 3, { kind: "sweep", copyOf: 1, model: "claude-haiku-4-5", projectDir: path.join(projects, "omega", "i3") }));
+ put(path.join(its("omega", 3), "report.json"), report("omega", "Omega: the vote, on another model"));
+ put(path.join(articles, "omega", "iterations", "current.json"), { format: "archilyzer-iterations-current", version: 1, report: 2, reportFrom: 2, video: null, reportAt: AT });
+ for (const n of [1, 3]) {
+ put(path.join(projects, "omega", `i${n}`, "video.manifest.json"), videoManifest(`Omega i${n}`));
+ put(path.join(projects, "omega", `i${n}`, "out", "omega.mp4"), "not really a video\n");
+ }
+
+ // psi: in the making.
+ put(path.join(its("psi", 1), "iteration.json"), iteration("psi", 1, { kind: "sweep" }));
+ put(path.join(its("psi", 1), "report.json"), report("psi", "Psi: a first look"));
+
+ // A report-video project with two takes.
+ const project = path.join(reports, "delete-fixture");
+ const m = videoManifest("The Delete Fixture");
+ put(path.join(project, "video.manifest.json"), m);
+ put(path.join(project, "out", "final", "delete-fixture.mp4"), "not really a video\n");
+ for (const [id, order, manifest] of [
+ ["keep", 1, m],
+ ["drop", 2, { ...m, title: "The Delete Fixture, shorter" }],
+ ]) {
+ put(path.join(project, "takes", id, "take.json"), { id, group: "ending", order, label: id === "keep" ? "Kept ending" : "Dropped ending", kind: "similar", preview: "preview.mp4" });
+ put(path.join(project, "takes", id, "preview.mp4"), "not really a video\n");
+ put(path.join(project, "takes", id, "video.manifest.json"), manifest);
+ }
+ return { projects, project };
+}
diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs
@@ -24,6 +24,7 @@ import { SONG_DATA } from "../../song/paths.mjs";
import { songCapabilities } from "./song-capabilities.mjs";
import { makeSitesFixture } from "./sites-fixture.mjs";
import { makeIterationsFixture } from "./iterations-fixture.mjs";
+import { makeDeleteFixture } from "./delete-fixture.mjs";
const CODE = path.resolve(path.dirname(new URL(import.meta.url).pathname), "..", "..", "song");
const dest = path.resolve(process.argv[2] ?? path.join(process.cwd(), ".e2e-song"));
@@ -1910,6 +1911,9 @@ writeProject("timeline-fixture", {
const { sites: SITES, articles: ARTICLES } = makeSitesFixture({ dest, reports, channels: CHANNELS });
// Release 27: an article in the making (zeta), its projects, today's usage.
makeIterationsFixture({ dest, articles: ARTICLES });
+// The release 27 follow-up's deletes: omega (a draft with iterations), psi (in
+// the making), reports/delete-fixture (a project with two takes).
+makeDeleteFixture({ dest, articles: ARTICLES, reports });
console.log(`fixture at ${dest}`);
console.log(` SITES_DIR=${SITES}`);