commit e20c1ef8723403d30e9f103901b82cea7ec10da2
parent db0d56c067e64787080bb45403dcd8c467f35b95
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sat, 10 Oct 2026 12:14:23 -0400
reports: a cited-only channel resolves citations, publishes no corpus link
Compose's and prepare's membership checks (and missingEvidenceWindows') take
the citable set — `channels` plus `citedChannels` — so a site's reports may cite
a channel it does not publish. Its moment pages and clips publish; its
transcripts, subs, digests and corpus.json entry do not (they stay
`publishedMemberSlugs`'), and its moments carry no `corpusUrl`. A channel in
neither key is `not-in-site`, and the sentence names both keys. Compose's local
`cited` is `citedSite`. X-post visibility is unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
6 files changed, 184 insertions(+), 21 deletions(-)
diff --git a/common/lib/siteSchema.ts b/common/lib/siteSchema.ts
@@ -327,6 +327,13 @@ export function isCitedOnlyChannel(
return (site.citedChannels ?? []).some((c) => c.slug === slug);
}
+// The sentence a citation of a channel outside the citable set is refused
+// with (`not-in-site`, compose and prepare): it names both keys, since either
+// would let the site cite the channel.
+export function notInSiteMessage(slug: string): string {
+ return `channel "${slug}" is in neither this site's \`channels\` nor its \`citedChannels\``;
+}
+
// The channels whose content belongs to unlisted sites alone: exposed by at
// least one site, and by no listed one. No public total counts them. A channel
// a listed site also exposes is not here (it is credited to the listed site),
diff --git a/common/publish/composeReports.test.ts b/common/publish/composeReports.test.ts
@@ -886,3 +886,90 @@ test("a report's notes.json (umtool's operator notes) is never published, export
}
}
});
+
+// RELEASE 23 — cited-only channels (`citedChannels`). Three sites cite the same
+// report: `padded` has the video channel in its pool (today's padding, which
+// publishes the channel's corpus); `padded-private` and `padded-cited` keep it
+// in the cited scope instead (pool [SOCIAL], cited [VIDEOS]) — its moments and
+// clips publish, its corpus does not, and no moment links into a corpus.
+test("a cited-only channel: its moment pages and clips publish on the citing site, its corpus never does", async () => {
+ const pool = [{ slug: SOCIAL, groupId: "default" }];
+ const citedScope = { reports: [REPORT], channels: pool, citedChannels: [{ slug: VIDEOS }] };
+ seedSite("padded", { reports: [REPORT] });
+ seedSite("padded-private", { ...citedScope, audience: "private" });
+ seedSite("padded-cited", citedScope);
+ seedSite("unpadded", { reports: [REPORT], channels: pool });
+ await buildIndex({ paths, onLog: () => {} });
+
+ const abc = `${VIDEOS}/abc123/10.00-20.00`;
+ type Moment = { record: { corpusUrl?: string }; clip?: { src: string } };
+
+ // Padding: the channel's corpus is published, and its moments link into it.
+ await compose("padded");
+ assert.ok(existsSync(pub("transcripts", VIDEOS)));
+ assert.equal(readJson<Moment>(pub("m", abc, "moment.json")).record.corpusUrl, `/?v=${VIDEOS}%2Fabc123&t=10`);
+ // What a padded build leaves in the shared public dir, and a stray digest.
+ writeText(pub("digests", VIDEOS, "manifest.json"), "{}");
+
+ for (const siteId of ["padded-cited", "padded-private"]) {
+ await compose(siteId);
+ const files = filesUnder(paths.exportPublicDir);
+ // The cited channel's moment pages and clips publish ...
+ const span = readJson<Moment>(pub("m", abc, "moment.json"));
+ assert.equal(span.clip?.src, `/media/clips/${abc}.mp4`, siteId);
+ assert.ok(files.includes(`media/clips/${abc}.mp4`), siteId);
+ assert.ok(files.includes(`m/${VIDEOS}/def456/5.00-9.00/moment.json`), siteId);
+ // ... with no link into a corpus that does not publish it; the pool's post
+ // still links into this site's corpus.
+ assert.equal(span.record.corpusUrl, undefined, siteId);
+ assert.equal(readJson<Moment>(pub("m", SOCIAL, "3kabc", "moment.json")).record.corpusUrl, `/?v=${SOCIAL}%2F3kabc&vm=post`);
+ const view = readJson<View>(pub("reports", REPORT, "page.json"));
+ assert.equal(view.citations.c01.record?.corpusUrl, undefined, siteId);
+ assert.equal(view.citations.c02.record?.corpusUrl, undefined, siteId);
+ assert.ok(view.citations.p01.record?.corpusUrl, siteId);
+ // Its transcripts, subs and digests trees are pruned: nothing of the
+ // channel's but its moments and clips.
+ for (const tree of ["transcripts", "subs", "digests", "posts", "stats", "archives"]) {
+ assert.ok(!existsSync(pub(tree, VIDEOS)), `${siteId}: ${tree}/${VIDEOS}`);
+ }
+ assert.deepEqual(
+ files.filter((f) => f.includes(VIDEOS) && !f.startsWith(`m/${VIDEOS}/`) && !f.startsWith(`media/clips/${VIDEOS}/`)),
+ [],
+ siteId,
+ );
+ // No browse, search or contract file names it: only the report, its
+ // citations, the moment index and the sitemap do.
+ const naming = files.filter(
+ (f) =>
+ !f.startsWith("reports/") &&
+ !f.startsWith("m/") &&
+ !f.startsWith("media/") &&
+ f !== "sitemap.xml" &&
+ readFileSync(pub(f)).includes(VIDEOS),
+ );
+ assert.deepEqual(naming, [], siteId);
+ assert.ok(files.includes("summaries/manifest.json"), `${siteId}: a full site still browses its pool`);
+ // corpus.json and site.json list the pool alone.
+ const corpus = readJson<{ channels: { slug: string }[]; site: { audience?: string } }>(pub("corpus.json"));
+ assert.deepEqual(corpus.channels.map((c) => c.slug), [SOCIAL], siteId);
+ const site = readJson<{ channels: { slug: string }[] }>(pub("site.json"));
+ assert.deepEqual(site.channels.map((c) => c.slug), [SOCIAL], siteId);
+ // The sitemap lists the moment.
+ assert.match(readFileSync(pub("sitemap.xml"), "utf8"), new RegExp(`/m/${abc}/`), siteId);
+ }
+ assert.equal(readJson<{ site: { audience?: string } }>(pub("corpus.json")).site.audience, "private");
+
+ // In neither key, the channel is refused: compose names both.
+ await assert.rejects(compose("unpadded"), (e: unknown) => {
+ assert.ok(e instanceof ComposeReportsError);
+ assert.deepEqual(
+ e.problems.map((p) => [p.kind, p.citation]),
+ [
+ ["not-in-site", `${REPORT}#c01`],
+ ["not-in-site", `${REPORT}#c02`],
+ ],
+ );
+ assert.match(e.message, /"demo-channel" is in neither this site's `channels` nor its `citedChannels`/);
+ return true;
+ });
+});
diff --git a/common/publish/composeReports.ts b/common/publish/composeReports.ts
@@ -64,8 +64,14 @@ import { copyFile, mkdir, readdir, readFile, rm, stat, writeFile } from "node:fs
import path from "node:path";
import { publishFileSizeProblem } from "../lib/builtExport";
import type { Paths } from "../lib/paths";
-import { siteChannelSlugs, type Site } from "../lib/site";
-import { isCitedSite, parseSiteUrl } from "../lib/siteSchema";
+import { type Site } from "../lib/site";
+import {
+ isCitedOnlyChannel,
+ isCitedSite,
+ notInSiteMessage,
+ parseSiteUrl,
+ siteCitableChannelSlugs,
+} from "../lib/siteSchema";
import { getSettings } from "../lib/settings";
import { postsVisibleTo } from "../lib/postsVisibility";
import { assertChannelTextReadable } from "../lib/channelMedia";
@@ -474,7 +480,10 @@ export async function resolveSiteReports(opts: ResolveSiteReportsOptions): Promi
const { paths, site } = opts;
const log = opts.log ?? (() => {});
const now = (opts.now?.() ?? new Date()).toISOString();
- const cited = isCitedSite(site);
+ const citedSite = isCitedSite(site);
+ // No corpus page to link a moment to: a cited site publishes none, and a
+ // cited-only channel (`citedChannels`) is not in the site's corpus.
+ const noCorpus = (slug: string) => citedSite || isCitedOnlyChannel(site, slug);
const problems: ComposeReportsProblem[] = [];
const loaded = await loadSiteReports(paths, site);
@@ -492,7 +501,9 @@ export async function resolveSiteReports(opts: ResolveSiteReportsOptions): Promi
const momentCues = new Map<string, Cue[]>();
const settings = opts.settings ?? getSettings();
- const pool = siteChannelSlugs(site);
+ // What a report on this site may cite: the pool plus its cited-only
+ // channels. Never a publish set — only the cited moments publish.
+ const citable = siteCitableChannelSlugs(site);
const configs = new Map<string, ChannelConfig | null>();
const configOf = async (slug: string) => {
if (!configs.has(slug)) configs.set(slug, await readChannelConfig(paths, slug).catch(() => null));
@@ -528,8 +539,8 @@ export async function resolveSiteReports(opts: ResolveSiteReportsOptions): Promi
};
// Resolve and verify every citation the reports cite. A channel outside the
- // site's pool, or a post the site may not carry, is refused before its
- // record is read.
+ // site's citable set (`channels` plus `citedChannels`), or a post the site
+ // may not carry, is refused before its record is read.
const refusedChannel = new Set<string>();
for (const report of reports) {
// The report's video and its poster: on disk, and small enough to publish.
@@ -559,8 +570,8 @@ export async function resolveSiteReports(opts: ResolveSiteReportsOptions): Promi
}
continue;
}
- if (!pool.has(c.channel)) {
- problems.push({ kind: "not-in-site", citation: ref, report: report.id, message: `channel "${c.channel}" is not one of this site's channels` });
+ if (!citable.has(c.channel)) {
+ problems.push({ kind: "not-in-site", citation: ref, report: report.id, message: notInSiteMessage(c.channel) });
refusedChannel.add(c.channel);
continue;
}
@@ -662,7 +673,7 @@ export async function resolveSiteReports(opts: ResolveSiteReportsOptions): Promi
date: post.createdAt.slice(0, 10),
platform: post.platform,
originalUrl: post.url,
- corpusUrl: cited ? undefined : corpusLink(`${c.channel}/${c.id}`, { vm: "post" }),
+ corpusUrl: noCorpus(c.channel) ? undefined : corpusLink(`${c.channel}/${c.id}`, { vm: "post" }),
});
}
const { summary, archiveOrg, wayback } = (await recordOf(c.channel, c.id))!;
@@ -684,7 +695,7 @@ export async function resolveSiteReports(opts: ResolveSiteReportsOptions): Promi
originalUrl: links.original.url,
originalLabel: links.original.label,
downloads: [links.copy],
- corpusUrl: cited ? undefined : corpusLink(summary.slug ?? `${c.channel}/${summary.id}`, seconds > 0 ? { t: String(seconds) } : {}),
+ corpusUrl: noCorpus(c.channel) ? undefined : corpusLink(summary.slug ?? `${c.channel}/${summary.id}`, seconds > 0 ? { t: String(seconds) } : {}),
});
}
if (summary.platform === "archiveorg") {
@@ -701,7 +712,7 @@ export async function resolveSiteReports(opts: ResolveSiteReportsOptions): Promi
originalUrl: links.original?.url ?? (summary.webpageUrl || undefined),
originalLabel: links.original?.label,
downloads: links.downloads.length > 0 ? links.downloads : undefined,
- corpusUrl: cited ? undefined : corpusLink(summary.slug ?? `${c.channel}/${summary.id}`, seconds > 0 ? { t: String(seconds) } : {}),
+ corpusUrl: noCorpus(c.channel) ? undefined : corpusLink(summary.slug ?? `${c.channel}/${summary.id}`, seconds > 0 ? { t: String(seconds) } : {}),
});
}
return defined({
@@ -716,7 +727,7 @@ export async function resolveSiteReports(opts: ResolveSiteReportsOptions): Promi
: (platformMomentUrl(summary.webpageUrl, summary.platform as Platform, c.start) ?? undefined),
// The viewer keys a record by its PUBLISHED slug, which on a platform
// with two ids is not the data dir's name.
- corpusUrl: cited ? undefined : corpusLink(summary.slug ?? `${c.channel}/${summary.id}`, seconds > 0 ? { t: String(seconds) } : {}),
+ corpusUrl: noCorpus(c.channel) ? undefined : corpusLink(summary.slug ?? `${c.channel}/${summary.id}`, seconds > 0 ? { t: String(seconds) } : {}),
});
};
// buildReportPageView's resolver is synchronous: resolve every cited
diff --git a/common/publish/missingEvidenceWindows.test.ts b/common/publish/missingEvidenceWindows.test.ts
@@ -124,6 +124,28 @@ test("on disk, to fetch, and what no window can fill", async () => {
elsewhere: "not-in-site",
});
assert.match(r.unfetchable.find((u) => u.id === "gone1")!.message, /deleted/);
+ // The refusal names both keys that would let the site cite the channel.
+ assert.match(r.unfetchable.find((u) => u.id === "elsewhere")!.message, /`channels` nor its `citedChannels`/);
+});
+
+test("a cited-only channel (citedChannels) is citable: its window is one to fetch, not not-in-site", async () => {
+ const CITING = "demo-citing";
+ writeJson(path.join(paths.sitesDir, CITING, "site.json"), {
+ title: "Citing",
+ channels: [{ slug: CH }],
+ citedChannels: [{ slug: OFF }],
+ reports: ["r3"],
+ });
+ writeJson(
+ path.join(paths.sitesDir, CITING, "reports", "r3", "report.json"),
+ report("r3", { e01: { kind: "video", channel: OFF, id: "elsewhere", start: 5, end: 6, quote: "a critic's" } }),
+ );
+ const r = await missingEvidenceWindows(paths, CITING);
+ assert.deepEqual(r.unfetchable, []);
+ assert.deepEqual(
+ r.missing.map((m) => [m.slug, m.id, m.citations]),
+ [[OFF, "elsewhere", ["r3#e01"]]],
+ );
});
test("a site that does not exist is an error", async () => {
diff --git a/common/publish/reportMedia.test.ts b/common/publish/reportMedia.test.ts
@@ -253,3 +253,31 @@ test("a clean prepare ends by exporting the reports; a host with no browser skip
assert.deepEqual(manifest.notes, ["report.pdf skipped: no browser here", "slides.pdf skipped: no browser here"]);
assert.ok(out.some((l) => l.includes("report.pdf skipped: no browser here")));
});
+
+// RELEASE 23: a cited-only channel (`citedChannels`) is citable — its moment is
+// cut like a pool channel's — while a channel in neither key is refused with a
+// sentence naming both.
+test("a cited-only channel's moment is prepared; a channel in neither key is not-in-site, naming both keys", async () => {
+ const CITING = "demo-citing";
+ writeJson(path.join(paths.sitesDir, CITING, "site.json"), {
+ title: "Citing",
+ channels: [{ slug: X }],
+ citedChannels: [{ slug: CH }],
+ reports: ["r9"],
+ });
+ writeJson(
+ path.join(paths.sitesDir, CITING, "reports", "r9", "report.json"),
+ report("r9", {
+ c01: { kind: "video", channel: CH, id: "abc123", start: 1, end: 2, quote: "one" },
+ c02: { kind: "video", channel: "elsewhere", id: "xyz", start: 1, end: 2, quote: "five" },
+ }),
+ );
+ const index = await prepareReportMedia({ siteId: CITING, settings: PUBLIC });
+ assert.deepEqual(Object.keys(index.moments), [VIDEO_KEY]);
+ assert.equal(index.moments[VIDEO_KEY].kind, "video");
+ assert.deepEqual(
+ index.problems.map((p) => [p.kind, p.moment]),
+ [["not-in-site", "elsewhere/xyz/1.00-2.00"]],
+ );
+ assert.match(index.problems[0].message, /"elsewhere" is in neither this site's `channels` nor its `citedChannels`/);
+});
diff --git a/common/publish/reportMedia.ts b/common/publish/reportMedia.ts
@@ -15,8 +15,8 @@
// post ./citedPostCaptures.ts copies the post's screenshot
// and media — only cited posts — into the cache.
//
-// A citation must resolve against the site's own `channels` (the pool a cited
-// site's citations may draw on), and a post must be one the site may carry
+// A citation must resolve against the site's citable set — its `channels` (the
+// pool) plus its `citedChannels` (cited only) — and a post must be one the site may carry
// (lib/postsVisibility.ts — a public site never shows a private platform's
// posts, cited or not).
//
@@ -48,7 +48,15 @@ import path from "node:path";
import { readJsonFile, writeJsonAtomic } from "../lib/jsonFile-server";
import { getPaths, type Paths } from "../lib/paths";
import { getSettings } from "../lib/settings";
-import { getSite, listSiteIds, siteChannelSlugs, siteDir, siteIndexDir, type Site } from "../lib/site";
+import {
+ getSite,
+ listSiteIds,
+ notInSiteMessage,
+ siteCitableChannelSlugs,
+ siteDir,
+ siteIndexDir,
+ type Site,
+} from "../lib/site";
import { postsVisibleTo } from "../lib/postsVisibility";
import { inspectChannelMedia } from "../lib/channelMedia";
import type { ChannelConfig } from "../lib/channelConfig";
@@ -251,7 +259,7 @@ export async function prepareReportMedia(opts: PrepareReportMediaOptions): Promi
const moments = citedMoments(reports);
log(`${moments.length} cited moment(s) with media.`);
- const pool = siteChannelSlugs(site);
+ const citable = siteCitableChannelSlugs(site);
const configs = new Map<string, ChannelConfig | null>();
const configOf = async (slug: string) => {
if (!configs.has(slug)) configs.set(slug, await readChannelConfig(paths, slug));
@@ -267,8 +275,8 @@ export async function prepareReportMedia(opts: PrepareReportMediaOptions): Promi
for (const m of moments) {
if (opts.signal?.aborted) throw new Error("prepare cancelled");
const slug = m.moment.channel;
- if (!pool.has(slug)) {
- fail(m, "not-in-site", `channel "${slug}" is not one of this site's channels`);
+ if (!citable.has(slug)) {
+ fail(m, "not-in-site", notInSiteMessage(slug));
continue;
}
const config = await configOf(slug);
@@ -463,7 +471,7 @@ export async function missingEvidenceWindows(paths: Paths, siteId: string): Prom
if (typeof c.quote === "string" && c.quote.trim()) quotes.set(`${report.id}#${cid}`, c.quote.trim());
}
}
- const pool = siteChannelSlugs(site);
+ const citable = siteCitableChannelSlugs(site);
const configs = new Map<string, ChannelConfig | null>();
const configOf = async (slug: string) => {
if (!configs.has(slug)) configs.set(slug, await readChannelConfig(paths, slug));
@@ -490,8 +498,8 @@ export async function missingEvidenceWindows(paths: Paths, siteId: string): Prom
const unfetchable = (why: UnfetchableReason, message: string) =>
out.unfetchable.push({ ...window, why, message });
- if (!pool.has(slug)) {
- unfetchable("not-in-site", `channel "${slug}" is not one of this site's channels`);
+ if (!citable.has(slug)) {
+ unfetchable("not-in-site", notInSiteMessage(slug));
continue;
}
const config = await configOf(slug);