commit c31b6543294c1d33e38838ef1f7427fbb4414be1
parent 9797246edd012540de12b191d8cc78bc417ef37c
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 20 Oct 2026 16:05:32 -0400
forum: an empty page is loaded once more before the walk stops on it; the e2e seam is E2E_FORUM_FIXTURE_DIR, per slot; docs regenerated
Live: right after a browser check clears, the page standing is often not the thread page yet ("Page 2193/2606: 0
post(s) parsed"). The walk now reloads it once, paced, and stops only on a second empty read. The test seam follows
the suite's convention (E2E_-prefixed, named per slot in e2e/servers.ts and the playwright config header).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
15 files changed, 135 insertions(+), 38 deletions(-)
diff --git a/COMMANDS.md b/COMMANDS.md
@@ -65,7 +65,7 @@ Run from the repo root (in the container: `docker compose exec editor pnpm archi
| `archilyzer seed` | | the home seeder of last resort: seed the playable torrents of settings.seeder.sites, each only while no other seeder has it (standby otherwise, with hysteresis), TCP + WebRTC, no DHT; runs until interrupted — behind the VPN (docker compose profile `seeder`, docker-compose.seeder.yml) |
| `archilyzer tracker` | `[--host 127.0.0.1] [--port 8000]` | the self-hosted tracker (HTTP + WebSocket, no UDP) for the seeder's torrents only — any other infohash is refused; runs until interrupted |
| `archilyzer duplicates` | `[--threshold N] [--all-durations] [--blocking title\|duration\|both] [--near F] [--tolerance N] …` | on-demand duplicate detection (after index + stats) *(passthrough)* |
-| `archilyzer posts fetch` | `--slug <channel> [--full \| --older [--floor YYYY-MM-DD] [--from YYYY-MM-DD] [--force]] [--limit N] [--pages N]` | fetch a social channel's posts into its posts corpus (--older: walk back below the oldest archived post; --pages: a forum thread's latest N pages) *(passthrough)* |
+| `archilyzer posts fetch` | `--slug <channel> [--full \| --older [--floor YYYY-MM-DD] [--from YYYY-MM-DD] [--force]] [--limit N] [--pages N] [--retry-on-block \| --retry-minutes N --retry-tries M]` | fetch a social channel's posts into its posts corpus (--older: walk back below the oldest archived post; --pages: a forum thread's latest N pages — a run catches up, then continues the history where it stopped; --full: a forum thread's full re-walk; --retry-\*: wait out a challenge or refusal page and run again) *(passthrough)* |
| `archilyzer posts import-html` | `<slug> <file-or-dir>… [--dry-run]` | import forum thread pages saved from a browser ("Save page as", .html) into a forum-thread channel: new posts appended, edited ones updated, nothing fetched |
| `archilyzer posts check` | `--slug <channel> [--mode stale\|unchecked\|all] [--limit N]` | which archived posts were deleted at the source (a Wayback pages channel: each record's ORIGINAL URL, asked at its own site) *(passthrough)* |
| `archilyzer diarize backfill` | `[--dry-run] [--scope transcribed\|channel:<slug>\|video:<slug>/<id>] [--limit N] [--force] …` | diarize videos whose audio is still on disk *(passthrough)* |
@@ -125,7 +125,7 @@ Drives a running editor over HTTP (`/api/ops/*`, the same actions its pages run)
| `download-missing` | download-missing downloads every listed video the channel does not hold: {"slug"}. "ignoreArchive": true drops the download archive so listed videos it names are fetched again (recovery from a stale archive); "abortOnError": false carries on past a failure (default: stop at the first that is not one video's own). Paced on the platform's queue. "storedUrl": "fallback" \| "only" reads each video from the media URL its record stores when the page is rate-limited (or always), one file per 20 min; with one, a held platform's run goes ahead as "only". | |
| `retry-bucket` | retry-bucket runs one bucket of a channel's report as one job, past any lane hold: {"slug", "bucket"}. "ids": \[...\] runs only those videos, and every one must be in the bucket (a stray id is refused, named); a job run with ids is not replayable, as a checkbox selection in the UI is not. "corruptFullSource" downloads again: the kept file is set aside, and comes back if the download fails; malformed again, the longer decode stays. A record that stores an Odysee media URL is read from that URL (as "only") until 2 such downloads are on record, then from the page. "storedUrl": "fallback" \| "only" reads each from the media URL its record stores, as on download-missing (a held platform's retry runs as "only"). "corruptHeldAudio" (held audio the audio audit found damaged) is refetched the same way, with the audio check on; the new file is audited again. | `pnpm ops retry-bucket --json '{"slug":"demo-odysee","bucket":"corruptHeldAudio"}' --wait` |
| `transcribe-bucket` | transcribe-bucket transcribes a channel's "downloaded, not transcribed" bucket on the transcription queue, as the channel page's Transcribe button does: {"slug"}. "ids": \[...\] narrows it the same way as on retry-bucket. | |
-| `fetch-posts` | fetch-posts fetches a social channel's new posts: {"slug"}. "full": true re-walks the whole timeline; "older": true walks back from the oldest archived post through search (X; needs a login), saving its place for the next run, down to "floor": "YYYY-MM-DD" when given; "from": "YYYY-MM-DD" starts the walk afresh there, replacing its saved place (and a "complete") — for a gap above one surviving old post. "limit": N caps the posts one run reads; "pages": N caps the pages (a forum thread: its latest N pages). "full" and "older" together are refused. An older walk over an account that shows no posts (nothing archived, and the last timeline fetch read none) is refused unless "force": true. A drained fetch stops at its next resume point and the next run resumes. | |
+| `fetch-posts` | fetch-posts fetches a social channel's new posts: {"slug"}. "full": true re-walks the whole timeline; "older": true walks back from the oldest archived post through search (X; needs a login), saving its place for the next run, down to "floor": "YYYY-MM-DD" when given; "from": "YYYY-MM-DD" starts the walk afresh there, replacing its saved place (and a "complete") — for a gap above one surviving old post. "limit": N caps the posts one run reads; "pages": N caps the pages (a forum thread: its latest N pages). A forum thread keeps two positions: a run catches up from the last page, then continues the history where it stopped; "full": true is its full re-walk (every page, edits updated). "retryOnBlock": {"minutes": 30, "max": 12} (or true: the forum default in settings) waits out a challenge or refusal page and runs again, max tries in all. "full" and "older" together are refused. An older walk over an account that shows no posts (nothing archived, and the last timeline fetch read none) is refused unless "force": true. A drained fetch stops at its next resume point and the next run resumes. | |
| `capture-posts` | capture-posts captures archived posts of a social channel (X, forum, Bluesky): a screenshot of each through the connected X profile (a forum thread: its host's forum profile; Bluesky: a headless browser with no login on bsky.app, the shot cropped to the post), and its attached media through gallery-dl (a forum thread: the same profile; Bluesky: its images from the CDN), into the channel's posts-media/<id>/: {"slug", "ids": \[...\]}. Every id must be in the channel's posts archive. "shots": false or "media": false skips that half; posts already captured are skipped unless "force": true. A post that links to an X Article also gets the article (article.json, .md, .png and its images) unless "articles": false; both halves off with "articles": true reads only the articles. Paced like a post fetch, on its queue. | |
| `publish` | publish runs publish stages on the editor's publish queue, one at a time, under one run id: {"verb": …}. "index" updates the index; "build" builds "siteId"/"siteIds" (forced; the index first when stale; "runner": "docker" builds every site in containers; "allowMissingMedia": true lets a report citation with no prepared media through compose, local builds only); "deploy" ships their built bundles (production, "preview": "<branch>", or "to": "local"; "force" redeploys a bundle already shipped there); "hub" / "homepage" build them, {"deploy": true} deploys after; "now" is Publish now (the stale index, then each policy target); "stale" builds every stale site. The answer lists every job ({target, kind, jobId}) and --wait follows them all. A site never built is refused: "no build of <id> in <dir> — archilyzer publish build <id>". `get publish` is the status. | |
| `build-index`, `build-site`, `build-deploy`, `deploy-site`, `build-hub`, `deploy-hub`, `build-homepage`, `deploy-homepage` | build-index, build-site, build-deploy, deploy-site, build-hub, deploy-hub, build-homepage and deploy-homepage are publish's aliases, with their old bodies and answers ("skipData" is accepted and ignored). | `pnpm ops build-deploy --json '{"siteIds":["anilyzer","jeralyzer"]}' --wait`<br>`pnpm ops build-site --json '{"siteId":"anilyzer"}' --wait`<br>`pnpm ops deploy-site --json '{"siteId":"anilyzer","preview":"tags-exclude"}' --wait`<br>`pnpm ops build-hub --wait`<br>`pnpm ops build-hub --json '{"deploy":true}' --wait`<br>`pnpm ops deploy-hub --wait`<br>`pnpm ops build-homepage --json '{"deploy":true}' --wait`<br>`pnpm ops deploy-homepage --json '{"preview":"refresh"}' --wait` |
diff --git a/ENVIRONMENT.md b/ENVIRONMENT.md
@@ -215,6 +215,7 @@ Read only by a test harness, a fake binary or a test-mode branch. Never set one
| `E2E_WORKERS` | 1 | How many workers the editor suite runs, each with a server set of its own (editor, export dev server, Ollama stub) over its own data root (`editor/.e2e-workers/w<n>`): a number (up to 8), or `auto` — floor((MemAvailable − HEAVY_MIN_FREE_MB) / 1.5 GB), 1 to 3. Specs in `editor/e2e/serial.ts` run afterwards on one worker. | editor/playwright.config.ts (editor/e2e/servers.ts) |
| `E2E_SERIAL_LAST` | — | Set by the editor suite's runner for its workers: `1` when the run is whole (no spec file or filter on the command line), so the @serial project runs last; `0` for a focused run, where Playwright would run a teardown project whole. | editor/playwright.config.ts |
| `E2E_BUILD_CHECKED` | — | Set by a suite's config once it has checked the start-mode build's stamp, so a worker's second load of the config does not check again. | editor/playwright.config.ts, umtool/playwright.config.ts |
+| `E2E_FORUM_FIXTURE_DIR` | unset (the forum fetcher opens its headless browser) | A directory of SYNTHETIC saved thread pages (`<dir>/<threadId>/page-<N>.html`) the forum-thread fetcher reads in place of a browser, with no pause between pages. The editor's e2e server names one in each slot's test data (`test-transcripts/.forum-fixture`; `forum-resume.spec`), and nothing else sets it. | common/social/forumFixtureLoader.ts (the forum-thread fetcher) |
| `E2E_QUEUE` | on | `0` skips the machine-global e2e queue (the port check still runs). | scripts/queue-lock.mjs |
| `E2E_PORT_CHECK` | on | `0` skips the pre-run check that the suite's ports are free. | scripts/queue-lock.mjs |
| `E2E_QUEUE_TIMEOUT` | wait forever | Seconds to wait for the queue before giving up. | scripts/queue-lock.mjs |
diff --git a/SETTINGS.md b/SETTINGS.md
@@ -168,13 +168,14 @@ Default: `"when-required"`
## `social`
-Per-platform settings of the social posts. Today two keys, both X's, both chosen in the X account session section of /settings: where the X fetchers' login comes from (`social.x.cookieSource`) and where X posts may appear (`social.x.visibility`). See common/social/xCookieSource.ts.
+Per-platform settings of the social posts: X's two, both chosen in the X account session section of /settings — where the X fetchers' login comes from (`social.x.cookieSource`) and where X posts may appear (`social.x.visibility`) — and a forum thread's retry on a block (`social.xenforo.retryOnBlock`, set on a forum channel's page). See common/social/xCookieSource.ts.
#### `social`
| Key | Default | Description |
|---|---|---|
| `x` | `{}` | X / Twitter. See `social.x` below. |
+| `xenforo` | absent | Forum threads (XenForo). See `social.xenforo` below. Absent: nothing set. |
#### `social.x`
@@ -183,6 +184,14 @@ Per-platform settings of the social posts. Today two keys, both X's, both chosen
| `cookieSource` | absent | Where the X fetchers' login comes from. `"browser"`: the operator's everyday browser, named by `cookiesFromBrowser` — gallery-dl is handed `--cookies-from-browser <spec>` and reads it on every run, and the Playwright fallback reads the same store (Firefox only; common/social/xBrowserLogin.ts), so the login lasts as long as the browser's. `"profile"`: the session broker's persistent profile ("Connect X account" on /settings) and the cookie jar it exports. ABSENT (the default) is resolved at read time, never stored: `"browser"` when `cookiesFromBrowser` is set and no profile is connected (no exported jar carrying an auth_token), else `"profile"`. The source, not `cookieMode`, governs the X fetchers. |
| `visibility` | absent | Where X posts may appear. `"public"` (the default; absent): an X channel's posts are built into every site that has the channel. `"private"`: every X channel's posts (a channel with `sourceKind: "social"` and `platform: "twitter"`) are left out of every PUBLIC site build — the channel with them, since posts are all an X channel holds — and built only into PRIVATE sites (`site.json` `audience`). Nothing on disk changes and fetching does not; a site already published changes on its next build and deploy, and flipping back is a rebuild. Chosen in the X account session section of /settings; the rule is common/lib/postsVisibility.ts. |
+#### `social.xenforo`
+
+Per entry — each entry spells its own values.
+
+| Key | Description |
+|---|---|
+| `retryOnBlock` | `{ "minutes": N, "max": M }` — what a forum thread's Fetch posts button does when the forum serves a browser check that will not clear, or refuses a page (403/429): the job waits N minutes and runs again, M tries in all (the first included; minutes 5–1440, tries 1–48). A captcha or a login wall is never retried — it needs a person. ABSENT (the default): off, the job stops at the block. Set on the forum channel page (Retry after a block); `fetch-posts` takes its own `retryOnBlock`. common/lib/forumWalk.ts. |
+
Default:
```json
diff --git a/common/controller/fetchForumPosts.test.ts b/common/controller/fetchForumPosts.test.ts
@@ -1,5 +1,5 @@
// fetchPosts over a FORUM THREAD (release 37 lane G), end to end through the
-// real XenForo fetcher reading SYNTHETIC saved pages (FORUM_FIXTURE_DIR,
+// real XenForo fetcher reading SYNTHETIC saved pages (E2E_FORUM_FIXTURE_DIR,
// social/forumFixtureLoader.ts): no browser, no network. The two positions in
// posts-state.json, an old single cursor migrating, the full re-walk's edits,
// and the retry on a block over a fake clock.
@@ -16,7 +16,7 @@ const ROOT = await mkdtemp(path.join(os.tmpdir(), "fetchforum-"));
const FIXTURES = path.join(ROOT, "forum-fixture");
// getPaths() is resolved lazily and cached: set before the first call.
process.env.TRANSCRIPTS_DIR = path.join(ROOT, "transcripts");
-process.env.FORUM_FIXTURE_DIR = FIXTURES;
+process.env.E2E_FORUM_FIXTURE_DIR = FIXTURES;
const { THREAD_URL, CHALLENGE_PAGE } = await import("../social/__fixtures__/xenforoPages");
const { FakeForumThread, FAKE_THREAD_ID } = await import("../social/__fixtures__/fakeForumThread");
diff --git a/common/lib/envVars.ts b/common/lib/envVars.ts
@@ -212,7 +212,7 @@ const DECLARED: EnvVarDecl[] = [
{ name: "E2E_WORKERS", audience: "test", default: "1", readBy: "editor/playwright.config.ts (editor/e2e/servers.ts)", doc: "How many workers the editor suite runs, each with a server set of its own (editor, export dev server, Ollama stub) over its own data root (`editor/.e2e-workers/w<n>`): a number (up to 8), or `auto` — floor((MemAvailable − HEAVY_MIN_FREE_MB) / 1.5 GB), 1 to 3. Specs in `editor/e2e/serial.ts` run afterwards on one worker." },
{ name: "E2E_SERIAL_LAST", audience: "test", default: "—", readBy: "editor/playwright.config.ts", doc: "Set by the editor suite's runner for its workers: `1` when the run is whole (no spec file or filter on the command line), so the @serial project runs last; `0` for a focused run, where Playwright would run a teardown project whole." },
{ name: "E2E_BUILD_CHECKED", audience: "test", default: "—", readBy: "editor/playwright.config.ts, umtool/playwright.config.ts", doc: "Set by a suite's config once it has checked the start-mode build's stamp, so a worker's second load of the config does not check again." },
- { name: "FORUM_FIXTURE_DIR", audience: "test", default: "unset (the forum fetcher opens its headless browser)", readBy: "common/social/forumFixtureLoader.ts (the forum-thread fetcher), editor/package.json (dev:test, start:test)", doc: "A directory of SYNTHETIC saved thread pages (`<dir>/<threadId>/page-<N>.html`) the forum-thread fetcher reads in place of a browser, with no pause between pages — the editor e2e suite's forum channel. Set by `dev:test` / `start:test` to `<E2E_DATA_ROOT>/test-transcripts/.forum-fixture`, and by nothing else." },
+ { name: "E2E_FORUM_FIXTURE_DIR", audience: "test", default: "unset (the forum fetcher opens its headless browser)", readBy: "common/social/forumFixtureLoader.ts (the forum-thread fetcher)", doc: "A directory of SYNTHETIC saved thread pages (`<dir>/<threadId>/page-<N>.html`) the forum-thread fetcher reads in place of a browser, with no pause between pages. The editor's e2e server names one in each slot's test data (`test-transcripts/.forum-fixture`; `forum-resume.spec`), and nothing else sets it." },
{ name: "E2E_QUEUE", audience: "test", default: "on", readBy: "scripts/queue-lock.mjs", doc: "`0` skips the machine-global e2e queue (the port check still runs)." },
{ name: "E2E_PORT_CHECK", audience: "test", default: "on", readBy: "scripts/queue-lock.mjs", doc: "`0` skips the pre-run check that the suite's ports are free." },
{ name: "E2E_QUEUE_TIMEOUT", audience: "test", default: "wait forever", readBy: "scripts/queue-lock.mjs", doc: "Seconds to wait for the queue before giving up." },
diff --git a/common/social/__fixtures__/fakeForumThread.ts b/common/social/__fixtures__/fakeForumThread.ts
@@ -2,7 +2,7 @@
// arrive at its end, posts are deleted and the pages shift down, a page is
// served as a challenge. The walk's tests read it through a loader, the
// controller's and the e2e suite's through the saved-pages directory
-// FORUM_FIXTURE_DIR names (social/forumFixtureLoader.ts). Invented forum,
+// E2E_FORUM_FIXTURE_DIR names (social/forumFixtureLoader.ts). Invented forum,
// members and words (xenforoPages.ts).
import { mkdir, readdir, rm, writeFile } from "node:fs/promises";
@@ -61,7 +61,7 @@ export class FakeForumThread {
return this.posts.map((p) => String(p.id));
}
- // The thread as FORUM_FIXTURE_DIR's saved pages: `<dir>/4242/page-<N>.html`,
+ // The thread as E2E_FORUM_FIXTURE_DIR's saved pages: `<dir>/4242/page-<N>.html`,
// pages past the end removed (block overrides are left alone).
async writeTo(dir: string): Promise<void> {
const threadDir = path.join(dir, FAKE_THREAD_ID);
diff --git a/common/social/forumFixtureLoader.ts b/common/social/forumFixtureLoader.ts
@@ -1,5 +1,5 @@
// A forum page loader over a DIRECTORY OF SAVED PAGES, for the editor's e2e
-// suite (FORUM_FIXTURE_DIR, set by `dev:test` / `start:test` only): the
+// suite (E2E_FORUM_FIXTURE_DIR, set per slot by e2e/servers.ts only): the
// forum-thread fetcher reads `<dir>/<threadId>/page-<N>.html` instead of
// opening a browser, so the channel page's Fetch posts and Full re-walk run end
// to end with no network. A page number past the last file is the last page,
@@ -13,7 +13,7 @@ import type { ForumPageLoader } from "./forumSession";
import { xenforoPageUrl, type XenforoThreadUrl } from "./xenforoParse";
export function forumFixtureDir(env: Readonly<Record<string, string | undefined>> = process.env): string | undefined {
- const dir = env.FORUM_FIXTURE_DIR;
+ const dir = env.E2E_FORUM_FIXTURE_DIR;
return dir && dir.trim() ? dir : undefined;
}
diff --git a/common/social/xenforoFetcher.test.ts b/common/social/xenforoFetcher.test.ts
@@ -66,7 +66,7 @@ const pageOf = (url: string): number => {
type FakeLoader = ForumPageLoader & { urls: string[]; closed: number };
function fakeLoader(
- override: (url: string, page: number) => { html: string; status?: number } | undefined = () => undefined,
+ override: (url: string, page: number) => { html: string; status?: number; challengeMs?: number } | undefined = () => undefined,
): FakeLoader {
const loader: FakeLoader = {
urls: [],
@@ -78,6 +78,7 @@ function fakeLoader(
return {
html: o?.html ?? pageHtml(page),
...(o?.status ? { status: o.status } : { status: 200 }),
+ ...(o?.challengeMs !== undefined ? { challengeMs: o.challengeMs } : {}),
url: `${THREAD_URL}${page > 1 ? `page-${page}` : ""}`,
};
},
@@ -326,15 +327,35 @@ test("an article thread: its first post atop every page never stops the walk, an
assert.equal(all.posts.length, 15);
});
-test("a page that parses to no posts stops rather than stepping past it", async () => {
+test("a page that parses to no posts is loaded once more, then stops rather than stepping past it", async () => {
const empty = threadPage({ page: 4, last: LAST, posts: [] });
- const res = await walkXenforoThread(
- input(),
- deps(fakeLoader((_url, page) => (page === 4 ? { html: empty } : undefined))).deps,
- );
+ const loader = fakeLoader((_url, page) => (page === 4 ? { html: empty } : undefined));
+ const res = await walkXenforoThread(input(), deps(loader).deps);
assert.equal(res.complete, false);
assert.equal(res.cursor, "4");
assert.match(res.error ?? "", /no posts/);
+ assert.equal(loader.urls.filter((u) => u.endsWith("page-4")).length, 2, "one reload, no more");
+});
+
+test("a page read empty just after a browser check cleared is reloaded, and the walk goes on", async () => {
+ // Live: "The browser check cleared in 12 s. → Page 2193/2606: 0 post(s)
+ // parsed" — the page standing after the check is not the thread page yet.
+ const empty = threadPage({ page: 4, last: LAST, posts: [] });
+ let reads = 0;
+ const loader = fakeLoader((_url, page) => {
+ if (page !== 4) return undefined;
+ reads++;
+ return reads === 1 ? { html: empty, challengeMs: 12_000 } : undefined;
+ });
+ const log: string[] = [];
+ const { deps: d, sleeps } = deps(loader);
+ const res = await walkXenforoThread(input({ onLog: (l) => log.push(l) }), d);
+ assert.equal(res.complete, true);
+ assert.equal(res.error, undefined);
+ assert.equal(res.posts.length, 15, "every post, page 4's included");
+ assert.equal(reads, 2);
+ assert.match(log.join("\n"), /Page 4: no posts on the first read after the browser check cleared; loading it again\./);
+ assert.equal(sleeps.length, loader.urls.length - 1, "the reload is paced like any load");
});
test("a bad cursor and a URL that is not a thread are refused before any load", async () => {
diff --git a/common/social/xenforoFetcher.ts b/common/social/xenforoFetcher.ts
@@ -54,6 +54,7 @@ import {
import {
browserForumLoader,
forumProfileDir,
+ type ForumPageLoad,
type ForumPageLoader,
} from "./forumSession";
import {
@@ -252,24 +253,37 @@ export async function walkXenforoThread(
for (;;) {
if (signal.aborted) return stop();
const url = xenforoPageUrl(thread, page);
- let load;
- try {
- load = await fetchPage(url);
- } catch (err) {
- return stop({ error: (err as Error).message });
- }
- if (signal.aborted) return stop();
- const block = classifyForumPage(load.html, load.status);
- if (block) {
- const why = forumBlockFailure(block, thread.host);
- onLog?.(`Page ${page === LAST_PAGE_PROBE ? "(last)" : page}: ${block.kind} — ${block.detail}.`);
- return stop({
- error: why.error,
- block: block.kind,
- ...(why.needsCookies ? { needsCookies: true } : {}),
- });
+ let load: ForumPageLoad;
+ let parsed: ReturnType<typeof parseXenforoThreadPage>;
+ // A page that parses to no posts is loaded ONCE more before the walk
+ // stops on it: right after a browser check clears, the page standing is
+ // often not yet the thread page (seen live: "Page 2193/2606: 0 post(s)
+ // parsed … (browser check cleared in 12 s)").
+ for (let tries = 1; ; tries++) {
+ try {
+ load = await fetchPage(url);
+ } catch (err) {
+ return stop({ error: (err as Error).message });
+ }
+ if (signal.aborted) return stop();
+ const block = classifyForumPage(load.html, load.status);
+ if (block) {
+ const why = forumBlockFailure(block, thread.host);
+ onLog?.(`Page ${page === LAST_PAGE_PROBE ? "(last)" : page}: ${block.kind} — ${block.detail}.`);
+ return stop({
+ error: why.error,
+ block: block.kind,
+ ...(why.needsCookies ? { needsCookies: true } : {}),
+ });
+ }
+ parsed = parseXenforoThreadPage(load.html, { channelSlug, pageUrl: load.url });
+ if (parsed.posts.length > 0 || tries >= 2) break;
+ onLog?.(
+ `Page ${page === LAST_PAGE_PROBE ? "(last)" : page}: no posts on the first read` +
+ (load.challengeMs !== undefined ? " after the browser check cleared" : "") +
+ "; loading it again.",
+ );
}
- const parsed = parseXenforoThreadPage(load.html, { channelSlug, pageUrl: load.url });
if (visited.has(parsed.page)) {
return stop({ error: `Asked for page ${page} and was shown page ${parsed.page} again; stopped rather than loop.` });
}
diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md
@@ -1,7 +1,7 @@
# Changelog
## [Unreleased]
-- **A forum thread's fetch resumes where it stopped instead of reading the thread again.** A forum channel now keeps two places: how far it has caught up with the newest posts, and where its walk back through the older pages stands. **Fetch posts** reads from the last page down to the newest post it already holds, then jumps straight to the older pages it has yet to read — a run capped at a few pages ("Latest N pages") no longer loses the older place, and a page whose posts are all held is stepped past without counting against the cap. Pages that shifted because posts were deleted are still read without a gap. **Full re-walk** (it replaces "Re-fetch full history" on a forum channel) asks first, with the page count and how long it takes at the channel's pace, then reads every page from the last to page 1: edited posts are updated, and posts no page shows any more are counted in the log and kept. The panel's status line says where both stand — "pages read 2338–2600 of 2600 · history to page 1 remaining: 2337 pages (~9.7 h)". The older place is checked against the pages the archive holds at every run, so a channel whose place was overwritten by the old single resume point heals on its next fetch. **Retry after a block** (the Forum session section) makes Fetch posts wait out a browser check that will not clear or a refused page — 30 minutes, then try again, up to 12 tries, say — and never retries a captcha or a login; `pnpm ops fetch-posts` takes `"retryOnBlock": {"minutes": 30, "max": 12}` (or `true` for the saved setting). Needs a restart of the editor.
+- **A forum thread's fetch resumes where it stopped instead of reading the thread again.** A forum channel now keeps two places: how far it has caught up with the newest posts, and where its walk back through the older pages stands. **Fetch posts** reads from the last page down to the newest post it already holds, then jumps straight to the older pages it has yet to read — a run capped at a few pages ("Latest N pages") no longer loses the older place, and a page whose posts are all held is stepped past without counting against the cap. Pages that shifted because posts were deleted are still read without a gap. **Full re-walk** (it replaces "Re-fetch full history" on a forum channel) asks first, with the page count and how long it takes at the channel's pace, then reads every page from the last to page 1: edited posts are updated, and posts no page shows any more are counted in the log and kept. The panel's status line says where both stand — "pages read 2338–2600 of 2600 · history to page 1 remaining: 2337 pages (~9.7 h)". The older place is checked against the pages the archive holds at every run, so a channel whose place was overwritten by the old single resume point heals on its next fetch. A page that reads empty — as one can just after a browser check clears — is loaded once more before the fetch stops on it. **Retry after a block** (the Forum session section) makes Fetch posts wait out a browser check that will not clear or a refused page — 30 minutes, then try again, up to 12 tries, say — and never retries a captcha or a login; `pnpm ops fetch-posts` takes `"retryOnBlock": {"minutes": 30, "max": 12}` (or `true` for the saved setting). Needs a restart of the editor.
- **Is a Wayback page's original still up? The channel page says, and can ask the Wayback Machine to save one now.** A Wayback pages channel's page has **Originals**: **Check originals** asks each record's original address at its own site — never the Wayback Machine — once per address, a few seconds apart, and the page lists every original that is gone (404 or 410, or X's, Tumblr's, Google Docs' or YouTube's "does not exist" page) with "the only copy" linking its Wayback copy; a suspended account or a document no longer shared reads as unavailable, and anything else (a wall, an outage, a redirect to another site) as an error, never as gone. Gone records read as deleted wherever a deleted post does. **Save Page Now** — "Ask the Wayback Machine to capture this now" — takes any address, or a record whose original is still up (**Capture now**): archive.org captures the page, the job waits for it, and the new capture is imported into the channel. It needs your archive.org S3 keys (`ARCHIVE_ORG_S3_ACCESS` and `ARCHIVE_ORG_S3_SECRET` in the editor's environment, or in the mode-600 file `archiveOrg.s3KeyFile` names); without them the button is off and says why, and the keys are never logged. From a terminal: `pnpm ops check-post-availability`, `pnpm ops save-page-now` (`dryRun` first). Needs a restart of the editor.
- **find-copy finds a copy of a gone page a report cites.** `pnpm ops find-copy` with `"pages": true` checks each page a report cites at its own site; for one that is gone it imports the Wayback capture nearest the citation's date into the Wayback pages channel you name (`"channel"`) or the one whose targets cover it, and its result names the record the citation should now cite. A page still up is left (save it now instead), and a cited page record whose original is gone keeps its stored capture. `"dryRun": true` asks the same questions and imports nothing. The report is not rewritten.
- **Wayback Machine captures of pages are records of their own.** A capture of a page that is not a video — an old blog post, a group's site, a channel's About page, a document taken down — goes into a **Wayback pages** channel: on the New channel form, paste a Wayback URL of such a page (`web.archive.org/web/*/example.com/blog*` scopes every capture under that path, `*.example.com` a whole domain, one capture's URL that page) or choose **Wayback pages** as the platform, and edit its targets (a URL, how it matches, optional dates). The channel page's **Import a capture** takes a capture's URL, or the page's own URL and a date for the capture nearest it, and imports it as one job at archive.org's pace: the page as captured is kept, its readable text, title, author, date, links and images become a record — searchable, in the MCP and on a built site like any post — dated by the page's own date when it gives one. A later capture of the same page is kept as a version of the first. **Re-extract** reads every kept capture again with no request. A capture of a video is still Import video's, and is refused here with a sentence saying so. An x.com or twitter.com capture is private exactly as X posts are. From a terminal: `pnpm ops import-page` (`dryRun` says what it would fetch) and `pnpm ops reextract-pages`; `pnpm archilyzer wayback pages import|reextract` run without the editor. Needs a restart of the editor.
diff --git a/editor/e2e/forum-resume.spec.ts b/editor/e2e/forum-resume.spec.ts
@@ -5,8 +5,8 @@
// retry after a block.
//
// The forum is invented and never contacted: the test server's forum fetcher
-// reads SYNTHETIC saved pages from FORUM_FIXTURE_DIR (`dev:test` / `start:test`
-// set it to <data root>/test-transcripts/.forum-fixture; see
+// reads SYNTHETIC saved pages from E2E_FORUM_FIXTURE_DIR (e2e/servers.ts sets
+// it to <data root>/test-transcripts/.forum-fixture; see
// common/social/forumFixtureLoader.ts), written here from a FakeForumThread.
import { test, expect, type Page } from "@playwright/test";
diff --git a/editor/e2e/servers.ts b/editor/e2e/servers.ts
@@ -57,6 +57,11 @@ export function waybackOriginFile(transcriptsDir: string): string {
return join(transcriptsDir, ".fake-wayback-origin");
}
+/** The saved thread pages a slot's forum fetcher reads (forumFixtureLoader.ts; forum-resume.spec). */
+export function forumFixtureDir(transcriptsDir: string): string {
+ return join(transcriptsDir, ".forum-fixture");
+}
+
/** The file naming a slot's stub umtool (common/lib/umtoolUrl.ts; find-clips.spec). */
export function umtoolOriginFile(transcriptsDir: string): string {
return join(transcriptsDir, ".fake-umtool-origin");
@@ -218,6 +223,9 @@ export function slotServers(slot: number, mode: E2EMode, env: Env = process.env)
// The same for the fake Wayback Machine wayback-pages.spec starts
// (lib/waybackClient.ts: the process's client sends web.archive.org there).
editorEnv.E2E_WAYBACK_ORIGIN_FILE = waybackOriginFile(paths.transcriptsDir);
+ // The forum fetcher's saved pages (forum-resume.spec): the slot's own
+ // directory (common/social/forumFixtureLoader.ts).
+ editorEnv.E2E_FORUM_FIXTURE_DIR = forumFixtureDir(paths.transcriptsDir);
// The same for the stub umtool find-clips.spec starts (lib/umtoolUrl.ts).
editorEnv.E2E_UMTOOL_ORIGIN_FILE = umtoolOriginFile(paths.transcriptsDir);
// The browser lookup's recorded page reads (browser-lookup.spec): set on
diff --git a/editor/package.json b/editor/package.json
@@ -5,8 +5,8 @@
"type": "module",
"scripts": {
"dev": "next dev --port ${EDITOR_PORT:-3001}",
- "dev:test": "WORKER_TOKEN=test-worker-token TRANSCRIPTS_DIR=${E2E_DATA_ROOT:-$(pwd)}/test-transcripts EXPORT_PUBLIC_DIR=${E2E_DATA_ROOT:-$(pwd)}/test-transcripts/.export-public SETTINGS_FILE=${E2E_DATA_ROOT:-$(pwd)}/test-settings.json EDITOR_CHANGELOG_FILE=${E2E_DATA_ROOT:-$(pwd)}/test-changelog.md EXPORT_CHANGELOG_FILE=${E2E_DATA_ROOT:-$(pwd)}/test-export-changelog.md GENERATION_USAGE_FILE=${E2E_DATA_ROOT:-$(pwd)}/test-transcripts/.generation-usage.jsonl YTDLP_BIN=$(pwd)/e2e/fixtures/bin/fake-ytdlp.mjs GALLERY_DL_BIN=$(pwd)/e2e/fixtures/bin/fake-gallery-dl.mjs WHISPER_BIN=$(pwd)/e2e/fixtures/bin/fake-whisper.mjs WHISPER_MODEL=/dev/null CHOUGH_BIN=$(pwd)/e2e/fixtures/bin/fake-chough.mjs CHOUGH_MODEL=/dev/null PARAKEET_STITCH_BIN=$(pwd)/e2e/fixtures/bin/fake-parakeet-stitch.mjs PARAKEET_CLI=/dev/null PARAKEET_MODEL=/dev/null DIARIZE_BIN=$(pwd)/e2e/fixtures/bin/fake-diarize.mjs FFMPEG_BIN=$(pwd)/e2e/fixtures/bin/fake-ffmpeg.mjs FFPROBE_BIN=$(pwd)/e2e/fixtures/bin/fake-ffprobe.mjs OLLAMA_URL=http://127.0.0.1:${OLLAMA_STUB_PORT:-11435} CLAUDE_BIN=$(pwd)/e2e/fixtures/bin/fake-claude.mjs FINDMNT_BIN=$(pwd)/e2e/fixtures/bin/fake-findmnt.mjs UDISKSCTL_BIN=$(pwd)/e2e/fixtures/bin/fake-udisksctl.mjs FORUM_FIXTURE_DIR=${E2E_DATA_ROOT:-$(pwd)}/test-transcripts/.forum-fixture next dev --port ${PORT:-3011}",
- "start:test": "WORKER_TOKEN=test-worker-token TRANSCRIPTS_DIR=${E2E_DATA_ROOT:-$(pwd)}/test-transcripts EXPORT_PUBLIC_DIR=${E2E_DATA_ROOT:-$(pwd)}/test-transcripts/.export-public SETTINGS_FILE=${E2E_DATA_ROOT:-$(pwd)}/test-settings.json EDITOR_CHANGELOG_FILE=${E2E_DATA_ROOT:-$(pwd)}/test-changelog.md EXPORT_CHANGELOG_FILE=${E2E_DATA_ROOT:-$(pwd)}/test-export-changelog.md GENERATION_USAGE_FILE=${E2E_DATA_ROOT:-$(pwd)}/test-transcripts/.generation-usage.jsonl YTDLP_BIN=$(pwd)/e2e/fixtures/bin/fake-ytdlp.mjs GALLERY_DL_BIN=$(pwd)/e2e/fixtures/bin/fake-gallery-dl.mjs WHISPER_BIN=$(pwd)/e2e/fixtures/bin/fake-whisper.mjs WHISPER_MODEL=/dev/null CHOUGH_BIN=$(pwd)/e2e/fixtures/bin/fake-chough.mjs CHOUGH_MODEL=/dev/null PARAKEET_STITCH_BIN=$(pwd)/e2e/fixtures/bin/fake-parakeet-stitch.mjs PARAKEET_CLI=/dev/null PARAKEET_MODEL=/dev/null DIARIZE_BIN=$(pwd)/e2e/fixtures/bin/fake-diarize.mjs FFMPEG_BIN=$(pwd)/e2e/fixtures/bin/fake-ffmpeg.mjs FFPROBE_BIN=$(pwd)/e2e/fixtures/bin/fake-ffprobe.mjs OLLAMA_URL=http://127.0.0.1:${OLLAMA_STUB_PORT:-11435} CLAUDE_BIN=$(pwd)/e2e/fixtures/bin/fake-claude.mjs FINDMNT_BIN=$(pwd)/e2e/fixtures/bin/fake-findmnt.mjs UDISKSCTL_BIN=$(pwd)/e2e/fixtures/bin/fake-udisksctl.mjs FORUM_FIXTURE_DIR=${E2E_DATA_ROOT:-$(pwd)}/test-transcripts/.forum-fixture next start --port ${PORT:-3011}",
+ "dev:test": "WORKER_TOKEN=test-worker-token TRANSCRIPTS_DIR=${E2E_DATA_ROOT:-$(pwd)}/test-transcripts EXPORT_PUBLIC_DIR=${E2E_DATA_ROOT:-$(pwd)}/test-transcripts/.export-public SETTINGS_FILE=${E2E_DATA_ROOT:-$(pwd)}/test-settings.json EDITOR_CHANGELOG_FILE=${E2E_DATA_ROOT:-$(pwd)}/test-changelog.md EXPORT_CHANGELOG_FILE=${E2E_DATA_ROOT:-$(pwd)}/test-export-changelog.md GENERATION_USAGE_FILE=${E2E_DATA_ROOT:-$(pwd)}/test-transcripts/.generation-usage.jsonl YTDLP_BIN=$(pwd)/e2e/fixtures/bin/fake-ytdlp.mjs GALLERY_DL_BIN=$(pwd)/e2e/fixtures/bin/fake-gallery-dl.mjs WHISPER_BIN=$(pwd)/e2e/fixtures/bin/fake-whisper.mjs WHISPER_MODEL=/dev/null CHOUGH_BIN=$(pwd)/e2e/fixtures/bin/fake-chough.mjs CHOUGH_MODEL=/dev/null PARAKEET_STITCH_BIN=$(pwd)/e2e/fixtures/bin/fake-parakeet-stitch.mjs PARAKEET_CLI=/dev/null PARAKEET_MODEL=/dev/null DIARIZE_BIN=$(pwd)/e2e/fixtures/bin/fake-diarize.mjs FFMPEG_BIN=$(pwd)/e2e/fixtures/bin/fake-ffmpeg.mjs FFPROBE_BIN=$(pwd)/e2e/fixtures/bin/fake-ffprobe.mjs OLLAMA_URL=http://127.0.0.1:${OLLAMA_STUB_PORT:-11435} CLAUDE_BIN=$(pwd)/e2e/fixtures/bin/fake-claude.mjs FINDMNT_BIN=$(pwd)/e2e/fixtures/bin/fake-findmnt.mjs UDISKSCTL_BIN=$(pwd)/e2e/fixtures/bin/fake-udisksctl.mjs next dev --port ${PORT:-3011}",
+ "start:test": "WORKER_TOKEN=test-worker-token TRANSCRIPTS_DIR=${E2E_DATA_ROOT:-$(pwd)}/test-transcripts EXPORT_PUBLIC_DIR=${E2E_DATA_ROOT:-$(pwd)}/test-transcripts/.export-public SETTINGS_FILE=${E2E_DATA_ROOT:-$(pwd)}/test-settings.json EDITOR_CHANGELOG_FILE=${E2E_DATA_ROOT:-$(pwd)}/test-changelog.md EXPORT_CHANGELOG_FILE=${E2E_DATA_ROOT:-$(pwd)}/test-export-changelog.md GENERATION_USAGE_FILE=${E2E_DATA_ROOT:-$(pwd)}/test-transcripts/.generation-usage.jsonl YTDLP_BIN=$(pwd)/e2e/fixtures/bin/fake-ytdlp.mjs GALLERY_DL_BIN=$(pwd)/e2e/fixtures/bin/fake-gallery-dl.mjs WHISPER_BIN=$(pwd)/e2e/fixtures/bin/fake-whisper.mjs WHISPER_MODEL=/dev/null CHOUGH_BIN=$(pwd)/e2e/fixtures/bin/fake-chough.mjs CHOUGH_MODEL=/dev/null PARAKEET_STITCH_BIN=$(pwd)/e2e/fixtures/bin/fake-parakeet-stitch.mjs PARAKEET_CLI=/dev/null PARAKEET_MODEL=/dev/null DIARIZE_BIN=$(pwd)/e2e/fixtures/bin/fake-diarize.mjs FFMPEG_BIN=$(pwd)/e2e/fixtures/bin/fake-ffmpeg.mjs FFPROBE_BIN=$(pwd)/e2e/fixtures/bin/fake-ffprobe.mjs OLLAMA_URL=http://127.0.0.1:${OLLAMA_STUB_PORT:-11435} CLAUDE_BIN=$(pwd)/e2e/fixtures/bin/fake-claude.mjs FINDMNT_BIN=$(pwd)/e2e/fixtures/bin/fake-findmnt.mjs UDISKSCTL_BIN=$(pwd)/e2e/fixtures/bin/fake-udisksctl.mjs next start --port ${PORT:-3011}",
"build": "next build",
"start": "UV_THREADPOOL_SIZE=${UV_THREADPOOL_SIZE:-16} next start --port ${EDITOR_PORT:-3001}",
"test": "tsx --test \"app/**/*.test.ts\" \"e2e/*.unit.ts\"",
diff --git a/editor/playwright.config.ts b/editor/playwright.config.ts
@@ -39,6 +39,11 @@ import { currentSlot } from "./e2e/testPaths";
// into, where the editor's Wayback client then sends
// every web.archive.org request
// (common/lib/waybackClient.ts; wayback-pages.spec)
+// E2E_FORUM_FIXTURE_DIR set per slot (e2e/servers.ts): the directory of
+// SYNTHETIC saved thread pages the forum fetcher
+// reads in place of a browser, with no pause
+// (common/social/forumFixtureLoader.ts;
+// forum-resume.spec)
// E2E_UMTOOL_ORIGIN_FILE set per slot (e2e/servers.ts): the file a spec
// writes its stub umtool's loopback origin into,
// which Find clips then posts to
diff --git a/plans/FACTS.md b/plans/FACTS.md
@@ -11237,3 +11237,42 @@ parsed to 0 cues, indexing the video textless) is CLOSED by `200a3105` (transcri
- New ops: `check-post-availability {slug, mode?, limit?}` (any posts channel), `save-page-now {url, slug?,
dryRun?}`. UI: `components/WaybackLivePanel.tsx` under the pages panel (Check originals, the gone table, Save Page
Now field + per-live-record Capture now; off with `spnOffSentence` when no keys).
+
+## Release 37 lane G: a forum thread's two walks (verified 2026-10-20, branch `r37/forum-resume`)
+
+- **State**: `posts-state.json` `forum` (`ForumWalkState`, `common/lib/forumWalk.ts`, pure):
+ `{newestPage, newestPostId, catchUpPage?, historyPage?, oldestPageReached, complete?}`. A forum fetch no longer
+ writes `cursor`; an old state's `cursor` is read ONCE as `historyPage` (then healed, below) and the next state
+ write drops it (`fetchTimeline` builds the state fresh each run; `older` is carried as before).
+- **The mark** is `newestPostId`: a CATCH-UP (from the last page down) ends at the first page holding an archived
+ post whose numeric id is ≤ the mark (XenForo post ids grow globally). With no mark (a pre-release-37 state), any
+ archived non-repeated post ends it, as before. A completed catch-up sets the mark to the highest id read this run.
+ A capped/interrupted catch-up writes `catchUpPage` (its next page) and never touches `historyPage` or the mark;
+ the next catch-up, meeting an all-held page above the mark, jumps to `catchUpPage` when it is below.
+- **History** reads `historyPage` down to page 1, writes only `historyPage` (`complete` at page 1). A first run
+ (nothing archived: `seenIds.size === 0`) is one history walk from the last page; it sets the mark from its top.
+- **An empty page is loaded once more** before the walk stops on it (`Page N: no posts on the first read …;
+ loading it again.`): just after a browser check clears, the page standing is often not the thread page yet.
+- **All-held pages** (every non-repeated post archived, nothing new) never count against `pages`/`limit`, in the
+ catch-up or the history; they log `Page N: all held, skipping on.` A full re-walk counts every page.
+- **Derive, don't trust** (`deriveForumWalk`, run by `fetchPosts` and by the channel page): the held BAND is the
+ contiguous run of `forum.page` values down from the highest held page (an isolated page 1 — an article thread's
+ starter — or an imported range is not part of it); `historyPage = min(stored, band.low + 1)`. NOT `band.low − 2`:
+ drift only moves posts to LOWER page numbers, so a start below `band.low − 1` could step over an unread page;
+ starting one above the foot re-reads held pages, uncounted. `band.low ≤ 1` ⇒ `complete`; `complete` with
+ `band.low > 1` is reopened. Live `kf-oney-thread` at 2026-10-20 (`{"cursor": "2507"}`, held 2341–2598, no gaps):
+ migrates to `historyPage 2342`.
+- **Full re-walk** (`full: true`, `stopAtKnown: false`): every page, archived posts handed back and UPSERTED with
+ `upsertPosts(…, {ignorePosition: true})` (a renumbered `#N` alone is not an edit); a complete one returns
+ `notSeen` (archived ids on no page), LOGGED, never marked. It leaves the mark at the run's top, clears
+ `catchUpPage`, `historyPage = min(stored, next)`.
+- **Retry on a block**: `fetchPosts({retryOnBlock: {minutes, max}, sleep?})` re-runs the whole timeline fetch after
+ `minutes` when the result's `block` is `"challenge"` or `"blocked"` (403/429); `max` is tries IN ALL; minutes
+ 5–1440, max 1–48 (`retryOnBlockProblem`). `PostFetchResult.block` carries the `ForumBlockKind`. Default for the
+ forum Fetch posts button: `settings.social.xenforo.retryOnBlock` (absent = off; the button passes `"settings"`,
+ ops `true`). Note `saveSettings` merges ONE level deep: a `social` patch replaces the block, so
+ `socialXPatch` (xSessionActions.ts) now spreads the rest of `social`.
+- **Test seam**: `E2E_FORUM_FIXTURE_DIR` (test audience) makes `xenforoFetcher.fetch` read
+ `<dir>/<threadId>/page-<N>.html` (`page-<N>.<status>.html` served in its place while it exists) with no pause
+ (`common/social/forumFixtureLoader.ts`); `editor/e2e/servers.ts` sets it per slot to `test-transcripts/.forum-fixture`.
+ `common/social/__fixtures__/fakeForumThread.ts` is a thread that grows, loses posts and writes those pages.