Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 73d75bf5985f365454827a2cbee4f7d134d69d8a
parent 8d436cf30ffae89ae0c9af6bd854c5b0e39a1394
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Mon,  2 Nov 2026 04:58:39 -0500

docs + e2e: a case's verify, leads and evidence (umtool research.md, case-stages.spec), Newgrounds, an excluded scan target; FACTS

umtool/docs/research.md gains "A case's stages: Verify, Leads, Evidence" and the routes; the editor
CHANGELOG's [Unreleased] the three changes; FACTS the verified facts lanes A, B and D code against
(the one findings writer, what lane C writes into pipeline.json, the contract additions, the lead
keys, the Newgrounds kinds, and that fetch-posts retryOnBlock was already on main).
umtool/e2e/case-stages.spec.ts walks the three stages on the fixture case in order: both tracks and
a correction that keeps the reader's words, the audio check while paused, a forum finding
quarantined; leads counted, never-archive as a hash, archive on no site; an excluded target, a
capture at a date, a forum attachment marked unverified and attached to its finding.
E2E_CASE_STAGES_SHOTS=<dir> writes its screenshots.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Meditor/CHANGELOG.md | 3+++
Mplans/FACTS.md | 65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/docs/README.md | 2+-
Mumtool/docs/research.md | 35++++++++++++++++++++++++++++++++++-
Aumtool/e2e/case-stages.spec.ts | 208+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/playwright.config.ts | 3+++
6 files changed, 314 insertions(+), 2 deletions(-)

diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog ## [Unreleased] +- **A research case can be verified, its leads decided and its evidence captured, all in umtool.** Every case page now has **Board · Verify · Leads · Evidence**. **Verify** shows each finding's moment in every caption track side by side — the original audio's captions beside the uploaded `en` ones, the quote's words lit where they land and "holds the quote" or "4 of 5 words" on each — and an **Audio check** that has the editor transcribe the window on a local worker (its held media, or a clip fetched through it; **Run even while transcription is paused** for a pause-all) and diffs what was heard with the quote ("Heard 9 of 9 words"). A finding is marked Verified, Corrected, Disputed, Unverified or Quarantined (one first seen on a forum says so); **Correct by hand** keeps the reader's words ("The reader wrote: …"). **Leads** lists the accounts and pages a forum or posts channel links most, counted by post, with the posts around each on demand; **Never archive** makes the lead's name one of the case's private names — stored as its hash, never as text, and withheld from then on — and **Archive** creates its channel through the editor on no site and starts its first fetch (**Older walk** after). **Evidence** takes Wayback captures of a list of pages at chosen dates (a page the Wayback Machine will not show is the row "excluded from the Wayback Machine (cause unknown)") and a forum post's attachments and screenshot, shown everywhere as "forum attachment, post #N, unverified", attached to the findings they back. Any quote, note or role typed by hand that holds one of the case's private names is refused with a count, never the name, and a possessive ("…'s") no longer slips a name past that check. Needs a restart of umtool. +- **Newgrounds pages are read whole.** A Wayback capture of a 2014 Newgrounds user page used to come out as one small block of it: the page keeps its profile, stats, links and news in many small boxes the generic extractor dropped. A user page (`<user>.newgrounds.com/`) is now read box by box — "Profile", "Location: …", "Joined on: …", its links — and an art page or a movie page is one record per work (its title, author, comments, image or file, tags, credits and date) that later captures update. A channel imported before this is put right by **Re-extract** (`reextract-pages`), from the captures it already keeps; nothing is fetched. Needs a restart of the editor. +- **A Wayback scan goes on past a page the archive excludes.** A target the Wayback Machine answers 403 for stopped the whole `wayback-scan` as an error. Now that target is marked "excluded from the Wayback Machine (cause unknown)" on the Captures tab (and `refusal: "excluded"` in the scan's result), it is done for this pass, and the next target is scanned. A new pass asks again. Needs a restart of the editor. - **Sync on an X, Bluesky or forum channel fetches its posts.** The Sync button on a social channel ran yt-dlp's video listing against the profile and failed. Every Sync — the channel rows', the dashboard's, a group's, Sync all, `pnpm ops sync`, a sync job's Retry — now runs the channel's post fetch (the same job as the channel page's Fetch posts: on the platform's queue, paced, and for X only on a fresh cookie jar), and a refusal is its own sentence beside the button. A full sweep is the video listing's, so a Sync never starts a social channel's whole re-walk; that is still Fetch posts → Re-fetch full history. - **A report video's project page names the sites its links depend on, and says when one is behind.** Each site a clip's QR opens is listed with its deploy's date (its `corpus.json`, read by Check links) and the cited videos newer than it — uploaded or transcribed after it, and not found on it — and the check's new `site-deploy-behind` row offers **Publish <site>**, which asks the editor to build and deploy it. - **A per-project link policy: cite via one site, these channels direct.** The Ember cut's citeUrls were rewritten by hand twice to send two channels to anilyzer and one to YouTube. A project's **Link policy** (Overview, or `umtool link-policy <p> --via <site> --direct a,b`) now says it once: new clips are written by it, and every clip that breaks it is a check row with a one-press fix (`umtool link-policy <p> --fix` for all). diff --git a/plans/FACTS.md b/plans/FACTS.md @@ -11570,3 +11570,68 @@ parsed to 0 cues, indexing the video textless) is CLOSED by `200a3105` (transcri the job makes later finds the store in its render phase and threw — the job's work was done and it ended `failed`. Counted as a skip like the missing store. The cookie actions do not revalidate at all (the banner refetches its view). + +## Release 38 lane C: a case's verify, leads and evidence; Newgrounds; an excluded scan target (verified 2026-11-02, branch `r38/case-verify-leads`) + +- **Where:** umtool `lib/research/case-{stage-files,findings-store,editor,verify,leads,evidence,stage-hrefs}.ts`, + routes `app/api/research/cases/[id]/stages/{verify[/captions|/audio],leads[/context|/older],evidence}`, pages + `app/research/[case]/{verify,leads,evidence}`, panels `components/research/stages/`. Every case page (the board's + `AppHeader below`, and each stage page) draws `CaseStagesNav` ("Case stages": Board · Verify · Leads · Evidence) — + lane A's stages join that one list. +- **One writer per stage file**, in `case-stage-files.ts`: `withFileLock(file)` (an in-process chain on + globalThis `__umtoolCaseStageLocks`), `writeWhole` (temp + rename), `readJsonFile` (409, never overwritten, when it + does not parse). `findings.jsonl`: `case-findings-store.ts` `appendFindings` (refuses a reused row id) and + `mutateFindings` (read all, change, write whole); a line that does not parse refuses both with 409 and its line + number. Lane B's appends and lane A's merge should call these, not write the file themselves. +- **pipeline.json is lane A's; lane C writes one thing into it:** `feedPrivateNameHash(case, sha)` adds a hash to + `privateNames.sha256` (sorted, deduped) under the same lock, every other key kept; with no definition it writes + a minimal valid `CaseDefinition` holding only that hash (status "defining"). +- **Contract additions** (`common/lib/research/caseTypes.ts`): `CASE_FILES.evidence` (`evidence.json`, + `CaseEvidence[]`, `e<n>` ids, states planned/queued/captured/excluded/failed), `FindingVerify.audio` + (`AudioCheck {at, job, text, matched, words, worker?}`), `FindingEvidence.evidence`/`position`, + `EXCLUDED_SENTENCE` (= the editor's `WAYBACK_EXCLUDED_PHRASE`, a test keeps them equal), + `forumAttachmentLabel(position, post)` → "forum attachment, post #N, unverified", `evidenceLabel(e)`, + `unpossessive`. `privateNameCandidates` also hashes a phrase whose last word is a possessive without its "'s" + (it used to keep the apostrophe, so "Jane's" passed the gate). `privateNames-server.ts` `redactPrivateNames(text, + hashes)` → `{text, hits}` (the name replaced by `[name withheld]`, a possessive's "'s" kept). `wordDiff.ts` + `quoteWordDiff(quote, heard)` → `{matched, words, ops}` (LCS over `wordsOf` words; transcript words outside the + matched stretch dropped). +- **Verify:** tracks = the record's primary + `altTracks`, ordered original (`en-orig`) → uploaded (`en`) → + transcription, at most 3; the window is cues starting in [t − 15, t + 35]; the lit words are the + quote-length stretch (max(n + 4, 1.5n) words) with the longest LCS, nearest t on a tie. A finding on a social + channel (xenforo, twitter, bluesky, webpage) shows the post's text as its one track. Shown text is redacted with + the case's hashes. `setVerify`: a quote/speaker change must be status `corrected` (400 otherwise), `original` + is set once and never overwritten; quote ≤ 45 words; quote+speaker+note with a private-name hit → 422 with a + count. `how` = hand (words changed) | audio (asked, and an audio check is kept) | captions. +- **The audio check** (`audioStep`): window [t − 5, t + 30]; media = the first `data/<id>/` file with a media + extension (`audio.*` first), else the tightest `clips/<from>-<to>.*` covering the window, else a fetch through + `fetchForReader` (fetch_clip's path); then `POST /api/ops/transcribe {path, start, end, whilePaused?}` on that + file's clock; the result is the `@@transcribe-result ` line of `GET /api/ops/job/<id>?tail=80`. Kept on + `verify.audio`; the status is never changed by it. +- **Leads:** `leadOf(url)` → `x:@handle` (x.com/twitter.com, not /i /intent /search…), `youtube:@h|c/…|user/…| + channel/…`, `bluesky:<handle>`, `tumblr:|newgrounds:|deviantart:<sub>`, `reddit:u/<n>`, `instagram:`, `tiktok:@`, + else `<host without www>/<path>` lowercased. Counted by POST (one per post per key), the forum's own host (posts' + `forum.host`, and the channel URL for xenforo; ± www) left out. The NAME hashed is the handle/user/last path + segment without "@". never-archive → `leads.json` keeps `{key: "hash:<sha>", url: "", platform, count, + disposition, role?}` and `pipeline.json` gets the sha; a lead whose name hashes into the case's private names is + counted in `withheld`, never listed. archive → `POST /api/ops/create-channel {fields: {name, handling, url}, + fetchPostsNow|fetchPlaylist}` with NO `sites` key (X: `https://x.com/<h>`; YouTube: `<url>/videos` + fetchPlaylist; + anything else a Wayback pages channel `https://web.archive.org/web/*/<host+path>*`); Older walk = `fetch-posts + {slug, older: true}`. +- **Evidence:** lookup = `wayback-lookup {url, okOnly: true, limit: 500}` (403 `refusal: "excluded"` → row + `excluded`); capture = `import-page {slug, url, at: YYYYMMDD}` (a picked Wayback pages channel, or + `create-channel` for the host on no site); forum = `capture-posts {slug, ids: [post], shots: true, media: true}`, + captured when the job is done and `posts-media/<post>/` holds a non-json file. The UI re-asks a queued row every + 1.5 s (`refresh`). `renderEvidenceSection(rows)` / `renderQuarantinedSection(findings)` are the export's. +- **Newgrounds** (`common/lib/waybackPages/extractors/newgrounds.ts`, registered after `x`, before `xenforo`): + claims `<user>.newgrounds.com/` (and `/profile`; not www/art/uploads/… subdomains), `www.newgrounds.com/art/view/ + <user>/<slug>`, `/portal/view/<id>`. Kinds `ng-user` (no item id: each capture a version), `ng-art` + (`ng-art-<user>-<slug>`), `ng-movie` (`ng-movie-<id>`). Pods: `.pod` → `.pod-head|.podtop` heading + `.pod-body| + .podcontent`, or a `.podtop` followed by a sibling `.podcontent`; a `<dl>` as "Term: value" lines. Date: + `meta[itemprop=datePublished]`, else the sidestats "Uploaded"/"Date added" value (read as UTC). The fixtures are + synthetic (no live Newgrounds page read). +- **wayback-scan, an excluded target:** `cdxPage`'s `WaybackExcludedError` no longer stops the run: the target's + report gets `refusal: "excluded"` + `error`, the scan file's target `excluded: WAYBACK_EXCLUDED_PHRASE` and + `complete: true` (cleared by `startPass`), the result `excluded: [urls]`, and the loop goes on to the next target. +- **Stage 11 (`fetch-posts {retryOnBlock}`) was already on main** (release 37 lane G, `fetchPosts.ts` "RETRY ON A + BLOCK", tested in `fetchForumPosts.test.ts`: "Waiting N min after a challenge page, try k/M." per wait). diff --git a/umtool/docs/README.md b/umtool/docs/README.md @@ -8,7 +8,7 @@ anywhere), Pinned, the **Running** list with today's API spend, and the theme (* | Place | Addresses | Sheet | |---|---|---| | Inbox | `/` (`?hidden=1`, `?muted=1`) | [inbox.md](inbox.md) | -| Research | `/research`, `/research/<case>`, `/research/runs`, `/research/runs/<article>/<n>`, `/research/archive` | [research.md](research.md) | +| Research | `/research`, `/research/<case>`, `/research/<case>/{verify,leads,evidence}`, `/research/runs`, `/research/runs/<article>/<n>`, `/research/archive` | [research.md](research.md) | | Work | `/work`, `/projects` (the projects grid) | [work.md](work.md) | | A site | `/sites/<site>` (`?ws=&rel=`) | [work.md](work.md) | | A piece | `/articles/<id>`, `/sites/<site>/<report>`, `/projects/<path>` (`?tab=`); an article's `/evidence` and `/compare` | [piece.md](piece.md) | diff --git a/umtool/docs/research.md b/umtool/docs/research.md @@ -76,6 +76,39 @@ claim line and note on each. Create's **From a board** lines open the same plans. +## A case's stages: Verify, Leads, Evidence (release 38 lane C) + +Every case page carries the row **Board · Verify · Leads · Evidence**. The stages read and write the pipeline's files +beside the board's `case.json` (`common/lib/research/caseTypes.ts`, `CASE_FILES`), each through one writer (temp + +rename, 409 and never overwritten when it does not parse). No model is needed for any of them; every fetch, capture, +transcription and channel is the editor's (its ops door), paced by it. + +- **Verify**, `/research/<case>/verify`: the findings (`findings.jsonl`) with their status and a **forum** tag for one + first seen on a forum. A finding's window in every caption track it has **side by side** (`en-orig` first, then `en`, + then a transcription; a post's text for a post), the quote's words lit where they land and "holds the quote" or + "N of M words" per track. **Audio check**: the held media (or a clip fetched through the editor) transcribed by the + editor's `transcribe` on a local worker — **Run even while transcription is paused** sends `whilePaused` — then + "Heard N of M words" and the word diff (missing struck through, extra in brackets), kept on the finding + (`verify.audio`). **Status**: Unverified, Verified, Corrected, Disputed, Quarantined (**Save status**, with a note). + **Correct by hand** (quote, speaker) saves as Corrected and keeps the reader's words once in `verify.original` + ("The reader wrote: …"). A hand-written quote, speaker or note that holds one of the case's private names is refused + with a count, never the name. +- **Leads**, `/research/<case>/leads[?channel=<slug>]`: over a posts or forum channel (the scope's first by default), + the accounts and pages its posts link most, **counted by post** (the forum's own links left out); a lead whose name + is a private name is counted as withheld, never listed. **Context** shows the posts that link it (private names + withheld). Each lead: a **Role** note and a **Disposition** — **Never archive** feeds the lead's name to the case's + private names as its sha256 and keeps the lead only as that hash (`[name withheld]`, no URL, in `leads.json`); + **Archive** creates the channel through `create-channel` **on no site** (X never on a site; a site is the + operator's) and starts its first fetch, then **Older walk** is `fetch-posts {older}`; **Watch** starts nothing. +- **Evidence**, `/research/<case>/evidence` (`evidence.json`): **Wayback captures at chosen dates** for a list of + pages — **Look up** is `wayback-lookup` (a 403 is the row **excluded from the Wayback Machine (cause unknown)**), + **Capture** is `import-page {slug, url, at}` into a Wayback pages channel (picked, or a new one on no site); **A forum + post's attachments and screenshot** through `capture-posts`, labelled **forum attachment, post #N, unverified** on + the row, its thumbnails, the finding it is attached to and the export. A queued row is asked again every 1.5 s. + **Attach to a finding** records it on both sides (`FindingRow.evidence`). +- The case export's **Evidence** and **Quarantined** sections are `renderEvidenceSection` / + `renderQuarantinedSection` (`lib/research/case-evidence.ts`). + ## Agent runs, `/research/runs` and `/research/runs/<article>/<n>` `/research/runs` lists every sweep iteration of the article store, newest first. A run page shows what a sweep did, @@ -107,5 +140,5 @@ Held counts are kept 5 minutes per channel ("Held counts from 3 min ago (kept 5 ## Routes `/api/research/{sources,scope,search,window,coverage,log,media,fetch}`, `/api/research/cases[/<id>[/quotes[/<qid>] -|/verify|/export.md|/handoff]]`, `/api/research/runs/<article>/<n>[/board]` — JSON, `no-store`, errors in words (400 bad +|/verify|/export.md|/handoff|/stages/{verify[/captions|/audio],leads[/context|/older],evidence}]]`, `/api/research/runs/<article>/<n>[/board]` — JSON, `no-store`, errors in words (400 bad input, 404 nothing there, 409 an unreadable file, 502 a source that cannot be read). diff --git a/umtool/e2e/case-stages.spec.ts b/umtool/e2e/case-stages.spec.ts @@ -0,0 +1,208 @@ +import { test, expect, type Page } from "@playwright/test"; +import { mkdirSync, readFileSync } from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import { EXCLUDED_URL, FORUM, PAGES, PRIVATE_NAME, STAGES_CASE, TARGET_URL, nameHash } from "./fixtures/case-stages-fixture.mjs"; +import { EN_REWRITE } from "./fixtures/research-fixture.mjs"; +import { caseStageHref } from "../lib/research/case-stage-hrefs"; +import { researchCaseHref } from "../lib/research/hrefs"; +import { WARM_TIMEOUT, warm } from "./warm"; + +// --------------------------------------------------------------------------- +// A research case's lane C stages (release 38) on the fixture case +// `fixture-pipeline` (e2e/fixtures/case-stages-fixture.mjs) and the stub +// editor (editor-stub-case-stages.mjs): verify (both tracks side by side, a +// correction that keeps the reader's words, the audio check while paused, a +// forum finding quarantined), leads (counts, never-archive as a hash, archive +// on no site) and evidence (an excluded target, a capture, a forum attachment +// marked unverified everywhere). In order: each test builds on the last. +// --------------------------------------------------------------------------- + +const HERE = path.dirname(fileURLToPath(import.meta.url)); +const FIXTURE = path.join(HERE, "..", ".e2e-song"); +const CASE_DIR = path.join(FIXTURE, ".umtool", "research", STAGES_CASE); +const read = (name: string) => readFileSync(path.join(CASE_DIR, name), "utf8"); +const findings = () => + read("findings.jsonl") + .trim() + .split("\n") + .map((l) => JSON.parse(l)); +const asked = (): { path: string; body: Record<string, unknown> }[] => { + try { + return JSON.parse(readFileSync(path.join(FIXTURE, "editor-stub.requests.json"), "utf8")); + } catch { + return []; + } +}; + +// Screenshots for the review, when asked for (E2E_CASE_STAGES_SHOTS=<dir>). +const SHOTS = process.env.E2E_CASE_STAGES_SHOTS ?? ""; +async function shot(page: Page, name: string) { + if (!SHOTS) return; + mkdirSync(SHOTS, { recursive: true }); + await page.screenshot({ path: path.join(SHOTS, `${name}.png`), fullPage: true }); +} + +test.describe.configure({ mode: "serial" }); + +test.beforeAll(async ({ playwright }) => { + test.setTimeout(WARM_TIMEOUT); + await warm(playwright, [caseStageHref(STAGES_CASE, "verify"), caseStageHref(STAGES_CASE, "leads"), caseStageHref(STAGES_CASE, "evidence")]); +}); + +test("the board links its stages; verify shows both tracks side by side, and a correction keeps the reader's words", async ({ page }) => { + await page.setViewportSize({ width: 1440, height: 1000 }); + await page.goto(researchCaseHref(STAGES_CASE)); + const nav = page.getByRole("navigation", { name: "Case stages" }); + await expect(nav.getByRole("link", { name: "Board" })).toHaveAttribute("aria-current", "page"); + await nav.getByRole("link", { name: "Verify" }).click(); + await expect(page).toHaveURL(new RegExp(`${caseStageHref(STAGES_CASE, "verify")}$`)); + + const list = page.getByRole("complementary", { name: "Findings" }); + await expect(list.locator("[data-finding]")).toHaveCount(3); + await expect(list.locator('[data-finding="f3"]')).toContainText("forum"); + const detail = page.locator('[data-verify-detail="f1"]'); + await expect(detail.locator("[data-quote]")).toContainText(EN_REWRITE.en); + const orig = detail.locator('[data-track="en-orig"]'); + const en = detail.locator('[data-track="en"]'); + await expect(orig).toContainText("original audio captions"); + await expect(orig).toContainText(EN_REWRITE.orig); + await expect(en).toContainText(EN_REWRITE.en); + await expect(en.locator("[data-lit]")).toHaveText([EN_REWRITE.en]); + await expect(en.locator("[data-track-holds]")).toHaveText("holds the quote"); + await expect(orig.locator("[data-track-holds]")).toHaveText("4 of 5 words"); + + await detail.getByLabel("Quote (verbatim)").fill(EN_REWRITE.orig); + await detail.getByLabel("Note").fill("en-orig says called in; the en track rewrote it"); + await detail.getByRole("button", { name: "Save as corrected" }).click(); + await expect(list.locator('[data-finding="f1"]')).toHaveAttribute("data-status", "corrected"); + await expect(detail.locator("[data-original]")).toHaveText(`The reader wrote: “${EN_REWRITE.en}” (host)`); + await expect(detail.locator("[data-quote]")).toContainText(EN_REWRITE.orig); + await expect(orig.locator("[data-track-holds]")).toHaveText("holds the quote"); + const f1 = findings().find((r) => r.row === "f1"); + expect(f1.quote).toBe(EN_REWRITE.orig); + expect(f1.verify).toMatchObject({ status: "corrected", how: "hand", original: { quote: EN_REWRITE.en, speaker: "host" } }); + await shot(page, "verify-corrected"); + + // A private name in a hand-written note is refused, and the refusal never names it. + await detail.getByLabel("Note").fill(`checked with ${PRIVATE_NAME}`); + await detail.getByRole("button", { name: "Save status" }).click(); + await expect(detail.getByRole("alert")).toContainText("match the case's private names"); + await expect(detail.getByRole("alert")).not.toContainText(PRIVATE_NAME); +}); + +test("the audio check transcribes the window through the editor, while paused, and the finding is verified by ear", async ({ page }) => { + await page.setViewportSize({ width: 1440, height: 1000 }); + await page.goto(caseStageHref(STAGES_CASE, "verify")); + const list = page.getByRole("complementary", { name: "Findings" }); + await list.locator('[data-finding="f2"]').click(); + const detail = page.locator('[data-verify-detail="f2"]'); + await detail.getByLabel("Run even while transcription is paused").check(); + const before = asked().length; + await detail.getByRole("button", { name: "Audio check" }).click(); + await expect(detail.locator("[data-audio-heard]")).toHaveText("Heard 9 of 9 words", { timeout: 15_000 }); + await expect(detail.locator("[data-audio-diff] [data-diff=same]")).toHaveCount(9); + const req = asked().slice(before).find((r) => r.path === "/api/ops/transcribe"); + expect(req?.body).toMatchObject({ start: 2039, end: 2074, whilePaused: true }); + expect(String(req?.body.path)).toMatch(/harbor-radio\/data\/hr-2022a\/audio\.m4a$/); + await detail.getByRole("group", { name: "Verify status" }).getByRole("button", { name: "Verified" }).click(); + await detail.getByRole("button", { name: "Save status" }).click(); + await expect(list.locator('[data-finding="f2"]')).toHaveAttribute("data-status", "verified"); + expect(findings().find((r) => r.row === "f2").verify).toMatchObject({ status: "verified", how: "audio", audio: { matched: 9, words: 9 } }); + + // The forum finding: the hint, then quarantined. + await list.locator('[data-finding="f3"]').click(); + const f3 = page.locator('[data-verify-detail="f3"]'); + await expect(f3.locator("[data-forum-hint]")).toContainText("First seen on a forum"); + await expect(f3.locator('[data-track="post"]')).toContainText("forum post #3 by deckhand"); + await f3.getByRole("group", { name: "Verify status" }).getByRole("button", { name: "Quarantined" }).click(); + await f3.getByRole("button", { name: "Save status" }).click(); + await expect(list.locator('[data-finding="f3"]')).toHaveAttribute("data-status", "quarantined"); + await expect(f3.locator("[data-forum-hint]")).toHaveCount(0); +}); + +test("leads: counted by post, a private name withheld; never-archive feeds a hash; archive creates on no site", async ({ page }) => { + await page.setViewportSize({ width: 1440, height: 1000 }); + await page.goto(caseStageHref(STAGES_CASE, "leads")); + await expect(page.getByLabel("Posts or forum channel")).toHaveValue(FORUM); + await expect(page.locator("[data-leads-summary]")).toContainText("7 posts read · 5 leads"); + await expect(page.locator("[data-withheld-count]")).toHaveText("1 withheld (the case's private names)"); + const table = page.getByRole("table", { name: "Leads" }); + await expect(table.locator("[data-lead]")).toHaveCount(5); + await expect(table.locator('[data-lead="x:@harborwatch"] td').nth(2)).toHaveText("3"); + await expect(table.locator('[data-lead="x:@tidewatcher"] td').nth(2)).toHaveText("2"); + await expect(page.locator("body")).not.toContainText(PRIVATE_NAME); + + // Context on demand. + await table.locator('[data-lead="x:@harborwatch"]').getByRole("button", { name: "Context" }).click(); + await expect(table.locator('[data-lead-context="x:@harborwatch"] li')).toHaveCount(3); + + // A role, then never-archive: withheld, its name a hash in the case's private names. + await table.getByLabel("Role of x:@tidewatcher").fill("the account the forum blames"); + await table.getByLabel("Role of x:@tidewatcher").blur(); + await expect.poll(() => read("leads.json")).toContain("the account the forum blames"); + await table.getByLabel("Disposition of x:@tidewatcher").selectOption("never-archive"); + await expect(page.locator('p[role="status"]')).toContainText("kept as a hash"); + await expect(table.locator('[data-lead="x:@tidewatcher"]')).toHaveCount(0); + await expect(table.locator("[data-lead-withheld]")).toHaveCount(1); + await expect(table.locator("[data-lead-withheld]")).toContainText("[name withheld]"); + await expect(table.locator("[data-lead-withheld]")).toContainText("the account the forum blames"); + const pipeline = JSON.parse(read("pipeline.json")); + expect(pipeline.privateNames.sha256).toContain(nameHash("TideWatcher")); + expect(read("leads.json").toLowerCase()).not.toContain("tidewatcher"); + await expect(page.locator("[data-withheld-count]")).toHaveText("2 withheld (the case's private names)"); + + // Archive: the channel created through the editor, on no site, its first fetch started. + await table.getByLabel("Disposition of x:@harborwatch").selectOption("archive"); + await expect(table.locator('[data-lead="x:@harborwatch"] [data-lead-channel]')).toBeVisible(); + const create = asked().filter((r) => r.path === "/api/ops/create-channel").at(-1); + expect(create?.body).toMatchObject({ fields: { url: "https://x.com/HarborWatch" }, fetchPostsNow: true }); + expect(create && "sites" in create.body).toBe(false); + await table.getByLabel("Disposition of youtube:@harborradio").selectOption("watch"); + await expect(table.locator('[data-lead="youtube:@harborradio"]')).toHaveAttribute("data-disposition", "watch"); + await shot(page, "leads-dispositions"); +}); + +test("evidence: an excluded target, a capture at a date, a forum attachment marked unverified, attached to a finding", async ({ page }) => { + await page.setViewportSize({ width: 1440, height: 1000 }); + await page.goto(caseStageHref(STAGES_CASE, "evidence")); + const targets = page.getByRole("form", { name: "Wayback targets" }); + await targets.getByLabel("Pages, one per line").fill(`${EXCLUDED_URL}\n${TARGET_URL}`); + await targets.getByLabel(/^Dates/).fill("2014-03-04"); + await targets.getByRole("button", { name: "Add targets" }).click(); + const table = page.getByRole("table", { name: "Captures" }); + await expect(table.locator("[data-evidence]")).toHaveCount(2); + + const gone = table.locator('[data-evidence="e1"]'); + await gone.getByRole("button", { name: "Look up" }).click(); + await expect(gone).toHaveAttribute("data-state", "excluded"); + await expect(gone.locator("[data-evidence-label]")).toHaveText("excluded from the Wayback Machine (cause unknown)"); + + const page2 = table.locator('[data-evidence="e2"]'); + await page2.getByLabel("Capture e2 into").selectOption(PAGES); + await page2.getByRole("button", { name: "Capture" }).click(); + await expect(page2).toHaveAttribute("data-state", "captured", { timeout: 15_000 }); + await expect(page2.locator("[data-evidence-label]")).toHaveText("Wayback capture, 2014-03-04"); + const imp = asked().filter((r) => r.path === "/api/ops/import-page").at(-1); + expect(imp?.body).toEqual({ slug: PAGES, url: TARGET_URL, at: "20140304" }); + + const forum = page.getByRole("form", { name: "Forum attachment" }); + await forum.getByLabel("Forum channel").selectOption(FORUM); + await forum.getByLabel("Post id").fill("70003"); + await forum.getByRole("button", { name: "Capture the post" }).click(); + const att = table.locator('[data-kind="forum-attachment"]'); + await expect(att).toHaveAttribute("data-state", "captured", { timeout: 15_000 }); + await expect(att.locator("[data-evidence-label]")).toHaveText("forum attachment, post #3, unverified"); + await expect(att.locator("img")).toHaveCount(2); + await expect(att.locator("img").first()).toHaveAttribute("alt", /forum attachment, post #3, unverified/); + await att.getByLabel(/^Attach e3 to a finding/).selectOption("f3"); + await expect(att.locator("td").last()).toContainText("f3"); + expect(findings().find((r) => r.row === "f3").evidence).toEqual([ + { kind: "forum-attachment", url: expect.stringContaining("post-70003"), evidence: "e3", post: "70003", position: 3 }, + ]); + await shot(page, "evidence-captures"); + + // The finding says it everywhere it shows. + await page.goto(caseStageHref(STAGES_CASE, "verify")); + await expect(page.locator('[data-finding="f3"] [data-evidence-label]')).toHaveText("forum attachment, post #3, unverified"); +}); diff --git a/umtool/playwright.config.ts b/umtool/playwright.config.ts @@ -45,6 +45,9 @@ import { portFor } from "yt-dlp-transcript-common/lib/ports.mjs"; // E2E_UMTOOL_OPEN_FOLDER_LOG set below on the app server: where the clip // export's Open folder records what it was asked to // show, in place of a file manager (lib/report/openFolder.mjs) +// E2E_CASE_STAGES_SHOTS a directory, set by whoever runs the suite: the +// research case stages' screenshots go there +// (case-stages.spec.ts, release 38 lane C) // The ports are common/lib/ports.mjs's (offset per worktree by // scripts/worktree.mjs), not test-only, and keep their names. const PORT = portFor("UMTOOL_E2E_PORT");