commit f16785c5a7cb73ba6109edaa4c10f5ec442f9d56
parent 3f3f841755a6ac82de12adf03667ccc1c316a39c
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 23 Oct 2026 13:04:26 -0400
Merge lane/forum-walk-catchup: an unfinished catch-up survives new pages at the top; a non-thread page after a check is loaded once more
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
# Conflicts:
# editor/CHANGELOG.md
Diffstat:
3 files changed, 97 insertions(+), 8 deletions(-)
diff --git a/common/social/xenforoFetcher.test.ts b/common/social/xenforoFetcher.test.ts
@@ -465,6 +465,67 @@ test("a capped catch-up keeps the history position; the next run jumps below wha
assert.deepEqual([...held].sort(), t.ids().sort());
});
+test("new pages at the top do not lose an unfinished catch-up: the run continues where it stopped, then the history", async () => {
+ // Live, 2026-10-23: a catch-up read 3796–3754 and stopped (no mark stored
+ // yet); the thread grew to 3798. The next run read 3798 and 3797, met the
+ // posts the stopped run had archived on 3796, called itself caught up and
+ // went to the history at 2308 — and 3753–3661 were never read.
+ const t = new FakeForumThread(30); // 10 pages
+ const held = new Set<string>();
+ const first = await runOnce(t, held, undefined, { pages: 5 }); // history 10–6
+ t.add(9); // pages 11–13
+ const capped = await runOnce(t, held, first.walk, { pages: 2 }); // 13, 12
+ assert.equal(capped.walk?.catchUpPage, 11);
+ t.add(6); // pages 14–15
+ for (const walk of [
+ capped.walk!,
+ // The live shape: no mark stored, so any archived post would have read as it.
+ (({ newestPostId: _mark, ...rest }) => rest)(capped.walk!) as ForumWalkState,
+ ]) {
+ const h = new Set(held);
+ const next = await runOnce(t, h, walk, { pages: 6 });
+ // 15 and 14 are new; 13 is the stopped run's (all held): jump to 11, meet
+ // the history walk's posts on 10, then the history from 5. (Held pages do
+ // not count against the cap, so the history runs on past 5.)
+ assert.deepEqual(pageUrls(next.loader).slice(0, 6), ["last", 14, 13, 11, 10, 5], `stored mark: ${walk.newestPostId ?? "none"}`);
+ assert.match(next.log.join("\n"), /Page 13: all held — an earlier catch-up read down to page 12; continuing there\./);
+ assert.match(next.log.join("\n"), /Caught up to page 15; history resumes at page 5\./);
+ assert.equal(next.walk?.catchUpPage, undefined);
+ assert.equal(next.walk?.newestPostId, "9045");
+ // Pages 15–11 are all held now: nothing between the top and the history is owed.
+ for (const id of t.ids().filter((x) => Number(x) > 9015)) assert.ok(h.has(id), `post ${id} held`);
+ }
+});
+
+test("a page that is not a thread page, just after a browser check cleared, is loaded once more and the walk goes on", async () => {
+ // Live, 2026-10-23, twice: "The browser check cleared in 4 s. → Page 3753:
+ // unknown — no forum posts on the page" — and the run stopped there.
+ let reads = 0;
+ const loader = fakeLoader((_url, page) => {
+ if (page !== 4) return undefined;
+ reads++;
+ return reads === 1 ? { html: "<html><head><title>Kiwi Farms</title></head><body>One moment…</body></html>", challengeMs: 4_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.error, undefined);
+ assert.equal(res.complete, true);
+ assert.equal(res.posts.length, 15, "every post, page 4's included");
+ assert.equal(reads, 2);
+ assert.match(log.join("\n"), /Page 4: no forum posts on the page 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 page that is still not a thread page on the second read stops the walk, as before", async () => {
+ const loader = fakeLoader((_url, page) =>
+ page === 4 ? { html: "<html><head><title>Kiwi Farms</title></head><body>One moment…</body></html>" } : undefined,
+ );
+ const res = await walkXenforoThread(input(), deps(loader).deps);
+ assert.match(res.error ?? "", /not a thread page/);
+ assert.equal(loader.urls.filter((u) => u.endsWith("page-4")).length, 2, "one reload, no more");
+});
+
test("drift: posts deleted below the read pages shift every page down, and the history still reaches page 1 with no gap", async () => {
const t = new FakeForumThread(30);
const held = new Set<string>();
diff --git a/common/social/xenforoFetcher.ts b/common/social/xenforoFetcher.ts
@@ -210,6 +210,15 @@ export async function walkXenforoThread(
}
const markId = w.newestPostId !== undefined ? Number(w.newestPostId) : undefined;
let mode: WalkMode = full ? "full" : firstRun ? "history" : "catch-up";
+ // WHERE AN EARLIER, UNFINISHED CATCH-UP STOPPED, kept apart from
+ // `w.catchUpPage`: this run's own catch-up moves that from its first page
+ // on, so a thread with new pages at the top lost the earlier place before
+ // it reached the pages the earlier run read -- and with no mark stored, the
+ // first post that run had archived read as "caught up", and the pages it
+ // still owed were skipped for the history (2026-10-23: pages 3661-3753 of a
+ // 3,798-page thread). Posts on pages above it were archived BY it: they are
+ // not the mark, and meeting them jumps to where it stopped.
+ let earlierCatchUp = mode === "catch-up" ? start.catchUpPage : undefined;
const posts: Post[] = [];
const taken = new Set<string>();
@@ -268,6 +277,19 @@ export async function walkXenforoThread(
if (signal.aborted) return stop();
const block = classifyForumPage(load.html, load.status);
if (block) {
+ // A page that is not a thread page at all ("no forum posts on the
+ // page") is loaded once more too: right after a browser check, the
+ // page standing is often still the check's (seen live 2026-10-23,
+ // twice: "The browser check cleared in 4 s. → Page 3753: unknown —
+ // no forum posts on the page", and the run stopped).
+ if (block.kind === "unknown" && tries < 2) {
+ onLog?.(
+ `Page ${page === LAST_PAGE_PROBE ? "(last)" : page}: ${block.detail} on the first read` +
+ (load.challengeMs !== undefined ? " after the browser check cleared" : "") +
+ "; loading it again.",
+ );
+ continue;
+ }
const why = forumBlockFailure(block, thread.host);
onLog?.(`Page ${page === LAST_PAGE_PROBE ? "(last)" : page}: ${block.kind} — ${block.detail}.`);
return stop({
@@ -297,6 +319,7 @@ export async function walkXenforoThread(
let held = 0;
let own = 0;
let reachedMark = false;
+ const aboveEarlier = earlierCatchUp !== undefined && page > earlierCatchUp;
const fresh: Post[] = [];
// Newest first within the page too, so the stops read in time order.
for (const post of [...parsed.posts].reverse()) {
@@ -317,7 +340,7 @@ export async function walkXenforoThread(
if (runTopId === undefined || idNum > runTopId) runTopId = idNum;
if (seenIds.has(post.id)) {
held++;
- if (mode === "catch-up" && (markId === undefined || idNum <= markId)) reachedMark = true;
+ if (mode === "catch-up" && !aboveEarlier && (markId === undefined || idNum <= markId)) reachedMark = true;
// A full re-walk hands archived posts back, for their edits.
if (mode === "full" && !taken.has(post.id)) {
taken.add(post.id);
@@ -367,14 +390,18 @@ export async function walkXenforoThread(
next = Math.min(w.historyPage, next);
onLog?.(`Caught up to page ${w.newestPage}; history resumes at page ${next}.`);
}
- } else if (allHeld) {
- // The pages an earlier, unfinished catch-up read: jump below them.
- if (w.catchUpPage && w.catchUpPage < next) {
- onLog?.(`Page ${page}: all held — an earlier catch-up read down to page ${w.catchUpPage + 1}; continuing there.`);
- next = w.catchUpPage;
- } else {
- onLog?.(`Page ${page}: all held, skipping on.`);
+ } else if (aboveEarlier && held > 0) {
+ // The pages an earlier, unfinished catch-up read: jump below them,
+ // to where it stopped. Once: below it is the band it still owed.
+ if (earlierCatchUp! < next) {
+ onLog?.(
+ `Page ${page}: ${allHeld ? "all held" : "reached posts it archived"} — an earlier catch-up read down to page ${earlierCatchUp! + 1}; continuing there.`,
+ );
+ next = earlierCatchUp!;
}
+ earlierCatchUp = undefined;
+ } else if (allHeld) {
+ onLog?.(`Page ${page}: all held, skipping on.`);
}
if (!finished && mode === "catch-up") w.catchUpPage = next;
} else if (mode === "history") {
diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md
@@ -3,6 +3,7 @@
## [Unreleased]
- **umtool's clip editor keeps a voice's pitch at any speed, and goes up to 4×.** A selection, an edge, a transcript line or the auto-audition played at 1.5× or 2× used to rise in pitch with the speed (2× was an octave up), unlike the same video at 2× in a player: the bench plays a range from decoded audio, whose speed control is a tape-speed knob. At any speed but 1× the range is now time-stretched at its own pitch first (waveform-similarity overlap-add) and played at 1×, still starting and stopping on the exact sample; a clip's selection is stretched ahead while the editor is idle, so playing it does not wait. The speed list adds 1.75×, 2.5×, 3×, 3.5× and 4×. Needs a restart of umtool.
- **A clip whose recording umtool cannot play is skipped by the clip walk, not opened broken.** A whole recording saved with **Fetch the whole recording** sits in the saved-video store, which umtool was not allowed to read: a clip it alone held counted as fetched, the walk stopped on it, and the player answered "outside the roots" (`costco-ok`). The store (`SAVED_VIDEOS_DIR`, else `transcripts/saved-videos`) is now readable, as the corpus is, so such a clip plays; and a window umtool may not read is no longer counted at all, so a clip with no window it can play is passed by and comes back once one is fetched. Needs a restart of umtool.
+- **A forum thread's fetch no longer skips the pages an interrupted catch-up still owed.** When a catch-up stopped partway down a thread and new pages were posted before the next fetch, the next fetch read the new pages, met the posts the stopped run had saved, took them for the point where it was caught up, and went on to the older history: the pages between were never read (on 2026-10-23, 93 pages of a 3,798-page thread). It now continues where the stopped catch-up left off, then goes on to the history. And a page that comes back as no thread page at all just after a browser check clears is loaded once more before the fetch stops on it, as an empty page already was. Needs a restart of the editor.
- **Record live reads Rumble's new segment packaging.** Rumble's CDN now serves a stream's pieces as byte ranges of one `.tar` file, which ffmpeg refused by its name ("not in allowed_segment_extensions"), so a recording through the browser path ended with nothing recorded. The recorder now also allows `tar` segments, and nothing looser. Needs a rebuild of the editor.
- **Jobs that ask a site are spaced apart, and X jobs start only on fresh cookies.** On 2026-10-23 thirteen X fetches queued in one loop ran less than a second apart on a cookie jar refreshed 16 days earlier; X answered with a Cloudflare challenge and the account needed a human verification. Now every job that sends requests to a platform waits after the previous one on the same platform ended — 5 minutes for X, 1 minute for forums and Bluesky, 20 seconds for everything else — and its row on /jobs and its log say so: "waiting 4m12s: X jobs are spaced 5 min apart (pacing.jobGapSeconds.twitter)". The gaps are on /settings beside the download sleep (`pacing.jobGapSeconds`), and the last job's end is remembered across a restart. With the connected X profile, a job that asks X is refused — when it is queued and again when its turn comes — unless the cookies were refreshed within the last hour: "X cookies were last refreshed 16 days ago (limit 60 min): press Refresh cookies (or Connect X account) on /settings, then fetch again." The limit is in the X account section of /settings (`social.x.maxCookieAgeMinutes`, 0 turns it off). The editor never refreshes the cookies itself, because a refresh loads x.com. With the browser login the age cannot be read; the job says so and runs. A job that asks a site can no longer be run "(immediate)": the queue picker leaves the option out, and `"queueKey": ""` from `pnpm ops` is refused with a sentence. Needs a restart of the editor.
- **An X challenge stops X.** When gallery-dl prints a Cloudflare challenge, a 401 or 403, or a login wall, the fetch now fails even if gallery-dl exits cleanly (the posts it read are kept), and the dashboard shows an **X needs fresh cookies** banner. While it is up, every X job (Fetch posts, the older walk, an X search, Capture posts, Import one post, Check deleted posts, the scheduler's fetches) is refused before it asks anything, and the refused jobs are listed for **Re-run stopped jobs**. Pass X's check by hand, press **Refresh cookies** on /settings, then **Recheck**: for X it sends no request and clears the banner when the login on disk is newer than the challenge. `pnpm ops get services` and `archilyzer doctor` list it as `x`. Needs a restart of the editor.