commit 24d0acd624a51c1412ec947a50c882b4d8b29fc4
parent 559f30f59e996dee6eac6294e506367adcbf45b8
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 3 Nov 2026 17:10:47 -0500
umtool e2e: the slur filter -- a made-up word put on the filter (posts slurs add, visual placeholder): As published (censored) draws it as a dark pill with its mask and the word is nowhere in the card's DOM; Uncensored draws the word; the redacted phrase stays bars in both. `posts slurs ls` names a project's own word by its mask alone
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
3 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/umtool/e2e/post-items.spec.ts b/umtool/e2e/post-items.spec.ts
@@ -130,6 +130,48 @@ test("a redacted term: Play shows the words; As published draws blank bars and t
expect(JSON.stringify(timeline())).toContain("here is the video");
});
+test("the slur filter: As published (censored) draws the placeholder pill and never the word; Uncensored draws the word; the redaction stays on in both", async ({ page }) => {
+ // A made-up word put on the filter (umtool posts slurs add; knobs.md, "The slur filter"), drawn as a placeholder.
+ umtool(["posts", "slurs", PROJECT, "add", "video"]);
+ umtool(["posts", "slurs", PROJECT, "visual", "placeholder"]);
+ umtool(["posts", "redact", PROJECT, "add", "here is"]);
+ const ls = umtool(["posts", "slurs", PROJECT, "ls"]);
+ expect(ls).toContain("the slur filter is ON");
+ expect(ls).toMatch(/v\*{4} +\(its own\) +×1/);
+ expect(ls).not.toContain("video");
+ await page.setViewportSize({ width: 1366, height: 1000 });
+ await page.goto(urls.playHref(PROJECT, { bare: true, clip: "p-vid" }));
+ await page.evaluate(() => {
+ window.localStorage.removeItem("umtool.play.asPublished");
+ window.localStorage.removeItem("umtool.play.uncensored");
+ });
+ await page.reload();
+ await expect(root(page)).toHaveAttribute("data-play-item", "p-vid");
+ const card = page.frameLocator('[data-post-card-frame="read"]');
+ // umtool's own view: the words as posted; no Uncensored toggle until As published is on.
+ await expect(card.locator("[data-post-words]")).toContainText("the video.");
+ await expect(page.locator("[data-play-uncensored]")).toHaveCount(0);
+ await page.locator("[data-play-as-published]").check();
+ await expect(page.locator("label:has([data-play-as-published])")).toContainText("As published (censored)");
+ // CENSORED: the word a dark pill holding its mask; the redacted phrase still bars.
+ await expect(card.locator("[data-post-slur]")).toHaveCount(1);
+ await expect(card.locator("[data-post-slur]")).toHaveText("v****");
+ await expect(card.locator("[data-post-blanked]")).toHaveCount(2);
+ const dom = await card.locator("html").evaluate((el) => el.outerHTML);
+ expect(dom.toLowerCase()).not.toContain("video.");
+ expect(dom.toLowerCase()).not.toContain("here is");
+ if (SHOTS) await page.screenshot({ path: path.join(SHOTS, "post-items-slurs-censored.png") });
+ // UNCENSORED: the word as posted; the redaction is not part of the switch.
+ await page.locator("[data-play-uncensored]").check();
+ await expect(page.locator("label:has([data-play-as-published])")).toContainText("As published (uncensored)");
+ await expect(card.locator("[data-post-slur]")).toHaveCount(0);
+ await expect(card.locator("[data-post-words]")).toContainText("the video.");
+ await expect(card.locator("[data-post-blanked]")).toHaveCount(2);
+ if (SHOTS) await page.screenshot({ path: path.join(SHOTS, "post-items-slurs-uncensored.png") });
+ // The snapshot is never rewritten.
+ expect(JSON.stringify(timeline())).toContain("here is the video");
+});
+
test("a censored attachment: set-item blurs it, Play previews the blur and its label, the bench toggles it off and saves", async ({ page }) => {
umtool(["posts", "set-item", PROJECT, "p-vid", "media.0.blur=on"]);
await page.setViewportSize({ width: 1366, height: 1000 });
diff --git a/umtool/lib/report/postSlursCli.mjs b/umtool/lib/report/postSlursCli.mjs
@@ -110,7 +110,8 @@ export async function slursCommand(project, rest, { json = false, out = (s) => c
}
out(` it ${s.on ? "masks" : "would mask"} ${report.total} word(s) in ${report.posts.length} post item(s):`);
const rows = Object.entries(report.bySlur).sort((a, b) => b[1].n - a[1].n);
- for (const [id, b] of rows) out(` ${b.mask.padEnd(10)} ${id.padEnd(18)} ×${String(b.n).padEnd(4)} in ${b.posts.length} post(s): ${b.posts.slice(0, 8).join(", ")}${b.posts.length > 8 ? ", …" : ""}`);
+ // A project's own word is named by its mask alone (its id would spell it).
+ for (const [id, b] of rows) out(` ${b.mask.padEnd(10)} ${(b.added ? "(its own)" : id).padEnd(18)} ×${String(b.n).padEnd(4)} in ${b.posts.length} post(s): ${b.posts.slice(0, 8).join(", ")}${b.posts.length > 8 ? ", …" : ""}`);
out(" per post item:");
for (const p of report.posts) out(` ${p.id.padEnd(22)} ${Object.entries(p.hits).map(([id, n]) => `${report.bySlur[id]?.mask ?? id} ×${n}`).join(", ")} (${p.where.join(", ")})`);
if (reads.length) {
diff --git a/umtool/report-to-video/post-slurs.mjs b/umtool/report-to-video/post-slurs.mjs
@@ -396,7 +396,8 @@ export function slurReport(timeline, s) {
hits[h.id] = (hits[h.id] ?? 0) + 1;
where.add(w.replace(/\[\d+\]/, ""));
total += 1;
- const b = (bySlur[h.id] ??= { mask: slurEntryOf(on, h.id)?.mask ?? "*", n: 0, posts: [] });
+ const se = slurEntryOf(on, h.id);
+ const b = (bySlur[h.id] ??= { mask: se?.mask ?? "*", n: 0, posts: [], ...(se?.added ? { added: true } : {}) });
b.n += 1;
if (!b.posts.includes(e.id)) b.posts.push(e.id);
}