Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 70d18eb9a9c87a7161156908ac4b11e278725851
parent bac70970c5ddf868d9b8c7c02524a07d7d31174d
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue, 29 Sep 2026 21:47:10 -0400

Merge r14/hidden-sites (release 14 slice HS) — hidden sites: site.json `listed` (default true, only false written); an unlisted site builds and deploys and is listed nowhere public — homepage cards, chart, stats and totals, channel-sites.json, the pooled stats, the hub's members, corpus.json and llms.txt, every sibling's footer; a shared channel is credited to the listed site; one checkbox in the site form; reviewed SHIP

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

Diffstat:
MSITE.md | 7+++++++
Mcommon/bin/compose-homepage.ts | 11+++++++++--
Mcommon/bin/compose-hub.test.ts | 40++++++++++++++++++++++++++++++++++++++++
Mcommon/bin/compose-hub.ts | 12++++++++----
Mcommon/controller/buildStats.test.ts | 57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mcommon/controller/buildStats.ts | 39+++++++++++++++++++++++++++++----------
Acommon/controller/poolSummary.test.ts | 28++++++++++++++++++++++++++++
Mcommon/controller/poolSummary.ts | 16++++++++++------
Mcommon/lib/homepageSummary.test.ts | 67+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mcommon/lib/homepageSummary.ts | 55++++++++++++++++++++++++++++++++++++++-----------------
Mcommon/lib/site.ts | 7+++++--
Mcommon/lib/siteSchema.test.ts | 60+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
Mcommon/lib/siteSchema.ts | 37+++++++++++++++++++++++++++++++++++++
Meditor/CHANGELOG.md | 1+
Meditor/app/sites/actions.ts | 5+++++
Meditor/app/sites/components/SiteForm.tsx | 16++++++++++++++++
Meditor/e2e/helpers.ts | 1+
Meditor/e2e/sites-crud.spec.ts | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mexport/CHANGELOG.md | 1+
Mhomepage/CHANGELOG.md | 1+
Mhomepage/e2e/fixture-summary.ts | 63++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
Ahomepage/e2e/unlisted-site.spec.ts | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mplans/FACTS.md | 10++++++++++
Mplans/release-14.md | 238++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
24 files changed, 832 insertions(+), 57 deletions(-)

diff --git a/SITE.md b/SITE.md @@ -23,6 +23,7 @@ Regenerate this file with `pnpm --filter yt-dlp-transcript-common exec tsx bin/f | [`cloudflareProject`](#cloudflareproject) | absent | | [`accent`](#accent) | absent | | [`siteUrl`](#siteurl) | absent | +| [`listed`](#listed) | `true` | | [`relatedSites`](#relatedsites) | `[]` | | [`pwa`](#pwa) | `false` | | [`archives`](#archives) | `true` | @@ -157,6 +158,12 @@ Absolute public URL of this site's deployment, e.g. `https://jeralyzer.pages.dev Default: absent +## `listed` + +Whether the family lists this site. Opt-OUT: absent/true = listed, only an explicit `false` is written. An unlisted site still builds and deploys as before, and its own pages are unchanged; it is left out of the homepage (cards, chart, `/stats`), the hub (members, federated search, `/corpus.json`, `/llms.txt`), every other site's footer, and the published `channel-sites.json` and pooled `stats/`. A channel only unlisted sites expose is in none of the family's public totals; a channel a listed site also exposes is credited to the listed one. + +Default: `true` + ## `relatedSites` Pulls specific siblings to the front of the footer's cross-site list, in named groups. Siblings not named here fall into a trailing "Other sites" group. Absent/empty = one flat list of every sibling. diff --git a/common/bin/compose-homepage.ts b/common/bin/compose-homepage.ts @@ -8,6 +8,9 @@ // public/channel-sites.json <- channel slug -> [siteId, ...] // public/homepage-summary.json <- small cross-site landing summary // +// None of the three names an unlisted site (site.json `listed: false`) or holds +// a channel only unlisted sites expose (lib/siteSchema.ts isListedSite). +// // Requires build:index to have populated the cues LMDB first (the homepage // prebuild chains it), same as the export pipeline. @@ -15,6 +18,7 @@ import path from "node:path"; import { getPaths, type Paths } from "../lib/paths"; import { writeJsonAtomic as writeJsonAtomicShared } from "../lib/jsonFile-server"; import { buildPoolSummary } from "../controller/poolSummary"; +import { isListedSite } from "../lib/site"; import { runIfEntryPoint } from "./_cli"; // Where the homepage Next.js app serves static assets from. Overridable for e2e @@ -45,7 +49,7 @@ export async function main(opts: { paths?: Paths } = {}): Promise<void> { statsDir, }); - // channel slug -> the ids of the content sites that expose it. Drives + // channel slug -> the ids of the listed content sites that expose it. Drives // `groupBy: "site"` in the hub's dashboard (see channelSites.tsx). await writeJsonAtomic( path.join(publicDir, "channel-sites.json"), @@ -60,8 +64,11 @@ export async function main(opts: { paths?: Paths } = {}): Promise<void> { summary, ); + const unlisted = sites.filter((s) => !isListedSite(s)).length; console.log( - `compose-homepage: ${Object.keys(channelSites).length} channel(s) mapped across ${sites.length} site(s); ` + + `compose-homepage: ${Object.keys(channelSites).length} channel(s) mapped across ${sites.length - unlisted} listed site(s)` + + (unlisted > 0 ? ` (${unlisted} unlisted left out)` : "") + + "; " + `summary covers ${summary.totals.transcripts} transcription(s) / ${summary.totals.downloads} download(s) ` + `across ${summary.sites.length} public site(s) into ${publicDir}.`, ); diff --git a/common/bin/compose-hub.test.ts b/common/bin/compose-hub.test.ts @@ -130,3 +130,43 @@ test("in a worktree, compose-hub writes its own files and never through the link rmSync(root, { recursive: true, force: true }); } }); + +// Release 14 slice HS: an unlisted site builds and deploys, and the hub does +// not list it — not a member, so not in federated search, corpus.json or +// llms.txt. +test("an unlisted site is in none of the hub's files; a listed one is in each", async () => { + const root = mkdtempSync(path.join(tmpdir(), "compose-hub-")); + const log = console.log; + try { + const paths = fixturePaths(root); + const write = (id: string, site: Record<string, unknown>) => { + mkdirSync(path.join(paths.sitesDir, id), { recursive: true }); + writeFileSync(path.join(paths.sitesDir, id, "site.json"), JSON.stringify(site)); + }; + write("fixture-shown", { siteTitle: "Shown Fixture", siteUrl: "https://fixture-shown.example" }); + write("fixture-unlisted", { + siteTitle: "Unlisted Fixture", + siteUrl: "https://fixture-unlisted.example", + listed: false, + }); + const lines: string[] = []; + console.log = (...a: unknown[]) => void lines.push(a.join(" ")); + await main({ paths }); + console.log = log; + const pool = JSON.parse( + readFileSync(path.join(paths.exportPublicDir, "hub-sites.json"), "utf8"), + ) as Array<{ siteId: string }>; + assert.deepEqual(pool.map((s) => s.siteId), ["fixture-shown"]); + for (const f of ["hub-sites.json", "corpus.json", "llms.txt"]) { + const text = readFileSync(path.join(paths.exportPublicDir, f), "utf8"); + assert.ok(text.includes("fixture-shown.example"), `${f} lists the listed site`); + for (const needle of ["fixture-unlisted", "Unlisted Fixture"]) { + assert.ok(!text.includes(needle), `${f} names ${needle}`); + } + } + assert.match(lines.join("\n"), /compose-hub: 1 built-in pool site\(s\)/); + } finally { + console.log = log; + rmSync(root, { recursive: true, force: true }); + } +}); diff --git a/common/bin/compose-hub.ts b/common/bin/compose-hub.ts @@ -4,7 +4,8 @@ // there is no SITE_ID and no per-site data: the hub is a federating shell that // reads every archive cross-origin at runtime. It emits: // -// public/hub-sites.json <- the built-in trusted pool (listSites with a siteUrl) +// public/hub-sites.json <- the built-in trusted pool (listSites with a siteUrl, +// listed — site.json `listed`, isListedSite) // public/hub-summary.json <- the official instances' numbers, the homepage's // own (lib/hubSummary.ts) — OPTIONAL: skipped when // there is no index to walk @@ -19,7 +20,7 @@ import { existsSync } from "node:fs"; import { cp, rm, access } from "node:fs/promises"; import { getPaths, type Paths } from "../lib/paths"; import { accentHex } from "../lib/accent"; -import { listSites, resolveHubUrl } from "../lib/site"; +import { isListedSite, listSites, resolveHubUrl } from "../lib/site"; import { getHomepageConfig } from "../lib/homepage"; import { SITE_DESCRIPTOR_VERSION } from "../lib/siteDescriptor"; import { @@ -79,7 +80,10 @@ export async function main(opts: { paths?: Paths } = {}): Promise<void> { const paths = opts.paths ?? getPaths(); const publicDir = paths.exportPublicDir; - // Built-in pool: every configured site that publishes a public URL. The entry + // Built-in pool: every configured site that publishes a public URL and is + // listed. An unlisted site (`listed: false`) still builds and deploys, but the + // hub does not list it: not a member, not in federated search, not in the + // hub's corpus.json or llms.txt (both are built from this list). The entry // the hub registry loads at boot to seed its trusted built-in pool, and the // input buildHubCorpus maps — ONE type for both (lib/archive/contract.ts // HubMemberInput), where this file used to restate it as a local @@ -88,7 +92,7 @@ export async function main(opts: { paths?: Paths } = {}): Promise<void> { // a siteUrl can't be federated and is dropped — by both consumers. const builtins: HubMemberInput[] = []; for (const site of listSites(paths)) { - if (!site.siteUrl) continue; + if (!site.siteUrl || !isListedSite(site)) continue; builtins.push({ siteId: site.siteId, siteTitle: site.siteTitle, diff --git a/common/controller/buildStats.test.ts b/common/controller/buildStats.test.ts @@ -65,6 +65,7 @@ const { buildIndex } = await import("./buildIndex"); const { buildStats, STATS_DOWNGRADE_ENV } = await import("./buildStats"); const { normalizeTranscript } = await import("./normalizeTranscript"); const { readStatsPages } = await import("./poolSummary"); +const { siteStatsDir } = await import("../lib/site"); const { STATS_SCHEMA_VERSION } = await import("../lib/stats"); const { open } = await import("lmdb"); @@ -594,6 +595,62 @@ test("(j) the schema guard: an older cache is cleared, a newer one is refused un } }); +// Release 14 slice HS: the whole-pool bundle is published as the homepage's +// `stats/`, and an unlisted site's content is in no public total. +test("(k) the whole-pool bundle leaves out a channel only an unlisted site exposes; the site's own bundle keeps it", async () => { + resetCorpus(); + const seedChannel = (slug: string, ids: string[]) => { + writeJson(path.join(paths.channelsDir, slug, "config.json"), { + handling: "youtube", + name: slug, + url: `https://www.youtube.com/@${slug}/videos`, + }); + for (const id of ids) { + seedVideo(id, "2026-07-11T11:00:00Z", {}, slug); + addCaptions(id, "2026-07-11T12:00:00Z", slug); + } + }; + seedVideo("listed-1"); + seedChannel("unlisted-channel", ["u1", "u2"]); + seedChannel("shared-channel", ["s1"]); + seedChannel("pool-channel", ["p1"]); + // The listed site also exposes the shared channel; the unlisted site exposes + // its own channel and the shared one. The pool channel is on no site. + const siteFile = path.join(paths.sitesDir, SITE, "site.json"); + const listed = JSON.parse(readFileSync(siteFile, "utf8")); + listed.channels.push({ slug: "shared-channel", groupId: "default" }); + writeJson(siteFile, listed); + writeJson(path.join(paths.sitesDir, "fixture-unlisted", "site.json"), { + ...listed, + siteId: "fixture-unlisted", + siteTitle: "Unlisted", + headerTitle: "Unlisted", + siteUrl: "https://unlisted.example", + listed: false, + channels: [ + { slug: "unlisted-channel", groupId: "default" }, + { slug: "shared-channel", groupId: "default" }, + ], + }); + await runIndex(); + const log: string[] = []; + const { byId } = await runStats(log); + assert.deepEqual([...byId.keys()].sort(), ["listed-1", "p1", "s1"]); + const manifest = JSON.parse(readFileSync(path.join(POOL, "manifest.json"), "utf8")); + assert.equal(manifest.totalCount, 3); + assert.deepEqual( + manifest.channels.map((c: { slug: string }) => c.slug), + ["pool-channel", "shared-channel", CHANNEL], + ); + assert.ok( + log.includes("Stats whole-pool: 3 videos, 1 page(s); 1 channel(s) only unlisted sites expose left out."), + log.join("\n"), + ); + // The unlisted site still builds as before: its own bundle has its videos. + const own = await readStatsPages(siteStatsDir(paths, "fixture-unlisted")); + assert.deepEqual(own.map((s) => s.id).sort(), ["s1", "u1", "u2"]); +}); + test("(z) no write this file caused landed outside its temp root", () => { // LMDB writes natively, past the spy: its file must be under the root too. assert.ok(paths.lmdbPath.startsWith(ROOT + path.sep), paths.lmdbPath); diff --git a/common/controller/buildStats.ts b/common/controller/buildStats.ts @@ -72,7 +72,11 @@ import { } from "../lib/channelMediaHold"; import { getSettings } from "../lib/settings"; import type { Paths } from "../lib/paths"; -import { listSites, siteStatsDir } from "../lib/site"; +import { + channelsOnlyOnUnlistedSites, + listSites, + siteStatsDir, +} from "../lib/site"; import { INDEX_SCANNED_AT_KEY, STATS_SCHEMA_VERSION, @@ -171,11 +175,12 @@ export type BuildStatsOptions = { paths: Paths; onLog?: (msg: string) => void; signal?: AbortSignal; - // When set, also write an UNFILTERED whole-pool stats bundle (every non- - // excluded channel) into this dir as {manifest,page-NNNN}.json. Used by the - // Archilyzer hub (compose-homepage), whose cross-site charts need the full - // dataset rather than any one site's filtered slice. Forces collection of the - // full dataset even when no per-site bundle needs a rebuild. + // When set, also write a whole-pool stats bundle (every non-excluded + // channel, but for those only unlisted sites expose) into this dir as + // {manifest,page-NNNN}.json. Used by the Archilyzer hub (compose-homepage), + // whose cross-site charts need the full dataset rather than any one site's + // filtered slice. Forces collection of the full dataset even when no per-site + // bundle needs a rebuild. wholePoolStatsDir?: string; }; @@ -707,16 +712,25 @@ export async function buildStats({ log(`Stats site ${plan.site.siteId}: ${filtered.length} videos, ${pageCount} page(s).`); } - // Whole-pool bundle for the hub: every non-excluded channel, unfiltered. Built + // Whole-pool bundle for the hub: every non-excluded channel, except a channel + // only unlisted sites expose (site.json `listed: false`): the bundle is + // published as the homepage's `stats/`, and an unlisted site's content is in + // no public total. Its own per-site bundle above is built as before. Built // from the same in-memory dataset so it stays consistent with the per-site // bundles. Always rewritten when requested (stats records are small). if (wholePoolStatsDir) { + const unlistedOnly = channelsOnlyOnUnlistedSites(sites); + const pooled = + unlistedOnly.size > 0 + ? all.filter((s) => !unlistedOnly.has(s.channelSlug)) + : all; const { pageCount } = await writePages( wholePoolStatsDir, - all, + pooled, STATS_MAX_PAGE_BYTES, ); const channelEntries: StatsChannelEntry[] = [...channels.keys()] + .filter((slug) => !unlistedOnly.has(slug)) .map((slug) => ({ slug, name: channels.get(slug)?.name ?? slug, @@ -726,13 +740,18 @@ export async function buildStats({ const manifest: StatsManifest = { version: STATS_MANIFEST_VERSION, generatedAt: new Date().toISOString(), - totalCount: all.length, + totalCount: pooled.length, pageCount, maxPageBytes: STATS_MAX_PAGE_BYTES, channels: channelEntries, }; await writeJsonAtomic(path.join(wholePoolStatsDir, "manifest.json"), manifest); - log(`Stats whole-pool: ${all.length} videos, ${pageCount} page(s).`); + log( + `Stats whole-pool: ${pooled.length} videos, ${pageCount} page(s)` + + (unlistedOnly.size > 0 + ? `; ${unlistedOnly.size} channel(s) only unlisted sites expose left out.` + : "."), + ); } // Prune fingerprints for sites that no longer exist (their staging dirs are diff --git a/common/controller/poolSummary.test.ts b/common/controller/poolSummary.test.ts @@ -0,0 +1,28 @@ +import { test } from "node:test"; +import assert from "node:assert/strict"; +import { parseSite } from "../lib/siteSchema"; +import { channelSitesOf } from "./poolSummary"; + +// Run with: +// pnpm --filter yt-dlp-transcript-common test +// +// channelSitesOf is the published `channel-sites.json` (compose-homepage) and +// the map the summary attributes channels by. Release 14 slice HS: an unlisted +// site (site.json `listed: false`) is in neither. + +test("channel-sites.json names listed sites only; a channel only an unlisted site exposes is absent", () => { + const sites = [ + parseSite("fixture-a", { channels: [{ slug: "a1" }, { slug: "shared" }] }), + parseSite("fixture-b", { channels: [{ slug: "b1" }, { slug: "shared" }] }), + parseSite("fixture-unlisted", { + listed: false, + channels: [{ slug: "shared" }, { slug: "own" }], + }), + ]; + assert.deepEqual(channelSitesOf(sites), { + a1: ["fixture-a"], + shared: ["fixture-a", "fixture-b"], + b1: ["fixture-b"], + }); + assert.ok(!JSON.stringify(channelSitesOf(sites)).includes("fixture-unlisted")); +}); diff --git a/common/controller/poolSummary.ts b/common/controller/poolSummary.ts @@ -11,7 +11,7 @@ import path from "node:path"; import { mkdir, readFile } from "node:fs/promises"; import type { Paths } from "../lib/paths"; import { buildStats } from "./buildStats"; -import { listSites, type Site } from "../lib/site"; +import { isListedSite, listSites, type Site } from "../lib/site"; import { statsPageFileName, type StatsManifest, @@ -45,11 +45,14 @@ export async function readStatsPages(statsDir: string): Promise<VideoStat[]> { return out; } -// channel slug -> the ids of the content sites that expose it. A channel on -// multiple sites maps to all of them; a pool-only channel is simply absent. -export function channelSitesOf(sites: Site[]): ChannelSitesMap { +// channel slug -> the ids of the LISTED content sites that expose it: the +// published `channel-sites.json`. A channel on multiple sites maps to all of +// them; a pool-only channel is simply absent, and so is an unlisted site +// (site.json `listed: false`) and a channel only unlisted sites expose. +export function channelSitesOf(sites: readonly Site[]): ChannelSitesMap { const channelSites: ChannelSitesMap = {}; for (const site of sites) { + if (!isListedSite(site)) continue; for (const c of site.channels) { (channelSites[c.slug] ??= []).push(site.siteId); } @@ -71,8 +74,9 @@ export async function buildPoolSummary(opts: { }): Promise<PoolSummary> { const { paths, statsDir } = opts; await mkdir(statsDir, { recursive: true }); - // Whole-pool stats dataset (every non-excluded channel). buildStats also - // refreshes the per-site bundles as a side effect, which is harmless. + // Whole-pool stats dataset (every non-excluded channel but those only + // unlisted sites expose). buildStats also refreshes the per-site bundles as a + // side effect, which is harmless. await buildStats({ paths, wholePoolStatsDir: statsDir }); const sites = listSites(paths); const channelSites = channelSitesOf(sites); diff --git a/common/lib/homepageSummary.test.ts b/common/lib/homepageSummary.test.ts @@ -277,3 +277,70 @@ test("a site's wordmark lead travels when it is a proper prefix of the title; ot assert.ok(plain.sites.every((x) => !("wordmarkLead" in x))); assert.equal(s.version, HOMEPAGE_SUMMARY_VERSION); }); + +// Release 14 slice HS: site.json `listed: false`. The site still builds and +// deploys; the family's public pages do not list it, and no public total counts +// the channels only it exposes. +test("an unlisted site is in no array and no total; a channel it shares is the listed site's", () => { + const unlisted = { ...site("zeta", ["q1", "a1"], "https://zeta.example"), listed: false } as Site; + const sites = [...SITES, unlisted]; + const channelSites = { ...CHANNEL_SITES, a1: ["alpha", "zeta"], q1: ["zeta"] }; + const own = [ + stat({ channelSlug: "q1", id: "q-1", uploadDate: "20251101", duration: 7200 }), + stat({ channelSlug: "q1", id: "q-2", uploadDate: "20260201", status: "deleted" }), + stat({ channelSlug: "q1", id: "q-3", hasTranscript: false, transcribedDate: null }), + ]; + const s = buildHomepageSummary([...STATS, ...own], channelSites, sites, NOW); + const base = buildHomepageSummary(STATS, CHANNEL_SITES, SITES, NOW); + // Byte for byte the summary without the unlisted site: every array (sites, + // channels, series, recent, monthly) and every total (totals, official, + // availability, monthlyUnplaced). + assert.deepEqual(s, base); + const text = JSON.stringify(s); + for (const needle of ["zeta", "ZETA", "q1", "Q1", "q-1"]) { + assert.ok(!text.includes(needle), needle); + } + // The shared channel stays credited to alpha. + assert.equal(s.sites.find((x) => x.siteId === "alpha")!.channels, 2); + assert.equal(s.version, 6); +}); + +test("an unlisted site with no siteUrl, or with every channel shared, changes nothing either", () => { + const base = buildHomepageSummary(STATS, CHANNEL_SITES, SITES, NOW); + // No siteUrl: never public, and its own channel is still in no total (unlike + // a pool-only channel, which `totals` counts). + const urlless = { ...site("zeta", ["r1"]), listed: false } as Site; + assert.deepEqual( + buildHomepageSummary( + [...STATS, stat({ channelSlug: "r1", id: "r-1" })], + { ...CHANNEL_SITES, r1: ["zeta"] }, + [...SITES, urlless], + NOW, + ), + base, + ); + const sharedOnly = { ...site("zeta", ["a1", "b1"], "https://zeta.example"), listed: false } as Site; + assert.deepEqual( + buildHomepageSummary(STATS, { ...CHANNEL_SITES, a1: ["alpha", "zeta"], b1: ["beta", "zeta"] }, [...SITES, sharedOnly], NOW), + base, + ); + // Listed explicitly is the default: the same summary as no key at all. + const listedTrue = SITES.map((x) => ({ ...x, listed: true })) as Site[]; + assert.deepEqual(buildHomepageSummary(STATS, CHANNEL_SITES, listedTrue, NOW), base); +}); + +test("a shared channel is the listed site's even when the unlisted site's id sorts first", () => { + const base = buildHomepageSummary(STATS, CHANNEL_SITES, SITES, NOW); + // "aaa-hidden" < "beta": the primary pick sorts ids, so only the listed + // filter keeps b1 with beta. + const unlisted = { ...site("aaa-hidden", ["b1", "q1"], "https://aaa-hidden.example"), listed: false } as Site; + const s = buildHomepageSummary( + [...STATS, stat({ channelSlug: "q1", id: "q-1", uploadDate: "20251101" })], + { ...CHANNEL_SITES, b1: ["aaa-hidden", "beta"], q1: ["aaa-hidden"] }, + [unlisted, ...SITES], + NOW, + ); + assert.deepEqual(s, base); + assert.ok(s.recent.filter((r) => r.slug.startsWith("b1/")).every((r) => r.siteId === "beta")); + assert.ok(!JSON.stringify(s).includes("aaa-hidden")); +}); diff --git a/common/lib/homepageSummary.ts b/common/lib/homepageSummary.ts @@ -1,6 +1,7 @@ import type { Platform } from "./platform"; import type { VideoStat } from "./stats"; import type { Site } from "./site"; +import { channelsOnlyOnUnlistedSites, isListedSite } from "./siteSchema"; import { accentHex, accentIdOf } from "./accent"; import { wordmarkLeadFor, type AccentId } from "./brand"; import { VIDEO_STATES, type VideoState } from "./availability"; @@ -10,11 +11,15 @@ import { VIDEO_STATES, type VideoState } from "./availability"; // HTML, so the landing renders instantly without the browser fetching the // multi-MB whole-pool stats dataset. // -// Scope: the chart "universe" is PUBLIC sites only (those with a siteUrl), and -// every video is attributed to a single PRIMARY public site (the first, by -// sorted id, exposing its channel) so the Site and Channel breakdowns partition -// the same set and combined totals stay honest. The KPI `totals` are instance- -// wide (count pool-only / URL-less content too) — a deliberate scope difference. +// Scope: the chart "universe" is PUBLIC sites only (those with a siteUrl that +// are listed — site.json `listed`, lib/siteSchema.ts isListedSite), and every +// video is attributed to a single PRIMARY public site (the first, by sorted id, +// exposing its channel) so the Site and Channel breakdowns partition the same +// set and combined totals stay honest. The KPI `totals` (and `availability`) +// are instance-wide (count pool-only / URL-less content too) — a deliberate +// scope difference — EXCEPT a channel only unlisted sites expose, which no +// part of the summary counts (channelsOnlyOnUnlistedSites). An unlisted site is +// in no array here; a channel it shares with a listed site is the listed one's. // // Two metrics are pre-binned at two granularities; Cumulative and Share (100%) // are derived client-side from these, so no extra precompute is needed. @@ -33,7 +38,12 @@ import { VIDEO_STATES, type VideoState } from "./availability"; // the same way — a summary without it paints its sites' hex, as before. So is // the per-site `wordmarkLead` (release 14): a summary without it shows each // card's title plain, as before. Nothing reads this number to accept a file. -export const HOMEPAGE_SUMMARY_VERSION = 5; +// +// v6 (release 14): an unlisted site (site.json `listed: false`) is in no array, +// and a channel only unlisted sites expose is in no total — `totals` and +// `availability` included. No field was added or removed; the number says the +// totals' scope moved. +export const HOMEPAGE_SUMMARY_VERSION = 6; // Day buckets are capped to this many trailing days so the embedded summary stays // small regardless of archive age (daily detail is only useful recently). @@ -166,7 +176,8 @@ export type HomepageOfficialTotals = { export type HomepageSummary = { version: number; generatedAt: string; // ISO timestamp - // Instance-wide headline numbers (count everything, not just public sites). + // Instance-wide headline numbers (count everything, not just public sites — + // but never a channel only unlisted sites expose). totals: { transcripts: number; downloads: number; @@ -351,12 +362,21 @@ export function buildHomepageSummary( const nowWeek = weekOf(nowDay.replace(/-/g, ""))!; const dayFloor = isoDate(new Date(now.getTime() - (DAY_WINDOW - 1) * 86400000)); - // Public sites only (need a link target + a stable place on the chart). - const publicSites = sites.filter((s): s is Site & { siteUrl: string } => !!s.siteUrl); + // Public sites only (need a link target + a stable place on the chart), and + // only the listed ones. + const publicSites = sites.filter( + (s): s is Site & { siteUrl: string } => !!s.siteUrl && isListedSite(s), + ); const siteById = new Map(publicSites.map((s) => [s.siteId, s])); + // An unlisted site's own channels: counted nowhere below, totals included. + const unlistedOnly = channelsOnlyOnUnlistedSites(sites); + const inScope = unlistedOnly.size > 0 + ? stats.filter((s) => !unlistedOnly.has(s.channelSlug)) + : stats; // channel slug -> primary public site (first by sorted id). Channels with no - // public site are out of the chart universe entirely. + // public site are out of the chart universe entirely. Over listed sites only, + // so a channel an unlisted site shares with a listed one is the listed one's. const primarySiteOf = new Map<string, string>(); for (const slug of Object.keys(channelSites)) { const primary = [...channelSites[slug]] @@ -369,7 +389,7 @@ export function buildHomepageSummary( const channelName = new Map<string, string>(); const transcribedItems: Attributed[] = []; const downloadedItems: Attributed[] = []; - // Instance-wide KPI accumulators (count everything, not just public). + // Instance-wide KPI accumulators (count everything in scope, not just public). let transcripts = 0; let downloads = 0; let hoursSeconds = 0; @@ -405,7 +425,7 @@ export function buildHomepageSummary( const uploadItems: { month: string; siteId: string }[] = []; let monthlyUnplaced = 0; - for (const s of stats) { + for (const s of inScope) { // A transcript COUNTS whether or not it carries a date: transcripts, // channels, hours, upload-month placement. Only the transcribed time series // (and "this month", and the recent rail) need `transcribedDate`. buildStats @@ -496,7 +516,7 @@ export function buildHomepageSummary( .sort((a, b) => a.name.localeCompare(b.name)); // Recent feed (public universe), attributed to the primary site for its link. - const recent: HomepageRecentItem[] = stats + const recent: HomepageRecentItem[] = inScope .filter((s): s is VideoStat & { transcribedDate: string } => Boolean(s.hasTranscript && s.transcribedDate && primarySiteOf.get(s.channelSlug)), ) @@ -522,16 +542,17 @@ export function buildHomepageSummary( }; }); - // State census over every record, matching `totals`' instance-wide scope - // (pool-only channels included) rather than the charts' public-site universe. + // State census over every in-scope record, matching `totals`' instance-wide + // scope (pool-only channels included, a channel only unlisted sites expose + // not) rather than the charts' public-site universe. // Seeded with every state at zero so the shape is stable across corpora. const byState = Object.fromEntries( VIDEO_STATES.map((s) => [s, 0]), ) as Record<VideoState, number>; - for (const s of stats) byState[s.status] = (byState[s.status] ?? 0) + 1; + for (const s of inScope) byState[s.status] = (byState[s.status] ?? 0) + 1; const availability: HomepageAvailability = { byState, - counted: stats.length, + counted: inScope.length, }; // Monthly back-catalogue series, keyed by the sites that survived the diff --git a/common/lib/site.ts b/common/lib/site.ts @@ -13,6 +13,7 @@ import { import { socialLinksForSave } from "./socialLinks"; import { readJsonFileSync, writeJsonAtomic } from "./jsonFile-server"; import { + isListedSite, isValidSiteId, parseSite, parseSiteUrl, @@ -138,7 +139,9 @@ export type CrossSiteLink = { siteId: string; title: string; url: string }; export type CrossSiteGroup = { label?: string; sites: CrossSiteLink[] }; // Resolve the footer's cross-site list for `current` against the full pool. -// Siblings that lack a siteUrl (or are `current`) are not linkable and dropped. +// Siblings that lack a siteUrl (or are `current`) are not linkable and dropped, +// and so is an unlisted sibling (`listed: false`, isListedSite) — even one a +// featured group names. An unlisted `current` still lists its siblings. // `current.relatedSites` groups render first, in order, each filtered to known // linkable ids (unknown/used/self skipped, empty groups dropped). Every still- // unused sibling lands in a trailing remainder group — unlabeled when there @@ -149,7 +152,7 @@ export function resolveRelatedSites( ): CrossSiteGroup[] { const byId = new Map<string, CrossSiteLink>(); for (const s of all) { - if (s.siteId === current.siteId || !s.siteUrl) continue; + if (s.siteId === current.siteId || !s.siteUrl || !isListedSite(s)) continue; byId.set(s.siteId, { siteId: s.siteId, title: s.siteTitle, url: s.siteUrl }); } const used = new Set<string>(); diff --git a/common/lib/siteSchema.test.ts b/common/lib/siteSchema.test.ts @@ -9,12 +9,14 @@ import type { z } from "zod"; import { SITE_FIELD_DOCS, SITE_KEYS, + channelsOnlyOnUnlistedSites, + isListedSite, parseSite, siteFieldsSchema, siteToDisk, type Site, } from "./siteSchema"; -import { getSite, siteConfigFile, writeSite } from "./site"; +import { getSite, resolveRelatedSites, siteConfigFile, writeSite } from "./site"; import type { Paths } from "./paths"; const HERE = path.dirname(fileURLToPath(import.meta.url)); @@ -60,6 +62,7 @@ test("empty, null, [] and a number all read as the defaults, every key emitted", assert.equal(want.duplicates, true); assert.equal(want.transcriptDownloads, true); assert.equal(want.pwa, false); + assert.equal(want.listed, true); assert.deepEqual(want.relatedSites, []); assert.equal(want.socialLinks, undefined); assert.ok("socialLinks" in want); @@ -231,6 +234,7 @@ function fixtures(): Array<[string, unknown]> { channels: [{ slug: "c1", groupId: "a", order: 3 }, { slug: "c2", groupId: "q" }], cloudflareProject: "p", siteUrl: "https://s.example//", + listed: false, relatedSites: [{ siteIds: ["x", "x", "BAD"] }, { label: " ", siteIds: [] }], pwa: true, archives: false, @@ -285,6 +289,59 @@ test("writeSite throws on no groups, a default outside the groups, and an unsafe assert.equal(fs.existsSync(siteConfigFile(paths, "s")), false); }); +test("listed: absent reads listed, only an explicit false unlists, and only false is written", async () => { + for (const v of [undefined, true, 0, "false", null]) { + assert.equal(parseSite("s", { listed: v }).listed, true, String(v)); + assert.equal("listed" in siteToDisk(parseSite("s", { listed: v })), false, String(v)); + } + assert.equal(parseSite("s", { listed: false }).listed, false); + // `true` in a caller's Site is the default, so it is not written either. + assert.equal("listed" in siteToDisk({ ...parseSite("s", {}), listed: true }), false); + + // Through the real writer and reader: false survives, absent reads listed. + const paths = scratchPaths(await mkdtemp(path.join(os.tmpdir(), "site-"))); + const hidden = parseSite("s", { siteTitle: "Hidden", siteUrl: "https://h.example", listed: false }); + await writeSite(hidden, paths); + assert.equal(JSON.parse(await readFile(siteConfigFile(paths, "s"), "utf8")).listed, false); + assert.deepEqual(getSite("s", paths), hidden); + await writeSite({ ...hidden, listed: true }, paths); + const disk = JSON.parse(await readFile(siteConfigFile(paths, "s"), "utf8")); + assert.equal("listed" in disk, false); + assert.equal(getSite("s", paths).listed, true); +}); + +test("isListedSite is the key's default; channelsOnlyOnUnlistedSites keeps a shared channel with the listed site", () => { + assert.equal(isListedSite({}), true); + assert.equal(isListedSite({ listed: true }), true); + assert.equal(isListedSite({ listed: false }), false); + const sites = [ + parseSite("shown", { channels: [{ slug: "shared" }, { slug: "mine" }] }), + parseSite("hidden", { listed: false, channels: [{ slug: "shared" }, { slug: "secret" }] }), + parseSite("hidden2", { listed: false, channels: [{ slug: "secret" }, { slug: "secret2" }] }), + ]; + assert.deepEqual([...channelsOnlyOnUnlistedSites(sites)].sort(), ["secret", "secret2"]); + assert.deepEqual([...channelsOnlyOnUnlistedSites([sites[0]])], []); +}); + +test("the footer never links an unlisted sibling, and an unlisted site's own footer still lists the rest", () => { + const current = parseSite("cur", { + siteUrl: "https://cur.example", + relatedSites: [{ label: "Friends", siteIds: ["hidden", "shown"] }], + }); + const shown = parseSite("shown", { siteTitle: "Shown", siteUrl: "https://shown.example" }); + const hidden = parseSite("hidden", { siteTitle: "Hidden", siteUrl: "https://hidden.example", listed: false }); + const other = parseSite("other", { siteTitle: "Other", siteUrl: "https://other.example" }); + const ids = (groups: ReturnType<typeof resolveRelatedSites>) => + groups.flatMap((g) => g.sites.map((s) => s.siteId)); + // Named in a featured group or not, the unlisted site is not linked. + assert.deepEqual(ids(resolveRelatedSites(current, [current, shown, hidden, other])), ["shown", "other"]); + // The unlisted site is still built as before: its footer lists its siblings. + assert.deepEqual( + ids(resolveRelatedSites({ ...hidden, relatedSites: [] }, [current, shown, hidden, other])), + ["cur", "shown", "other"], + ); +}); + test("writeSite → getSite round-trips, and the file holds only non-defaults", async () => { const paths = scratchPaths(await mkdtemp(path.join(os.tmpdir(), "site-"))); const site = parseSite("s", { siteTitle: "Mine", archives: false }); @@ -295,4 +352,5 @@ test("writeSite → getSite round-trips, and the file holds only non-defaults", assert.equal("duplicates" in disk, false); assert.equal("transcriptDownloads" in disk, false); assert.equal("pwa" in disk, false); + assert.equal("listed" in disk, false); }); diff --git a/common/lib/siteSchema.ts b/common/lib/siteSchema.ts @@ -84,6 +84,7 @@ export type Site = { cloudflareProject?: string; accent?: string; siteUrl?: string; + listed?: boolean; relatedSites?: RelatedSiteGroup[]; pwa?: boolean; archives?: boolean; @@ -116,6 +117,8 @@ export const SITE_FIELD_DOCS: FieldDocs<Site> = { 'Per-site brand accent: a named accent id (`signal`, `brass`, `vermilion`, `violet`, `sakura`, `blue`, `green`) or a custom `"#rrggbb"`. It is the site\'s accent on every page; a reader does not pick one. Absent = `signal`, the family default. A custom hex is darkened or lightened per base until it reaches 4.5:1. The public `/site.json` always carries a hex: an id is published as its on-dark value. Any other spelling is dropped.', siteUrl: "Absolute public URL of this site's deployment, e.g. `https://jeralyzer.pages.dev` (trimmed, trailing slashes removed; anything not absolute http(s) is dropped). Drives the cross-site footer: a site with no siteUrl is omitted from every other site's list.", + listed: + "Whether the family lists this site. Opt-OUT: absent/true = listed, only an explicit `false` is written. An unlisted site still builds and deploys as before, and its own pages are unchanged; it is left out of the homepage (cards, chart, `/stats`), the hub (members, federated search, `/corpus.json`, `/llms.txt`), every other site's footer, and the published `channel-sites.json` and pooled `stats/`. A channel only unlisted sites expose is in none of the family's public totals; a channel a listed site also exposes is credited to the listed one.", relatedSites: "Pulls specific siblings to the front of the footer's cross-site list, in named groups. Siblings not named here fall into a trailing \"Other sites\" group. Absent/empty = one flat list of every sibling.", pwa: @@ -139,6 +142,36 @@ export function isValidSiteId(id: unknown): id is string { return typeof id === "string" && SITE_ID_RE.test(id); } +// THE ONE PREDICATE for `listed` (site.json's opt-out; absent = listed). Every +// public output that enumerates the family's sites filters through it: the +// homepage summary (lib/homepageSummary.ts), channel-sites.json and the pooled +// stats (controller/poolSummary.ts, controller/buildStats.ts), the hub's +// member list (bin/compose-hub.ts) and the footer's siblings +// (lib/site.ts resolveRelatedSites). The editor's own pages list every site. +// Here, beside the key, and exported from lib/site like isValidSiteId, so the +// pure summary builder can use it without importing file I/O. +export function isListedSite(site: Pick<Site, "listed">): boolean { + return site.listed !== false; +} + +// 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), +// and a channel no site exposes (pool-only) is not here either — the family's +// instance-wide totals have always counted it. +export function channelsOnlyOnUnlistedSites( + sites: readonly Pick<Site, "listed" | "channels">[], +): Set<string> { + const onListed = new Set<string>(); + const onUnlisted = new Set<string>(); + for (const site of sites) { + const into = isListedSite(site) ? onListed : onUnlisted; + for (const c of site.channels) into.add(c.slug); + } + for (const slug of onListed) onUnlisted.delete(slug); + return onUnlisted; +} + export const SITE_DEFAULT_TITLE = "Transcript Browser"; export const SITE_DEFAULT_DESCRIPTION = "Browse and search video transcripts"; @@ -246,6 +279,8 @@ export const siteFieldsSchema = z.object({ ).describe(d.cloudflareProject), accent: settingsField(parseAccentSetting).describe(d.accent), siteUrl: settingsField(parseSiteUrl).describe(d.siteUrl), + // Opt-out: only an explicit false unlists. Absent/true stays listed. + listed: settingsField((v): boolean => v !== false).describe(d.listed), relatedSites: settingsField(parseRelatedSites).describe(d.relatedSites), pwa: settingsField((v): boolean => v === true).describe(d.pwa), // Opt-out: only an explicit false disables. Absent/true stays on. @@ -335,6 +370,8 @@ export function siteToDisk(site: Site): Site { : {}), ...(accent ? { accent } : {}), ...(siteUrl ? { siteUrl } : {}), + // Listed is the default: only the opt-out is persisted. + ...(site.listed === false ? { listed: false } : {}), ...(relatedSites.length > 0 ? { relatedSites } : {}), ...(site.pwa ? { pwa: true } : {}), // Persist only the non-default: archives is on unless explicitly disabled. diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -11,6 +11,7 @@ - **A social icon is checked by what it may contain, when it is saved new or edited and every time it is shown, and a refused one says why.** An icon must be one well-formed `<svg>` of shapes, groups, gradients, clips, masks, filters, text and simple animation, with SVG presentation attributes: no script, `style` block, `foreignObject`, link, embedded image, `title`/`desc` with anything but text (text-only ones are removed), or HTML element; no event handler, however it is written; a `style` attribute of presentation properties only; a reference only to something inside the icon, written plainly; and nothing that could load from elsewhere (a CSS escape or comment, `image-set(`, `image(`, `cross-fade(`, `element(`, `src(`, `paint(`, `@import`). Comments, a leading XML declaration and a plain DOCTYPE are removed. A refused save ends with the reason ("… has an invalid SVG: it has an event handler attribute.", "… it links to something outside the icon.") and never repeats the markup; for a drawing program's file it says to export it with presentation attributes rather than a style block (in Inkscape, save as Plain SVG). **Upgrading:** an icon an older build stored is kept as it is when a save does not change it — a pause, a priority or a title still saves — but a page shows it as its label until its SVG is replaced; `archilyzer doctor`'s new "social icons" line names every stored icon that fails, by file and label, with the reason. - **Two grounds, Light and Dark, and no accent picker in the header.** The editor's header keeps its theme toggle, which cycles System, Light and Dark; the theme menu (Base and Accent) is gone, and the editor wears its own accent, Signal. A stored choice of the retired third ground loads as Light and is rewritten once; a stored accent is not read and is left in storage. A site's accent is still set in its form; the form's hint no longer says a reader can pick another. - **The hub URL hints say what the setting does now.** Settings' **Family hub URL** and a site's **Hub URL** no longer promise a Hub link in the header (it was removed): the value is published as `hubUrl` in each site's `/site.json` and `/corpus.json`, so the hub can tell its member sites. `SETTINGS.md` and `SITE.md` say the same. +- **A site can be left off the homepage and the hub.** A site's settings have a new checkbox, **List on the Archilyzer homepage and hub**, on by default (`listed` in `site.json`; only `false` is written). Turned off, the site still builds and deploys at its own URL as before, but the homepage has no card, chart series, `/stats` entry or recent item for it; the hub does not list it as a member, search it, or name it in its `corpus.json` and `llms.txt`; no other site's footer links it; and `channel-sites.json` and the homepage's `stats/` leave it out. A channel only unlisted sites carry is in none of the published totals, the homepage's headline numbers included; a channel a listed site also carries is counted under the listed site. The editor's own pages still show every site. It takes effect at the next homepage, hub and site builds. ## [0.10.0] - 2026-09-28 - **The homepage can be built and deployed from `/sites`.** Under a new **Homepage** section, after Hub, there is **Build homepage** (tick **Deploy after build** to ship it in the same job, only if the build succeeds) and **Deploy homepage**, which ships the build already in `homepage/out`. A **Preview branch** box beside them sends either deploy to a Cloudflare Pages preview of the `archilyzer` project instead of production, and shows the preview's address as you type; a name Cloudflare would refuse or rewrite, or `main`, greys the deploy buttons out and says why. A line under the buttons says what a deploy would ship: when `homepage/out` was built (or that it holds no build yet), and where it goes, with the live URL. Deploy homepage with nothing built is refused before any job starts. The homepage reads the search index as it stands, so run **Build index** first when its numbers should move. The jobs run the same code as `archilyzer build homepage` / `deploy homepage`, and show on `/jobs` as `build-homepage`, `deploy-homepage` and `build-deploy-homepage`. The Hub section no longer describes the homepage. diff --git a/editor/app/sites/actions.ts b/editor/app/sites/actions.ts @@ -92,6 +92,9 @@ export async function saveSiteAction( }; } const siteUrl = parseSiteUrl(siteUrlRaw); + // Listed on the homepage and hub by default: the same opt-out idiom as + // archives below (an unchecked box sends no key → persisted as false). + const listed = formData.get("listed") === "on"; // Hub parent (per-site override of the family default) + PWA opt-in. const hubUrlRaw = String(formData.get("hubUrl") ?? "").trim(); @@ -217,6 +220,8 @@ export async function saveSiteAction( ...(accent ? { accent } : {}), ...(cloudflareProject ? { cloudflareProject } : {}), ...(siteUrl ? { siteUrl } : {}), + // The Site is rebuilt from the form: a key missing here is dropped on save. + ...(listed ? {} : { listed: false }), ...(hubUrl ? { hubUrl } : {}), ...(pwa ? { pwa: true } : {}), ...(archives ? {} : { archives: false }), diff --git a/editor/app/sites/components/SiteForm.tsx b/editor/app/sites/components/SiteForm.tsx @@ -327,6 +327,22 @@ export function SiteForm({ initial, channels, allSites, isNew }: Props) { defaultValue={initial.siteUrl ?? ""} hint="Absolute URL this site is served at (e.g. https://jeralyzer.com). Used so other sites can link to it in their footer. Leave blank to omit this site from cross-site lists." /> + <label className="flex items-center gap-2 text-sm"> + <input + type="checkbox" + name="listed" + defaultChecked={initial.listed !== false} + className="accent-brand" + /> + List on the Archilyzer homepage and hub + </label> + <p className="-mt-2 text-xs text-muted-foreground"> + On by default. Turn off to leave this site out of the homepage (its + card, chart and stats), the hub (its members, search, corpus.json and + llms.txt) and every other site&apos;s footer, and to count its own + channels in none of the published totals. The site still builds and + deploys as before, at its own URL. + </p> <Field label="Hub URL" name="hubUrl" diff --git a/editor/e2e/helpers.ts b/editor/e2e/helpers.ts @@ -152,6 +152,7 @@ export async function writeSite( ? { cloudflareProject: site.cloudflareProject } : {}), ...(site.siteUrl ? { siteUrl: site.siteUrl } : {}), + ...(site.listed === false ? { listed: false } : {}), ...(site.relatedSites ? { relatedSites: site.relatedSites } : {}), }; await writeFile( diff --git a/editor/e2e/sites-crud.spec.ts b/editor/e2e/sites-crud.spec.ts @@ -345,6 +345,62 @@ test("archives + per-video transcript downloads opt-outs round-trip", async ({ await expect(downloads).toBeChecked(); }); +test("the listed opt-out round-trips, and a save of another field keeps it", async ({ + page, +}) => { + await resetData("empty"); + // An invented fixture id: no real site is named in a test. + await writeSite("fixture-unlisted", { + siteTitle: "Unlisted Fixture", + siteUrl: "https://fixture-unlisted.example", + listed: false, + }); + + type ListedSiteFile = { siteTitle?: string; listed?: boolean }; + const file = "test-transcripts/sites/fixture-unlisted/site.json"; + const listed = page.getByRole("checkbox", { + name: "List on the Archilyzer homepage and hub", + }); + const save = async () => { + await page.getByRole("button", { name: /save site/i }).click(); + await expect( + page.getByRole("status").filter({ hasText: "Saved" }), + ).toBeVisible(); + }; + + // `false` on disk opens unticked, and a save that changes only the title + // keeps it: the action rebuilds the site from the form. + await page.goto("/sites/fixture-unlisted"); + await expect(listed).not.toBeChecked(); + await page.getByLabel(/site title/i).fill("Unlisted Fixture Renamed"); + await save(); + await expect(async () => { + const site = await readJson<ListedSiteFile>(file); + expect(site.siteTitle).toBe("Unlisted Fixture Renamed"); + expect(site.listed).toBe(false); + }).toPass({ timeout: 10_000 }); + + // Ticking it removes the key — listed is the default. + await page.goto("/sites/fixture-unlisted"); + await expect(listed).not.toBeChecked(); + await listed.check(); + await save(); + await expect(async () => { + const site = await readJson<ListedSiteFile>(file); + expect("listed" in site).toBe(false); + }).toPass({ timeout: 10_000 }); + + // And unticking writes the explicit false again. + await page.goto("/sites/fixture-unlisted"); + await expect(listed).toBeChecked(); + await listed.uncheck(); + await save(); + await expect(async () => { + const site = await readJson<ListedSiteFile>(file); + expect(site.listed).toBe(false); + }).toPass({ timeout: 10_000 }); +}); + test("the hub form's per-video transcript downloads opt-out round-trips to homepage.json", async ({ page, }) => { diff --git a/export/CHANGELOG.md b/export/CHANGELOG.md @@ -6,6 +6,7 @@ - **A chart's stacked bars are separated by a 2 px gap in the chart card's colour.** A stacked bar's segments were drawn touching; they now have a 2 px gap in the card's colour between them, and in high-contrast mode the system's background colour. Stacked areas keep their line in each series' colour along the top, charts of one series, line charts and side-by-side bars are unchanged. Needs a rebuild and deploy of each site. - **Two grounds, Light and Dark, and each site in its own accent.** The third ground, the warm paper one, is gone: the header's toggle cycles System, Light and Dark. A reader who had chosen it gets Light, before the page first paints and with no other ground on the way, and the stored choice becomes Light (the old paper theme's `archive` + `light` too). The theme menu's accent picker is gone from the header and the slide-out menu: every page wears the site's own accent (`site.json` `accent`), and a reader's stored pick from before is not read and is left in storage. Needs a rebuild and deploy of each site. - **The header carries the operator's social links and one theme toggle, keeps the site's name on a small screen, and links to the Archilyzer home in place of the sites menu.** Every site's header and the hub's end with the social icons (the site's `socialLinks`, else `settings.json`'s) followed by the theme toggle, all 36 px keys (44 px on a touch screen) with a focus ring. From 520 px wide the header shows every link, up to four (with more, the ones marked **Keep in header on small screens** first, then the last of the rest); below 520 px it shows only the marked ones (none marked → none) and keeps the site's name beside them. The switch is 32.5rem, so at a larger text size it comes later. With one marked link, every current site's name shows in full from 360 px wide on a touch screen. The footer keeps every link, in the same keys (its icons were 20 px and turned the accent on hover; they now turn the text colour), and wraps them rather than widen the page. The **Sites** dropdown and the **Hub** link are gone from the header and the slide-out menu: in their place a link, **Archilyzer**, goes to the Archilyzer home's Official Instances, in the same tab (not on the hub, which lists them itself). **Changelog** moved from the header and the menu to the footer, after Use with AI. The nav and the Archilyzer link are inline from 1024 px wide; below that they are in the slide-out menu, which now holds only them. Only as last resorts, for a very long name on a phone, does the name drop (its mark stays; the same before and after the page's font has loaded, and never with its last letter cut off) and do the icons scroll sideways in their own box. A site's `hubUrl` still loads and is no longer shown. Needs a rebuild and deploy of each site. +- **An unlisted site is not in the hub or in another site's footer.** The hub's members (`hub-sites.json`), and so its federated search, `corpus.json` and `llms.txt`, leave out a site whose `listed` is `false`; the hub's instance figures count none of the channels only it carries; and no other site's footer links it, even from a featured group. The unlisted site's own pages are unchanged. ## [0.10.0] - 2026-09-28 - **A video whose recheck failed shows as possibly missing rather than available.** When a video drops out of its channel's listing it is marked "Missing?" until a recheck says why. A recheck that could not reach the video — a blocked request or a network error — used to clear the mark as if the video had been found. It now leaves "Missing?" in place until a recheck actually reaches the video. Needs a rebuild and deploy of every export site. diff --git a/homepage/CHANGELOG.md b/homepage/CHANGELOG.md @@ -1,6 +1,7 @@ # Homepage Changelog ## [Unreleased] +- **An unlisted site is not on the homepage.** A site whose settings turn off **List on the Archilyzer homepage and hub** (`listed: false`) has no Official Instances card, chart series, `/stats` entry or recent item, is not in `channel-sites.json` or `stats/`, and the channels only it carries count in none of the numbers, the headline totals included. The summary's version is 6. The e2e fixture has a seventh, unlisted site that no page names. - **`/#instances` goes straight to Official Instances.** The section carries `id="instances"`, clear of the sticky header, and every archive's header now links there (`INSTANCES_URL` in `common/lib/project.ts`). With no sites the link lands on the top of the page. - **The social links are in the header beside the theme toggle, and on a small screen the header keeps the name.** The operator's social icons (`homepage.json`'s, else `settings.json`'s) sit in the header's bar as well as in the footer's Elsewhere column, followed by the theme toggle, all spaced alike. From 768 px wide the bar is wordmark, nav, icons, toggle; below 768 px it is wordmark, icons, toggle, and the nav has the rule below to itself, where its four links fit. From 520 px wide the header shows every link, up to four (with more, the ones marked **Keep in header on small screens** first, then the last of the rest); below 520 px it shows only the marked ones (none marked → none; the switch is 32.5rem, so at a larger text size it comes later), and the wordmark keeps its full name: "Archilyzer" shows from 292 px wide on a touch screen with one marked link. The footer always shows every link. Only as last resorts, on a screen narrower still or at a much larger text size, does the wordmark's text drop (its mark stays) and do the icons scroll sideways in their own box, the last one in view first. Each is an icon named by its label, with no text beside it. diff --git a/homepage/e2e/fixture-summary.ts b/homepage/e2e/fixture-summary.ts @@ -26,7 +26,14 @@ import type { VideoStat } from "../../common/lib/stats"; // symlog axis reaches 10K while the Recent weeks stay linear and small; // • every site transcribes every day of the last 200, so every line is full // and every series has a non-zero start for Indexed; -// • uploads spread over 2019–2026, for the growth chart's months. +// • uploads spread over 2019–2026, for the growth chart's months; +// • a seventh site, UNLISTED (site.json `listed: false`, release 14 slice +// HS): its own two channels transcribe every day like the rest, and it +// also exposes the first site's first channel. The summary names it nowhere +// and counts its own channels in no total, so `buildFixtureSummary()` is +// exactly `buildFixtureSummary(FIXTURE_SITES, [])` — every number the specs +// read is the six listed sites'. Every site in the second list is unlisted: +// `buildFixtureInputs` sets `listed: false` on it, whatever it carries. export const FIXTURE_SUMMARY_NAME = ".e2e-summary.json"; @@ -42,7 +49,8 @@ export const FIXTURE_PALE_HEX = "#f4c2d7"; // site.json one (a named accent's site, the custom hex's and a site with no // accent have one — the last ends MID-WORD, "Fix" + "ture Three", as // "Jer" + "alyzer" does; the rest show their title plain); `daily` how many -// recordings each channel transcribes a day. +// recordings each channel transcribes a day. Whether a site is listed is the +// list it is passed in (buildFixtureInputs), not a field. export type FixtureSite = { siteId: string; siteTitle: string; @@ -61,6 +69,16 @@ export const FIXTURE_SITES: readonly FixtureSite[] = [ { siteId: "fixture-six", siteTitle: "Fixture Six", accent: "vermilion", channels: 2, daily: 3 }, ]; +// The unlisted site (an invented id, as every fixture's). Not in FIXTURE_SITES, +// which is the six the pages show; buildFixtureInputs' second list, which +// unlists it. +export const FIXTURE_UNLISTED_SITE: FixtureSite = { + siteId: "fixture-unlisted", + siteTitle: "Fixture Unlisted", + channels: 2, + daily: 6, +}; + const DAY = 86_400_000; const SPIKE = { site: 0, start: Date.UTC(2026, 4, 11), days: 7, count: 12_000 }; const HISTORY_DAYS = 200; @@ -76,7 +94,13 @@ function uploadDate(n: number): string { return ymd(d.getTime()); } -export function buildFixtureSummary(fixtureSites: readonly FixtureSite[] = FIXTURE_SITES) { +// The builder's inputs: the recordings, the channel → sites map and the sites. +// `fixtureSites` are listed; every site in `unlistedSites` is written with +// `listed: false`, and each also exposes the first listed site's first channel. +export function buildFixtureInputs( + fixtureSites: readonly FixtureSite[] = FIXTURE_SITES, + unlistedSites: readonly FixtureSite[] = [FIXTURE_UNLISTED_SITE], +): { stats: VideoStat[]; channelSites: Record<string, string[]>; sites: Site[] } { const stats: VideoStat[] = []; const channelSites: Record<string, string[]> = {}; const sites: Site[] = []; @@ -112,17 +136,24 @@ export function buildFixtureSummary(fixtureSites: readonly FixtureSite[] = FIXTU }); }; const today = Date.UTC(2026, 8, 15); - fixtureSites.forEach((s, i) => { + // A site's own channels, `<siteId>-ch<N>`, each transcribing every day of the + // last HISTORY_DAYS; `shared` are other sites' channels it also exposes. + const addSite = ( + s: FixtureSite, + i: number, + { listed = true, shared = [] }: { listed?: boolean; shared?: string[] } = {}, + ) => { const slugs = Array.from({ length: s.channels }, (_, c) => `${s.siteId}-ch${c + 1}`); - for (const slug of slugs) channelSites[slug] = [s.siteId]; + for (const slug of [...slugs, ...shared]) (channelSites[slug] ??= []).push(s.siteId); sites.push({ siteId: s.siteId, siteTitle: s.siteTitle, siteDescription: `${s.siteTitle}, an e2e fixture archive.`, siteUrl: `https://${s.siteId}.example`, - channels: slugs.map((slug) => ({ slug })), + channels: [...slugs, ...shared].map((slug) => ({ slug })), ...(s.accent ? { accent: s.accent } : {}), ...(s.wordmarkLead ? { wordmarkLead: s.wordmarkLead } : {}), + ...(listed ? {} : { listed: false }), } as unknown as Site); slugs.forEach((slug, c) => { const name = `${s.siteTitle} Channel ${c + 1}`; @@ -133,13 +164,31 @@ export function buildFixtureSummary(fixtureSites: readonly FixtureSite[] = FIXTU for (let k = 0; k < count; k++) record(i, slug, name, day); } }); - }); + }; + fixtureSites.forEach((s, i) => addSite(s, i)); // The megaspike: one week of bulk transcription on the first site's first // channel. const spikeSite = fixtureSites[SPIKE.site]; for (let k = 0; k < SPIKE.count; k++) { record(SPIKE.site, `${spikeSite.siteId}-ch1`, `${spikeSite.siteTitle} Channel 1`, SPIKE.start + (k % SPIKE.days) * DAY); } + // The unlisted sites LAST, so every listed site's recordings (their numbers, + // dates and states) are the same with them or without. + unlistedSites.forEach((s, j) => + addSite(s, fixtureSites.length + j, { + listed: false, + shared: [`${spikeSite.siteId}-ch1`], + }), + ); + return { stats, channelSites, sites }; +} + +// The summary the e2e dev server reads: the real builder over those inputs. +export function buildFixtureSummary( + fixtureSites: readonly FixtureSite[] = FIXTURE_SITES, + unlistedSites: readonly FixtureSite[] = [FIXTURE_UNLISTED_SITE], +) { + const { stats, channelSites, sites } = buildFixtureInputs(fixtureSites, unlistedSites); return buildHomepageSummary(stats, channelSites, sites, FIXTURE_NOW); } diff --git a/homepage/e2e/unlisted-site.spec.ts b/homepage/e2e/unlisted-site.spec.ts @@ -0,0 +1,61 @@ +import fs from "node:fs"; +import path from "node:path"; +import { test, expect } from "@playwright/test"; +import { + FIXTURE_SITES, + FIXTURE_SUMMARY_NAME, + FIXTURE_UNLISTED_SITE, + buildFixtureInputs, + buildFixtureSummary, +} from "./fixture-summary"; + +// Release 14 slice HS: a site with site.json `listed: false` builds and +// deploys, and the homepage lists it nowhere — not a card, not a chart series, +// not a recent item — and counts the channels only it exposes in no total. +// +// The fixture summary (fixture-summary.ts) is built over six listed sites and +// one unlisted one, which has two channels of its own and shares the first +// site's first channel. + +const NEEDLES = [FIXTURE_UNLISTED_SITE.siteId, FIXTURE_UNLISTED_SITE.siteTitle]; + +test("the summary the server reads is the one built without the unlisted site", () => { + // The site is in the builder's input: unlisted, with recordings of its own + // and a channel shared with the first listed site. + const { stats, channelSites, sites } = buildFixtureInputs(); + const unlisted = sites.find((s) => s.siteId === FIXTURE_UNLISTED_SITE.siteId); + expect(unlisted?.listed).toBe(false); + const own = stats.filter((s) => s.channelSlug.startsWith(`${FIXTURE_UNLISTED_SITE.siteId}-ch`)); + expect(own.length).toBeGreaterThan(0); + expect(channelSites[`${FIXTURE_SITES[0].siteId}-ch1`]).toContain(FIXTURE_UNLISTED_SITE.siteId); + // Listed, the same site would change the summary: a card, and its recordings. + const withoutIt = buildFixtureSummary(FIXTURE_SITES, []); + const asListed = buildFixtureSummary([...FIXTURE_SITES, FIXTURE_UNLISTED_SITE], []); + expect(asListed.sites.map((s) => s.siteId)).toContain(FIXTURE_UNLISTED_SITE.siteId); + expect(asListed.totals.transcripts).toBe(withoutIt.totals.transcripts + own.length); + + const onDisk = JSON.parse( + fs.readFileSync(path.resolve(process.cwd(), "e2e", FIXTURE_SUMMARY_NAME), "utf8"), + ); + // Every array and every total: what the six listed sites alone produce. + expect(onDisk).toEqual(JSON.parse(JSON.stringify(withoutIt))); + const text = JSON.stringify(onDisk); + for (const needle of NEEDLES) expect(text).not.toContain(needle); + expect(onDisk.sites.map((s: { siteId: string }) => s.siteId)).toEqual( + FIXTURE_SITES.map((s) => s.siteId), + ); +}); + +for (const route of ["/", "/stats/"]) { + test(`${route} names no unlisted site, in its HTML or on the page`, async ({ page }) => { + const res = await page.goto(route); + expect(res?.ok()).toBe(true); + const served = (await res?.text()) ?? ""; + // The listed sites are there, so the check below is not vacuous. + for (const s of FIXTURE_SITES) expect(served).toContain(s.siteId); + for (const needle of NEEDLES) { + expect(served).not.toContain(needle); + expect(await page.content()).not.toContain(needle); + } + }); +} diff --git a/plans/FACTS.md b/plans/FACTS.md @@ -153,6 +153,16 @@ THROWS at declaration — module load — on a name `SUB_FILE_RE` matches; Never name the curated field `tags`. Never assume a `tags.json` is the keyword list: `transcripts/tags.json` and `sites/<id>/tags.json` are curated tags. +**`listed` / `unlisted` mean three unrelated things** (release 14, slice HS): + +| Which | Where | What it is | +| --- | --- | --- | +| A video's visibility | `common/lib/availability.ts` (the `"unlisted"` state, `isUnlisted`), `common/lib/transcripts{,-server}.ts`, `common/components/shareUrl.ts`, `common/controller/buildIndex.ts` | The platform's own "unlisted" (reachable by link, not listed on the channel). | +| The hub's list has loaded | `export/app/components/hub/useHubSites.ts` — `listed` | `/hub-sites.json` has been answered and `/hub-summary.json` has settled. | +| **A site the family lists** | `site.json` `listed` (`common/lib/siteSchema.ts` — `isListedSite`, `channelsOnlyOnUnlistedSites`) | Absent = listed; `false` keeps the site off the homepage, the hub and the other sites' footers, and out of the public totals. | + +A grep for either word finds all three; read the file before assuming which. + **Never publish a path segment named `.git`.** wrangler's Pages upload drops `**/.git` (and `**/node_modules`) SILENTLY, and Cloudflare's managed rules block `/.git/` requests. The source mirror is `/source/archilyzer.git/` for that reason (release 12, below). A mirror named `.git` would diff --git a/plans/release-14.md b/plans/release-14.md @@ -20,10 +20,11 @@ slice HP added to it on the operator's ruling of the same day. Rules: |---|---|---|---| | HP | `homepage/social-visible` | The homepage's social row and one theme toggle in the header at every width, the wordmark's text dropped first on a very small screen and the row scrolling only as the last resort, one shared `SocialLinks` component, larger keys with a focus ring; Changelog in the footer only; the instance cards' names as the site's wordmark; the social icon checked by an allowlist on save and at render; a sized SVG with no viewBox gets one; `featured` ("Show in header") on a social link | `common/components/{SocialLinks,SocialScroll,ThemeRadios,ThemeToggle,ThemeScript,ThemeProvider,Wordmark}.tsx` + `themeConfig.ts`, `common/bin/doctor.ts`, the growth chart, `common/lib/{socialSvg,socialLinks}.ts` + tests, `common/lib/settingsSchema.ts` (the social-link type, parser, docs; the normalizer moved to `socialSvg.ts`), `common/lib/normalizeSocialSvg.test.ts`, `common/lib/{settings,site,homepage}.ts` (the save errors), `common/lib/{homepageSummary,siteColor}.ts`, `homepage/app/components/{Header,Footer,ArchiveCards}.tsx`, `homepage/app/lib/{nav,summary}.ts`, `homepage/app/not-found.tsx`, `homepage/e2e/**` (the fixtures, `helpers.ts`, the new and the rewritten specs), `homepage/playwright.config.ts`, `export/app/components/{MobileMenu,Footer}.tsx` (the `ThemeRadios` swap; the footer's read path), `editor/app/components/SocialLinksField.tsx` + `socialLinksJson{,.test}.ts`, `editor/app/{settings,sites}/actions.ts` (the save errors), `editor/e2e/settings.spec.ts`, `SETTINGS.md`, `SITE.md` | | Lows, chart gap, T1, H1 (H3 folded in), H2 | `r14/two-grounds-headers` | The final review's Lows; the charts' surface gap; two grounds and each site in its own accent; the export and hub headers carry the social row and the toggle as one group, with an Archilyzer link to the homepage's `#instances` in place of the sites dropdown and the hub link; Changelog to the footer; after its review, the narrow header keeps the name and shows only the marked links (every header) | `common/components/{ThemeProvider,ThemeScript,ThemeToggle,SocialScroll}.tsx` + `themeConfig.ts` (and the deleted `ThemeMenu`, `ThemeRadios`), `common/components/charts/{ChartView,CrossSiteChart,surfaceGap}`, `common/styles/tokens.css`, `common/lib/{brand,accent,siteColor,paths,project,socialSvg,siteSchema,settingsSchema}.ts` + tests, `scripts/next-build-trace.test.mjs`, `export/app/components/{Header,MobileMenu,Footer}.tsx` (and the deleted `SiblingSwitcher`), `export/app/{layout.tsx,globals.css,changelog/page.tsx,lib/brand.ts}`, `export/e2e{,-hub}/**` (the theme, header and branding specs), `export/playwright.config.ts`, `editor/app/{layout.tsx,globals.css,sites/components/SiteForm.tsx}`, `editor/e2e/theme.spec.ts`, `homepage/app/{page.tsx,layout.tsx,globals.css,lib/*,changelog/page.tsx,components/{Header,ArchiveGrowthChart,ArchiveCards}.tsx}`, `homepage/e2e/**`, `homepage/content/docs/operate.md`, `SETTINGS.md`, `SITE.md` | +| HS | `r14/hidden-sites` | Hidden sites: `site.json` `listed` (absent = listed). An unlisted site builds and deploys as before, and is left off the homepage (cards, chart, `/stats`), the hub (members, federated search, `corpus.json`, `llms.txt`), every other site's footer and the published id lists (`channel-sites.json`, the pooled `stats/`); the channels only it exposes count in no public total. One checkbox in the site form | `common/lib/{siteSchema,site,homepageSummary}.ts` + tests, `common/controller/{poolSummary,buildStats}.ts` + tests, `common/bin/{compose-homepage,compose-hub}.ts` + `compose-hub.test.ts`, `editor/app/sites/{actions.ts,components/SiteForm.tsx}`, `editor/e2e/{helpers.ts,sites-crud.spec.ts}`, `homepage/e2e/{fixture-summary.ts,unlisted-site.spec.ts}`, `SITE.md`, `plans/FACTS.md` (Naming hazards) | | S1 | per the plan | per the plan | per the plan | -**Order:** HP → `r14/two-grounds-headers` → S1. The shared files are the three changelogs' -`[Unreleased]` sections and this record. +**Order:** HP → `r14/two-grounds-headers` → HS (`r14/hidden-sites`) and S1 (`r14/first-search`), +siblings. The shared files are the three changelogs' `[Unreleased]` sections and this record. ## Record @@ -1004,12 +1005,229 @@ There the bar overflows and the wide row scrolls while the name shows: measured 1100 px at 150 % and from 779 to 1300 px at 200 %. With the browser's own text size `md` moves too and nothing overflows. The `md` layout is slice HP's and unchanged here. +### Slice HS, as shipped — hidden sites: a site that builds and deploys, and is listed nowhere (2026-09-29) + +Branch `r14/hidden-sites` off `main` `99d4d76a`, worktree `~/Projects/homepage-social-visible` +(block #3: editor test 3311, export 3310, homepage e2e 3340, hub e2e 3341), one Opus implementer. +Scratch files `hs-*` in the job's `tmp`. The rulings (2026-09-29, not re-opened): +1. A hidden site is absent from the homepage (cards, chart, `/stats`), the hub (members, federated + search, `corpus.json`, `llms.txt`), every other site's related-sites footer, and the published + id lists (`channel-sites.json`, the pooled `stats/`). +2. Its hours and transcripts are in no public total. +3. The editor has one checkbox in each site's settings, and no homepage settings page. +4. The hidden site itself builds and deploys exactly as before. + +| sha | what | +|---|---| +| `122b8879` | `common:` `site.json` `listed` (schema, docs, parser, writer; `SITE.md`); `isListedSite` and `channelsOnlyOnUnlistedSites`; the footer drops an unlisted sibling | +| `77aa1456` | `common:` the homepage summary (v6), `channel-sites.json` and the whole-pool stats leave out an unlisted site and the channels only it exposes | +| `cbd12a8b` | `common:` `hub-sites.json` (and through it the hub's `corpus.json` and `llms.txt`) lists listed sites only | +| `5836d6ec` | `sites:` the checkbox, and `saveSiteAction` carries the key; `sites-crud` e2e | +| `64ae9b47` | `homepage:` the e2e fixture's seventh, unlisted site; `unlisted-site.spec.ts` | +| `30b3f486` | `plans:` this record; the three changelogs | +| `e3ee2eb1` | `homepage:` the fixture's second list unlists every site in it; the spec proves the site is in the input (review L1, L2) | +| `65675373` | `common:` a shared channel stays the listed site's when the unlisted id sorts first (review L3) | +| `20ff9ecf` | `plans:` FACTS' naming hazards (L4); this release's slices table, Order and Rollout carry HS (L6) | +| `7ea35dfb` | merge of `main` `ccf90892` (release 15 IG); `buildStats.ts` and `editor/CHANGELOG.md` merged clean, the HS bullet under `[Unreleased]` | +| _this_ | `plans:` the commit table, the review and the post-merge gates | + +The six commits up to `30b3f486` were rewritten after the review for the release's commit trailer +(`git filter-branch --msg-filter`, trees unchanged); their first shas were `5918ba27`, `10378f7f`, +`1491a7ab`, `ca22f0e6`, `e12515c2`, `4eeb80ee`. + +- **The key:** `listed?: boolean` in `site.json`, after `siteUrl`, in the type, `SITE_FIELD_DOCS`, + `siteFieldsSchema` and `siteToDisk`. Absent or anything but `false` reads `true`; only `false` is + written (the `archives` idiom). `SITE.md` regenerated. +- **One predicate.** `isListedSite(site)` (`site.listed !== false`) and + `channelsOnlyOnUnlistedSites(sites)` — the channels at least one site exposes and no listed site + does. Both live beside the key in `common/lib/siteSchema.ts` and are exported from `lib/site` + (its `export *`), like `isValidSiteId`: the summary builder is pure and imports them without + `lib/site`'s file I/O. Every filter below calls them. +- **What each public output does now:** + + | Output | Code | An unlisted site | A channel only unlisted sites expose | + |---|---|---|---| + | Homepage summary: `sites`, `official`, `monthly`, `series`, `recent`, `channels` | `buildHomepageSummary`, the public-site filter | absent | absent | + | Homepage summary: `totals`, `availability` | the same, over the in-scope stats | — | not counted | + | `channel-sites.json` | `channelSitesOf` (`controller/poolSummary.ts`) | absent from every list | absent | + | The homepage's `stats/` (whole-pool bundle) | `buildStats`, the whole-pool block | — | its records and its manifest entry absent | + | `hub-summary.json` | `toHubSummary` of the same summary | absent | not counted | + | `hub-sites.json`, the hub's `corpus.json`, `llms.txt` | `compose-hub.ts`, the built-in pool | absent | — | + | Every other site's footer | `resolveRelatedSites` | not linked, even from a featured group | — | + + - A channel a listed site also exposes is credited to the listed site: `primarySiteOf` runs over + listed public sites only. + - The summary's version is 6. No field was added or removed; the number marks the scope change. +- **What stays, and why:** + - The unlisted site's own build and deploy: `buildAll` and the deploy paths + (`common/publish/build.ts`), its per-site stats and summaries (`buildStats`, `buildIndex`), its + archives and chart templates, its own `/site.json`, `corpus.json`, `llms.txt`, sitemap. Its own + footer still lists its listed siblings. + - The editor's pages (`/sites`, the channel page's memberships, the nav's site switcher, the + priority focus), which list every site. + - `siteChannelIndex`, `renameChannel`, `migrateToSites`, `listSiteIds` for the CLI's + site argument, the export's default site: none is a public list. + - The per-site staging in `buildIndex.ts` (another slice's file, and per site). +- **Editor.** The site form has **List on the Archilyzer homepage and hub** after Public URL, on + by default, with a hint. `saveSiteAction` rebuilds the `Site` from the form; it now carries + `listed: false`, so a save of any other field keeps it. The other writers (`writeSite` from the + channel page, `renameChannel`, `migrateToSites`) spread the stored site or create a new one. +- **Tests:** + - `siteSchema.test.ts`: absent and `true` read listed, only `false` unlists and only `false` is + written, through `writeSite`/`getSite`; the "everything" round-trip fixture carries + `listed: false`; `channelsOnlyOnUnlistedSites` keeps a shared channel with the listed site; the + footer drops an unlisted sibling named in a featured group, and an unlisted site's footer + still lists the rest. + - `homepageSummary.test.ts`: an unlisted site with its own channel and one shared with a listed + site gives a summary deep-equal to the one without it (every array, every total), and its id, + title and channel appear nowhere in the JSON; an unlisted site with no `siteUrl`, and one whose + channels are all shared, change nothing either; `listed: true` equals no key. + - `buildStats.test.ts` (k): the whole-pool bundle leaves out the unlisted-only channel (records, + manifest, count, log line) and keeps a pool-only one; the unlisted site's own bundle keeps all + three of its videos. + - `poolSummary.test.ts` (new): `channelSitesOf` names listed sites only. + - `compose-hub.test.ts`: `hub-sites.json`, `corpus.json` and `llms.txt` name the listed site and + not the unlisted one. + - Editor `sites-crud`: a `listed: false` file opens unticked; a save that changes only the title + keeps `false`; ticking removes the key; unticking writes it again. + - Homepage `unlisted-site.spec.ts`: the builder's input holds the unlisted site (`listed: + false`, its own records, the shared channel), and listed it would add a card and its records; + the summary the dev server reads equals the one built without it; `/` and `/stats/` (served + HTML and DOM) name all six listed sites and not the unlisted one. + - `homepageSummary.test.ts`, after the review: an unlisted id that sorts BEFORE the listed one + (`aaa-hidden` < `beta`) still leaves the shared channel with the listed site. +- **The homepage e2e fixture** (`homepage/e2e/fixture-summary.ts`), for the slices that build on + it: + - `FIXTURE_SITES`: the six listed sites, unchanged. + - `FIXTURE_UNLISTED_SITE`: `fixture-unlisted`, "Fixture Unlisted", two channels of its own + (`fixture-unlisted-ch1/2`, six a day, like the rest); it also exposes `fixture-one-ch1`. + - `buildFixtureInputs(fixtureSites = FIXTURE_SITES, unlistedSites = [FIXTURE_UNLISTED_SITE])` + returns the builder's inputs (`stats`, `channelSites`, `sites`). The first list is listed; + every site in the second is written with `listed: false`, whatever it carries (`FixtureSite` + has no `listed` field), and shares the first listed site's first channel. + - `buildFixtureSummary(…)` is the real builder over those inputs. The unlisted sites' records are + generated last, after the megaspike, so every listed record is the same with them or without, + and `buildFixtureSummary()` equals `buildFixtureSummary(FIXTURE_SITES, [])`. Passed in the + FIRST list, the same site is listed: 7 sites and 39,599 transcripts instead of 6 and 37,199. + +#### Proof: a hidden fixture site through the real builds + +A throwaway corpus in the job's scratch dir (`$T/hs-proof/`, `make-corpus.mjs`): three channels +of three captioned videos each, and two sites with public URLs — `fixture-listed` (the listed +channel and the shared one) and `fixture-unlisted` (`listed: false`; the shared channel and one of +its own). Every path the builds write was pinned there (`TRANSCRIPTS_DIR`, `SETTINGS_FILE`, +`EXPORT_INDEX_DIR`, …) except the two apps' own `public/` and `out/`. The worktree's own gitignored +`homepage/public` data and `export/out` were set aside first and put back after; the +`export/public` links were dropped (never their targets) and re-seeded from the primary after. The +primary's `export/public` was untouched (no entry newer than the slice's start). Each build was +capped at 5 GB with no swap. + +| Build | Result | Time | Max RSS | +|---|---|---|---| +| `archilyzer index` | 0 | 4 s | — | +| `archilyzer build homepage --no-source` | 0 | 20 s | 776 MB | +| `archilyzer build hub` | 0 | 34 s | 1,005 MB | +| `archilyzer build site fixture-unlisted --skip-archives` | 0 | 41 s | 962 MB | +| `archilyzer build site fixture-listed --skip-archives` | 0 | 84 s | 970 MB | + +Counts (files holding the string / occurrences, `grep -rF`): + +| Tree | `fixture-unlisted` | its title | its own channel's slug | its own channel's name | `fixture-listed` | +|---|---|---|---|---|---| +| `homepage/public` (summary, `channel-sites.json`, `stats/`) | 0 / 0 | 0 / 0 | 0 / 0 | 0 / 0 | 2 / 25 | +| `homepage/out` | 0 / 0 | 0 / 0 | 0 / 0 | 0 / 0 | 10 / 145 | +| `export/public` (hub compose) | 0 / 0 | 0 / 0 | 0 / 0 | 0 / 0 | 4 / 10 | +| `export/out` (hub) | 0 / 0 | 0 / 0 | 0 / 0 | 0 / 0 | 4 / 10 | +| `export/out` (the listed site) | 0 / 0 | 0 / 0 | 0 / 0 | — | 9 / 30 (its URL) | + +- The compose lines: `compose-homepage: 2 channel(s) mapped across 1 listed site(s) (1 unlisted + left out); summary covers 6 transcription(s) / 6 download(s) across 1 public site(s)` and + `compose-hub: 1 built-in pool site(s) …; hub-summary.json covers 1 official instance(s)`. +- The summary: version 6; `totals` 6 transcripts, 6 downloads, 1 site, 2 channels, 6 hours; + `official` the same; `availability.counted` 6. With the unlisted site counted they would have + been 9 transcripts and 9 hours. +- The pooled `stats/` manifest: 6 records, channels `proof-listed-channel` and + `proof-shared-channel`. `channel-sites.json` maps both to `fixture-listed` alone. +- **The unlisted site still builds:** its own stats bundle holds all six of its videos (both its + channels); its build ships its own pages (its id in 17 files), and its footer links + `https://fixture-listed.example`. The listed site's footer links nothing: its only sibling is + unlisted. + +#### Gates (at `64ae9b47`, the tree of the first `e12515c2`; logs `$T/hs-*.log`) + +- **tsc** was clean before every commit (69 s, 33 s, 44 s — the last over the tip's code). +- **Unit:** + + | Suite | Result | + |---|---| + | common | 2,218/2,218 (8 new) | + | editor unit | 87/87 | + | homepage unit | 12/12 | + | `test:scripts` | 191 passed, 1 skipped (192) | + | mcp | 271/271 | + +- **Docs:** `docs files --check`, `settings example --check` and `docs env --check` all exit **0**. +- **e2e**, each detached and queued: + + | Suite | Passed | Failed | Time | + |---|---|---|---| + | homepage, full (the new `unlisted-site.spec.ts` 3) | 97 | 0 | 3.6 min | + | hub, full | 36 | 0 | 1.4 min (after 3.5 min in the queue) | + | editor: `sites-crud` (the new listed round-trip 1) | 15 | 0 | 0.9 min (after 11 min in the queue) | + +- **Builds:** the five above, in the proof. The editor's and umtool's `next build` were not run (no + route or bundled path changed; tsc covers the form and the action). +- **Numbers tool:** none. +- **After the review and the merge of `main` (at `7ea35dfb`; `$T/hs-gates3.log`):** tsc clean + (183 s, the machine under load); common 2,229/2,229 (release 15 IG's 2,220, this slice's 8 and + the review's 1); homepage unit 12/12; homepage e2e `unlisted-site.spec.ts` 3 passed, 0 failed + (19 s). The fixture's second list unlisting a site that carries no key, and the listed variant's + 7 sites / 39,599 transcripts, were checked by a script (`$T/hs-fixture-check2.ts`). + +#### Review (verdict SHIP; `$T/hs-review.md`) + +| Finding | Fix | +|---|---| +| L1: the fixture's second list relied on each site's own `listed: false` | `e3ee2eb1`: `buildFixtureInputs` writes `listed: false` on every site in it; `FixtureSite` has no `listed` | +| L2: the spec's first case would pass if the builder ignored the unlisted site | `e3ee2eb1`: it asserts the site is in the input (unlisted, its records, the shared channel) and that, listed, it adds a card and exactly its own records | +| L3: every unlisted id sorted after the listed one | `65675373`: `aaa-hidden` sorts before `beta`; the summary is still the one without it | +| L4: `unlisted` / `listed` already mean other things | `20ff9ecf`: a FACTS "Naming hazards" table of the three | +| L5: the listed site's out not searched for the own channel's name; the export site suite and `e2e:2origin` not run | left: both changes are no-ops for a site without the key, and the unit test and the real build's footer cover them | +| L6: this record's slices table, Order and Rollout did not name HS; the hub check's N | `20ff9ecf`: HS row and Order; the Rollout names HS, counts public LISTED sites and checks the new box | + +#### Found and left + +- **The unlisted site's own `/site.json` and `/corpus.json` still carry its `hubUrl`** (ruling 4: + it deploys exactly as before). A visitor who adds its origin to the hub by hand gets it as any + added origin, and the hub can read that `hubUrl` as a family member's. +- **`listed` / `unlisted` mean three things:** a video's visibility, `useHubSites`' `listed` + flag (the hub's list has loaded), and a site the family lists. FACTS' "Naming hazards" has the + table since the review. +- **The Rollout's hub check** ("`hub-summary.json covers N official instance(s)`") counts public + LISTED sites; the Rollout says so since the review. +- **Unlisting takes effect at the next builds.** The homepage, the hub and every other site are + static: until each is rebuilt and deployed, it still lists the site. +- **The editor's `/sites` list** shows no marker for an unlisted site; the form's checkbox is the + one place (ruling 3). + +#### Decisions the operator could overturn + +| What I assumed | The alternative | +|---|---| +| `totals` and `availability` keep counting pool-only channels and channels of sites with no public URL, as before; only a channel exposed by unlisted sites alone leaves them | `totals` count the listed public sites only, the same scope as `official` | +| A channel an unlisted site shares with a listed site with NO public URL is not "only on unlisted sites", so `totals` count it | count a channel only when a listed PUBLIC site exposes it | +| The pooled `stats/` keep pool-only channels, as before | the pooled `stats/` hold only channels a listed public site exposes | +| `isListedSite` lives beside the key in `siteSchema.ts`, exported from `lib/site` | define it in `lib/site.ts` itself, and have the summary builder import `lib/site`'s file I/O | +| The summary's version is 6 | stay at 5 (no field changed) | +| An unlisted site's own footer still links its listed siblings | an unlisted site shows no related-sites footer | +| The checkbox sits after Public URL, with a hint naming what it removes | at the end of the form, or without a hint | + ## Rollout -Release 14 is slice HP (merged, `bfa1ff3c`) and `r14/two-grounds-headers` (after the parent's -merge). Every command below is typed **from the primary checkout's root**. There is no -`archilyzer` on PATH, so it is `pnpm archilyzer …`. The command forms are the ones verified in -`plans/stats-cache-key.md`'s rollout. +Release 14 is slice HP (merged, `bfa1ff3c`), `r14/two-grounds-headers` and slice HS +(`r14/hidden-sites`), each after the parent's merge. Every command below is typed **from the +primary checkout's root**. There is no `archilyzer` on PATH, so it is `pnpm archilyzer …`. The +command forms are the ones verified in `plans/stats-cache-key.md`'s rollout. **Preconditions.** 1. `main` carries `r14/two-grounds-headers`. @@ -1038,8 +1256,9 @@ hub goes before the sites, because in basic mode they share `export/out`. The si - `pnpm ops build-hub --wait`, then `pnpm ops deploy-hub --wait`. **Between the two,** the build's `compose-hub: …` line must end with `hub-summary.json covers - N official instance(s)`, where N is the number of public sites. If it says `hub-summary.json - skipped: …`, stop and fix what it names. + N official instance(s)`, where N is the number of public LISTED sites (a site whose + **List on the Archilyzer homepage and hub** is unticked is not counted). If it says + `hub-summary.json skipped: …`, stop and fix what it names. 4. **The six sites:** `pnpm ops build-deploy --json '{"all":true}' --wait`. **Live checks.** @@ -1057,3 +1276,6 @@ hub goes before the sites, because in basic mode they share `export/out`. The si and `localStorage.getItem("ytdlp-tb:base")` now reads `"light"`. - The homepage's growth chart has no slash in the page colour through any band. `/stats` in Area mode has coloured top lines. +- Every site's settings in the editor show **List on the Archilyzer homepage and hub**, ticked. With + none unticked, the homepage, the hub and every footer list the same sites as before, and + `https://archilyzer.pages.dev/homepage-summary.json` reads `"version":6`.