// ACCOUNT ACTIVITY on a posts channel's page (lane x-console): posts per day // over the archive's range, and the long silences — ≥ 3× the account's median // gap AND ≥ 48 h — each linked to the post before and the post after. // // The shape is Mr Obvious's 5–8 Nov 2026 gap (verified read-only against the // real corpus by an offline script): a busy account, a post every 15 minutes // on 3–4 Nov, nothing for four days, busy again on 8 Nov. The posts are // written straight to the channel's shard (no fetch, nothing reaches X), plus // posts by another account the with-replies timeline archived, which do not // count. import { mkdir, writeFile } from "node:fs/promises"; import path from "node:path"; import { test, expect, type Page } from "@playwright/test"; import { resetData, resolvePath, testPaths, writeSettings } from "./helpers"; const SLUG = "x-obvious"; const HANDLE = "obvious_user"; type P = { id: string; createdAt: string; author: string }; function posts(): P[] { const out: P[] = []; let n = 1000; for (const day of ["2026-11-03", "2026-11-04"]) { for (let m = 0; m < 8 * 60; m += 15) { const h = String(10 + Math.floor(m / 60)).padStart(2, "0"); out.push({ id: String(++n), createdAt: `${day}T${h}:${String(m % 60).padStart(2, "0")}:00.000Z`, author: HANDLE }); } } // Another account's post inside the gap (a reply's parent): not this // account's activity. out.push({ id: "9000", createdAt: "2026-11-06T12:00:00.000Z", author: "someone_else" }); for (let m = 0; m < 4 * 60; m += 15) { const h = String(19 + Math.floor(m / 60)).padStart(2, "0"); out.push({ id: String(++n), createdAt: `2026-11-08T${h}:${String(m % 60).padStart(2, "0")}:00.000Z`, author: HANDLE }); } return out; } async function writeChannel(): Promise
{ const dir = resolvePath(`${testPaths().transcriptsDir}/channels/${SLUG}`); await mkdir(path.join(dir, "posts"), { recursive: true }); await writeFile( path.join(dir, "config.json"), JSON.stringify({ name: "Obvious (X)", handling: "transcribe", sourceKind: "social", postFetcher: "x-gallery-dl", platform: "twitter", socialHandle: HANDLE, url: `https://x.com/${HANDLE}`, }), ); const all = posts(); const lines = all.map((p) => JSON.stringify({ id: p.id, slug: `${SLUG}/${p.id}`, channelSlug: SLUG, author: p.author, createdAt: p.createdAt, text: `post ${p.id}`, url: `https://x.com/${p.author}/status/${p.id}`, platform: "twitter", isReply: false, isRepost: false, links: [], }), ); await writeFile(path.join(dir, "posts", "2026-11.jsonl"), lines.join("\n") + "\n"); await writeFile(path.join(dir, "posts-archive"), all.map((p) => `twitter ${p.id}\n`).join("")); await writeFile( path.join(dir, "posts-state.json"), JSON.stringify({ lastFetchedAt: "2026-11-09T00:00:00.000Z", lastFetchedCount: 16 }), ); return all; } const SHOTS = process.env.E2E_UI_OPS_SHOTS ?? ""; async function shot(page: Page, name: string) { if (!SHOTS) return; await mkdir(SHOTS, { recursive: true }); await page.screenshot({ path: path.join(SHOTS, `${name}.png`), fullPage: false }); } test("a posts channel's activity: posts per day, the four-day silence marked and linked to the posts on either side", async ({ page, }) => { await resetData("empty"); await writeSettings({ minFreeDiskGB: 0 }); const all = await writeChannel(); const own = all.filter((p) => p.author === HANDLE); const before = own.filter((p) => p.createdAt.startsWith("2026-11-04")).at(-1)!; const after = own.find((p) => p.createdAt.startsWith("2026-11-08"))!; await page.setViewportSize({ width: 1366, height: 768 }); await page.goto(`/channels/${SLUG}`); const panel = page.getByRole("region", { name: "account activity" }); await expect(panel.getByRole("heading", { name: "Account activity" })).toBeVisible(); // Only the account's own posts count; the range is 3 – 8 Nov. await expect(panel.getByLabel("account activity summary")).toContainText( "80 posts by @obvious_user · 3 Nov 2026 – 8 Nov 2026 · median gap 15 min · busiest day 32", ); // The strip: one bar per day with a post (4 days carry none), one silence shaded. const strip = panel.getByRole("img", { name: "posts per day" }); await expect(strip.locator("rect.fill-info")).toHaveCount(3); await expect(strip.locator("rect[data-silence]")).toHaveCount(1); const silences = panel.getByRole("list", { name: "long silences" }); await expect(silences.getByRole("listitem")).toHaveCount(1); const gap = silences.getByLabel("silence 2026-11-04 to 2026-11-08"); await expect(gap).toContainText("4 Nov 17:45 → 8 Nov 19:00"); await expect(gap).toContainText("4 d 1 h"); await expect(gap.getByRole("link", { name: "post before" })).toHaveAttribute( "href", `https://x.com/${HANDLE}/status/${before.id}`, ); await expect(gap.getByRole("link", { name: "post after" })).toHaveAttribute( "href", `https://x.com/${HANDLE}/status/${after.id}`, ); await expect(panel).toContainText("no archived post for ≥ 2 d (≥ 48 h and ≥ 3× the median gap)"); await panel.scrollIntoViewIfNeeded(); await shot(page, "account-activity"); });