commit 51c23fc9fcee8d756086eaea4c2629d17b4330b0
parent badbad7e3574a22e8eec5fdcdcc9f1d74c2b55a3
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Mon, 2 Nov 2026 04:23:22 -0500
wayback scan: an excluded target is answered, not failed -- marked, and the next target goes on
A CDX 403 for a scan target's listing stopped the whole wayback-scan as an error. Now the target's
report carries refusal "excluded" and "excluded from the Wayback Machine (cause unknown)", the scan
file marks it (cleared when a new pass starts), the result lists `excluded`, the log says so, the
Captures tab shows the sentence, and the next target is listed. wayback-lookup and import-page
already answered the same refusal (release 37 lane F).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
7 files changed, 78 insertions(+), 8 deletions(-)
diff --git a/OPERATING.md b/OPERATING.md
@@ -245,11 +245,15 @@ pnpm ops reextract-pages --json '{"slug":"old-blog","dryRun":true}' --wait
- `reextract-pages` (the channel page's **Re-extract**) re-reads every stored body with the extractor it goes to
now — no request — and replaces the records when anything changed. Offline with the editor stopped:
`pnpm archilyzer wayback pages reextract <slug> --dry-run`.
+- Site extractors read Google Docs, YouTube channel pages, X, Newgrounds (a user page, an art page, a movie page:
+ `ng-user`, `ng-art`, `ng-movie`), XenForo threads and Tumblr; every other page is the generic extractor's. A
+ channel imported before an extractor existed is put right by a re-extract.
- An x.com / twitter.com capture is private exactly as X posts are (`social.x.visibility`): while X is private,
only a Wayback pages channel whose target is on X takes one, and a public site leaves that channel out.
- A URL the Wayback Machine answers 403 for (while it answers others) is **excluded** — "excluded from the Wayback
Machine (cause unknown)": `wayback-lookup` answers 403 with `refusal: "excluded"`, `import-page` and
- `archive-lookup` carry the same code and sentence.
+ `archive-lookup` carry the same code and sentence, and `wayback-scan` marks that target excluded (its report's
+ `refusal`, the Captures tab's line) and goes on to the next one.
### Archived pages: the Wayback Machine and archive.today
diff --git a/common/controller/waybackScan.test.ts b/common/controller/waybackScan.test.ts
@@ -205,3 +205,37 @@ test("the body and the job: refused before any job for a channel that is not a W
assert.equal(result.pass, 3, "a full pass is a new pass");
assert.equal(result.complete, true);
});
+
+test("release 38 lane C: an excluded target is answered, not failed -- marked, and the next target goes on", async () => {
+ const paths = getPaths();
+ const targets = [
+ { url: "gone.example", match: "host" as const },
+ { url: "blog.example", match: "host" as const },
+ ];
+ const wayback = { targets, collapse: "digest" as const, auto: false };
+ await channel("blog-excluded", { targets });
+ const fake = await startFakeWayback({ captures: SCAN_CAPTURES, excluded: ["gone.example"] });
+ try {
+ const c = new WaybackClient({ fetch: fake.fetch, sleep: async () => {} }, { minGapMs: 0, maxAttempts: 2 });
+ const lines: string[] = [];
+ const run = await runWaybackScan({ paths, slug: "blog-excluded", wayback, client: c, onLog: (l) => lines.push(l) });
+ assert.equal(run.ok, true, run.error);
+ assert.equal(run.stopped, undefined);
+ assert.deepEqual(run.excluded, ["gone.example"]);
+ const [gone, blog] = run.targets;
+ assert.equal(gone.refusal, "excluded");
+ assert.match(gone.error ?? "", /excluded from the Wayback Machine \(cause unknown\)/);
+ assert.equal(gone.complete, true);
+ assert.equal(gone.rows, 0);
+ assert.equal(blog.refusal, undefined);
+ assert.ok(blog.rows > 0, "the next target was listed");
+ assert.ok(lines.some((l) => /excluded from the Wayback Machine \(cause unknown\)/.test(l)), "the log says so");
+ const file = (await readWaybackScan(paths.channelsDir, "blog-excluded"))!;
+ assert.equal(file.targets[0].excluded, "excluded from the Wayback Machine (cause unknown)");
+ // A new pass asks again: the mark is cleared when the pass starts.
+ const full = await runWaybackScan({ paths, slug: "blog-excluded", wayback, client: c, full: true });
+ assert.deepEqual(full.excluded, ["gone.example"]);
+ } finally {
+ await fake.close();
+ }
+});
diff --git a/common/controller/waybackScan.ts b/common/controller/waybackScan.ts
@@ -25,7 +25,7 @@ import path from "node:path";
import type { Paths } from "../lib/paths";
import { isSafeChannelSegment } from "../lib/citations/moments";
import { ArchiveOrgRequestError } from "../lib/archiveOrgClient";
-import { WAYBACK_ORIGIN, waybackClient } from "../lib/waybackClient";
+import { WAYBACK_EXCLUDED_PHRASE, WAYBACK_ORIGIN, isWaybackExcluded, waybackClient } from "../lib/waybackClient";
import { runManagedFunction, type StreamActionResult } from "../jobs/streamCommand";
import {
keepCaptureUrl,
@@ -118,6 +118,12 @@ export type WaybackScanTargetReport = {
resumeKey?: string;
// A dry run: what the next request for this target would be.
next?: string;
+ // Release 38 lane C: the Wayback Machine answered 403 for this target's
+ // listing — "excluded from the Wayback Machine (cause unknown)". A fact about
+ // the URL, not an outage: the target is done for this pass and the run goes
+ // on to the next one.
+ refusal?: "excluded";
+ error?: string;
};
export type WaybackScanResult = {
@@ -135,6 +141,8 @@ export type WaybackScanResult = {
// Why the run stopped before every target's end: "row cap", "drained",
// "cancelled", "request cap", or the refusal.
stopped?: string;
+ // Release 38 lane C: the targets the Wayback Machine excludes (their URLs).
+ excluded?: string[];
error?: string;
path?: string;
};
@@ -188,7 +196,7 @@ export function startPass(file: WaybackScanFile, nowIso: string, incremental: bo
file.passStartedAt = nowIso;
const passFrom = incremental && !fresh ? cdxTsBefore(previous, PASS_OVERLAP_DAYS) : undefined;
file.targets = file.targets.map((t): WaybackScanTarget => {
- const { resumeKey: _r, completedAt: _c, passFrom: _p, ...rest } = t;
+ const { resumeKey: _r, completedAt: _c, passFrom: _p, excluded: _x, ...rest } = t;
return { ...rest, complete: false, rows: 0, ...(passFrom ? { passFrom } : {}) };
});
}
@@ -220,6 +228,7 @@ export async function runWaybackScan(opts: RunWaybackScanOpts): Promise<WaybackS
{ url: t.url, match: t.match, requests: 0, rows: 0, added: 0, complete: t.complete, ...(t.resumeKey ? { resumeKey: t.resumeKey } : {}) },
]),
);
+ const excluded: string[] = [];
const result = (extra: Partial<WaybackScanResult> = {}): WaybackScanResult => ({
ok: true,
slug: opts.slug,
@@ -232,6 +241,7 @@ export async function runWaybackScan(opts: RunWaybackScanOpts): Promise<WaybackS
added: [...reports.values()].reduce((n, r) => n + r.added, 0),
totalRows: file.rows.length,
complete: file.targets.every((t) => t.complete),
+ ...(excluded.length ? { excluded: [...excluded] } : {}),
...extra,
});
@@ -280,6 +290,22 @@ export async function runWaybackScan(opts: RunWaybackScanOpts): Promise<WaybackS
body = await client.cdxPage(url, opts.signal ? { signal: opts.signal } : {});
} catch (e) {
if (opts.signal?.aborted) { stopped = "cancelled"; break outer; }
+ if (isWaybackExcluded(e)) {
+ // Release 38 lane C: an excluded target is answered, not failed —
+ // done for this pass (a new pass asks again), the next target goes on.
+ t.complete = true;
+ t.completedAt = now().toISOString();
+ t.excluded = WAYBACK_EXCLUDED_PHRASE;
+ delete t.resumeKey;
+ r.complete = true;
+ r.refusal = "excluded";
+ r.error = (e as Error).message;
+ delete r.resumeKey;
+ excluded.push(t.url);
+ log(` ${WAYBACK_EXCLUDED_PHRASE}: the listing answered HTTP 403; the next target goes on`);
+ await flush();
+ break;
+ }
error = e instanceof ArchiveOrgRequestError ? e.message : `the CDX request failed: ${(e as Error).message}`;
stopped = error;
break outer;
diff --git a/common/lib/waybackPages/scanFile.ts b/common/lib/waybackPages/scanFile.ts
@@ -9,7 +9,7 @@
// summary}`.
// targets[] per target: {key, url, match, from?, to?, resumeKey?, complete,
// rows (CDX rows read this pass), lastScanAt?, completedAt?,
-// passFrom?}
+// passFrom?, excluded?}
// rows[] {originalUrl, digest, firstTs, lastTs, count, mimetype, status,
// pass (the pass that first listed it)}
// summary {pages, versions, byYear (first seen), byPrefix (first one and
@@ -49,6 +49,9 @@ export type WaybackScanTarget = {
completedAt?: string;
// The lower bound this pass asks from (a later pass only).
passFrom?: string;
+ // Release 38 lane C: this pass's listing was refused as excluded —
+ // WAYBACK_EXCLUDED_PHRASE. Cleared when a new pass starts.
+ excluded?: string;
};
export type WaybackScanRow = {
diff --git a/editor/app/api/ops/wayback-scan/route.ts b/editor/app/api/ops/wayback-scan/route.ts
@@ -21,7 +21,10 @@ export const dynamic = "force-dynamic";
// channel with no `wayback.targets`. The log ends `@@wayback-scan {slug,
// dryRun, pass, newPass, targets: [{url, match, requests, rows, added,
// complete, resumeKey?, next?}], requests, rowsRead, added, totalRows,
-// complete, stopped?, error?}`.
+// complete, stopped?, error?, excluded?}`. A target the Wayback Machine
+// answers 403 for is EXCLUDED (release 38 lane C): its report carries
+// `refusal: "excluded"` and "excluded from the Wayback Machine (cause
+// unknown)", it is done for this pass, and the run goes on to the next target.
//
// AN ADAPTER: the refusals are the controller's (controller/waybackScan.ts).
export async function POST(request: Request) {
diff --git a/editor/app/channels/[slug]/captures/components/CapturesPanel.tsx b/editor/app/channels/[slug]/captures/components/CapturesPanel.tsx
@@ -30,7 +30,7 @@ export type CapturesStatus = {
lastScanJobId?: string;
pass: number;
complete: boolean;
- targets: { url: string; match: string; complete: boolean; rows: number; resumable: boolean }[];
+ targets: { url: string; match: string; complete: boolean; rows: number; resumable: boolean; excluded?: string }[];
auto: boolean;
liveScanJobId?: string;
};
@@ -122,7 +122,7 @@ export function CapturesPanel({ slug, status, rows, matching, matchingToImport,
<ul className="text-xs text-muted-foreground flex flex-col gap-0.5" aria-label="scan targets">
{status.targets.map((t) => (
<li key={`${t.match} ${t.url}`}>
- <span className="font-mono">{t.url}</span> ({t.match}) — {t.complete ? "complete" : t.resumable ? `${n(t.rows)} rows read, continues` : "not scanned this pass"}
+ <span className="font-mono">{t.url}</span> ({t.match}) — {t.excluded ? <span data-scan-target-excluded="">{t.excluded}</span> : t.complete ? "complete" : t.resumable ? `${n(t.rows)} rows read, continues` : "not scanned this pass"}
</li>
))}
</ul>
diff --git a/editor/app/channels/[slug]/captures/page.tsx b/editor/app/channels/[slug]/captures/page.tsx
@@ -65,7 +65,7 @@ export default async function CapturesPage({
complete: scan ? wayback.targets.every((t) => scan.targets.some((s) => s.key === waybackTargetKey(t) && s.complete)) : false,
targets: wayback.targets.map((t) => {
const st = scan?.targets.find((s) => s.key === waybackTargetKey(t));
- return { url: t.url, match: t.match, complete: st?.complete ?? false, rows: st?.rows ?? 0, resumable: !!st?.resumeKey };
+ return { url: t.url, match: t.match, complete: st?.complete ?? false, rows: st?.rows ?? 0, resumable: !!st?.resumeKey, ...(st?.excluded ? { excluded: st.excluded } : {}) };
}),
auto: wayback.auto,
...(liveScan ? { liveScanJobId: liveScan.id } : {}),