commit 60da519815592d6dfa0e54bf50684a9c5b188e51
parent 668d1c883edf6c068f187431ce2ad5710833efc0
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 18 Nov 2026 12:10:09 -0500
review 1 M2, S1: a fetcher key is not a source, and no door builds an address for a published post
M2. setPostFetcherAction refused a source-less channel nothing: it wrote
postFetcher, the predicate turned false and every guard went off. The
predicate no longer asks that key (a fetcher is how a source is read; with
no url, handle, search, library marker or page scope there is nothing to
read), the action refuses with the channel's sentence and writes nothing,
and the channel page offers no Scraping method and says why. The other
writers of a source key: Configure refuses (as before); setWaybackAuto
needs an existing wayback scope; setXSearchLeadHidden needs an X search
channel; the trending settings need a library; local media refuses a posts
channel; the rest write no source key. import-post now answers the same
sentence.
S1. findVideoSourceUrl answers null for a source-less channel, so
defaultWebpageUrl("twitter", id) is never built from one of its posts;
the fetch-windows job fails such an item "no-url" with the sentence before
any lookup, whatever address the item carries; wayback-lookup {slug, id}
refuses by name. An X account channel answers as before (pinned).
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
10 files changed, 128 insertions(+), 5 deletions(-)
diff --git a/common/controller/fetchWindows.test.ts b/common/controller/fetchWindows.test.ts
@@ -885,3 +885,29 @@ test("a local media library channel and a local recording fail local-media, and
for (const f of r.failed) assert.match(f.message ?? "", /no online source, so no clip can be fetched/);
assert.equal(r.fetched.length, 1);
});
+
+// Lane x-trending-publish, review 1 S1: posts published from a private library
+// have no page of their own. The item is failed before any URL is looked up,
+// even one that carries an address of its own; the run goes on.
+test("a source-less posts channel's window is refused with its sentence, whatever URL the item carries", async () => {
+ const PUBLISHED = { name: "Kettle Festival", handling: "transcribe", sourceKind: "social", platform: "twitter" } as never;
+ let looked = 0;
+ const h = harness({
+ readChannelConfig: async (_p, slug) => (slug === "kettle-festival" ? PUBLISHED : CONFIG),
+ findVideoSourceUrl: async () => {
+ looked++;
+ return null;
+ },
+ });
+ const r = await go(
+ await corpus(),
+ [{ ...item("1900000000000001001", "/x"), slug: "kettle-festival", webpageUrl: "https://x.com/i/status/1900000000000001001" }, { slug: "kettle-festival", id: "1900000000000001002", from: 1, to: 2 }, item("v2", "/ok")],
+ h,
+ );
+ assert.deepEqual(r.failed.map((f) => [f.class, f.message]), [
+ ["no-url", "kettle-festival holds posts published from a private library: it has no account to fetch from, and nothing is asked of X for it."],
+ ["no-url", "kettle-festival holds posts published from a private library: it has no account to fetch from, and nothing is asked of X for it."],
+ ]);
+ assert.equal(looked, 0, "no source URL was looked up for it");
+ assert.equal(r.fetched.length, 1, "the run goes on");
+});
diff --git a/common/controller/fetchWindows.ts b/common/controller/fetchWindows.ts
@@ -1,5 +1,6 @@
import path from "node:path";
import { localMediaFetchRefusal } from "../lib/localMedia";
+import { isSourcelessPostsChannel, SOURCELESS_POSTS_CHANNEL } from "../lib/sourcelessPosts";
import type { Paths } from "../lib/paths";
import type { ChannelConfig } from "../lib/channelConfig";
import type { SiteSettings } from "../lib/settings";
@@ -854,6 +855,15 @@ export async function fetchWindows({
progress();
continue;
}
+ // Posts published from a private library (lib/sourcelessPosts.ts; review 1
+ // S1): no page of its own, so no window is fetched for it — whatever
+ // address the item itself carries.
+ if (isSourcelessPostsChannel(config)) {
+ fail(item, "no-url", SOURCELESS_POSTS_CHANNEL(item.slug));
+ done += 1;
+ progress();
+ continue;
+ }
const unreadable = await textProblem(item.slug);
if (unreadable) {
fail(item, "unreachable", unreadable);
diff --git a/common/controller/sourcelessPosts.test.ts b/common/controller/sourcelessPosts.test.ts
@@ -33,6 +33,11 @@ const { capturePosts } = await import("./capturePosts");
const { checkPostAvailability } = await import("./checkPostAvailability");
const { fetchPosts } = await import("./fetchPosts");
const { isXPostsChannel, listXRunCandidates, planXRun } = await import("./xRun");
+const { findVideoSourceUrl } = await import("./undownloadedVideos");
+const { recordWebpageUrl } = await import("../publish/findCopy");
+const { planImportPost } = await import("../social/importPost");
+const { defaultWebpageUrl } = await import("../lib/platform");
+const { readChannelConfig } = await import("./channels");
const paths = getPaths();
const settings = {} as never;
@@ -58,6 +63,11 @@ await createChannel(paths, "teapot-x", { name: "Teapot (X)", handling: "transcri
await writePosts(path.join(paths.channelsDir, "kettle-festival"), [
{ id: "801", slug: "kettle-festival/801", channelSlug: "kettle-festival", author: "teapot_news", createdAt: "2026-11-16T12:00:00.000Z", uploadDate: "20261116", text: "words", url: "https://x.com/teapot_news/status/801", platform: "twitter", isReply: false, isRepost: false, links: [] },
]);
+// The same channel after some hand gave it a fetcher key.
+await createChannel(paths, "kettle-keyed", { ...PUBLISHED, postFetcher: "x-gallery-dl" });
+await writePosts(path.join(paths.channelsDir, "kettle-keyed"), [
+ { id: "801", slug: "kettle-keyed/801", channelSlug: "kettle-keyed", author: "teapot_news", createdAt: "2026-11-16T12:00:00.000Z", uploadDate: "20261116", text: "words", url: "https://x.com/teapot_news/status/801", platform: "twitter", isReply: false, isRepost: false, links: [] },
+]);
const SENTENCE = SOURCELESS_POSTS_CHANNEL("kettle-festival");
test("the shape: an X posts channel with no account, search, page or marker — and no other", () => {
@@ -65,7 +75,6 @@ test("the shape: an X posts channel with no account, search, page or marker —
for (const other of [
{ ...PUBLISHED, url: "https://x.com/teapot_news" },
{ ...PUBLISHED, socialHandle: "teapot_news" },
- { ...PUBLISHED, postFetcher: "x-gallery-dl" },
{ ...PUBLISHED, xSearch: { query: "kettles" } },
{ ...PUBLISHED, xTrending: {} },
{ ...PUBLISHED, platform: "bluesky" },
@@ -76,6 +85,8 @@ test("the shape: an X posts channel with no account, search, page or marker —
]) {
assert.equal(isSourcelessPostsChannel(other as never), false, JSON.stringify(other));
}
+ // A FETCHER KEY IS NOT A SOURCE (review 1 M2): writing one cannot switch the guards off.
+ assert.equal(isSourcelessPostsChannel({ ...PUBLISHED, postFetcher: "x-gallery-dl" } as never), true);
assert.match(SENTENCE, /^kettle-festival holds posts published from a private library: it has no account to fetch from/);
});
@@ -110,3 +121,32 @@ test("where channels are listed it is left out, with its reason: an X run's cand
assert.equal(fetcherCalls, 0);
assert.equal(existsSync(TOUCHED), false);
});
+
+// Review 1 M2.
+test("a fetcher key written onto it changes nothing: every door still refuses, and no fetcher is called", async () => {
+ const says = SOURCELESS_POSTS_CHANNEL("kettle-keyed");
+ assert.equal((await fetchPosts({ paths, slug: "kettle-keyed", settings } as never)).error, says);
+ assert.equal((await capturePosts({ paths, slug: "kettle-keyed", settings, ids: ["801"] } as never)).error, says);
+ assert.equal((await checkPostAvailability({ paths, slug: "kettle-keyed" } as never)).error, says);
+ assert.deepEqual(await planXRun(paths, { channels: ["kettle-keyed"] }), { ok: false, error: says });
+ assert.deepEqual((await listXRunCandidates(paths)).map((c) => c.slug), ["teapot-x"]);
+ assert.equal(syncSkipForShape({ ...PUBLISHED, postFetcher: "x-gallery-dl" } as never), "published posts: no account to fetch from");
+ assert.equal(fetcherCalls, 0);
+ assert.equal(existsSync(TOUCHED), false);
+});
+
+// Review 1 S1.
+test("no source URL is ever built for one of its posts, and import-post is refused; an account channel answers as before", async () => {
+ for (const slug of ["kettle-festival", "kettle-keyed"]) {
+ assert.equal(await findVideoSourceUrl(paths, slug, "801"), null, `${slug}, config read`);
+ assert.equal(await findVideoSourceUrl(paths, slug, "801", (await readChannelConfig(paths, slug))!), null, `${slug}, config handed in`);
+ assert.equal(await recordWebpageUrl(paths, slug, "801"), null, `${slug}: nothing for a Wayback lookup`);
+ const imported = await planImportPost(paths, slug, "https://x.com/teapot_news/status/1900000000000001001");
+ assert.deepEqual(imported, { ok: false, error: SOURCELESS_POSTS_CHANNEL(slug) });
+ }
+ // CONTROL: an X account channel still gets the address built from its platform and the id.
+ const built = defaultWebpageUrl("twitter", "801");
+ assert.ok(built, "the platform builds an address from an id");
+ assert.equal(await findVideoSourceUrl(paths, "teapot-x", "801", (await readChannelConfig(paths, "teapot-x"))!), built);
+ assert.equal(fetcherCalls, 0);
+});
diff --git a/common/controller/undownloadedVideos.ts b/common/controller/undownloadedVideos.ts
@@ -1,4 +1,5 @@
import path from "node:path";
+import { isSourcelessPostsChannel } from "../lib/sourcelessPosts";
import { readChannelConfig } from "./channels";
import { localMediaFetchRefusal } from "../lib/localMedia";
import { readFile } from "node:fs/promises";
@@ -33,6 +34,12 @@ export async function findVideoSourceUrl(
if (localMediaFetchRefusal(slug, config ?? (await readChannelConfig(paths, slug).catch(() => null)), videoId)) {
return null;
}
+ // POSTS PUBLISHED FROM A PRIVATE LIBRARY (lib/sourcelessPosts.ts; review 1
+ // S1): no account, no page. Null, so no door — transcribe-one, a clip
+ // window, a persist, a redownload, a Wayback lookup — is handed
+ // `defaultWebpageUrl("twitter", id)` built from the channel's platform and
+ // a post's id. Any other posts channel answers as before.
+ if (isSourcelessPostsChannel(config ?? (await readChannelConfig(paths, slug).catch(() => null)))) return null;
const metaPath = path.join(channelRoot, "data", videoId, "metadata.info.json");
try {
const raw = await readFile(metaPath, "utf8");
diff --git a/common/lib/sourcelessPosts.ts b/common/lib/sourcelessPosts.ts
@@ -1,5 +1,9 @@
// A POSTS CHANNEL WITH NO SOURCE (lane x-trending-publish): an X posts
// channel that names no account, no search and no page — nothing to fetch.
+// A `postFetcher` key does not make a source (review 1 M2): a fetcher is HOW
+// a source is read, and with no url, handle, search, library marker or page
+// scope there is nothing for it to read. So that key is not asked, and
+// writing it cannot switch this predicate, and every guard that asks it, off.
// Its posts were PUT there: a topic of a private library, published by the
// operator (controller/publishXTrending.ts). The channel carries no mark of
// that; it is told by its shape alone, and by this one predicate.
@@ -13,11 +17,11 @@
import { isRemoteOnlyChannel, isSocialChannel, type ChannelConfig } from "./channelConfig";
type Shape = Pick<ChannelConfig, "sourceKind" | "platform"> &
- Partial<Pick<ChannelConfig, "url" | "socialHandle" | "postFetcher" | "xSearch" | "xTrending" | "wayback" | "remoteOnly">>;
+ Partial<Pick<ChannelConfig, "url" | "socialHandle" | "xSearch" | "xTrending" | "wayback" | "remoteOnly">>;
export function isSourcelessPostsChannel(config: Shape | null | undefined): boolean {
if (!config || !isSocialChannel(config) || config.platform !== "twitter") return false;
- if (config.url || config.socialHandle || config.postFetcher) return false;
+ if (config.url || config.socialHandle) return false;
if (config.xSearch || config.xTrending || config.wayback) return false;
return !isRemoteOnlyChannel(config);
}
diff --git a/common/social/importPost.ts b/common/social/importPost.ts
@@ -17,6 +17,7 @@
// platform's queue, so it never runs beside a fetch of the same source.
// A post already archived is not read again.
+import { isSourcelessPostsChannel, SOURCELESS_POSTS_CHANNEL } from "../lib/sourcelessPosts";
import path from "node:path";
import type { Paths } from "../lib/paths";
import type { Post } from "../lib/posts";
@@ -73,6 +74,8 @@ export async function planImportPost(
if (!isSocialChannel(config)) {
return { ok: false, error: `${slug} is not a posts channel; import-post imports into a channel that archives an account's posts` };
}
+ // Posts published from a private library: nothing is asked of X for it.
+ if (isSourcelessPostsChannel(config)) return { ok: false, error: SOURCELESS_POSTS_CHANNEL(slug) };
const fetcher = (opts.fetcherFor ?? ((c) => resolveSocialFetcher(c.postFetcher, c.url)))(config);
if (!fetcher) return { ok: false, error: `${slug} has no post fetcher` };
const want = PLATFORM_LABEL[ref.platform] ?? ref.platform;
diff --git a/editor/app/api/ops/publish-trending/route.test.ts b/editor/app/api/ops/publish-trending/route.test.ts
@@ -149,3 +149,25 @@ test("the library's accounts, and Archive this account as a dry run: <handle>-x,
assert.match((await post(LEAD, "x-search-lead", { slug: "trending", handle: "saucer_fan", action: "never" })).json.error, /is not an X search channel/);
assert.equal(await exists(path.join(ROOT, "channels", "saucer_fan-x")), false, "a dry run creates nothing");
});
+
+// Review 1 M2 and S1: the published channel cannot be given a fetcher, and no door builds an address for one of its posts.
+test("the published channel: Scraping method is refused and writes nothing; a Wayback lookup and transcribe-one of one of its posts are refused", async () => {
+ const SLUG = "kettle-festival-2026";
+ const SAYS = `${SLUG} holds posts published from a private library: it has no account to fetch from, and nothing is asked of X for it.`;
+ const { setPostFetcherAction } = await import("../../../channels/[slug]/socialActions");
+ const before = await readFile(path.join(ROOT, "channels", SLUG, "config.json"), "utf8");
+ for (const fetcher of ["x-gallery-dl", "x-playwright", "nope"]) {
+ assert.deepEqual(await setPostFetcherAction(SLUG, fetcher), { ok: false, error: SAYS });
+ }
+ assert.equal(await readFile(path.join(ROOT, "channels", SLUG, "config.json"), "utf8"), before, "no key was written");
+
+ const WAYBACK = (await import("../wayback-lookup/route")).POST;
+ const looked = await post(WAYBACK, "wayback-lookup", { slug: SLUG, id: A });
+ assert.equal(looked.status, 400);
+ assert.equal(looked.json.error, SAYS);
+
+ const TRANSCRIBE = (await import("../transcribe-one/route")).POST;
+ const transcribed = await post(TRANSCRIBE, "transcribe-one", { slug: SLUG, id: A });
+ assert.ok(transcribed.status >= 400, JSON.stringify(transcribed.json));
+ assert.equal(transcribed.json.jobId, undefined, "no job was made");
+});
diff --git a/editor/app/api/ops/wayback-lookup/route.ts b/editor/app/api/ops/wayback-lookup/route.ts
@@ -2,6 +2,8 @@ import { NextResponse } from "next/server";
import { ArchiveOrgRequestError } from "yt-dlp-transcript-common/lib/archiveOrgClient";
import { isWaybackExcluded } from "yt-dlp-transcript-common/lib/waybackClient";
import { getPaths } from "yt-dlp-transcript-common/lib/paths";
+import { readChannelConfig } from "yt-dlp-transcript-common/controller/channels";
+import { isSourcelessPostsChannel, SOURCELESS_POSTS_CHANNEL } from "yt-dlp-transcript-common/lib/sourcelessPosts";
import { recordWebpageUrl, waybackLookup } from "yt-dlp-transcript-common/publish/findCopy";
import { OpsInputError, ops, opsFail, optBool, optPositiveInt, optString, reqSlug, reqVideoId } from "../_lib";
@@ -35,6 +37,9 @@ export async function POST(request: Request) {
} else if (hasRecord) {
const slug = reqSlug(body, "slug");
const id = reqVideoId(body, "id");
+ // Posts published from a private library have no page of their own to
+ // look up (review 1 S1): refused by name, before any address is built.
+ if (isSourcelessPostsChannel(await readChannelConfig(getPaths(), slug))) return opsFail(SOURCELESS_POSTS_CHANNEL(slug));
const found = await recordWebpageUrl(getPaths(), slug, id);
if (!found) return opsFail(`no page is known for ${slug}/${id} (no metadata, availability check or playlist entry names one)`, 404);
url = found;
diff --git a/editor/app/channels/[slug]/page.tsx b/editor/app/channels/[slug]/page.tsx
@@ -43,6 +43,7 @@ import { savePageNowAvailability } from "yt-dlp-transcript-common/controller/sav
import { isWaybackPagesChannel } from "yt-dlp-transcript-common/lib/waybackPages/config";
import { isXSearchChannel } from "yt-dlp-transcript-common/lib/xSearch/config";
import { isXTrendingChannel, xTrendingLimits } from "yt-dlp-transcript-common/lib/xTrending/config";
+import { isSourcelessPostsChannel, SOURCELESS_POSTS_CHANNEL } from "yt-dlp-transcript-common/lib/sourcelessPosts";
import { listXTrending, X_TRENDING_LIST_MAX } from "yt-dlp-transcript-common/lib/xTrending/store";
import { XTrendingPanel } from "./components/XTrendingPanel";
import { describeXSearchWalk } from "yt-dlp-transcript-common/lib/xSearch/walk";
@@ -301,9 +302,11 @@ export default async function ChannelDetailPage({
lastFetchedCount: fetchState?.lastFetchedCount,
lastError: fetchState?.lastError,
needsCookies: fetchState?.needsCookies,
- fetcherLabel: fetcher?.label ?? "no fetcher configured",
+ // Posts published from a private library: no source, so no fetcher
+ // to choose (the select is not offered) and the sentence says why.
+ fetcherLabel: isSourcelessPostsChannel(config) ? SOURCELESS_POSTS_CHANNEL(slug) : (fetcher?.label ?? "no fetcher configured"),
fetcherId: fetcher?.id ?? "",
- availableFetchers: await listPostFetchersFor(config.platform ?? ""),
+ availableFetchers: isSourcelessPostsChannel(config) ? [] : await listPostFetchersFor(config.platform ?? ""),
deletedCount: availabilityRecords.filter((r) =>
isPostGone(r.availability),
).length,
diff --git a/editor/app/channels/[slug]/socialActions.ts b/editor/app/channels/[slug]/socialActions.ts
@@ -104,6 +104,9 @@ export async function setPostFetcherAction(
if (!isSocialChannel(config)) {
return { ok: false, error: `${slug} is not a social channel.` };
}
+ // Posts published from a private library have no source for a fetcher to
+ // read (review 1 M2): the key is not written.
+ if (isSourcelessPostsChannel(config)) return { ok: false, error: SOURCELESS_POSTS_CHANNEL(slug) };
await registerBuiltinSocialFetchers();
const wanted = fetcherId.trim();
const fetcher = getSocialFetcher(wanted);