commit 521299fad5eb244d8459ec7669f2958b75dc4673
parent 1d518763a42394d6e9c07706a426921fabc00d38
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 14 Oct 2026 02:36:24 -0400
umtool e2e: the article and site list tests read Work
Work rows carry data-status, data-audience and data-open-notes for them.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
4 files changed, 61 insertions(+), 53 deletions(-)
diff --git a/umtool/app/work/page.tsx b/umtool/app/work/page.tsx
@@ -10,6 +10,7 @@ import { LitList } from "@/components/ui/lit-list";
import { LitActions, LitGroup, LitLine } from "@/components/ui/lit-line";
import { Toolbar, ToolbarGroup } from "@/components/ui/toolbar";
import { newArticleHref, projectsHref, siteHref, workHref, type WorkQuery } from "@/lib/hrefs";
+import { ARTICLES_KEY } from "@/lib/articles/key.mjs";
import { KINDS } from "@/lib/projects";
import { readWork, type WorkRow } from "@/lib/work";
import { LIFECYCLES, STAGES, keepRow, lifeFilter, sortRows } from "@/lib/work/facets.mjs";
@@ -141,7 +142,7 @@ export default async function WorkPage({ searchParams }: { searchParams: Promise
{sites.map((s) => (
<Chip key={s} href={href({ site: s })} on={sp.site === s} label={s} n={n({ site: s })} />
))}
- {sp.site && (
+ {sp.site && sp.site !== ARTICLES_KEY && (
<Link href={siteHref(sp.site)} data-site-page={sp.site} className="ink-link ml-1 text-[12px]">
site page →
</Link>
@@ -223,13 +224,14 @@ function groupBySite(rows: WorkRow[]): { key: string; title: React.ReactNode; ro
.sort(([a], [b]) => (a === "" ? 1 : b === "" ? -1 : a.localeCompare(b)))
.map(([key, list]) => ({
key: key || "projects",
- title: key ? (
- <Link href={siteHref(key)} className="normal-case tracking-normal text-text-2 hover:text-text">
- {key}
- </Link>
- ) : (
- "projects"
- ),
+ title:
+ key && key !== ARTICLES_KEY ? (
+ <Link href={siteHref(key)} className="normal-case tracking-normal text-text-2 hover:text-text">
+ {key}
+ </Link>
+ ) : (
+ key || "projects"
+ ),
rows: list,
}));
}
@@ -241,6 +243,9 @@ function Row({ r }: { r: WorkRow }) {
data-piece={r.id}
data-stage={r.bucket}
data-lifecycle={r.lifecycle}
+ data-status={r.status ?? undefined}
+ data-audience={r.audience ?? undefined}
+ data-open-notes={r.counts.notes}
className="grid grid-cols-[minmax(0,1fr)_190px_160px_130px_56px] items-center gap-x-3.5"
>
<div className="flex min-w-0 items-center gap-2">
diff --git a/umtool/components/dashboard/Lifecycle.tsx b/umtool/components/dashboard/Lifecycle.tsx
@@ -67,7 +67,7 @@ export function LifecycleButton({
type="button"
disabled={!hydrated || busy}
data-lifecycle-to={to}
- data-piece={piece}
+ data-lifecycle-piece={piece}
title={error ?? undefined}
className={cn(buttonVariants({ variant, size }), error && "text-reject-text", className)}
onClick={async () => {
diff --git a/umtool/e2e/articles.spec.ts b/umtool/e2e/articles.spec.ts
@@ -6,7 +6,8 @@ import { WARM_TIMEOUT, warm } from "./warm";
// ---------------------------------------------------------------------------
// /articles (release 26): the homepage's article store, ARTICLES_DIR -- its
-// list, an article's page, its evidence, and its notes beside its report.json.
+// list (Work's articles since P3: /articles redirects to /work?kind=article),
+// an article's page, its evidence, and its notes beside its report.json.
//
// delta published, public, cites sitechan/sv1 (plays from a clip window)
// epsilon a draft
@@ -19,7 +20,7 @@ const NOTES = path.join(HERE, "..", ".e2e-song", "articles", "delta", "notes.jso
test.beforeAll(async ({ playwright }) => {
test.setTimeout(WARM_TIMEOUT);
await warm(playwright, [
- "/articles",
+ "/work?kind=article",
"/articles/delta",
"/articles/delta/evidence",
"/api/notes?article=articles/delta",
@@ -29,26 +30,28 @@ test.beforeAll(async ({ playwright }) => {
test.beforeEach(() => rmSync(NOTES, { force: true }));
test.afterAll(() => rmSync(NOTES, { force: true }));
-test("/articles lists the store: published in index.json's order, drafts after, each with its audience", async ({ page }) => {
+test("/articles is Work's articles; the store is its site facet, each article with its status and audience", async ({ page }) => {
const res = await page.goto("/articles");
expect(res?.status()).toBe(200);
- await expect(page.getByRole("link", { name: "articles", exact: true }).first()).toHaveAttribute("aria-current", "page");
- const rows = page.locator("[data-article]");
- await expect(rows).toHaveCount(2);
- await expect(rows.nth(0)).toHaveAttribute("data-article", "articles/delta");
- await expect(rows.nth(0)).toHaveAttribute("data-status", "published");
- await expect(rows.nth(0).locator("[data-audience]")).toHaveAttribute("data-audience", "public");
- await expect(rows.nth(1)).toHaveAttribute("data-article", "articles/epsilon");
- await expect(rows.nth(1)).toHaveAttribute("data-status", "draft");
- await expect(rows.nth(1).locator("[data-audience]")).toHaveAttribute("data-audience", "private");
+ await expect(page).toHaveURL(/\/work\?kind=article$/);
+ await expect(page.locator("[data-app-rail] [data-place=work]")).toHaveAttribute("aria-current", "page");
+ await page.locator("[data-facet=site]").getByRole("link", { name: /^articles \d+$/ }).click();
+ await expect(page).toHaveURL(/site=articles/);
+ // The store has no site page of its own.
+ await expect(page.locator("[data-site-page]")).toHaveCount(0);
+ const delta = page.locator("[data-piece='a:articles/delta']");
+ await expect(delta).toHaveAttribute("data-status", "published");
+ await expect(delta).toHaveAttribute("data-audience", "public");
+ const epsilon = page.locator("[data-piece='a:articles/epsilon']");
+ await expect(epsilon).toHaveAttribute("data-status", "draft");
+ await expect(epsilon).toHaveAttribute("data-audience", "private");
- await page.getByRole("link", { name: /^public \d+$/ }).click();
+ // The old list's keys still filter, and say so as a chip you can take off.
+ await page.goto("/articles?audience=public");
await expect(page).toHaveURL(/audience=public/);
- await expect(page.locator("[data-article]")).toHaveCount(1);
-
- // A site's own pages are a link away.
- await page.getByRole("link", { name: "site pages" }).click();
- await expect(page).toHaveURL(/\/sites$/);
+ await expect(page.locator("[data-extra=audience]")).toBeVisible();
+ await expect(page.locator("[data-piece^='a:articles/']")).toHaveCount(1);
+ await expect(page.locator("[data-piece='a:articles/delta']")).toBeVisible();
});
test("an article's page reads, its evidence plays, and a note lands beside its report.json", async ({ page, request }) => {
@@ -77,5 +80,5 @@ test("an article's page reads, its evidence plays, and a note lands beside its r
expect(doc.notes[0]).toMatchObject({ status: "open", author: "operator", text: "Check the date." });
await page.goto("/articles?notes=open");
- await expect(page.locator("[data-article='articles/delta'] [data-open-notes]")).toHaveAttribute("data-open-notes", "1");
+ await expect(page.locator("[data-piece='a:articles/delta']")).toHaveAttribute("data-open-notes", "1");
});
diff --git a/umtool/e2e/sites.spec.ts b/umtool/e2e/sites.spec.ts
@@ -2,7 +2,8 @@ import { test, expect } from "@playwright/test";
import { WARM_TIMEOUT, warm } from "./warm";
// ---------------------------------------------------------------------------
-// /sites: every site's articles, a site's page, its media and workspace files.
+// /sites: every site's articles (Work by site since P3: /sites redirects to
+// /work?by=site), a site's page, its media and workspace files.
//
// priv/polemic-alpha published, a video + poster, linked to the project
// sitews/polemic-alpha (slug in the draft's workspace)
@@ -14,45 +15,44 @@ import { WARM_TIMEOUT, warm } from "./warm";
test.beforeAll(async ({ playwright }) => {
test.setTimeout(WARM_TIMEOUT);
- await warm(playwright, ["/sites", "/sites/priv", "/sites/priv/polemic-alpha", "/api/sites/media?site=priv&report=polemic-alpha&file=poster.jpg", "/api/sites/workspace?ws=sitews&rel=NOTES.md"]);
+ await warm(playwright, ["/work?by=site", "/sites/priv", "/sites/priv/polemic-alpha", "/api/sites/media?site=priv&report=polemic-alpha&file=poster.jpg", "/api/sites/workspace?ws=sitews&rel=NOTES.md"]);
});
-test("/sites lists every site, private first, with published and draft articles", async ({ page }) => {
+test("/sites is Work by site: a group per site, its title the site's page, with published and draft articles", async ({ page }) => {
const res = await page.goto("/sites");
expect(res?.status()).toBe(200);
- // The nav calls it "articles" (the editor's /sites is the sites themselves).
- await expect(page.getByRole("link", { name: "articles", exact: true }).first()).toHaveAttribute("aria-current", "page");
- await expect(page.getByRole("link", { name: "sites", exact: true })).toHaveCount(0);
+ await expect(page).toHaveURL(/\/work\?by=site$/);
+ await expect(page.locator("[data-app-rail] [data-place=work]")).toHaveAttribute("aria-current", "page");
- const sites = page.locator("[data-site]");
- await expect(sites).toHaveCount(2);
- await expect(sites.nth(0)).toHaveAttribute("data-site", "priv");
- await expect(sites.nth(1)).toHaveAttribute("data-site", "pub");
- await expect(page.locator("[data-site='priv'] [data-audience]")).toHaveAttribute("data-audience", "private");
- await expect(page.locator("[data-site='priv'] [data-counts]")).toHaveAttribute("data-counts", "1/1");
-
- const alpha = page.locator("[data-article='priv/polemic-alpha']");
+ for (const site of ["priv", "pub"]) {
+ const group = page.locator(`[data-site='${site}']`);
+ await expect(group).toHaveCount(1);
+ await expect(group.getByRole("link", { name: site, exact: true })).toHaveAttribute("href", `/sites/${site}`);
+ }
+ const alpha = page.locator("[data-site='priv'] [data-piece='a:priv/polemic-alpha']");
await expect(alpha).toHaveAttribute("data-status", "published");
await expect(alpha).toContainText("Alpha: the rigged vote");
- await expect(alpha.locator("[data-project-link='sitews/polemic-alpha']")).toBeVisible();
- await expect(alpha).toContainText("alpha.json");
- await expect(alpha.locator("img")).toHaveCount(1);
- await expect(page.locator("[data-article='priv/polemic-beta']")).toHaveAttribute("data-status", "draft");
+ // Its video project is part of the piece (linked by the slug in its workspace).
+ await expect(alpha).toContainText("article + report video");
+ await expect(page.locator("[data-site='priv'] [data-piece='a:priv/polemic-beta']")).toHaveAttribute("data-status", "draft");
+ await expect(page.locator("[data-site='pub'] [data-piece='a:pub/gamma']")).toBeVisible();
});
-test("the filters are links, and compose", async ({ page }) => {
- await page.goto("/sites");
- await page.getByRole("link", { name: /^draft \d+$/ }).click();
+test("the old /sites keys still filter, and the site facet links the site's page", async ({ page }) => {
+ await page.goto("/sites?status=draft");
await expect(page).toHaveURL(/status=draft/);
- await expect(page.locator("[data-article]")).toHaveCount(1);
- await expect(page.locator("[data-article='priv/polemic-beta']")).toBeVisible();
+ await expect(page.locator("[data-extra=status]")).toBeVisible();
+ await expect(page.locator("[data-piece^='a:priv/'], [data-piece^='a:pub/']")).toHaveCount(1);
+ await expect(page.locator("[data-piece='a:priv/polemic-beta']")).toBeVisible();
await page.goto("/sites?site=pub");
await expect(page.locator("[data-site]")).toHaveCount(1);
- await expect(page.locator("[data-article='pub/gamma']")).toBeVisible();
+ await expect(page.locator("[data-piece='a:pub/gamma']")).toBeVisible();
+ await page.locator("[data-site-page=pub]").click();
+ await expect(page).toHaveURL(/\/sites\/pub$/);
await page.goto("/sites?notes=open");
- await expect(page.locator("[data-article]")).toHaveCount(0);
+ await expect(page.locator("[data-piece^='a:priv/'], [data-piece^='a:pub/']")).toHaveCount(0);
});
test("a site's page plays its report videos, lists its project's takes and its workspace", async ({ page, request }) => {