Archilyzer · Source

archilyzer

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

commit d58d3a78fd81c1e25454f1f6c096ac41eb6ce1e5
parent df7873ac2bf686342be2b1302c372a24a5d5fd13
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Mon,  2 Nov 2026 04:46:36 -0500

research cases: the export's refusal names the rows; the docs, the changelog, the env table

The export now runs the gate over the merged rows, the summary and the title before it
builds the markdown, so a refusal names the finding (`(f3)`), not `REPORT.md`; the
markdown is still checked as a whole when it is written. umtool/docs/research.md gains the
pipeline page; editor/CHANGELOG.md an [Unreleased] bullet; ENVIRONMENT.md names
`archilyzer case` among REPORTS_DIR's and SONG_REPORTS_DIR's readers.

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

Diffstat:
MENVIRONMENT.md | 4++--
Mcommon/bin/case.test.ts | 2+-
Mcommon/controller/casePipelineRun.ts | 16+++++++++++++++-
Mcommon/lib/envVars.ts | 4++--
Meditor/CHANGELOG.md | 1+
Mumtool/docs/research.md | 37++++++++++++++++++++++++++++++++++++-
Mumtool/e2e/case-pipeline.spec.ts | 3++-
7 files changed, 59 insertions(+), 8 deletions(-)

diff --git a/ENVIRONMENT.md b/ENVIRONMENT.md @@ -91,8 +91,8 @@ Tokens, credentials and knobs a running process reads. Most configuration is not | `NITTER_INSTANCES` | a built-in list | Comma-separated Nitter instances for the X fallback fetcher, in order of preference. | common/social/xNitterFetcher.ts | | `ARCHILYZER_X_BROWSER` | the first of `chromium`, `google-chrome`, `google-chrome-stable`, `chrome` on PATH, else Playwright's bundled Chromium | The Chromium-family browser /settings' "Connect X account" opens (a path, or a name looked up on PATH), and a forum-thread channel's "Connect forum session" too. It is launched without the automation signals, in the X session profile (or the forum host's profile); a value that is not an executable refuses the connect rather than opening another browser. | common/social/xBrowser.ts | | `UMTOOL_MEDIA_DIR` | unset (no media root: a project link's target is kept) | umtool's media root, where a tiered project's `out/` (and its deliverables) are linked to. Read by `archilyzer reports delete` and the editor's `delete-article` / `delete-iteration` too: an iteration project's link that is exactly its mirror there is removed with its target. Its other uses are documented in [umtool/docs](umtool/docs/README.md). | common/lib/report/delete.ts, umtool (lib/paths.mjs) | -| `REPORTS_DIR` | `~/reports` (or the parent of `SONG_REPORTS_DIR`) | umtool's reports root, the tree its projects hang off; with `UMTOOL_MEDIA_DIR`, it says where a project's media mirror is (`<media>/<path relative to it>`) for a delete. | common/lib/report/delete.ts, umtool (lib/paths.mjs) | -| `SONG_REPORTS_DIR` | unset | umtool's um-song deliverables tree; when `REPORTS_DIR` is unset, its parent is the reports root a delete reads (as umtool does). | common/lib/report/delete.ts, umtool (song/paths.mjs) | +| `REPORTS_DIR` | `~/reports` (or the parent of `SONG_REPORTS_DIR`) | umtool's reports root, the tree its projects hang off; with `UMTOOL_MEDIA_DIR`, it says where a project's media mirror is (`<media>/<path relative to it>`) for a delete. | common/lib/report/delete.ts, common/bin/case.ts, umtool (lib/paths.mjs) | +| `SONG_REPORTS_DIR` | unset | umtool's um-song deliverables tree; when `REPORTS_DIR` is unset, its parent is the reports root a delete and `archilyzer case` read (as umtool does). | common/lib/report/delete.ts, common/bin/case.ts, umtool (song/paths.mjs) | | `UMTOOL_URL` | unset (no link; the MCP's `notes` off) | umtool's front door; when set, the video page links to it, its Find clips hands the recording to umtool's clip finder (the `find-clips` job posts to `/api/report/clips` with WORKER_TOKEN), and the MCP's `notes` tool reads the operator's notes there and writes a reply as the agent's (e.g. `http://localhost:3050`). Unset: Find clips is disabled. | editor/app/channels/[slug]/videos/[id]/page.tsx, common/lib/umtoolUrl.ts, mcp/src/archivalTools.ts | | `TRANSCRIPT_SITE_URL` | — | MCP server: one published archive to read over HTTP. | mcp/src/sources.ts | | `TRANSCRIPT_HUB_URL` | — | MCP server: a hub, federating every archive it lists. | mcp/src/sources.ts | diff --git a/common/bin/case.test.ts b/common/bin/case.test.ts @@ -91,7 +91,7 @@ test("a case through the CLI: define → coverage → candidates → batches → const blocked = await quiet(() => main("export", ["wren"], flags, { paths })); assert.equal(blocked.value, 1); - assert.match(blocked.err, /the privacy gate blocked the export: \d+ private-name hits? in 1 item \(REPORT\.md\)/); + assert.match(blocked.err, /the privacy gate blocked the export: \d+ private-name hits? in 1 item \(f2\)/); assert.doesNotMatch(blocked.err + blocked.out, /Ottoline|Brackenridge/i); assert.ok(!(await readdir(caseDir)).includes("REPORT.md")); const stages = JSON.parse(await readFile(path.join(caseDir, "stages.json"), "utf8")); diff --git a/common/controller/casePipelineRun.ts b/common/controller/casePipelineRun.ts @@ -22,6 +22,7 @@ import { mergeFindings, reportHtml, reportMarkdown, + rowGateText, type MergeResult, type ScanOptions, } from "../lib/research/casePipeline"; @@ -40,10 +41,13 @@ import { writeDateChecks, writeReport, } from "../lib/research/caseStore-server"; +import { assertNoPrivateNames } from "../lib/research/casePrivacy-server"; import { caseCandidates, caseChannels, caseCoverage, subjectUploads } from "./caseCorpus"; type By = CaseStageRun["by"]; +const plural = (n: number, w: string) => `${n} ${w}${n === 1 ? "" : "s"}`; + async function definitionOf(dir: string, caseId: string): Promise<CaseDefinition> { const def = await readDefinition(dir, caseId); if (!def) throw new CasePipelineError(`case ${caseId} has no pipeline yet: define its subjects, eras and groups first`, 409); @@ -131,7 +135,7 @@ async function coverageLine(dir: string, def: CaseDefinition, paths: Paths | nul return [ `Scope: ${channels.length} ${channels.length === 1 ? "channel" : "channels"}${channels.length && channels.length <= 12 ? ` (${channels.join(", ")})` : ""}${eras ? `; eras ${eras}` : ""}.`, counts - ? `Candidates: ${counts.windows} windows in ${counts.videos} recordings, ${counts.scanned.withText} recordings with words read for them and ${counts.scanned.noText} in an era with no transcript yet; the noise filters dropped ${counts.noise.noSubject + counts.noise.noGroup + counts.noise.capped} windows and ${counts.noise.notStrict} hits.` + ? `Candidates: ${counts.windows} windows in ${counts.videos} recordings, ${counts.scanned.withText} recordings with words read for them and ${counts.scanned.noText} in an era with no transcript yet; the noise filters dropped ${plural(counts.noise.noSubject + counts.noise.noGroup + counts.noise.capped, "window")} and ${plural(counts.noise.notStrict, "hit")}.` : "No candidate scan is recorded.", `Batches: ${batches.length}, ${read} read.`, ].join(" "); @@ -144,6 +148,16 @@ export async function runExport(dir: string, caseId: string, title: string, by: const merged = await mergeView(dir, caseId, o); if (merged.invalid.length) log(`${merged.invalid.length} findings ${merged.invalid.length === 1 ? "line does" : "lines do"} not check (lines ${merged.invalid.map((x) => x.line).join(", ")}): left out`); const summary = await readSummary(dir); + // The gate names the rows first (counts and row ids); the whole markdown is checked again as it is written. + assertNoPrivateNames( + "the export", + [ + ...[...merged.sections.flatMap((x) => x.rows), ...merged.quarantined].map((r) => ({ id: r.row, text: rowGateText(r) })), + { id: "summary", text: summary?.text ?? "" }, + { id: "title", text: title }, + ], + def.privateNames.sha256, + ); const markdown = reportMarkdown({ title, summary, merged, coverage: await coverageLine(dir, def, o.paths ?? null) }); await writeReport(dir, markdown, reportHtml(markdown), def.privateNames.sha256); const shown = merged.sections.reduce((n, s) => n + s.rows.length, 0); diff --git a/common/lib/envVars.ts b/common/lib/envVars.ts @@ -127,8 +127,8 @@ const DECLARED: EnvVarDecl[] = [ { name: "NITTER_INSTANCES", audience: "runtime", default: "a built-in list", readBy: "common/social/xNitterFetcher.ts", doc: "Comma-separated Nitter instances for the X fallback fetcher, in order of preference." }, { name: "ARCHILYZER_X_BROWSER", audience: "runtime", default: "the first of `chromium`, `google-chrome`, `google-chrome-stable`, `chrome` on PATH, else Playwright's bundled Chromium", readBy: "common/social/xBrowser.ts", doc: "The Chromium-family browser /settings' \"Connect X account\" opens (a path, or a name looked up on PATH), and a forum-thread channel's \"Connect forum session\" too. It is launched without the automation signals, in the X session profile (or the forum host's profile); a value that is not an executable refuses the connect rather than opening another browser." }, { name: "UMTOOL_MEDIA_DIR", audience: "runtime", default: "unset (no media root: a project link's target is kept)", readBy: "common/lib/report/delete.ts, umtool (lib/paths.mjs)", doc: "umtool's media root, where a tiered project's `out/` (and its deliverables) are linked to. Read by `archilyzer reports delete` and the editor's `delete-article` / `delete-iteration` too: an iteration project's link that is exactly its mirror there is removed with its target. Its other uses are documented in [umtool/docs](umtool/docs/README.md)." }, - { name: "REPORTS_DIR", audience: "runtime", default: "`~/reports` (or the parent of `SONG_REPORTS_DIR`)", readBy: "common/lib/report/delete.ts, umtool (lib/paths.mjs)", doc: "umtool's reports root, the tree its projects hang off; with `UMTOOL_MEDIA_DIR`, it says where a project's media mirror is (`<media>/<path relative to it>`) for a delete." }, - { name: "SONG_REPORTS_DIR", audience: "runtime", default: "unset", readBy: "common/lib/report/delete.ts, umtool (song/paths.mjs)", doc: "umtool's um-song deliverables tree; when `REPORTS_DIR` is unset, its parent is the reports root a delete reads (as umtool does)." }, + { name: "REPORTS_DIR", audience: "runtime", default: "`~/reports` (or the parent of `SONG_REPORTS_DIR`)", readBy: "common/lib/report/delete.ts, common/bin/case.ts, umtool (lib/paths.mjs)", doc: "umtool's reports root, the tree its projects hang off; with `UMTOOL_MEDIA_DIR`, it says where a project's media mirror is (`<media>/<path relative to it>`) for a delete." }, + { name: "SONG_REPORTS_DIR", audience: "runtime", default: "unset", readBy: "common/lib/report/delete.ts, common/bin/case.ts, umtool (song/paths.mjs)", doc: "umtool's um-song deliverables tree; when `REPORTS_DIR` is unset, its parent is the reports root a delete and `archilyzer case` read (as umtool does)." }, { name: "UMTOOL_URL", audience: "runtime", default: "unset (no link; the MCP's `notes` off)", readBy: "editor/app/channels/[slug]/videos/[id]/page.tsx, common/lib/umtoolUrl.ts, mcp/src/archivalTools.ts", doc: "umtool's front door; when set, the video page links to it, its Find clips hands the recording to umtool's clip finder (the `find-clips` job posts to `/api/report/clips` with WORKER_TOKEN), and the MCP's `notes` tool reads the operator's notes there and writes a reply as the agent's (e.g. `http://localhost:3050`). Unset: Find clips is disabled." }, { name: "TRANSCRIPT_SITE_URL", audience: "runtime", default: "—", readBy: "mcp/src/sources.ts", doc: "MCP server: one published archive to read over HTTP." }, { name: "TRANSCRIPT_HUB_URL", audience: "runtime", default: "—", readBy: "mcp/src/sources.ts", doc: "MCP server: a hub, federating every archive it lists." }, diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## [Unreleased] +- **A research case runs as a pipeline beside its board.** What a Claude Code session did on a case by hand is now stages on umtool's `/research/<case>/pipeline` and in `archilyzer case <verb> <case>`: the case's definition (subjects and their own channels, scope, eras with term families, reader groups, prompts, key dates); coverage per channel × year (listed, held, transcribed, untranscribed audio; key years marked) with each gap's button asking the editor's own `download-missing`, `transcribe-bucket`, `persist-videos` or `channel-priority` focus, plan first; candidate windows off the live corpus (en-orig before en, families per era, ±W s windows, title hits, noise filters, counts before any read); batches per reader group as wrapped text (no line over 200 characters); finding rows by hand; the merge (one finding per recording within 20 s), a summary, `REPORT.md`/`.html`, a hand-off that pins the findings to the board; and date checks ("no response found in captioned uploads through <date>"). A case's private names are stored only as sha256 (typed on the page they are hashed in the browser; on the CLI they come on stdin), withheld from the candidates and batches the case stores, and the privacy gate blocks any finding, summary, export or hand-off — the board's own included — that names one, saying counts and row ids, never the name. The reading stage (a candidate deck, `case-read`) is the next lane's. Needs a restart of umtool. - **X has a cookie banner like Rumble's, and says how fresh its jar is.** X's banner used to go up only when X answered a fetch with a challenge, so an X fetch on an old jar was simply refused with a sentence the operator saw only in a job's error. Now the fresh-jar rule's refusal (`social.x.maxCookieAgeMinutes`, an hour by default) puts an **X needs fresh cookies** banner on the dashboard — "press Refresh cookies (or Connect X account) on /settings — with the browser login, open x.com in firefox" — with the jar's age under it, read from disk: the exported jar's time, or, with the browser login, when Firefox last sent its x.com `auth_token` (read by the cookie's name from a private copy of Firefox's cookie store; its value is never read). An X fetch refused at its start is offered under **Re-run stopped jobs** once the jar is fresh. Recheck re-reads the age and asks X nothing; the banner clears by itself as soon as an X job passes the rule on a fresh jar. This banner does not itself refuse X jobs (the rule does); a real challenge or login failure from X replaces it with the one that does. gallery-dl's own words are now read more carefully: its "AuthRequired: authenticated cookies needed to access this timeline" (what X answers a logged-out timeline with), "Could not authenticate you", a 401 and an API 403 count as a **login failure** (worded so on the banner and in the refusal), a 429 or "rate limit" is pacing and never raises the banner, and a protected or blocking account, an NSFW or protected tweet and a 403 on a twimg.com media file are about that one account or file — those used to raise X's banner and stop every X job. `pnpm ops get services` now always carries `x` (the jar's source, age, limit and whether an X job could start on it). Needs a restart of the editor. - **Rumble's cookies are checked on a timer, so the banner goes up before a sync fails.** Until now a stale Cloudflare clearance was noticed only when a Rumble sync or clip fetch failed on it. Every 3 hours (stretched a little at random, never shortened) the editor now looks by itself: when Rumble has been idle that long, it asks Rumble once for the last video it answered cleanly — a refusal is checked once more on the previous, different video a minute or more later, because a removed video refuses too, and two different videos refused put the banner up; every banner already up is rechecked once, as its Recheck button does, so it clears by itself after rumble.com was opened in Firefox; and X's jar age is re-read from disk (X jobs queued on an old jar put X's banner up before their start refuses them). Nothing is asked while a job is queued or running on Rumble's queues (its answer is the check), while Rumble is cooling down or held, or while a recheck runs, and a failed check is never retried — it waits for the next tick or a click. Each check is a **Recheck service cookies** job on /jobs. `settings.serviceCookies.recheckIntervalMinutes` (180; 30–1440; 0 turns it off) and `probeServices` (`["rumble"]`; YouTube and Odysee may be added), set with `pnpm ops settings --json '{"patch":{"serviceCookies":{"recheckIntervalMinutes":0}}}'`; `pnpm ops get services` shows the timer's last tick under `timer`. Not on an idle boot. Needs a restart of the editor. - **A channel can download only the videos you add.** The operator wanted Harmful Opinions downloaded by hand, with its title filter gone, and nothing said that: `syncIntervalMinutes: 0` stops the listing but the download lane still works the backlog it has — and dropping a filter re-decides every video it had settled, so the whole channel would come down — while a `paused` tier stops every lane, transcription too. Configure → Advanced → **Downloads**: Manual (`downloadMode: "manual"` in config.json; `pnpm ops channel-config --json '{"slug":"<slug>","patch":{"downloadMode":"manual"}}'`, `""` sets it back to Automatic). On a manual channel the download lane skips the channel (its backlog, retries, metadata scan and chat backlog); a sync reads only the newest page of the listing and a full sweep still refreshes the playlist and the maybe-missing set, and neither downloads the new uploads it finds; Download from playlist, Download videos (`download-missing`) and the bucket retries refuse with a notice. What you ask for still downloads — Import, `import-video`, the video page's download and persist buttons, `persist-videos`, clip windows, a whole-recording fetch — and the videos on disk are still transcribed. The channel's report keeps the listed videos it lacks as **Listed, not requested** (`manualNotRequestedIds`) rather than undownloaded work, so no lane, rack figure, dashboard count or group Download button counts them, and a video that leaves the listing unfetched is not raised as never fetched; the channel page says "Manual downloads — only videos you add are downloaded" at the top and the rack row carries a **manual dl** chip. An import still passes the channel's download filter, so set the mode first and then clear the filter. Needs a restart of the editor. diff --git a/umtool/docs/research.md b/umtool/docs/research.md @@ -76,6 +76,41 @@ claim line and note on each. Create's **From a board** lines open the same plans. +## A case's pipeline, `/research/<case>/pipeline` (release 38) + +Beside the board (its side panel's **Open the case pipeline**): the research a Claude Code session did on a case, as +stages, each with its manual path and its buttons. The stages are common's (`controller/casePipelineRun.ts`), so +`archilyzer case <verb> <case>` (COMMANDS.md) runs the same ones from a shell, and `stages.json` shows either's run to +the other. The files sit beside `case.json`, never in it (`common/lib/research/caseTypes.ts` `CASE_FILES`). + +- **Define** — `pipeline.json`: subjects (and their own channels), scope (channels, `<site>:<group>` groups, sites), + eras with term families (regex, flags `iu`; `strictFamilies` for a subject's own late material), reader groups (a + list of slugs, `"subject"` or `"coverage"`; an era), reader prompts, key dates. Edited as JSON, checked whole. +- **Private names** — typed into a password field, hashed in the browser, and only the sha256 is posted and stored + (`privateNames.sha256`). The page shows a count. Once a name is in, it is withheld (`[name withheld]`) from the + candidates and batches the case stores, so no file of the case holds it. +- **1 Coverage** — per channel × year: listed, held, transcribed, untranscribed audio; key years (an era touches them) + marked. Each channel's gap buttons ask the editor's own ops, plan first: **Download missing** (`download-missing`), + **Transcribe** (`transcribe-bucket`), **Persist the key period** (`persist-videos`, its plan the dryRun), and **Focus + the case** (`channel-priority` focus: the case's first site, else its channels). +- **2 Candidates** — the scope's held recordings dated in an era, read through the caption-track rule (en-orig before + en), each era's families matched, ±W s windows merged, title hits, the noise filters (a coverage window must name a + subject; strict families on a subject's own channel), counted per family, year, channel and group before any read. +- **3 Batches** — per reader group under a character budget, written as wrapped text (no line over 200). A batch a + reader has begun is kept; new windows make the next round. **Read the text** shows one. +- **4 Read** — lane B's deck and `case-read` readers come next; until then the reader prompts (the naming rule always + in them) and a box for finding rows as JSON lines. +- **5 Merge** — the same recording within 20 s is one finding (higher relevance, then later round); sections by + group; relevance 2 and up; the quarantined in their own section. The **Summary** is a person's (or a model's, marked + a draft). +- **6 Privacy gate** — every write of findings, the summary, the export and a hand-off is checked against the + hashes; a hit blocks it and names the rows, never the name. The board's own export and hand-offs are gated by the + same names. +- **Export and hand-off** — `REPORT.md` (the house format) and `REPORT.html`; **Hand off to the board** pins the merged + findings to the board, one section per reader group, and the board's hand-offs take it from there. +- **9 Date checks** — the subject's uploads around each key date and the latest after it, captioned or not, and the + sentence ("no response found in captioned uploads through <date>", or the findings that are one). + ## 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 +142,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|/pipeline[/<op>]]]` (the pipeline's ops are listed in its route), `/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-pipeline.spec.ts b/umtool/e2e/case-pipeline.spec.ts @@ -162,9 +162,10 @@ test("a case through its pipeline: define, coverage, candidates, batches, findin await expect(status(page)).not.toContainText("Ottoline"); await shot(page, "05-privacy-gate", "privacy"); - // The export is blocked, naming REPORT.md's count, never the name; nothing is written. + // The export is blocked, naming the row, never the name; nothing is written. await page.getByRole("button", { name: "Export the report" }).click(); await expect(status(page)).toContainText("the privacy gate blocked the export"); + await expect(status(page)).toContainText("in 1 item (f3)"); await expect(stageState(page, "export")).toHaveAttribute("data-stage-state", "failed", STAGE); await expect(page.locator("#stage-export [data-stage-log]")).not.toContainText("Ottoline"); expect(readFileSync(path.join(CASE_DIR, "stages.json"), "utf8")).not.toMatch(/Ottoline|Brackenridge/i);