commit c8c84def5e0c91c54c4fab858008a30e8486f5f5 parent f904526b3c7d0019e60c6c036810dda4abdf12fc Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st> Date: Sun, 11 Oct 2026 14:24:45 -0400 sites: reports become pages — site.json `pages`, served at /pages/<id>/, linked by title Release 26 A5 (plans/reports-on-homepage.md). A site's published reports are its pages: site.json `pages` (ordered ids; legacy `reports` read as `pages` for release 26 only, never written; a patch of `reports` is refused), served at /pages/<id>/ with their views under public/pages/ (SITE_REPORTS_BASE flips to /pages/: compose, the audits, the _headers feed types, corpus.json and llms.txt follow), and linked from the header by title after Ask AI. The Reports index route is gone, and so is the search-off home-as-index: a search-off site's home is its first page. A save with search off and no pages is refused (siteSearchProblem, D5). Compose still clears a public/reports/ an older compose left; a cited build holding one is refused. citedChannels unchanged. The editor's site form lists the pages; the e2e fixture, specs and unit tests move to /pages/; SITE.md and REPORT.md regenerated. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Diffstat:
78 files changed, 1041 insertions(+), 940 deletions(-)
diff --git a/PUBLISH.md b/PUBLISH.md @@ -57,7 +57,8 @@ for exactly the records that can hold one. ### Reports and cited sites -A site with `reports` (site.json) has two more steps, before its build and on the +A site with `pages` (site.json — its reports, each served at `/pages/<id>/` and linked +from the header by its title; `reports` before release 26) has two more steps, before its build and on the host. First, **fetch the missing evidence**: *Fetch missing evidence* on the Reports tab, or `pnpm ops fetch-windows --json '{"siteId":"<id>"}' --wait`, fetches the window of every cited span whose media is not on disk, through the editor's managed @@ -117,12 +118,12 @@ and only a file of at most 24 MiB: a larger pack stays on the host; the page's download line lists what was published), its cited stills (never a saved source copy), one page per cited moment with the transcript lines around it, the prepared clips and captures — only those the published reports cite — and each report's revision -history: `reports/<id>/history/history.json` (every revision's number, date, commit, -report sha256, change summary and claim-level word diff, which `/reports/<id>/history/` -renders) and a dumb-HTTP clone at `reports/<id>/history/repo/`, staged as the source +history: `pages/<id>/history/history.json` (every revision's number, date, commit, +report sha256, change summary and claim-level word diff, which `/pages/<id>/history/` +renders) and a dumb-HTTP clone at `pages/<id>/history/repo/`, staged as the source mirror is (a fresh bare clone, `repack -a -d`, `update-server-info`, then only `HEAD`, `packed-refs`, `info/refs`, `objects/info/packs`, the packs and `refs/heads/main`), so -`git clone <siteUrl>/reports/<id>/history/repo` works. The deploy audit refuses any other +`git clone <siteUrl>/pages/<id>/history/repo` works. The deploy audit refuses any other file in a clone or one over 24 MiB, and counts the clone's files toward Pages' 20,000. Every quote is checked as it is composed: a span's against its cues within 5 s either side (read under the caption-track rule — `en-orig` first, then the first English track with cues — and against every diff --git a/REPORT.md b/REPORT.md @@ -2,7 +2,7 @@ <!-- GENERATED by common/bin/file-schemas-docs.ts from the schemas and their *_FIELD_DOCS records — do not edit by hand. --> -One cited report, format `"archilyzer-report"`, version 1, persisted to `transcripts/sites/<siteId>/reports/<reportId>/report.json` beside its `stills/` and `sources/<sourceId>/`; a relative path in it is relative to that directory. A site's `reports` list in `site.json` is the published, ordered list — see [SITE.md](SITE.md); a report directory it does not name is a draft. The schema is `common/lib/report/schema.ts`; its citations and sources are the citation model's — see [CITATIONS.md](CITATIONS.md). A `notes.json` beside it holds the operator's notes on the article (umtool, `umtool notes`; [umtool/docs/notes.md](umtool/docs/notes.md)) and is never published. +One cited report, format `"archilyzer-report"`, version 1, persisted to `transcripts/sites/<siteId>/reports/<reportId>/report.json` beside its `stills/` and `sources/<sourceId>/`; a relative path in it is relative to that directory. A site's `pages` list in `site.json` is the published, ordered list, each served at `/pages/<id>/` — see [SITE.md](SITE.md); a report directory it does not name is a draft. The schema is `common/lib/report/schema.ts`; its citations and sources are the citation model's — see [CITATIONS.md](CITATIONS.md). A `notes.json` beside it holds the operator's notes on the article (umtool, `umtool notes`; [umtool/docs/notes.md](umtool/docs/notes.md)) and is never published. A **fact-check** (`"kind": "factcheck"`) is sections (chapters) of claims, each with a verdict and its findings. A **sweep** (`"kind": "sweep"`) is sections with no verdicts, or bodies that cite inline. Either may keep a **timeline** (`entries`): dated entries appended over time. Markdown fields (`summary`, an entry's `body`, a section's `body`, a claim's `findings`) cite with `[label](cite:<id>)`. @@ -16,7 +16,7 @@ Regenerate this file with `pnpm --filter yt-dlp-transcript-common exec tsx bin/f |---|---|---| | `format` | yes | `"archilyzer-report"`. | | `version` | yes | `1`. | -| `id` | yes | The report's id: a lowercase slug (`[a-z0-9][a-z0-9-]*`, at most 64), its directory name under `reports/` and the last segment of its page, `/reports/<id>/`. Must match the directory. | +| `id` | yes | The report's id: a lowercase slug (`[a-z0-9][a-z0-9-]*`, at most 64), its directory name under `reports/` and the last segment of its page (on a site, `/pages/<id>/`). Must match the directory. | | `kind` | yes | `"factcheck"` — sections of claims, each with a verdict — or `"sweep"` — sections with no verdicts, or bodies with inline citations. | | `series` | no | The series the report belongs to: a recurring name for its kind of report. It is shown on its own line above the title, in the accent colour, at the head of the report's page, its exports and the report list (where a report with no series shows its kind instead), and is joined to the title as `<series>: <title>` where one line names the report (a page title, a link, a cited-in entry). | | `title` | yes | The report's title. | @@ -61,7 +61,7 @@ Regenerate this file with `pnpm --filter yt-dlp-transcript-common exec tsx bin/f ## The timeline -A report may keep a timeline: `entries`, dated blocks a reader sees newest first under **Timeline**, after the summary and before what the check found and the claims — on its page, in its exports and as one slide each. Entries of the same instant keep their order in the file. Each entry's id is its anchor (`#<id>`). Its citations are numbered with the rest, in the page's order. A report with a newer entry than its own `updated` is shown as updated then (the index, the header, the feeds). On a site with a public `siteUrl`, compose publishes the timeline as feeds beside the page — `/reports/<id>/feed.xml` (RSS 2.0) and `/reports/<id>/feed.json` (JSON Feed 1.1), one item per entry, its permalink the page at its anchor — and the page links them ("Subscribe", and `<link rel="alternate">`). A site with no `siteUrl` publishes no feed. +A report may keep a timeline: `entries`, dated blocks a reader sees newest first under **Timeline**, after the summary and before what the check found and the claims — on its page, in its exports and as one slide each. Entries of the same instant keep their order in the file. Each entry's id is its anchor (`#<id>`). Its citations are numbered with the rest, in the page's order. A report with a newer entry than its own `updated` is shown as updated then (the index, the header, the feeds). On a site with a public `siteUrl`, compose publishes the timeline as feeds beside the page — `/pages/<id>/feed.xml` (RSS 2.0) and `/pages/<id>/feed.json` (JSON Feed 1.1), one item per entry, its permalink the page at its anchor — and the page links them ("Subscribe", and `<link rel="alternate">`). A site with no `siteUrl` publishes no feed. #### `entries[]` diff --git a/SITE.md b/SITE.md @@ -26,7 +26,7 @@ Regenerate this file with `pnpm --filter yt-dlp-transcript-common exec tsx bin/f | [`siteUrl`](#siteurl) | absent | | [`listed`](#listed) | `true` | | [`audience`](#audience) | absent | -| [`reports`](#reports) | `[]` | +| [`pages`](#pages) | `[]` | | [`relatedSites`](#relatedsites) | `[]` | | [`search`](#search) | `true` | | [`pwa`](#pwa) | `false` | @@ -193,9 +193,9 @@ Who this site is built for. `"public"` (the default; absent) or `"private"`: the Default: absent -## `reports` +## `pages` -The site's published reports, in display order: report ids (lowercase slugs, `[a-z0-9][a-z0-9-]*`), each a directory under `sites/<siteId>/reports/`. A report directory not named here is a draft and is not published. Invalid and repeated ids are dropped. Absent/empty = no reports. +The site's pages, in order: report ids (lowercase slugs, `[a-z0-9][a-z0-9-]*`), each a directory under `sites/<siteId>/reports/` holding a report document. Each is served at `/pages/<id>/` and linked from the site's header by its title; a report directory not named here is a draft and is not published. Invalid and repeated ids are dropped. Absent/empty = no pages. Legacy `reports` (the key before release 26) reads as `pages` when `pages` is absent, and is never written. Default: @@ -224,7 +224,7 @@ Default: ## `search` -Whether this site publishes its searchable corpus. Opt-OUT: absent/true = on, only an explicit `false` is written. Off = report-only: the site publishes only its `reports` and the moments they cite — no search, browse, transcripts or archives; `channels` is the pool its citations resolve against (with `citedChannels`), and its `/corpus.json` says `"scope": "cited"`. A report-only site is never listed (as `listed: false`, whatever `listed` says). Legacy `publish: "cited"` reads as `false`. +Whether this site publishes its searchable corpus. Opt-OUT: absent/true = on, only an explicit `false` is written. Off = pages only: the site publishes only its `pages` and the moments they cite — no search, browse, transcripts or archives; its home page is its first page; `channels` is the pool its citations resolve against (with `citedChannels`), and its `/corpus.json` says `"scope": "cited"`. A save with search off and no `pages` is refused. A search-off site is never listed (as `listed: false`, whatever `listed` says). Legacy `publish: "cited"` reads as `false`. Default: `true` diff --git a/common/bin/compose-hub.ts b/common/bin/compose-hub.ts @@ -121,7 +121,10 @@ export const SITE_ONLY_PUBLIC_ENTRIES: readonly string[] = [ "digests", "stats", "archives", - // A report site's reports, moments and cited media (publish/composeReports.ts). + // A site's pages (its reports), moments and cited media + // (publish/composeReports.ts), and where a site's reports were before + // release 26. + "pages", "reports", "m", "media", diff --git a/common/bin/compose-site.ts b/common/bin/compose-site.ts @@ -9,8 +9,8 @@ // public/transcripts/<slug>/ <- shared/transcripts/<slug>/ (site's members) // public/stats/* <- sites/<id>/stats/ (per-site) // public/chart-templates.json <- sites/<id>/chart-templates.json (per-site) -// public/reports/, m/, media/ <- the site's reports, resolved against the -// corpus (publish/composeReports.ts) +// public/pages/, m/, media/ <- the site's pages (its reports), resolved +// against the corpus (publish/composeReports.ts) // // Only the site's member channels are composed, so each deployed bundle holds // only that site's data. Checked-in static assets in public/ are left intact. diff --git a/common/bin/reports-check.ts b/common/bin/reports-check.ts @@ -62,7 +62,7 @@ export async function checkMain( return 2; } const site = getSite(opts.siteId, paths); - const ids = opts.reports ?? site.reports ?? []; + const ids = opts.reports ?? site.pages ?? []; if (ids.length === 0) { out.log(`reports check ${opts.siteId}: the site publishes no reports — nothing to check.`); return 0; @@ -70,7 +70,7 @@ export async function checkMain( try { const resolved = await resolveSiteReports({ paths, - site: { ...site, reports: ids }, + site: { ...site, pages: ids }, allowMissingMedia: opts.allowMissingMedia === true, ...(opts.settings ? { settings: opts.settings } : {}), }); diff --git a/common/components/report/ReportIndex.tsx b/common/components/report/ReportIndex.tsx @@ -2,10 +2,9 @@ import Link from "next/link"; import type { ReportIndexView } from "../../lib/report/views"; import { EmptyState, Eyebrow, ReportName, dateLabel } from "./parts"; -// The report index: `/reports/`, and a cited site's home page when it has more -// than one report. One card per published report, in the site's order -// (site.json `reports`): its name, subtitle and dates -- its counts and tally -// are the report page's. `heading: null` draws no heading (the home page: the +// A report index: one card per published report, in the index's order: its +// name, subtitle and dates -- its counts and tally are the report page's. (A +// site has none since release 26: its header links each page by its title.) `heading: null` draws no heading (the home page: the // header already names the site). `empty` is what an index with nothing in it // says. diff --git a/common/components/report/exportSlides.test.ts b/common/components/report/exportSlides.test.ts @@ -64,7 +64,7 @@ function view(r = report()): ReportPageView { const FOOTER = { revision: 2, date: "2026-10-04", reportSha256: "ab".repeat(32) }; const images: Record<string, string> = { "/media/posters/abc123.png": "data:image/png;base64,AAA", - "/reports/demo/stills/a1.png": "data:image/png;base64,BBB", + "/pages/demo/stills/a1.png": "data:image/png;base64,BBB", "/media/posts/demo-social/123/shot.png": "data:image/png;base64,CCC", }; const html = (v = view(), siteUrl = "https://site.example/") => @@ -90,7 +90,7 @@ test("one file: the stylesheet and the script inline, every picture the resolver // The clip's poster on k1's evidence, the still on the section's; k2's // quote shows its post's words, not its capture. assert.deepEqual(srcs.sort(), ["data:image/png;base64,AAA", "data:image/png;base64,BBB"]); - assert.deepEqual(slidesImagePaths(view()), ["/media/posters/abc123.png", "/reports/demo/stills/a1.png"]); + assert.deepEqual(slidesImagePaths(view()), ["/media/posters/abc123.png", "/pages/demo/stills/a1.png"]); // The site's accent, on the light base. assert.match(out, /<html lang="en" class="rs-root" style="--brand:#6a4bc4;/); // Escaped, as everywhere. @@ -99,8 +99,8 @@ test("one file: the stylesheet and the script inline, every picture the resolver test("the way back: each slide links to its place in the article on the site; with no site, nowhere", () => { const out = html(); - assert.match(out, /href="https:\/\/site\.example\/reports\/demo\/#k1" data-slide-read="k1"/); - assert.match(out, /href="https:\/\/site\.example\/reports\/demo\/#report-end" data-slide-read="report-end"/); + assert.match(out, /href="https:\/\/site\.example\/pages\/demo\/#k1" data-slide-read="k1"/); + assert.match(out, /href="https:\/\/site\.example\/pages\/demo\/#report-end" data-slide-read="report-end"/); assert.doesNotMatch(html(view(), ""), /data-slide-read=/); // A citation's number goes to the reference list under the deck, which links out. assert.match(out, /<a href="#c-v1">\[1\]<\/a>/); @@ -114,7 +114,7 @@ test("a timeline entry is a slide: its date, its title, its first sentences", () out, /data-slide="entry:e1" data-slide-kind="entry" data-layout="statement"[^>]*>.*<b>Timeline<\/b> · 1 of 1.*<p class="rs-dates"><time datetime="2026-10-03T08:00:00Z">2026-10-03<\/time><\/p><h2 class="rs-h">An update<\/h2><div class="rs-statement"><div class="rs-md"><p>It moved<sup[^>]*><a href="#c-v1">\[1\]<\/a><\/sup>\. Then more\.<\/p>/s, ); - assert.match(out, /href="https:\/\/site\.example\/reports\/demo\/#e1" data-slide-read="e1"/); + assert.match(out, /href="https:\/\/site\.example\/pages\/demo\/#e1" data-slide-read="e1"/); }); test("the sources slide names which document this is", () => { @@ -133,7 +133,7 @@ test("the string slides mirror Slide.tsx: the same `rs-` classes, slide by slide const articles = out.split(/(?=<article class="rs-slide")/).slice(1).map((a) => a.slice(0, a.indexOf("</article>") + 10)); slides.forEach((s, i) => { const react = renderToStaticMarkup( - React.createElement(Slide, { slide: s, view: v, total: slides.length, pageUrl: "https://site.example/reports/demo/" }), + React.createElement(Slide, { slide: s, view: v, total: slides.length, pageUrl: "https://site.example/pages/demo/" }), ); assert.deepEqual(classes(articles[i]), classes(react), s.key); }); diff --git a/common/components/report/renderer.test.ts b/common/components/report/renderer.test.ts @@ -21,7 +21,7 @@ const history: ReportHistoryView = { reportId: "demo", title: "Demo", branch: "main", - clone: "/reports/demo/history/repo", + clone: "/pages/demo/history/repo", revisions: [{ revision: 1, date: "2026-10-01T09:00:00Z", commit: "c".repeat(40), reportSha256: "a".repeat(64), summary: [], claims: [] }], }; @@ -37,12 +37,12 @@ const moment: MomentPageView = { test("a history page links its report and its history.json under the site's base, or the one it is given", () => { const site = renderToStaticMarkup(h(ReportHistory, { view: history })); - assert.match(site, /href="\/reports\/demo\/"/); - assert.match(site, /href="\/reports\/demo\/history\/history.json"/); + assert.match(site, /href="\/pages\/demo\/"/); + assert.match(site, /href="\/pages\/demo\/history\/history.json"/); const other = renderToStaticMarkup(h(ReportHistory, { view: history, base: "/articles/" })); assert.match(other, /href="\/articles\/demo\/"/); assert.match(other, /href="\/articles\/demo\/history\/history.json"/); - assert.doesNotMatch(other, /href="\/reports\//); + assert.doesNotMatch(other, /href="\/pages\//); }); test("a moment opens in the archive at the view's corpus link, or the resolver's, or nowhere", () => { diff --git a/common/components/report/slides/ReportReader.tsx b/common/components/report/slides/ReportReader.tsx @@ -82,7 +82,7 @@ export function ReportReader({ series, views = READER_VIEWS, }: { - // The report's page view (/reports/<id>/page.json). + // The report's page view (`<base><id>/page.json`, lib/report/routes.ts). pagePath: string; title: string; series?: string; diff --git a/common/lib/archive/headers.test.ts b/common/lib/archive/headers.test.ts @@ -174,12 +174,12 @@ test("every rendered entry is one path line and one indented header", () => { }); // A report's timeline feeds (lib/report/feeds.ts) are served with their own -// media type, and readable cross-origin (no site CORS rule covers reports/). +// media type, and readable cross-origin (no site CORS rule covers pages/). const SITE_TYPES_BLOCK = `# Served with their own media type. -/reports/:report/feed.xml +/pages/:report/feed.xml Content-Type: application/rss+xml; charset=utf-8 Access-Control-Allow-Origin: * -/reports/:report/feed.json +/pages/:report/feed.json Content-Type: application/feed+json; charset=utf-8 Access-Control-Allow-Origin: * `; @@ -197,6 +197,6 @@ test("renderHeadersFile: a site's typed paths follow its CORS lines, before the test("the typed paths are the report feeds' files and media types", () => { assert.deepEqual( SITE_TYPED_PATHS, - REPORT_FEED_FORMATS.map((f) => ({ path: `/reports/:report/${REPORT_FEED_FILENAMES[f]}`, type: `${REPORT_FEED_MIME[f]}; charset=utf-8` })), + REPORT_FEED_FORMATS.map((f) => ({ path: `/pages/:report/${REPORT_FEED_FILENAMES[f]}`, type: `${REPORT_FEED_MIME[f]}; charset=utf-8` })), ); }); diff --git a/common/lib/archive/headers.ts b/common/lib/archive/headers.ts @@ -11,6 +11,7 @@ // `CONTRACT` / `ROOT_FILES`, no `node:*`. import { CONTRACT, ROOT_FILES } from "./contract"; +import { SITE_REPORTS_BASE } from "../report/routes"; // The single header every served document gets. All served data is public // static JSON with no credentials, so `*` is correct and is what lets a @@ -87,8 +88,8 @@ const NO_STORE_HEADER = "Cache-Control: no-store"; // Kept in step with lib/report/views.ts (REPORT_FEED_FILENAMES, REPORT_FEED_MIME) // by headers.test.ts. export const SITE_TYPED_PATHS: readonly { path: string; type: string }[] = [ - { path: "/reports/:report/feed.xml", type: "application/rss+xml; charset=utf-8" }, - { path: "/reports/:report/feed.json", type: "application/feed+json; charset=utf-8" }, + { path: `${SITE_REPORTS_BASE}:report/feed.xml`, type: "application/rss+xml; charset=utf-8" }, + { path: `${SITE_REPORTS_BASE}:report/feed.json`, type: "application/feed+json; charset=utf-8" }, ]; // Whether a `_headers` path rule (a literal path, or one ending in a `*` splat) diff --git a/common/lib/archive/reader-reports.test.ts b/common/lib/archive/reader-reports.test.ts @@ -27,7 +27,7 @@ const CITED_CORPUS = { site: { id: "demo-reports", title: "Demo reports", url: ORIGIN, scope: "cited", audience: "public" }, totals: { channels: 0, videos: 0 }, channels: [], - reports: { index: `${ORIGIN}/reports/index.json`, count: 1 }, + reports: { index: `${ORIGIN}/pages/index.json`, count: 1 }, }; const FULL_CORPUS = { @@ -35,7 +35,7 @@ const FULL_CORPUS = { kind: "site", site: { id: "demo-full", title: "Demo full", url: ORIGIN }, channels: [{ slug: "demo-channel", name: "Demo Channel", videoCount: 1 }], - reports: { index: `${ORIGIN}/reports/index.json`, count: 1 }, + reports: { index: `${ORIGIN}/pages/index.json`, count: 1 }, }; const INDEX: ReportIndexView = { @@ -46,7 +46,7 @@ const INDEX: ReportIndexView = { id: "demo-report", kind: "factcheck", title: "A demo report", - href: "/reports/demo-report/", + href: "/pages/demo-report/", citationCount: 1, claimCount: 1, tally: [{ verdict: "CORROBORATED", count: 1 }], @@ -101,8 +101,8 @@ test("remote: a cited site is an empty corpus with its reports, read without an const restore = installFetch( { [`${ORIGIN}/corpus.json`]: CITED_CORPUS, - [`${ORIGIN}/reports/index.json`]: INDEX, - [`${ORIGIN}/reports/demo-report/page.json`]: PAGE, + [`${ORIGIN}/pages/index.json`]: INDEX, + [`${ORIGIN}/pages/demo-report/page.json`]: PAGE, }, fetches, ); @@ -117,18 +117,18 @@ test("remote: a cited site is an empty corpus with its reports, read without an assert.deepEqual((await r.loadGroups()).groups, []); assert.equal((await r.videoIndex()).size, 0); await r.reports(); - assert.equal(fetches.filter((u) => u.endsWith("/reports/index.json")).length, 1, "the index is cached"); + assert.equal(fetches.filter((u) => u.endsWith("/pages/index.json")).length, 1, "the index is cached"); } finally { restore(); } }); -test("remote: a report id is one path segment — it cannot leave /reports/", async () => { +test("remote: a report id is one path segment — it cannot leave /pages/", async () => { const fetches: string[] = []; const restore = installFetch({ [`${ORIGIN}/corpus.json`]: CITED_CORPUS }, fetches); try { assert.equal(await new RemoteSource(ORIGIN).reportPage("../corpus"), null); - assert.deepEqual(fetches, [`${ORIGIN}/reports/..%2Fcorpus/page.json`]); + assert.deepEqual(fetches, [`${ORIGIN}/pages/..%2Fcorpus/page.json`]); } finally { restore(); } @@ -137,7 +137,7 @@ test("remote: a report id is one path segment — it cannot leave /reports/", as test("remote: a full site with reports reads its channels as before; one without has no reports", async () => { const restore = installFetch({ [`${ORIGIN}/corpus.json`]: FULL_CORPUS, - [`${ORIGIN}/reports/index.json`]: INDEX, + [`${ORIGIN}/pages/index.json`]: INDEX, }); try { const r = new RemoteSource(ORIGIN); @@ -194,8 +194,8 @@ async function writeDir(files: Record<string, unknown>): Promise<string> { test("local: a cited dir never falls back to a stale transcripts/ listing", async () => { const dir = await writeDir({ "corpus.json": CITED_CORPUS, - "reports/index.json": INDEX, - "reports/demo-report/page.json": PAGE, + "pages/index.json": INDEX, + "pages/demo-report/page.json": PAGE, // A stale channel tree a cited build must not be read as. "transcripts/demo-channel/manifest.json": { version: 1, pageCount: 0, slugToPage: {} }, }); @@ -226,7 +226,7 @@ test("local: a full dir with no reports reads as before", async () => { }); test("local: a page.json that is not a report page is an error, not an absence", async () => { - const dir = await writeDir({ "corpus.json": CITED_CORPUS, "reports/demo-report/page.json": { hello: 1 } }); + const dir = await writeDir({ "corpus.json": CITED_CORPUS, "pages/demo-report/page.json": { hello: 1 } }); try { await assert.rejects(() => new LocalSource(dir).reportPage("demo-report"), /not a report page view/); } finally { diff --git a/common/lib/archive/reader.ts b/common/lib/archive/reader.ts @@ -413,11 +413,11 @@ export interface ArchiveReader { // archive. Learned from corpus.json with the channel list. OPTIONAL: a stub // has no corpus.json, and a hub's members each have their own. scope?(): Promise<CorpusScope>; - // The site's report index (/reports/index.json, spec 5): one entry per + // The site's report index (/pages/index.json, spec 5): one entry per // published report. [] when it publishes none — absent, malformed, or a site // built before spec 5. Cached per source. reports?(): Promise<ReportIndexEntry[]>; - // One report's page view (/reports/<id>/page.json), every citation + // One report's page view (/pages/<id>/page.json), every citation // resolved; null when the site publishes no report of that id. reportPage?(id: string): Promise<ReportPageView | null>; } @@ -459,7 +459,7 @@ export function coerceReportPage(raw: unknown, id: string): ReportPageView { // A report id as ONE path segment of a URL. An id is a lowercase slug // (lib/report/schema.ts REPORT_ID_RE); anything else is encoded so it cannot -// leave /reports/ — it simply names no report. +// leave /pages/ — it simply names no report. function reportPagePathFor(id: string): string { return reportViewPath(encodeURIComponent(id)); } diff --git a/common/lib/builtExport.test.ts b/common/lib/builtExport.test.ts @@ -166,11 +166,11 @@ test("builtHubProblem accepts only a hub bundle", () => { }); // Found on main 2026-10-05: the export app renders its report and moment -// routes into EVERY build — `reports/index.html`, the `_none` placeholders — -// so a hub bundle always has `reports/` and `m/`, and listing them as site +// routes into EVERY build — `pages/index.html`, the `_none` placeholders — +// so a hub bundle always has `pages/` and `m/`, and listing them as site // data refused every hub. What is refused now is the report DATA a site's // compose writes there. -test("builtHubProblem: the shell's reports/ and m/ pages pass; report data, moment data and a real post do not", () => { +test("builtHubProblem: the shell's pages/ and m/ pages pass; report data, moment data and a real post do not", () => { const hub = tempOut(); try { writeFileSync(path.join(hub.dir, "hub-sites.json"), "[]"); @@ -180,10 +180,10 @@ test("builtHubProblem: the shell's reports/ and m/ pages pass; report data, mome }; // What `next build` renders for the export app's own routes. for (const rel of [ - "reports/index.html", - "reports/index.txt", - "reports/_none/index.html", - "reports/_none/history/index.html", + "pages/index.html", + "pages/index.txt", + "pages/_none/index.html", + "pages/_none/history/index.html", "m/_none/index.html", "m/_none/index.txt", ]) { @@ -199,22 +199,22 @@ test("builtHubProblem: the shell's reports/ and m/ pages pass; report data, mome return problem; }; for (const rel of [ - "reports/index.json", - "reports/r1/page.json", - "reports/r1/citations.json", - "reports/r1/citations.csv", - "reports/r1/evidence-pack.zip", - "reports/r1/history/history.json", - "reports/r1/history/repo/HEAD", + "pages/index.json", + "pages/r1/page.json", + "pages/r1/citations.json", + "pages/r1/citations.csv", + "pages/r1/evidence-pack.zip", + "pages/r1/history/history.json", + "pages/r1/history/repo/HEAD", "m/index.json", "m/jer/v1/0-10/moment.json", ]) { const problem = refusedFor(rel); assert.match(problem ?? "", /still carries a site's data/, rel); - assert.ok(problem!.includes(rel.endsWith("/HEAD") ? "reports/r1/history/repo/" : rel), `${rel}: ${problem}`); + assert.ok(problem!.includes(rel.endsWith("/HEAD") ? "pages/r1/history/repo/" : rel), `${rel}: ${problem}`); } // (The history clone is a directory: removing its HEAD leaves repo/.) - rmSync(path.join(hub.dir, "reports", "r1"), { recursive: true }); + rmSync(path.join(hub.dir, "pages", "r1"), { recursive: true }); assert.equal(builtHubProblem(hub.dir), null, "nothing left behind"); // A tombstone-only posts/ is the hub's own; one real post is a site's. @@ -376,12 +376,12 @@ function citedOut(extra: string[] = []): { dir: string; cleanup: () => void } { "downloads/index.html", "duplicates/index.html", "offline/index.html", - "reports/index.json", - "reports/index.html", - "reports/_none/index.html", - "reports/demo-report/index.html", - "reports/demo-report/page.json", - "reports/demo-report/stills/a01.png", + "pages/index.json", + "pages/index.html", + "pages/_none/index.html", + "pages/demo-report/index.html", + "pages/demo-report/page.json", + "pages/demo-report/stills/a01.png", "m/index.json", "m/_none/index.html", "m/demo-channel/abc123/10.00-20.00/index.html", @@ -426,6 +426,8 @@ test("a cited build holding anything corpus-shaped is refused — by the audit a "sw.js", "media/thumbnails/a.jpg", "media/stray.mp4", + // where a site's reports were published before release 26 + "reports/demo-report/page.json", ]) { const t = citedOut([extra]); try { @@ -466,15 +468,15 @@ test("a cited build over the Pages file limit is refused", () => { // A report's published history clone (publish/reportHistory.ts). const HISTORY_REPO_FILES = [ - "reports/demo-report/history/index.html", - "reports/demo-report/history/history.json", - "reports/demo-report/history/repo/HEAD", - "reports/demo-report/history/repo/packed-refs", - "reports/demo-report/history/repo/info/refs", - "reports/demo-report/history/repo/objects/info/packs", - "reports/demo-report/history/repo/refs/heads/main", - `reports/demo-report/history/repo/objects/pack/pack-${"a".repeat(40)}.pack`, - `reports/demo-report/history/repo/objects/pack/pack-${"a".repeat(40)}.idx`, + "pages/demo-report/history/index.html", + "pages/demo-report/history/history.json", + "pages/demo-report/history/repo/HEAD", + "pages/demo-report/history/repo/packed-refs", + "pages/demo-report/history/repo/info/refs", + "pages/demo-report/history/repo/objects/info/packs", + "pages/demo-report/history/repo/refs/heads/main", + `pages/demo-report/history/repo/objects/pack/pack-${"a".repeat(40)}.pack`, + `pages/demo-report/history/repo/objects/pack/pack-${"a".repeat(40)}.idx`, ]; test("a report's history clone passes the audit; anything else in it is refused, full build or cited", () => { @@ -484,10 +486,10 @@ test("a report's history clone passes the audit; anything else in it is refused, assert.equal(builtBundleProblem(t.dir, "reports-site"), null); assert.equal(builtSiteProblem(t.dir, "reports-site"), null); for (const leak of ["config", "hooks/pre-commit", "logs/HEAD", "description", "FETCH_HEAD"]) { - const f = path.join(t.dir, "reports", "demo-report", "history", "repo", leak); + const f = path.join(t.dir, "pages", "demo-report", "history", "repo", leak); mkdirSync(path.dirname(f), { recursive: true }); writeFileSync(f, "x"); - assert.match(reportHistoryProblem(t.dir)!, new RegExp(`history clone that are not published: reports/demo-report/history/repo/${leak}`)); + assert.match(reportHistoryProblem(t.dir)!, new RegExp(`history clone that are not published: pages/demo-report/history/repo/${leak}`)); assert.match(builtBundleProblem(t.dir, "reports-site")!, /history clone/); rmSync(f); } @@ -496,7 +498,7 @@ test("a report's history clone passes the audit; anything else in it is refused, } const full = bundle({ site: { siteId: "anilyzer" }, corpus: { spec: 5, site: { id: "anilyzer" } } }); try { - const f = path.join(full.dir, "reports", "r1", "history", "repo", "config"); + const f = path.join(full.dir, "pages", "r1", "history", "repo", "config"); mkdirSync(path.dirname(f), { recursive: true }); writeFileSync(f, "x"); assert.match(builtSiteProblem(full.dir, "anilyzer")!, /history clone/); diff --git a/common/lib/builtExport.ts b/common/lib/builtExport.ts @@ -17,6 +17,7 @@ import { existsSync, readdirSync, readFileSync, statSync, type Dirent } from "no import path from "node:path"; import { isCitedOnlyChannel, isCitedSite } from "./siteSchema"; import { REPORT_HISTORY_REPO_FILE_RE } from "./report/revisions"; +import { SITE_REPORTS_BASE, reportBaseDir } from "./report/routes"; import { MOMENTS_INDEX_PATH, REPORTS_INDEX_PATH, @@ -27,6 +28,9 @@ import { reportViewPath, } from "./report/views"; +// Where a site's reports (its pages) are in an out dir: `pages`. +const SITE_REPORTS_DIR = reportBaseDir(SITE_REPORTS_BASE); + /** * The site id of the build sitting in `outDir`, or null when there is no * readable build there (no directory, no site.json, unparseable, or a site.json @@ -200,9 +204,9 @@ export const CITED_OUT_ALLOWED_DIRS: readonly string[] = [ "downloads", "duplicates", "offline", - // What compose's reports stage writes: the reports and their stills, the + // What compose's reports stage writes: the pages and their stills, the // moment pages, the cited media (with each route's placeholder, `_none`). - "reports", + SITE_REPORTS_DIR, "m", "media", "icons", @@ -337,17 +341,17 @@ export function citedBuildProblem(outDir: string): string | null { } // A file inside a report's published history clone, by its out/-relative path. -const REPORT_HISTORY_REPO_DIR_RE = /^reports\/[^/]+\/history\/repo\//; +const REPORT_HISTORY_REPO_DIR_RE = new RegExp(`^${SITE_REPORTS_DIR}/[^/]+/history/repo/`); /** - * Why the reports' history clones in `outDir` (`reports/<id>/history/repo/`, + * Why the reports' history clones in `outDir` (`pages/<id>/history/repo/`, * publish/reportHistory.ts) may not ship, as one sentence — or null. Any * build, full or cited: a clone may hold only the dumb-HTTP files its stager * copies (REPORT_HISTORY_REPO_FILE_RE — never a config, hook or log of the * store), each within the publish limit (PUBLISH_MAX_FILE_BYTES). */ export function reportHistoryProblem(outDir: string): string | null { - const reportsDir = path.join(outDir, "reports"); + const reportsDir = path.join(outDir, SITE_REPORTS_DIR); let reports: Dirent[]; try { reports = readdirSync(reportsDir, { withFileTypes: true }); @@ -366,8 +370,8 @@ export function reportHistoryProblem(outDir: string): string | null { const rr = rel ? `${rel}/${e.name}` : e.name; if (e.isDirectory()) walk(p, rr); else { - if (!REPORT_HISTORY_REPO_FILE_RE.test(rr)) extra.push(`reports/${r.name}/history/repo/${rr}`); - const problem = publishFileSizeProblem(`reports/${r.name}/history/repo/${rr}`, statSync(p).size); + if (!REPORT_HISTORY_REPO_FILE_RE.test(rr)) extra.push(`${SITE_REPORTS_DIR}/${r.name}/history/repo/${rr}`); + const problem = publishFileSizeProblem(`${SITE_REPORTS_DIR}/${r.name}/history/repo/${rr}`, statSync(p).size); if (problem) oversize.push(problem); } } @@ -518,8 +522,8 @@ export function builtHubProblem(outDir: string): string | null { existsSync(path.join(outDir, tree)) && !(tree === "posts" && isTombstonePostsTree(path.join(outDir, tree))), ); - // reports/ and m/ are the export app's own routes, rendered into EVERY - // build (the hub's included: /reports/, /reports/_none/, /m/_none/) — their + // pages/ and m/ are the export app's own routes, rendered into EVERY + // build (the hub's included: /pages/_none/, /m/_none/) — their // shell pages are not data. What a site's reports stage writes is. const reportData = hubReportDataIn(outDir); if (reportData.length > 0) carried.push(...reportData); @@ -603,9 +607,9 @@ export function isTombstoneChannelDir(dir: string): boolean { // The per-site data trees a hub bundle must never carry (the trees of // compose-hub's SITE_ONLY_PUBLIC_ENTRIES). A `posts/` of tombstones only is -// the hub's own (isTombstonePostsTree). `reports/` and `m/` are NOT here: the +// the hub's own (isTombstonePostsTree). `pages/` and `m/` are NOT here: the // export app renders its report and moment routes into every build, the hub's -// too (`reports/index.html`, the `_none` placeholders), so their presence says +// too (the `_none` placeholders), so their presence says // nothing — hubReportDataIn looks for the report DATA inside them instead. // (Listing them refused every hub bundle from 2026-10-05.) const HUB_FORBIDDEN_TREES = [ @@ -620,7 +624,7 @@ const HUB_FORBIDDEN_TREES = [ ]; // The files only a site's reports stage writes (lib/report/views.ts names -// them; publish/composeReports.ts writes them), by name within reports/<id>/ +// them; publish/composeReports.ts writes them), by name within pages/<id>/ // and m/…: the report index, each report's page view, its citations, its // exports, its timeline's feeds and its revision history; the moment index // and each moment view. @@ -636,7 +640,7 @@ const REPORT_DATA_FILES = new Set<string>([ const MOMENT_DATA_FILE = path.posix.basename(momentViewPath("x")); /** - * The report and moment DATA in a bundle's `reports/` and `m/` (root-relative + * The report and moment DATA in a bundle's `pages/` and `m/` (root-relative * paths, at most a few): what a site's compose writes there, never what the * export app's own route pages are. Empty for a hub bundle, which carries the * shell pages only. @@ -658,7 +662,7 @@ export function hubReportDataIn(outDir: string, limit = 5): string[] { const child = `${rel}/${e.name}`; if (e.isDirectory()) { // A report's revision history clone (history/repo/) is data whatever it holds. - if (rel.startsWith("reports/") && e.name === "repo" && rel.endsWith("/history")) { + if (rel.startsWith(`${SITE_REPORTS_DIR}/`) && e.name === "repo" && rel.endsWith("/history")) { found.push(`${child}/`); continue; } @@ -668,7 +672,7 @@ export function hubReportDataIn(outDir: string, limit = 5): string[] { } } }; - walk("reports", (name, depth) => depth >= 1 && REPORT_DATA_FILES.has(name), 0); + walk(SITE_REPORTS_DIR, (name, depth) => depth >= 1 && REPORT_DATA_FILES.has(name), 0); walk("m", (name) => name === MOMENT_DATA_FILE, 0); return found.slice(0, limit); } diff --git a/common/lib/corpus.ts b/common/lib/corpus.ts @@ -2,6 +2,7 @@ import type { PublicSiteDescriptor } from "./siteDescriptor"; import { AI_DOC_URL, PROJECT_GENERATOR } from "./project"; import { TAGS_FILENAME } from "./curatedTags"; import { REPORTS_INDEX_PATH, reportFullTitle } from "./report/views"; +import { SITE_REPORTS_BASE } from "./report/routes"; import { CONTRACT, archiveUrl, @@ -36,8 +37,8 @@ import { // version — an older reader ignores an unknown field, as it always has. // // v5: reports — a site may publish cited reports, announced as `reports` -// ({ index: "/reports/index.json" }, the report index the export's Reports -// pages read); and a CITED site (site.json `search: false`) publishes ONLY +// ({ index: "/pages/index.json" — "/reports/index.json" before release 26 +// A5 — the index of the site's pages); and a CITED site (site.json `search: false`) publishes ONLY // them, saying so as `site.scope: "cited"` with no channels and zero totals. // An older reader sees an empty corpus there, which is the safe reading: there // is no shard to fetch. @@ -215,7 +216,7 @@ export type SiteCorpus = { bulkArchives?: { manifest: string; note: string }; // Present when this site publishes at least one report (spec 5): the report // index, each entry linking its page; every report's page view and - // citations sit beside it under /reports/<id>/. + // citations sit beside it under /pages/<id>/. reports?: { index: string; count: number; description: string }; // Pointer to the human page on using the archive with AI: the homepage's AI // and MCP doc (AI_DOC_URL; the site's own /use-with-ai page until release @@ -341,8 +342,9 @@ export function buildSiteCorpus( count: opts.reportCount, description: "Cited reports. The index lists each report (title, kind, counts, " + - "`href` of its page); /reports/<id>/page.json is one report with every " + - "citation resolved, and /reports/<id>/citations.json (an " + + "`href` of its page); " + + `${SITE_REPORTS_BASE}<id>/page.json is one report with every ` + + `citation resolved, and ${SITE_REPORTS_BASE}<id>/citations.json (an ` + "archilyzer-citations set) and citations.csv are its citations as " + "data. A video or audio citation's moment page is /m/<channel>/<id>/" + "<start>-<end>/ (moment.json beside it), a post's /m/<channel>/<id>/.", @@ -512,15 +514,15 @@ function renderCitedLlmsTxt(corpus: SiteCorpus, reports: readonly LlmsReport[]): if (corpus.reports) { out.push( `- [Report index](${corpus.reports.index}): every report, as JSON; ` + - `/reports/<id>/page.json is one report with its citations resolved.`, + `${SITE_REPORTS_BASE}<id>/page.json is one report with its citations resolved.`, ); } pushReports(out, base, reports); out.push(""); out.push("## Citations"); out.push( - `- Each report's citations as data: /reports/<id>/citations.json (an ` + - `archilyzer-citations set) and /reports/<id>/citations.csv.`, + `- Each report's citations as data: ${SITE_REPORTS_BASE}<id>/citations.json (an ` + + `archilyzer-citations set) and ${SITE_REPORTS_BASE}<id>/citations.csv.`, ); out.push( `- A cited video or audio span has a moment page, /m/<channel>/<id>/<start>-<end>/ ` + diff --git a/common/lib/report/docs.ts b/common/lib/report/docs.ts @@ -35,9 +35,9 @@ export function renderReportMarkdown(): string { `One cited report, format \`"${REPORT_FORMAT}"\`, version ${REPORT_VERSION}, ` + "persisted to `transcripts/sites/<siteId>/reports/<reportId>/report.json` beside " + "its `stills/` and `sources/<sourceId>/`; a relative path in it is relative to " + - "that directory. A site's `reports` list in `site.json` is the published, " + - "ordered list — see [SITE.md](SITE.md); a report directory it does not name is a " + - "draft. The schema is `common/lib/report/schema.ts`; its citations and sources " + + "that directory. A site's `pages` list in `site.json` is the published, " + + "ordered list, each served at `/pages/<id>/` — see [SITE.md](SITE.md); a report " + + "directory it does not name is a draft. The schema is `common/lib/report/schema.ts`; its citations and sources " + "are the citation model's — see [CITATIONS.md](CITATIONS.md). A `notes.json` " + "beside it holds the operator's notes on the article (umtool, `umtool notes`; " + "[umtool/docs/notes.md](umtool/docs/notes.md)) and is never published.", @@ -84,7 +84,7 @@ export function renderReportMarkdown(): string { "the rest, in the page's order. A report with a newer entry than its own `updated` is " + "shown as updated then (the index, the header, the feeds). On a site with a public " + "`siteUrl`, compose publishes the timeline as feeds beside the page — " + - "`/reports/<id>/feed.xml` (RSS 2.0) and `/reports/<id>/feed.json` (JSON Feed 1.1), one " + + "`/pages/<id>/feed.xml` (RSS 2.0) and `/pages/<id>/feed.json` (JSON Feed 1.1), one " + "item per entry, its permalink the page at its anchor — and the page links them " + "(\"Subscribe\", and `<link rel=\"alternate\">`). A site with no `siteUrl` publishes no feed.", ); diff --git a/common/lib/report/export.test.ts b/common/lib/report/export.test.ts @@ -117,14 +117,14 @@ test("the heading: the series and the title (or the title alone), the dates and }); test("the heading's revision: this export's, linked to the history on the site", () => { - const history = { revision: 2, date: "2026-10-04", href: "/reports/demo/history/", current: true }; + const history = { revision: 2, date: "2026-10-04", href: "/pages/demo/history/", current: true }; const withRev = { ...opts, footer: { ...opts.footer, revision: 2 } }; assert.match( reportExportHtml({ ...view, history }, withRev), - /<p class="dates" data-report-dates="">2026-10-01 · updated 2026-10-04 · <a href="https:\/\/reports\.example\.org\/reports\/demo\/history\/">revision 2<\/a><\/p>/, + /<p class="dates" data-report-dates="">2026-10-01 · updated 2026-10-04 · <a href="https:\/\/reports\.example\.org\/pages\/demo\/history\/">revision 2<\/a><\/p>/, ); assert.match(reportExportHtml({ ...view, history }, { ...withRev, siteUrl: undefined }), /updated 2026-10-04 · revision 2<\/p>/); - assert.match(reportExportMarkdown({ ...view, history }, withRev), /^2026-10-01 · updated 2026-10-04 · \[revision 2\]\(https:\/\/reports\.example\.org\/reports\/demo\/history\/\)$/m); + assert.match(reportExportMarkdown({ ...view, history }, withRev), /^2026-10-01 · updated 2026-10-04 · \[revision 2\]\(https:\/\/reports\.example\.org\/pages\/demo\/history\/\)$/m); }); test("the three tiers: the quick take, what the check found, every claim from how it was checked", () => { @@ -186,7 +186,7 @@ test("verdicts, inline markers [n] to the reference list, and references with ev assert.doesNotMatch(html, /<video/, "a clip is linked, not played, in the one-file export"); assert.match(html, /Archived: <a href="https:\/\/archive\.example\.org\/p">/); assert.match(html, /quote match 97%/); - assert.match(html, /<footer class="export-footer" data-export-footer=""><p>2026-10-04 · report sha256 0123456789ab<\/p><p>Published at <a href="https:\/\/reports\.example\.org\/reports\/demo\/">/); + assert.match(html, /<footer class="export-footer" data-export-footer=""><p>2026-10-04 · report sha256 0123456789ab<\/p><p>Published at <a href="https:\/\/reports\.example\.org\/pages\/demo\/">/); }); test("without a site URL nothing links to the site; the pack's clip plays in place", () => { @@ -213,8 +213,8 @@ test("markdownToHtml: paragraphs, lists, quotes, code, headings under the page's "<h3>Head</h3>\n<p>A <em>word</em> and <strong>strong</strong>.</p>\n<ol><li>one</li><li>two</li></ol>\n" + "<blockquote><p>quoted</p></blockquote>\n<pre><code><b></code></pre>", ); - assert.equal(markdownToHtml("[site](/reports/x/)", () => undefined, { siteUrl: "https://s.example" }), '<p><a href="https://s.example/reports/x/">site</a></p>'); - assert.equal(markdownToHtml("[site](/reports/x/)", () => undefined), "<p>site</p>"); + assert.equal(markdownToHtml("[site](/pages/x/)", () => undefined, { siteUrl: "https://s.example" }), '<p><a href="https://s.example/pages/x/">site</a></p>'); + assert.equal(markdownToHtml("[site](/pages/x/)", () => undefined), "<p>site</p>"); }); test("the Markdown export: the heading lines, `label [n]` citations, numbered references, the footer", () => { @@ -246,7 +246,7 @@ test("the Markdown export: the heading lines, `label [n]` citations, numbered re const refs = [...md.matchAll(/^(\d+)\. “(.*)”/gm)].map((m) => `${m[1]}:${m[2]}`); assert.deepEqual(refs, ["1:one \\* two", "2:four", "3:five", "4:two", "5:three"]); assert.match(md, /Moment page: <https:\/\/reports\.example\.org\/m\/demo-channel\/abc123\/3126\.00-3151\.00\/>/); - assert.match(md, /---\n\n2026-10-04 · report sha256 0123456789ab\n\nPublished at <https:\/\/reports\.example\.org\/reports\/demo\/>\n$/); + assert.match(md, /---\n\n2026-10-04 · report sha256 0123456789ab\n\nPublished at <https:\/\/reports\.example\.org\/pages\/demo\/>\n$/); }); test("mdText escapes what Markdown would read; citedMarkdownToPlain numbers citations", () => { diff --git a/common/lib/report/feeds.test.ts b/common/lib/report/feeds.test.ts @@ -40,7 +40,7 @@ function report(): Report { date: "2026-10-05T09:30:00Z", updated: "2026-10-06", title: "Second", - body: "See [the section](#s1), [the index](/reports/) and [one](cite:v1).", + body: "See [the section](#s1), [the index](/pages/) and [one](cite:v1).", }, ], sections: [{ id: "s1", title: "Section", body: "A body." }], @@ -57,8 +57,8 @@ const view = (r: Report = report()): ReportPageView => { test("feed URLs beside the report's page", () => { assert.deepEqual(reportFeedUrls(SITE, "living"), { - rss: "https://site.example/reports/living/feed.xml", - json: "https://site.example/reports/living/feed.json", + rss: "https://site.example/pages/living/feed.xml", + json: "https://site.example/pages/living/feed.json", }); }); @@ -80,24 +80,24 @@ test("RSS 2.0: the channel, then one item per entry newest first, absolute links const xml = renderReportRss(view(), { siteUrl: SITE }); assert.match(xml, /^<\?xml version="1\.0" encoding="UTF-8"\?>\n<rss version="2\.0" xmlns:atom="http:\/\/www\.w3\.org\/2005\/Atom">\n<channel>\n/); assert.match(xml, /<title>Watch: Bits & <pieces><\/title>/); - assert.match(xml, /<link>https:\/\/site\.example\/reports\/living\/<\/link>/); + assert.match(xml, /<link>https:\/\/site\.example\/pages\/living\/<\/link>/); // No subtitle: the summary as plain text. assert.match(xml, /<description>It starts here\.<\/description>/); - assert.match(xml, /<atom:link href="https:\/\/site\.example\/reports\/living\/feed\.xml" rel="self" type="application\/rss\+xml"\/>/); + assert.match(xml, /<atom:link href="https:\/\/site\.example\/pages\/living\/feed\.xml" rel="self" type="application\/rss\+xml"\/>/); // The newest entry's update is the report's. assert.match(xml, /<lastBuildDate>Tue, 06 Oct 2026 00:00:00 GMT<\/lastBuildDate>/); const items = [...xml.matchAll(/<item>([\s\S]*?)<\/item>/g)].map((m) => m[1]); assert.equal(items.length, 2); assert.match(items[0], /<title>Second<\/title>/); - assert.match(items[0], /<link>https:\/\/site\.example\/reports\/living\/#newer<\/link>/); - assert.match(items[0], /<guid isPermaLink="true">https:\/\/site\.example\/reports\/living\/#newer<\/guid>/); + assert.match(items[0], /<link>https:\/\/site\.example\/pages\/living\/#newer<\/link>/); + assert.match(items[0], /<guid isPermaLink="true">https:\/\/site\.example\/pages\/living\/#newer<\/guid>/); assert.match(items[0], /<pubDate>Mon, 05 Oct 2026 09:30:00 GMT<\/pubDate>/); assert.match(items[1], /<title>First & "quoted"<\/title>/); // The body is HTML, escaped as text: a fragment link to the page, a // site-root link to the site, a citation's marker to its reference on the page. - assert.match(items[0], /<a href="https:\/\/site\.example\/reports\/living\/#s1">the section<\/a>/); - assert.match(items[0], /<a href="https:\/\/site\.example\/reports\/">the index<\/a>/); - assert.match(items[0], /one<sup class="cite"><a href="https:\/\/site\.example\/reports\/living\/#c-v1">\[1\]/); + assert.match(items[0], /<a href="https:\/\/site\.example\/pages\/living\/#s1">the section<\/a>/); + assert.match(items[0], /<a href="https:\/\/site\.example\/pages\/">the index<\/a>/); + assert.match(items[0], /one<sup class="cite"><a href="https:\/\/site\.example\/pages\/living\/#c-v1">\[1\]/); // Raw HTML in an entry is text, escaped twice over in the feed. assert.match(items[1], /&lt;b&gt;here&lt;\/b&gt;/); assert.doesNotMatch(xml, /<b>/); @@ -108,19 +108,19 @@ test("JSON Feed 1.1: the same items newest first, ids their permalinks, dates RF const feed = renderReportJsonFeed(view(), { siteUrl: SITE }); assert.equal(feed.version, JSON_FEED_VERSION); assert.equal(feed.title, "Watch: Bits & <pieces>"); - assert.equal(feed.home_page_url, "https://site.example/reports/living/"); - assert.equal(feed.feed_url, "https://site.example/reports/living/feed.json"); + assert.equal(feed.home_page_url, "https://site.example/pages/living/"); + assert.equal(feed.feed_url, "https://site.example/pages/living/feed.json"); assert.equal(feed.description, "It starts here."); assert.deepEqual( feed.items.map((i) => [i.id, i.url, i.title, i.date_published, i.date_modified]), [ - ["https://site.example/reports/living/#newer", "https://site.example/reports/living/#newer", "Second", "2026-10-05T09:30:00.000Z", "2026-10-06T00:00:00.000Z"], - ["https://site.example/reports/living/#older", "https://site.example/reports/living/#older", "First & \"quoted\"", "2026-10-02T00:00:00.000Z", undefined], + ["https://site.example/pages/living/#newer", "https://site.example/pages/living/#newer", "Second", "2026-10-05T09:30:00.000Z", "2026-10-06T00:00:00.000Z"], + ["https://site.example/pages/living/#older", "https://site.example/pages/living/#older", "First & \"quoted\"", "2026-10-02T00:00:00.000Z", undefined], ], ); assert.equal( feed.items[1].content_html, - '<p>It began<sup class="cite"><a href="https://site.example/reports/living/#c-w1">[2]</a></sup> <b>here</b>.</p>', + '<p>It began<sup class="cite"><a href="https://site.example/pages/living/#c-w1">[2]</a></sup> <b>here</b>.</p>', ); assert.equal("date_modified" in feed.items[1], false); // A round trip through JSON is the same feed. diff --git a/common/lib/report/reader-server.test.ts b/common/lib/report/reader-server.test.ts @@ -36,11 +36,12 @@ function publicDirWith(files: Record<string, unknown>): string { const page = (id: string) => ({ format: REPORT_PAGE_FORMAT, id, kind: "sweep", title: `Title ${id}`, sections: [] }); -test("the site's base is /reports/, and every path helper defaults to it", () => { - assert.equal(SITE_REPORTS_BASE, "/reports/"); - assert.equal(REPORTS_INDEX_PATH, "/reports/index.json"); - assert.equal(reportPagePath("a"), "/reports/a/"); - assert.equal(reportHistoryPagePath("a"), "/reports/a/history/"); +test("the site's base is /pages/, and every path helper defaults to it", () => { + assert.equal(SITE_REPORTS_BASE, "/pages/"); + assert.equal(REPORTS_INDEX_PATH, "/pages/index.json"); + assert.equal(reportPagePath("a"), "/pages/a/"); + assert.equal(reportHistoryPagePath("a"), "/pages/a/history/"); + assert.equal(reportBaseDir(SITE_REPORTS_BASE), "pages"); }); test("a base names every report path", () => { @@ -53,7 +54,7 @@ test("a base names every report path", () => { }); test("a base is lowercase segments with a slash on both ends", () => { - for (const ok of ["/reports/", "/pages/", "/a/b/"]) assert.ok(isReportBase(ok), ok); + for (const ok of ["/reports/", "/pages/", "/articles/", "/a/b/"]) assert.ok(isReportBase(ok), ok); for (const bad of ["reports/", "/reports", "/", "/Reports/", "//", "/../", 3]) assert.ok(!isReportBase(bad), String(bad)); assert.equal(reportBaseDir("/reports/"), "reports"); assert.equal(reportBaseDir("/a/b/"), "a/b"); diff --git a/common/lib/report/reader-server.ts b/common/lib/report/reader-server.ts @@ -55,6 +55,8 @@ export type ReportReader = { readReportHistory(reportId: string): ReportHistoryView | null; // The build's one report, when it publishes exactly one. onlyReportView(): ReportPageView | null; + // The build's first report in index order (a search-off site's home page). + firstReportView(): ReportPageView | null; // The moment keys to build pages for (only keys exactly as momentKey spells // them: each segment is a path segment of a page written to disk). momentKeys(): string[]; @@ -101,6 +103,10 @@ export function createReportReader(opts: ReportReaderOptions): ReportReader { const ids = reader.reportIds(); return ids.length === 1 ? reader.readReportView(ids[0]) : null; }, + firstReportView() { + const ids = reader.reportIds(); + return ids.length > 0 ? reader.readReportView(ids[0]) : null; + }, momentKeys() { const v = readView<MomentIndexView>(MOMENTS_INDEX_PATH, MOMENT_INDEX_FORMAT); return (Array.isArray(v?.moments) ? v.moments : []).filter((k) => parseMomentKey(k) !== null); diff --git a/common/lib/report/revisions.ts b/common/lib/report/revisions.ts @@ -4,7 +4,7 @@ // `archilyzer reports export` commits a revision to the report's own git // history whenever its report.json changed (publish/reportHistory.ts); the // commit message is `Revision N` and the lines of `reportChangeSummary`. The -// site's history page (`/reports/<id>/history/`) lists every revision with +// site's history page (`/pages/<id>/history/`) lists every revision with // that summary and a claim-level word diff against the one before // (`claimChanges`), both computed at compose into `history.json` // (ReportHistoryView), so the page only renders. @@ -30,7 +30,7 @@ export function reportHistoryViewPath(reportId: string, base: ReportBase = SITE_ return `${base}${reportId}/history/history.json`; } -// The dumb-HTTP clone of the report's history: `git clone <site>/reports/<id>/history/repo`. +// The dumb-HTTP clone of the report's history: `git clone <site>/pages/<id>/history/repo`. export function reportHistoryRepoPath(reportId: string, base: ReportBase = SITE_REPORTS_BASE): string { return `${base}${reportId}/history/repo`; } diff --git a/common/lib/report/routes.ts b/common/lib/report/routes.ts @@ -12,11 +12,16 @@ // // Pure, no imports: the export site's pages and the browser can use it. -// A base is a site-root path with a leading and a trailing slash: `/reports/`. +// A base is a site-root path with a leading and a trailing slash: `/pages/`. export type ReportBase = `/${string}/`; -// A site's reports. -export const SITE_REPORTS_BASE: ReportBase = "/reports/"; +// A site's reports: its pages (site.json `pages`), at `/pages/<id>/` (release +// 26 A5; `/reports/` before it). +export const SITE_REPORTS_BASE: ReportBase = "/pages/"; + +// Where a site's reports were published before release 26: compose still +// clears it from a public dir an older compose wrote. +export const LEGACY_SITE_REPORTS_DIR = "reports"; const BASE_RE = /^\/(?:[a-z0-9][a-z0-9-]*\/)+$/; @@ -25,8 +30,8 @@ export function isReportBase(v: unknown): v is ReportBase { return typeof v === "string" && BASE_RE.test(v); } -// The base's top directory under a public dir or an out dir, `reports` for -// `/reports/`. +// The base's top directory under a public dir or an out dir, `pages` for +// `/pages/`. export function reportBaseDir(base: ReportBase): string { return base.split("/").filter(Boolean).join("/"); } diff --git a/common/lib/report/schema.ts b/common/lib/report/schema.ts @@ -131,7 +131,7 @@ export type SlideSpec = z.infer<typeof slideSchema>; export type ReportSlidesSpec = z.infer<typeof reportSlidesSchema>; // A report id is its directory name under `reports/` and a path segment of its -// page (`/reports/<id>/`): a lowercase slug, like a site id. +// page (a site's `/pages/<id>/`): a lowercase slug, like a site id. export const REPORT_ID_RE = /^[a-z0-9][a-z0-9-]{0,63}$/; export function isReportId(v: unknown): v is string { @@ -141,7 +141,7 @@ export function isReportId(v: unknown): v is string { export const REPORT_FIELD_DOCS: FieldDocs<Report> = { format: `\`"${REPORT_FORMAT}"\`.`, version: `\`${REPORT_VERSION}\`.`, - id: "The report's id: a lowercase slug (`[a-z0-9][a-z0-9-]*`, at most 64), its directory name under `reports/` and the last segment of its page, `/reports/<id>/`. Must match the directory.", + id: "The report's id: a lowercase slug (`[a-z0-9][a-z0-9-]*`, at most 64), its directory name under `reports/` and the last segment of its page (on a site, `/pages/<id>/`). Must match the directory.", kind: '`"factcheck"` — sections of claims, each with a verdict — or `"sweep"` — sections with no verdicts, or bodies with inline citations.', series: "The series the report belongs to: a recurring name for its kind of report. It is shown on its own line above the title, in the accent colour, at the head of the report's page, its exports and the report list (where a report with no series shows its kind instead), and is joined to the title as `<series>: <title>` where one line names the report (a page title, a link, a cited-in entry).", title: "The report's title.", diff --git a/common/lib/report/timeline.test.ts b/common/lib/report/timeline.test.ts @@ -44,7 +44,7 @@ function report(): Report { const view = (r: Report = report()): ReportPageView => buildReportPageView(r, { record: (c) => ({ channel: c.channel, id: c.id, title: `Record ${c.id}` }), - feeds: { rss: "https://site.example/reports/living/feed.xml", json: "https://site.example/reports/living/feed.json" }, + feeds: { rss: "https://site.example/pages/living/feed.xml", json: "https://site.example/pages/living/feed.json" }, }); test("a report with a timeline is sound", () => { @@ -126,8 +126,8 @@ test("cited-in: a citation in an entry links to the entry's anchor", () => { const index = buildCitedIn([r]); const entries = index["demo-channel/abc123/10.00-20.00"]; assert.deepEqual(entries[1], { reportId: "living", sectionId: null, claimId: null, entryId: "e9", citationId: "v1" }); - assert.equal(citedInHref(entries[1]), "/reports/living/#e9"); - assert.equal(citedInHref(entries[0]), "/reports/living/"); + assert.equal(citedInHref(entries[1]), "/pages/living/#e9"); + assert.equal(citedInHref(entries[0]), "/pages/living/"); const views = citedInViews(entries, [view(r)]); assert.equal(views[1].entryTitle, "Clip"); }); @@ -147,7 +147,7 @@ test("the page view: entries newest first with their dates; updated counts the n }); assert.equal(v.updated, "2026-10-05T09:30:00Z"); assert.equal(reportIndexEntry(v).updated, "2026-10-05T09:30:00Z"); - assert.equal(v.feeds?.rss, "https://site.example/reports/living/feed.xml"); + assert.equal(v.feeds?.rss, "https://site.example/pages/living/feed.xml"); const none = view({ ...report(), entries: undefined }); assert.equal(none.entries, undefined); assert.equal(none.feeds, undefined); diff --git a/common/lib/report/views.test.ts b/common/lib/report/views.test.ts @@ -90,7 +90,7 @@ const view = buildReportPageView(report, { record: (c) => record(c.channel, c.id), poster: (c) => (c.kind === "video" ? "/poster.png" : undefined), post: () => ({ author: "@someone", text: "three, and more" }), - downloads: { json: "/reports/demo/citations.json" }, + downloads: { json: "/pages/demo/citations.json" }, }); test("the fixture report here is sound", () => { @@ -131,7 +131,7 @@ test("a source citation names its document by id; the document (never its saved const s1 = view.citations.s1; assert.equal(s1.kind, "source"); if (s1.kind !== "source") return; - assert.equal(s1.image, "/reports/demo/stills/s1.png"); + assert.equal(s1.image, "/pages/demo/stills/s1.png"); assert.equal(s1.href, "https://example.org/a"); assert.equal(s1.sourceId, "s0"); assert.equal(s1.sourceTitle, "An article"); @@ -209,7 +209,7 @@ test("the view keeps the claim structure, with the source sentence as an id", () citations: ["v1", "a1"], }); assert.deepEqual(view.sections[1].claims[0].citations, ["a1"]); - assert.deepEqual(view.downloads, { json: "/reports/demo/citations.json" }); + assert.deepEqual(view.downloads, { json: "/pages/demo/citations.json" }); }); test("a section's citations, in number order; code is not citing", () => { @@ -229,7 +229,7 @@ test("the tally counts verdicts in the vocabulary's order; the index entry carri { verdict: "CONTRADICTED", count: 1 }, ]); const entry = reportIndexEntry(view); - assert.equal(entry.href, "/reports/demo/"); + assert.equal(entry.href, "/pages/demo/"); assert.equal(entry.citationCount, 5); assert.equal(entry.claimCount, 2); assert.deepEqual(entry.tally, verdictTally(view)); @@ -242,12 +242,12 @@ test("cited-in entries resolve to the claim's anchor with titles and the citatio assert.deepEqual( entries.map((e) => [e.href, e.claimTitle, e.claimText, e.verdict, e.verdictStyle?.label, e.number]), [ - ["/reports/demo/#c1", "One", "Claim one.", "CONTRADICTED", "Contradicted", 4], - ["/reports/demo/#c2", undefined, "Claim two.", "PARTLY", "Half", 4], + ["/pages/demo/#c1", "One", "Claim one.", "CONTRADICTED", "Contradicted", 4], + ["/pages/demo/#c2", undefined, "Claim two.", "PARTLY", "Half", 4], ], ); const summary = citedInViews(index["demo-channel/abc123/3126.00-3151.00"], [view]); - assert.equal(summary[0].href, "/reports/demo/"); + assert.equal(summary[0].href, "/pages/demo/"); assert.equal(citedInViews(index["demo-social/123"], []).length, 0); }); @@ -257,7 +257,7 @@ test("paths: the clip, the moment view and a report asset", () => { "/media/clips/demo-channel/-abc/1.00-2.50.mp4", ); assert.equal(momentViewPath("demo-social/123"), "/m/demo-social/123/moment.json"); - assert.equal(reportAssetPath("demo", "./stills/x.png"), "/reports/demo/stills/x.png"); + assert.equal(reportAssetPath("demo", "./stills/x.png"), "/pages/demo/stills/x.png"); assert.equal(sourceAnchor("s0"), "source-s0"); }); @@ -412,6 +412,6 @@ test("a report's video rides its page view as site-root paths; a report without const withVideo = { ...report, video: { src: "video.mp4", poster: "media/poster.jpg", caption: "The cut" } }; assert.deepEqual(validateReport(withVideo), []); const v = buildReportPageView(withVideo, { record: (c) => record(c.channel, c.id) }); - assert.deepEqual(v.video, { src: `/reports/${report.id}/video.mp4`, poster: `/reports/${report.id}/media/poster.jpg`, caption: "The cut" }); + assert.deepEqual(v.video, { src: `/pages/${report.id}/video.mp4`, poster: `/pages/${report.id}/media/poster.jpg`, caption: "The cut" }); assert.equal("video" in view, false); }); diff --git a/common/lib/report/views.ts b/common/lib/report/views.ts @@ -1,15 +1,17 @@ // REPORT AND MOMENT PAGE VIEWS — the JSON the reports stage of compose writes // under the export app's public dir, and the export app's pages read. One -// definition, so the writer and the reader cannot disagree: +// definition, so the writer and the reader cannot disagree. Every report path +// is under the base its build serves reports under (./routes.ts): a site's +// `/pages/` (its pages, site.json `pages`) below. // -// /reports/index.json ReportIndexView the report index (and a cited site's home) -// /reports/<reportId>/page.json ReportPageView one report, its citations resolved -// /reports/<reportId>/citations.{json,csv} the report's citations, for download -// /reports/<reportId>/feed.{xml,json} its timeline as RSS 2.0 and JSON Feed 1.1 (./feeds.ts), +// /pages/index.json ReportIndexView the site's pages, in order (its header's links) +// /pages/<reportId>/page.json ReportPageView one report, its citations resolved +// /pages/<reportId>/citations.{json,csv} the report's citations, for download +// /pages/<reportId>/feed.{xml,json} its timeline as RSS 2.0 and JSON Feed 1.1 (./feeds.ts), // for a report with entries on a site with a public URL -// /reports/<reportId>/stills/… a source citation's still, as the report names it -// /reports/<reportId>/history/history.json ReportHistoryView its revisions (lib/report/revisions.ts) -// /reports/<reportId>/history/repo/ a dumb-HTTP clone of its revision history +// /pages/<reportId>/stills/… a source citation's still, as the report names it +// /pages/<reportId>/history/history.json ReportHistoryView its revisions (lib/report/revisions.ts) +// /pages/<reportId>/history/repo/ a dumb-HTTP clone of its revision history // /m/index.json MomentIndexView every moment page to build // /m/<momentKey>/moment.json MomentPageView one moment: clip, cues, record, "cited in" // /media/clips/<channel>/<id>/<start>-<end>.mp4 a span's evidence clip diff --git a/common/lib/site.ts b/common/lib/site.ts @@ -20,6 +20,7 @@ import { parseSiteUrl, siteChannelSlugs, sitePublishProblem, + siteSearchProblem, siteToDisk, type Site, } from "./siteSchema"; @@ -245,6 +246,9 @@ export async function writeSite( // 18). A private one is clamped to "build" by siteToDisk, not refused. const publishProblem = sitePublishProblem(site); if (publishProblem) throw new Error(publishProblem); + // A search-off site publishes only its pages: one with none is refused (D5). + const searchProblem = siteSearchProblem(site); + if (searchProblem) throw new Error(searchProblem); // undefined socialLinks = inherit the global default; only validate/persist a // key when the site explicitly overrides (an array, even empty). // A link whose SVG is unchanged from the file on disk is kept as it is; a new @@ -268,7 +272,7 @@ export async function writeSite( } // PATCH SOME KEYS OF A SITE — the writer for a surface that owns a few keys and -// none of the others (the Reports tab's `reports`). The site is read from disk +// none of the others (the Reports tab's `pages`). The site is read from disk // INSIDE the file lock and the patch is applied to that, so a patch never // writes back a copy of the other keys read earlier, and two patches never // interleave. A function patch is given the site as it is now (to reorder a @@ -289,6 +293,13 @@ export async function patchSite( if (!fs.existsSync(file)) return null; const current = getSite(siteId, paths); const changes = typeof patch === "function" ? patch(current) : patch; + // `reports` became `pages` in release 26 (A5). A caller still patching the + // old key (a generator outside the repo) is refused, loudly: its write + // would otherwise be dropped, or replace the page list with a list built + // from a key the site no longer has. + if ("reports" in (changes as Record<string, unknown>)) { + throw new Error(`site.json "reports" is now "pages" (release 26): patch "pages" instead`); + } await writeSite({ ...current, ...changes, siteId }, paths); return getSite(siteId, paths); }); diff --git a/common/lib/siteSchema.test.ts b/common/lib/siteSchema.test.ts @@ -22,6 +22,7 @@ import { siteFieldsSchema, sitePublishPolicy, sitePublishProblem, + siteSearchProblem, siteToDisk, type Site, } from "./siteSchema"; @@ -74,7 +75,7 @@ test("empty, null, [] and a number all read as the defaults, every key emitted", assert.equal(want.listed, true); assert.deepEqual(want.relatedSites, []); assert.equal(want.search, true); - assert.deepEqual(want.reports, []); + assert.deepEqual(want.pages, []); assert.deepEqual(want.citedChannels, []); assert.equal(want.socialLinks, undefined); assert.ok("socialLinks" in want); @@ -249,7 +250,7 @@ function fixtures(): Array<[string, unknown]> { siteUrl: "https://s.example//", listed: false, search: false, - reports: ["r-one", "r-one", "Bad", "", 7, "r-two"], + pages: ["r-one", "r-one", "Bad", "", 7, "r-two"], relatedSites: [{ siteIds: ["x", "x", "BAD"] }, { label: " ", siteIds: [] }], pwa: true, archives: false, @@ -338,7 +339,7 @@ test("search: absent/true is on, only false is report-only, and only false is wr assert.equal(siteToDisk(off).search, false); assert.equal(isCitedSite({}), false); // A search-off site with no reports is still report-only (an empty index). - assert.equal(isCitedSite(parseSite("s", { search: false, reports: [] })), true); + assert.equal(isCitedSite(parseSite("s", { search: false, pages: [] })), true); }); test("legacy publish: \"cited\" reads as search off and is rewritten as search: false", () => { @@ -358,38 +359,70 @@ test("legacy publish: \"cited\" reads as search off and is rewritten as search: assert.equal(parseSite("s", { publish: "cited", search: true }).search, true); }); -test("reports: ordered slugs, invalid and repeated ids dropped, written only when non-empty", () => { +test("pages: ordered slugs, invalid and repeated ids dropped, written only when non-empty", () => { assert.deepEqual( parseSiteReports(["b-two", "a-one", "b-two", "Upper", "-lead", "has space", "", 3, null, "c3"]), ["b-two", "a-one", "c3"], ); for (const v of [undefined, null, "a-one", { a: 1 }, 5]) { - assert.deepEqual(parseSite("s", v === undefined ? {} : { reports: v }).reports, [], String(v)); + assert.deepEqual(parseSite("s", v === undefined ? {} : { pages: v }).pages, [], String(v)); } - const site = parseSite("s", { reports: ["z-last", "a-first", "a-first"] }); - assert.deepEqual(site.reports, ["z-last", "a-first"]); - assert.deepEqual(siteToDisk(site).reports, ["z-last", "a-first"]); - assert.equal("reports" in siteToDisk(parseSite("s", { reports: [] })), false); - assert.equal("reports" in siteToDisk(parseSite("s", { reports: ["BAD"] })), false); + const site = parseSite("s", { pages: ["z-last", "a-first", "a-first"] }); + assert.deepEqual(site.pages, ["z-last", "a-first"]); + assert.deepEqual(siteToDisk(site).pages, ["z-last", "a-first"]); + assert.equal("pages" in siteToDisk(parseSite("s", { pages: [] })), false); + assert.equal("pages" in siteToDisk(parseSite("s", { pages: ["BAD"] })), false); // siteToDisk re-parses a caller's list: a bad id handed to the writer is not persisted. - assert.deepEqual(siteToDisk({ ...site, reports: ["ok", "NOPE", "ok"] }).reports, ["ok"]); + assert.deepEqual(siteToDisk({ ...site, pages: ["ok", "NOPE", "ok"] }).pages, ["ok"]); }); -test("writeSite → getSite round-trips a report-only site and its reports; a full site writes neither key", async () => { +test("legacy reports (before release 26) reads as pages, is never written, and loses to pages", () => { + const legacy = parseSite("s", { search: false, reports: ["one", "two"] }); + assert.deepEqual(legacy.pages, ["one", "two"]); + assert.equal(legacy.search, false); + const disk = siteToDisk(legacy) as Record<string, unknown>; + assert.deepEqual(disk.pages, ["one", "two"]); + assert.equal("reports" in disk, false); + assert.equal("reports" in legacy, false); + assert.deepEqual(parseSite("s", { pages: ["new"], reports: ["old"] }).pages, ["new"]); + assert.deepEqual(parseSite("s", { pages: [], reports: ["old"] }).pages, []); +}); + +test("a search-off site with no pages is refused on save; with one, or with search on, it is not", async () => { + assert.match(siteSearchProblem({ search: false }) ?? "", /search is off and the site has no pages/); + assert.match(siteSearchProblem({ search: false, pages: ["BAD"] }) ?? "", /no pages/); + assert.equal(siteSearchProblem({ search: false, pages: ["one"] }), null); + assert.equal(siteSearchProblem({ search: true }), null); + assert.equal(siteSearchProblem({}), null); const paths = scratchPaths(await mkdtemp(path.join(os.tmpdir(), "site-"))); - const cited = parseSite("s", { search: false, reports: ["first", "second"] }); + await assert.rejects(writeSite(parseSite("s", { search: false }), paths), /no pages/); + assert.equal(fs.existsSync(siteConfigFile(paths, "s")), false); + await writeSite(parseSite("s", { search: false, pages: ["one"] }), paths); + // A caller still patching the pre-release-26 key is refused, not ignored. + await assert.rejects( + patchSite("s", (cur) => ({ reports: ["two", ...(cur.pages ?? [])] }) as Partial<Site>, paths), + /"reports" is now "pages"/, + ); + // Unpublishing the last page of a search-off site is refused too. + await assert.rejects(patchSite("s", { pages: [] }, paths), /no pages/); + assert.deepEqual(getSite("s", paths).pages, ["one"]); +}); + +test("writeSite → getSite round-trips a search-off site and its pages; a full site writes neither key", async () => { + const paths = scratchPaths(await mkdtemp(path.join(os.tmpdir(), "site-"))); + const cited = parseSite("s", { search: false, pages: ["first", "second"] }); await writeSite(cited, paths); assert.deepEqual(getSite("s", paths), cited); const disk = JSON.parse(await readFile(siteConfigFile(paths, "s"), "utf8")); assert.equal(disk.search, false); assert.equal("publish" in disk, false); - assert.deepEqual(disk.reports, ["first", "second"]); - await writeSite({ ...cited, search: true, reports: [] }, paths); + assert.deepEqual(disk.pages, ["first", "second"]); + await writeSite({ ...cited, search: true, pages: [] }, paths); const plain = JSON.parse(await readFile(siteConfigFile(paths, "s"), "utf8")); assert.equal("search" in plain, false); - assert.equal("reports" in plain, false); + assert.equal("pages" in plain, false); assert.equal(getSite("s", paths).search, true); - assert.deepEqual(getSite("s", paths).reports, []); + assert.deepEqual(getSite("s", paths).pages, []); }); test("isListedSite is the key's default; channelsOnlyOnUnlistedSites keeps a shared channel with the listed site", () => { @@ -409,7 +442,7 @@ test("a report-only site is never listed, whatever `listed` says; a full site wi assert.equal(isListedSite({ search: false }), false); assert.equal(isListedSite({ search: false, listed: true }), false); assert.equal(isListedSite({ search: true }), true); - assert.equal(isListedSite(parseSite("full-with-reports", { reports: ["demo-report"] })), true); + assert.equal(isListedSite(parseSite("full-with-reports", { pages: ["demo-report"] })), true); const sites = [ parseSite("shown", { channels: [{ slug: "shared" }] }), parseSite("reports", { search: false, channels: [{ slug: "shared" }, { slug: "pool-only" }] }), @@ -450,34 +483,34 @@ test("writeSite → getSite round-trips, and the file holds only non-defaults", assert.equal("listed" in disk, false); assert.equal("search" in disk, false); assert.equal("publish" in disk, false); - assert.equal("reports" in disk, false); + assert.equal("pages" in disk, false); }); test("patchSite applies a patch to the site on disk now, keeps every other key, and never creates a site", async () => { const paths = scratchPaths(await mkdtemp(path.join(os.tmpdir(), "site-"))); - assert.equal(await patchSite("s", { reports: ["one"] }, paths), null); + assert.equal(await patchSite("s", { pages: ["one"] }, paths), null); assert.equal(fs.existsSync(siteConfigFile(paths, "s")), false); const site = parseSite("s", { siteTitle: "Mine", archives: false, search: false, - reports: ["one", "two"], + pages: ["one", "two"], }); await writeSite(site, paths); // Another writer changes a key after this caller last read the site: the // patch is applied to the file, not to the stale copy. await writeSite({ ...site, siteTitle: "Renamed" }, paths); - const patched = await patchSite("s", { reports: ["two", "one"] }, paths); - assert.deepEqual(patched, { ...site, siteTitle: "Renamed", reports: ["two", "one"] }); + const patched = await patchSite("s", { pages: ["two", "one"] }, paths); + assert.deepEqual(patched, { ...site, siteTitle: "Renamed", pages: ["two", "one"] }); assert.deepEqual(getSite("s", paths), patched); // A function patch sees the site as it is; two patches do not interleave. await Promise.all([ - patchSite("s", (cur) => ({ reports: [...(cur.reports ?? []), "three"] }), paths), - patchSite("s", (cur) => ({ reports: [...(cur.reports ?? []), "four"] }), paths), + patchSite("s", (cur) => ({ pages: [...(cur.pages ?? []), "three"] }), paths), + patchSite("s", (cur) => ({ pages: [...(cur.pages ?? []), "four"] }), paths), ]); - assert.deepEqual(getSite("s", paths).reports, ["two", "one", "three", "four"]); + assert.deepEqual(getSite("s", paths).pages, ["two", "one", "three", "four"]); // The id is the directory's, whatever a patch says. await patchSite("s", { siteId: "other" } as Partial<Site>, paths); assert.equal(getSite("s", paths).siteId, "s"); @@ -589,14 +622,14 @@ test("writeSite → getSite round-trips citedChannels, and patchSite keeps the k channels: [{ slug: "pool" }], citedChannels: [{ slug: "critic" }, { slug: "other-critic" }], search: false, - reports: ["one"], + pages: ["one"], }); await writeSite(site, paths); assert.deepEqual(getSite("s", paths), site); const disk = JSON.parse(await readFile(siteConfigFile(paths, "s"), "utf8")); assert.deepEqual(disk.citedChannels, [{ slug: "critic" }, { slug: "other-critic" }]); // A surface that patches another key leaves the cited scope as it is. - const patched = await patchSite("s", { reports: ["one", "two"] }, paths); + const patched = await patchSite("s", { pages: ["one", "two"] }, paths); assert.deepEqual(patched?.citedChannels, [{ slug: "critic" }, { slug: "other-critic" }]); // Emptied, the key leaves the file. await patchSite("s", { citedChannels: [] }, paths); diff --git a/common/lib/siteSchema.ts b/common/lib/siteSchema.ts @@ -105,8 +105,9 @@ export function isPrivateSite(site: Pick<Site, "audience">): boolean { } // THE ONE PREDICATE for a report-only ("cited") site: search is off. Such a -// site publishes only its reports and the moments they cite (corpus.json -// `site.scope: "cited"`). Absent or true is a full, searchable site. +// site publishes only its pages (`pages`) and the moments they cite +// (corpus.json `site.scope: "cited"`). Absent or true is a full, searchable +// site. export function isCitedSite(site: Pick<Site, "search">): boolean { return site.search === false; } @@ -121,6 +122,18 @@ function migrateLegacyPublish(raw: unknown): unknown { return { ...r, search: false }; } +// LEGACY, release 26 only: `reports` (the published list before it was a +// site's pages) reads as `pages` when the file sets no `pages`. siteToDisk +// never writes `reports`, so the next save migrates the file; the data move +// (plans/reports-on-homepage.md, A7) rewrites every file that still has it. +function migrateLegacyReports(raw: unknown): unknown { + if (!raw || typeof raw !== "object" || Array.isArray(raw)) return raw; + const r = raw as Record<string, unknown>; + if (!("reports" in r)) return raw; + const { reports, ...rest } = r; + return rest.pages !== undefined ? rest : { ...rest, pages: reports }; +} + // A report id: a lowercase slug, the directory name under // `sites/<siteId>/reports/`. The grammar is the report document's own // (lib/report/schema.ts) — one definition. @@ -130,8 +143,9 @@ export function isValidReportId(id: unknown): id is string { return isReportId(id); } -// Parse the published report list: valid ids, first occurrence kept, order -// preserved. Anything else (a non-array, a bad or repeated id) is dropped. +// Parse a site's page list (`pages`: report ids): valid ids, first occurrence +// kept, order preserved. Anything else (a non-array, a bad or repeated id) is +// dropped. export function parseSiteReports(input: unknown): string[] { if (!Array.isArray(input)) return []; const out: string[] = []; @@ -163,7 +177,7 @@ export type Site = { siteUrl?: string; listed?: boolean; audience?: SiteAudience; - reports?: string[]; + pages?: string[]; relatedSites?: RelatedSiteGroup[]; search?: boolean; pwa?: boolean; @@ -204,12 +218,12 @@ export const SITE_FIELD_DOCS: FieldDocs<Site> = { "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. A private site and a report-only site (`search: false`) are never listed, whatever `listed` says.", audience: 'Who this site is built for. `"public"` (the default; absent) or `"private"`: the operator\'s own reading copy, built on this machine and never deployed — the deploy stage refuses it before any upload — Deploy production, Deploy preview, Deploy local, Build & deploy, Publish now, the publish lane, `archilyzer publish deploy`, docker/publish-site.sh — while a build without a deploy still works (its publish policy reads as `build`). A private site is never listed (as `listed: false`, whatever `listed` says), publishes no `hubUrl`, and its `/corpus.json` says `"audience": "private"`. Content kept from the public — X posts while `social.x.visibility` is `"private"` — is built only into private sites. Only `"private"` is written.', - reports: - "The site's published reports, in display order: report ids (lowercase slugs, `[a-z0-9][a-z0-9-]*`), each a directory under `sites/<siteId>/reports/`. A report directory not named here is a draft and is not published. Invalid and repeated ids are dropped. Absent/empty = no reports.", + pages: + "The site's pages, in order: report ids (lowercase slugs, `[a-z0-9][a-z0-9-]*`), each a directory under `sites/<siteId>/reports/` holding a report document. Each is served at `/pages/<id>/` and linked from the site's header by its title; a report directory not named here is a draft and is not published. Invalid and repeated ids are dropped. Absent/empty = no pages. Legacy `reports` (the key before release 26) reads as `pages` when `pages` is absent, and is never written.", 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.", search: - "Whether this site publishes its searchable corpus. Opt-OUT: absent/true = on, only an explicit `false` is written. Off = report-only: the site publishes only its `reports` and the moments they cite — no search, browse, transcripts or archives; `channels` is the pool its citations resolve against (with `citedChannels`), and its `/corpus.json` says `\"scope\": \"cited\"`. A report-only site is never listed (as `listed: false`, whatever `listed` says). Legacy `publish: \"cited\"` reads as `false`.", + "Whether this site publishes its searchable corpus. Opt-OUT: absent/true = on, only an explicit `false` is written. Off = pages only: the site publishes only its `pages` and the moments they cite — no search, browse, transcripts or archives; its home page is its first page; `channels` is the pool its citations resolve against (with `citedChannels`), and its `/corpus.json` says `\"scope\": \"cited\"`. A save with search off and no `pages` is refused. A search-off site is never listed (as `listed: false`, whatever `listed` says). Legacy `publish: \"cited\"` reads as `false`.", pwa: "Whether this site ships an installable PWA (service worker + web manifest). Default false: a \"dumb instance\" that serves the CORS-enabled JSON federation contract but is not independently installable, so a visitor trusts only the hub PWA. Stored only when true.", archives: @@ -272,6 +286,14 @@ function parseSitePublish(v: unknown): SitePublish | undefined { return { auto }; } +// Why a save of this site's search switch is refused, or null: a site with +// search off publishes only its pages, so it needs one (D5, +// plans/reports-on-homepage.md — no report-only site without a page). +export function siteSearchProblem(site: Pick<Site, "search" | "pages">): string | null { + if (!isCitedSite(site) || parseSiteReports(site.pages).length > 0) return null; + return "search is off and the site has no pages — a search-off site publishes only its pages: add one, or turn search on"; +} + // siteId shares the group-id grammar: lowercase slug, used as a directory name. export const SITE_ID_RE = /^[a-z0-9][a-z0-9-]*$/; @@ -496,7 +518,7 @@ export const siteFieldsSchema = z.object({ audience: settingsField((v): SiteAudience | undefined => v === "private" ? "private" : undefined, ).describe(d.audience), - reports: settingsField(parseSiteReports).describe(d.reports), + pages: settingsField(parseSiteReports).describe(d.pages), relatedSites: settingsField(parseRelatedSites).describe(d.relatedSites), // Opt-out: only an explicit false is report-only. Absent/true stays on. search: settingsField((v): boolean => v !== false).describe(d.search), @@ -522,7 +544,7 @@ export const siteFieldsSchema = z.object({ // output lacks `socialLinks`, `accent`, … on a file that does not spell them — // where parseSite has always emitted them, present and `undefined`. Rebuilding // from SITE_KEYS keeps that shape (and the key order) exactly. -export const siteSchema = z.preprocess(migrateLegacyPublish, siteFieldsSchema).transform((s): Site => { +export const siteSchema = z.preprocess((raw) => migrateLegacyReports(migrateLegacyPublish(raw)), siteFieldsSchema).transform((s): Site => { const groups = s.groups; const resolved: Partial<Record<keyof Site, unknown>> = { ...s, @@ -576,7 +598,7 @@ export function siteToDisk(site: Site): Site { channels, ); const relatedSites = parseRelatedSites(site.relatedSites); - const reports = parseSiteReports(site.reports); + const pages = parseSiteReports(site.pages); const accent = parseAccentSetting(site.accent); const wordmarkLead = wordmarkLeadFor(site.headerTitle, site.wordmarkLead); const siteUrl = parseSiteUrl(site.siteUrl); @@ -608,7 +630,7 @@ export function siteToDisk(site: Site): Site { ...(site.listed === false ? { listed: false } : {}), // Public is the default: only the private audience is persisted. ...(isPrivateSite(site) ? { audience: "private" as const } : {}), - ...(reports.length > 0 ? { reports } : {}), + ...(pages.length > 0 ? { pages } : {}), ...(relatedSites.length > 0 ? { relatedSites } : {}), // Search is the default: only report-only is persisted (never `publish`). ...(isCitedSite(site) ? { search: false } : {}), diff --git a/common/publish/composeReports.test.ts b/common/publish/composeReports.test.ts @@ -284,8 +284,8 @@ async function seedCorpus() { }, ]); - seedSite("cited", { search: false, reports: [REPORT] }); - seedSite("full", { reports: [REPORT] }); + seedSite("cited", { search: false, pages: [REPORT] }); + seedSite("full", { pages: [REPORT] }); seedSite("plain", {}, false); await buildIndex({ paths, onLog: () => {} }); } @@ -326,11 +326,11 @@ test("a cited site: exactly its reports, moments, cited media and contract — t `media/clips/${def}.m4a`, `media/posts/${SOCIAL}/3kabc/photo.jpg`, `media/posts/${SOCIAL}/3kabc/shot.png`, - `reports/${REPORT}/citations.csv`, - `reports/${REPORT}/citations.json`, - `reports/${REPORT}/page.json`, - `reports/${REPORT}/stills/a01.png`, - "reports/index.json", + `pages/${REPORT}/citations.csv`, + `pages/${REPORT}/citations.json`, + `pages/${REPORT}/page.json`, + `pages/${REPORT}/stills/a01.png`, + "pages/index.json", "robots.txt", "site.json", "sitemap.xml", @@ -360,12 +360,12 @@ test("a cited site's contract: site.json without channels, corpus.json scope cit assert.equal(corpus.site.audience, "public"); assert.deepEqual(corpus.channels, []); assert.deepEqual(corpus.totals, { channels: 0, videos: 0 }); - assert.equal(corpus.reports?.index, "https://cited.example.test/reports/index.json"); + assert.equal(corpus.reports?.index, "https://cited.example.test/pages/index.json"); assert.equal(corpus.reports?.count, 1); const llms = readFileSync(pub("llms.txt"), "utf8"); assert.match(llms, /^# Site cited/); - assert.match(llms, /\[Checking a demo article\]\(https:\/\/cited\.example\.test\/reports\/demo-report\/\): Four claims, one stream/); + assert.match(llms, /\[Checking a demo article\]\(https:\/\/cited\.example\.test\/pages\/demo-report\/\): Four claims, one stream/); assert.match(llms, /there is no searchable corpus here/); assert.doesNotMatch(llms, /## Channels|shardScheme|page-<NNNN>|transcripts\//); @@ -373,8 +373,7 @@ test("a cited site's contract: site.json without channels, corpus.json scope cit const locs = [...sitemap.matchAll(/<loc>([^<]+)<\/loc>/g)].map((m) => m[1].replace("https://cited.example.test", "")); assert.deepEqual(locs, [ "/", - "/reports/", - "/reports/demo-report/", + "/pages/demo-report/", `/m/${VIDEOS}/abc123/10.00-20.00/`, `/m/${VIDEOS}/def456/5.00-9.00/`, `/m/${SOCIAL}/3kabc/`, @@ -387,7 +386,7 @@ test("a cited site's contract: site.json without channels, corpus.json scope cit type View = { citations: Record<string, { verification?: Record<string, unknown>; record?: Record<string, unknown>; shot?: string; text?: string; author?: string }> }; test("verification is computed at compose: a hand-typed block is overwritten, a page's dropped, en-orig read when en has no cues", () => { - const view = readJson<View>(pub("reports", REPORT, "page.json")); + const view = readJson<View>(pub("pages", REPORT, "page.json")); const v = view.citations.c01.verification!; assert.equal(v.quoteScore, 1); assert.equal(v.method, `${QUOTE_CHECK_METHOD}; text: transcript.en.vtt`, "the method names the transcript that matched"); @@ -435,7 +434,7 @@ test("moment pages: the clip with its pad, the bounded cue context, the post's c ); assert.deepEqual( span.citedIn.map((e) => e.href), - [`/reports/${REPORT}/#claim-1`], + [`/pages/${REPORT}/#claim-1`], ); const audio = readJson<Record<string, unknown>>(pub("m", VIDEOS, "def456", "5.00-9.00", "moment.json")); assert.equal(audio.kind, "audio"); @@ -456,14 +455,14 @@ test("moment pages: the clip with its pad, the bounded cue context, the post's c }); test("the citations as files: a valid citation set without the saved copy, and one CSV row per citation", () => { - const set = readJson(pub("reports", REPORT, "citations.json")); + const set = readJson(pub("pages", REPORT, "citations.json")); const parsed = parseCitationSet(set); assert.ok(parsed.ok, JSON.stringify(parsed.problems)); assert.deepEqual(parsed.problems, []); assert.deepEqual(Object.keys((set as { citations: object }).citations), ["a01", "c01", "p01", "c02", "w01"]); assert.ok(!JSON.stringify(set).includes("saved"), "a source's saved copy is never published"); - const csv = readFileSync(pub("reports", REPORT, "citations.csv"), "utf8").trimEnd().split("\r\n"); + const csv = readFileSync(pub("pages", REPORT, "citations.csv"), "utf8").trimEnd().split("\r\n"); assert.equal(csv[0], CITATIONS_CSV_COLUMNS.join(",")); assert.equal(csv.length, 6); assert.equal( @@ -485,7 +484,7 @@ test("a quote that drifted from its cues fails compose, before anything is writt ); return true; }); - assert.ok(!existsSync(pub("reports"))); + assert.ok(!existsSync(pub("pages"))); assert.ok(!existsSync(pub("site.json")), "a failed compose leaves public/ naming no site"); } finally { writeJson(file, report()); @@ -527,10 +526,10 @@ test("a report's video: copied beside its page and named in the view; a missing writeText(path.join(dir, "video.mp4"), "mp4-bytes"); writeText(path.join(dir, "poster.jpg"), "jpg-bytes"); await compose("cited"); - assert.equal(readFileSync(pub("reports", REPORT, "video.mp4"), "utf8"), "mp4-bytes"); - assert.equal(readFileSync(pub("reports", REPORT, "poster.jpg"), "utf8"), "jpg-bytes"); - const view = readJson<{ video?: unknown }>(pub("reports", REPORT, "page.json")); - assert.deepEqual(view.video, { src: `/reports/${REPORT}/video.mp4`, poster: `/reports/${REPORT}/poster.jpg`, caption: "The cut" }); + assert.equal(readFileSync(pub("pages", REPORT, "video.mp4"), "utf8"), "mp4-bytes"); + assert.equal(readFileSync(pub("pages", REPORT, "poster.jpg"), "utf8"), "jpg-bytes"); + const view = readJson<{ video?: unknown }>(pub("pages", REPORT, "page.json")); + assert.deepEqual(view.video, { src: `/pages/${REPORT}/video.mp4`, poster: `/pages/${REPORT}/poster.jpg`, caption: "The cut" }); writeFileSync(path.join(dir, "video.mp4"), Buffer.alloc(25 * 1024 * 1024)); await assert.rejects(compose("cited"), (e: unknown) => { assert.ok(e instanceof ComposeReportsError); @@ -579,14 +578,14 @@ test("a full site with reports keeps its corpus and links each moment into it", assert.equal(post.record.corpusUrl, `/?v=${SOCIAL}%2F3kabc&vm=post`); const llms = readFileSync(pub("llms.txt"), "utf8"); assert.match(llms, /## Reports[^]*Checking a demo article[^]*## Channels/); - assert.match(readFileSync(pub("sitemap.xml"), "utf8"), /\/reports\/demo-report\//); + assert.match(readFileSync(pub("sitemap.xml"), "utf8"), /\/pages\/demo-report\//); assert.equal(citedBuildProblem(paths.exportPublicDir), null, "the audit leaves a full build alone"); }); test("a site with no reports ships none of the last site's", async () => { await compose("cited"); await compose("plain"); - for (const entry of ["reports", "m", "media"]) assert.ok(!existsSync(pub(entry)), entry); + for (const entry of ["pages", "reports", "m", "media"]) assert.ok(!existsSync(pub(entry)), entry); const corpus = readJson<{ reports?: unknown }>(pub("corpus.json")); assert.equal(corpus.reports, undefined); }); @@ -603,43 +602,43 @@ test("a report's timeline: its feeds beside the page on a site with a public URL ["timeline", {}], ["timeline-private", { siteUrl: undefined, audience: "private" }], ] as const) { - seedSite(siteId, { search: false, reports: [REPORT], ...extra }); + seedSite(siteId, { search: false, pages: [REPORT], ...extra }); writeJson(path.join(paths.sitesDir, siteId, "reports", REPORT, "report.json"), withTimeline); } await compose("timeline"); - const page = readJson<{ entries: { id: string }[]; updated?: string; feeds?: Record<string, string> }>(pub("reports", REPORT, "page.json")); + const page = readJson<{ entries: { id: string }[]; updated?: string; feeds?: Record<string, string> }>(pub("pages", REPORT, "page.json")); assert.deepEqual(page.entries.map((e) => e.id), ["e-new", "e-old"]); assert.equal(page.updated, "2026-10-05T08:30:00Z"); assert.deepEqual(page.feeds, { - rss: `https://timeline.example.test/reports/${REPORT}/feed.xml`, - json: `https://timeline.example.test/reports/${REPORT}/feed.json`, + rss: `https://timeline.example.test/pages/${REPORT}/feed.xml`, + json: `https://timeline.example.test/pages/${REPORT}/feed.json`, }); - const index = readJson<{ reports: { updated?: string }[] }>(pub("reports", "index.json")); + const index = readJson<{ reports: { updated?: string }[] }>(pub("pages", "index.json")); assert.equal(index.reports[0].updated, "2026-10-05T08:30:00Z"); - const rss = readFileSync(pub("reports", REPORT, "feed.xml"), "utf8"); + const rss = readFileSync(pub("pages", REPORT, "feed.xml"), "utf8"); const items = [...rss.matchAll(/<link>([^<]+)<\/link>/g)].map((m) => m[1]); assert.deepEqual(items, [ - `https://timeline.example.test/reports/${REPORT}/`, - `https://timeline.example.test/reports/${REPORT}/#e-new`, - `https://timeline.example.test/reports/${REPORT}/#e-old`, + `https://timeline.example.test/pages/${REPORT}/`, + `https://timeline.example.test/pages/${REPORT}/#e-new`, + `https://timeline.example.test/pages/${REPORT}/#e-old`, ]); assert.match(rss, /<title>First & <update><\/title>/); - const feed = readJson<{ version: string; items: { id: string }[] }>(pub("reports", REPORT, "feed.json")); + const feed = readJson<{ version: string; items: { id: string }[] }>(pub("pages", REPORT, "feed.json")); assert.equal(feed.version, "https://jsonfeed.org/version/1.1"); assert.deepEqual(feed.items.map((i) => i.id.split("#")[1]), ["e-new", "e-old"]); // Served as what they are, and readable cross-origin. - assert.match(readFileSync(pub("_headers"), "utf8"), /\/reports\/:report\/feed\.xml\n {2}Content-Type: application\/rss\+xml; charset=utf-8\n/); - // The cited audit allows them (reports/ is the stage's own). + assert.match(readFileSync(pub("_headers"), "utf8"), /\/pages\/:report\/feed\.xml\n {2}Content-Type: application\/rss\+xml; charset=utf-8\n/); + // The cited audit allows them (pages/ is the stage's own). assert.equal(citedBuildProblem(paths.exportPublicDir), null); // No public URL: the page and its timeline, no feed — absolute links have nowhere to point. await compose("timeline-private"); - const priv = readJson<{ entries: unknown[]; feeds?: unknown }>(pub("reports", REPORT, "page.json")); + const priv = readJson<{ entries: unknown[]; feeds?: unknown }>(pub("pages", REPORT, "page.json")); assert.equal(priv.entries.length, 2); assert.equal(priv.feeds, undefined); - assert.ok(!existsSync(pub("reports", REPORT, "feed.xml"))); - assert.ok(!existsSync(pub("reports", REPORT, "feed.json"))); + assert.ok(!existsSync(pub("pages", REPORT, "feed.xml"))); + assert.ok(!existsSync(pub("pages", REPORT, "feed.json"))); }); // ─── Exports (publish/reportExports.ts) ─── @@ -732,20 +731,20 @@ test("reports export: every format from the resolved view, a self-contained HTML test("compose publishes the exports beside the report and lists them as downloads", async () => { await compose("cited"); for (const f of ["report.html", "report.pdf", "report.md", "slides.html", "slides.pdf", "evidence-pack.zip"]) { - assert.equal(sha(pub("reports", REPORT, f)), sha(path.join(reportExportDir(paths, "cited", REPORT), f)), f); + assert.equal(sha(pub("pages", REPORT, f)), sha(path.join(reportExportDir(paths, "cited", REPORT), f)), f); } - const view = readJson<{ downloads: Record<string, string> }>(pub("reports", REPORT, "page.json")); + const view = readJson<{ downloads: Record<string, string> }>(pub("pages", REPORT, "page.json")); assert.deepEqual(view.downloads, { - html: `/reports/${REPORT}/report.html`, - pdf: `/reports/${REPORT}/report.pdf`, - md: `/reports/${REPORT}/report.md`, - slides: `/reports/${REPORT}/slides.html`, - "slides-pdf": `/reports/${REPORT}/slides.pdf`, - zip: `/reports/${REPORT}/evidence-pack.zip`, - json: `/reports/${REPORT}/citations.json`, - csv: `/reports/${REPORT}/citations.csv`, + html: `/pages/${REPORT}/report.html`, + pdf: `/pages/${REPORT}/report.pdf`, + md: `/pages/${REPORT}/report.md`, + slides: `/pages/${REPORT}/slides.html`, + "slides-pdf": `/pages/${REPORT}/slides.pdf`, + zip: `/pages/${REPORT}/evidence-pack.zip`, + json: `/pages/${REPORT}/citations.json`, + csv: `/pages/${REPORT}/citations.csv`, }); - assert.equal(citedBuildProblem(paths.exportPublicDir), null, "the exports are within reports/, which the audit allows"); + assert.equal(citedBuildProblem(paths.exportPublicDir), null, "the exports are within pages/, which the audit allows"); }); test("reports export commits a revision when report.json changed; compose publishes the history, the page names it", async () => { @@ -783,19 +782,19 @@ test("reports export commits a revision when report.json changed; compose publis const history = readJson<{ clone: string; revisions: { revision: number; commit: string; reportSha256: string; date: string; summary: string[]; claims: { id: string }[] }[]; - }>(pub("reports", REPORT, "history", "history.json")); - assert.equal(history.clone, `https://cited.example.test/reports/${REPORT}/history/repo`); + }>(pub("pages", REPORT, "history", "history.json")); + assert.equal(history.clone, `https://cited.example.test/pages/${REPORT}/history/repo`); assert.deepEqual(history.revisions.map((x) => x.revision), [1, 2]); assert.equal(history.revisions[1].commit, m.revision?.commit); assert.equal(history.revisions[1].reportSha256, sha(file)); assert.equal(history.revisions[1].date, "2026-10-06T08:00:00Z"); assert.deepEqual(history.revisions[1].claims.map((c) => c.id), ["claim-1"]); - const repo = filesUnder(pub("reports", REPORT, "history", "repo")); + const repo = filesUnder(pub("pages", REPORT, "history", "repo")); assert.deepEqual(repo.filter((f) => !f.startsWith("objects/pack/")), ["HEAD", "info/refs", "objects/info/packs", "packed-refs", "refs/heads/main"]); assert.ok(repo.some((f) => f.endsWith(".pack"))); - const view = readJson<{ history: unknown }>(pub("reports", REPORT, "page.json")); - assert.deepEqual(view.history, { revision: 2, date: "2026-10-06T08:00:00Z", href: `/reports/${REPORT}/history/`, current: true }); - assert.match(readFileSync(pub("sitemap.xml"), "utf8"), new RegExp(`/reports/${REPORT}/history/`)); + const view = readJson<{ history: unknown }>(pub("pages", REPORT, "page.json")); + assert.deepEqual(view.history, { revision: 2, date: "2026-10-06T08:00:00Z", href: `/pages/${REPORT}/history/`, current: true }); + assert.match(readFileSync(pub("sitemap.xml"), "utf8"), new RegExp(`/pages/${REPORT}/history/`)); assert.equal(citedBuildProblem(paths.exportPublicDir), null); assert.equal(reportHistoryProblem(paths.exportPublicDir), null); } finally { @@ -803,7 +802,7 @@ test("reports export commits a revision when report.json changed; compose publis } // Edited since the newest revision and not exported: the page says so. await compose("cited"); - const view = readJson<{ history: { revision: number; current: boolean } }>(pub("reports", REPORT, "page.json")); + const view = readJson<{ history: { revision: number; current: boolean } }>(pub("pages", REPORT, "page.json")); assert.deepEqual([view.history.revision, view.history.current], [2, false]); // Exported again, the way back is revision 3. const back = await exportSiteReports({ siteId: "cited", paths, now: () => new Date("2026-10-06T09:00:00Z"), openPdfPrinter: fakePrinter([]), onLog: () => {} }); @@ -811,7 +810,7 @@ test("reports export commits a revision when report.json changed; compose publis assert.deepEqual(back.exported[0].manifest.revision?.summary, ["Verdict changed: claim-1 PARTLY → CONTRADICTED", "Claim edited: claim-1 (text)"]); // A site with no reports ships no history. await compose("plain"); - assert.ok(!existsSync(pub("reports"))); + assert.ok(!existsSync(pub("pages"))); }); test("an export of another version of the report is not published; a pack over the limit stays local", async () => { @@ -821,17 +820,17 @@ test("an export of another version of the report is not published; a pack over t writeFileSync(file, `${saved}\n`); try { await compose("cited"); - assert.ok(!existsSync(pub("reports", REPORT, "report.html"))); - const view = readJson<{ downloads: Record<string, string> }>(pub("reports", REPORT, "page.json")); + assert.ok(!existsSync(pub("pages", REPORT, "report.html"))); + const view = readJson<{ downloads: Record<string, string> }>(pub("pages", REPORT, "page.json")); assert.deepEqual(Object.keys(view.downloads), ["json", "csv"]); } finally { writeFileSync(file, saved); } truncateSync(path.join(dir, "evidence-pack.zip"), 25 * 1024 * 1024); await compose("cited"); - assert.ok(existsSync(pub("reports", REPORT, "report.html"))); - assert.ok(!existsSync(pub("reports", REPORT, "evidence-pack.zip"))); - const view = readJson<{ downloads: Record<string, string> }>(pub("reports", REPORT, "page.json")); + assert.ok(existsSync(pub("pages", REPORT, "report.html"))); + assert.ok(!existsSync(pub("pages", REPORT, "evidence-pack.zip"))); + const view = readJson<{ downloads: Record<string, string> }>(pub("pages", REPORT, "page.json")); assert.deepEqual(Object.keys(view.downloads), ["html", "pdf", "md", "slides", "slides-pdf", "json", "csv"]); }); @@ -896,11 +895,11 @@ test("a report's notes.json (umtool's operator notes) is never published, export // 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] }); + const citedScope = { pages: [REPORT], channels: pool, citedChannels: [{ slug: VIDEOS }] }; + seedSite("padded", { pages: [REPORT] }); seedSite("padded-private", { ...citedScope, audience: "private" }); seedSite("padded-cited", citedScope); - seedSite("unpadded", { reports: [REPORT], channels: pool }); + seedSite("unpadded", { pages: [REPORT], channels: pool }); await buildIndex({ paths, onLog: () => {} }); const abc = `${VIDEOS}/abc123/10.00-20.00`; @@ -928,7 +927,7 @@ test("a cited-only channel: its moment pages and clips publish on the citing sit // 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")); + const view = readJson<View>(pub("pages", 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); @@ -946,7 +945,7 @@ test("a cited-only channel: its moment pages and clips publish on the citing sit // citations, the moment index and the sitemap do. const naming = files.filter( (f) => - !f.startsWith("reports/") && + !f.startsWith("pages/") && !f.startsWith("m/") && !f.startsWith("media/") && f !== "sitemap.xml" && diff --git a/common/publish/composeReports.ts b/common/publish/composeReports.ts @@ -146,9 +146,17 @@ import { import { publishableReportExports, reportFileSha256, type PublishableReportExports } from "./reportExportFiles"; import { publishReportHistory, readReportHistoryView, reportHistoryGitDir, reportHistoryRef } from "./reportHistory"; import type { ReportHistoryRef, ReportHistoryView } from "../lib/report/revisions"; - -// The public dir's entries this stage owns. Every compose removes them first. -export const REPORT_PUBLIC_ENTRIES: readonly string[] = ["reports", "m", "media"]; +import { LEGACY_SITE_REPORTS_DIR, SITE_REPORTS_BASE, reportBaseDir } from "../lib/report/routes"; + +// The public dir's entries this stage owns. Every compose removes them first — +// and the dir a site's reports were published under before release 26, so an +// older compose's reports never outlive it. +export const REPORT_PUBLIC_ENTRIES: readonly string[] = [ + reportBaseDir(SITE_REPORTS_BASE), + LEGACY_SITE_REPORTS_DIR, + "m", + "media", +]; // The transcript lines a moment page shows either side of its span, and at // most how many: bounded context, never the record (plans/report-sites.md, @@ -849,7 +857,7 @@ export async function composeReports(opts: ComposeReportsOptions): Promise<Compo for (const entry of REPORT_PUBLIC_ENTRIES) { await rm(path.join(publicDir, entry), { recursive: true, force: true }); } - if ((site.reports ?? []).length === 0) { + if ((site.pages ?? []).length === 0) { log("[reports] none published."); return { reports: [], moments: [], allowed: [] }; } @@ -857,7 +865,7 @@ export async function composeReports(opts: ComposeReportsOptions): Promise<Compo // Each report's exports (publish/reportExports.ts), made from the report // as it is now and small enough to publish; the citations as files always. const exportsOf = new Map<string, PublishableReportExports>(); - for (const id of site.reports ?? []) { + for (const id of site.pages ?? []) { const found = await publishableReportExports(paths, site.siteId, id); exportsOf.set(id, found); for (const note of found.notes) log(`[reports] ${id}: ${note}`); @@ -866,7 +874,7 @@ export async function composeReports(opts: ComposeReportsOptions): Promise<Compo // anything is written; a report never exported has none. const histories = new Map<string, { view: ReportHistoryView; ref: ReportHistoryRef; gitDir: string }>(); const historyProblems: ComposeReportsProblem[] = []; - for (const id of site.reports ?? []) { + for (const id of site.pages ?? []) { const gitDir = reportHistoryGitDir(paths, site.siteId, id); try { const view = await readReportHistoryView(gitDir, { reportId: id, siteUrl: site.siteUrl }); @@ -977,13 +985,13 @@ function postAuthor(post: Post): string { const defined = <T extends object>(o: T): T => Object.fromEntries(Object.entries(o).filter(([, v]) => v !== undefined)) as T; -// The site-root routes the reports add to a sitemap: the index, each report -// (and its history page, when it has one), each moment page. +// The site-root routes the reports add to a sitemap: each page (and its +// history page, when it has one), each moment page. A site has no index of +// its pages (its header links each one). export function reportRoutes(composed: Pick<ComposedReports, "reports" | "moments" | "histories">): string[] { if (composed.reports.length === 0) return []; const histories = new Set(composed.histories ?? []); return [ - "/reports/", ...composed.reports.flatMap((r) => (histories.has(r.id) ? [r.href, reportHistoryPagePath(r.id)] : [r.href])), ...composed.moments.map((k) => momentPath(k)), ]; diff --git a/common/publish/reportExports.ts b/common/publish/reportExports.ts @@ -79,6 +79,7 @@ import { resolveAccent } from "../lib/accent"; import { REPORT_EXPORT_FILENAMES, REPORT_EXPORT_FORMATS, + reportPagePath, type ReportExportFormat, type ReportPageView, type SpanCitationView, @@ -315,7 +316,7 @@ function within(base: string, rel: string): string | undefined { } function reportFiles(paths: Paths, siteId: string, view: ReportPageView, resolved: ResolvedSiteReports): ReportFiles { - const own = `/reports/${view.id}/`; + const own = reportPagePath(view.id); return { local: (p) => { if (p.startsWith(own)) return within(siteReportDir(paths, siteId, view.id), p.slice(own.length)); @@ -335,7 +336,7 @@ function reportFiles(paths: Paths, siteId: string, view: ReportPageView, resolve // A site-root path's place in the evidence pack: the site's media under // media/, the report's own files (its stills) under media/report/. function packPathOf(view: ReportPageView, sitePath: string): string | undefined { - const own = `/reports/${view.id}/`; + const own = reportPagePath(view.id); if (sitePath.startsWith(own)) return `media/report/${sitePath.slice(own.length)}`; if (sitePath.startsWith("/media/")) return sitePath.slice(1); return undefined; @@ -689,7 +690,7 @@ export async function exportSiteReports(opts: ExportSiteReportsOptions): Promise const { siteId } = opts; if (!listSiteIds(paths).includes(siteId)) throw new Error(`no site "${siteId}" (no sites/${siteId}/site.json)`); const site = getSite(siteId, paths); - const published = site.reports ?? []; + const published = site.pages ?? []; if (opts.reportId && !published.includes(opts.reportId)) { throw new Error(`site "${siteId}" does not publish a report "${opts.reportId}" (only a published report is exported)`); } diff --git a/common/publish/reportHistory.test.ts b/common/publish/reportHistory.test.ts @@ -166,7 +166,7 @@ test("the history view: each revision's hashes, summary and claim diff; the page const r2 = await commit(gitDir, reportJson({ text: "The bridge opened in 2019." }), "2026-03-08T12:00:00Z"); const view = await readReportHistoryView(gitDir, { reportId: "demo", siteUrl: "https://reports.example.org/" }); assert.ok(view); - assert.equal(view.clone, "https://reports.example.org/reports/demo/history/repo"); + assert.equal(view.clone, "https://reports.example.org/pages/demo/history/repo"); assert.deepEqual( view.revisions.map((r) => [r.revision, r.commit, r.reportSha256, r.date]), [ @@ -184,12 +184,12 @@ test("the history view: each revision's hashes, summary and claim diff; the page assert.deepEqual(reportHistoryRef(view, r2.reportSha256), { revision: 2, date: "2026-03-08T12:00:00Z", - href: "/reports/demo/history/", + href: "/pages/demo/history/", current: true, }); assert.equal(reportHistoryRef(view, sha("edited")).current, false); const relative = await readReportHistoryView(gitDir, { reportId: "demo" }); - assert.equal(relative?.clone, "/reports/demo/history/repo"); + assert.equal(relative?.clone, "/pages/demo/history/repo"); assert.equal(await readReportHistoryView(path.join(ROOT, "none"), { reportId: "demo" }), null); }); @@ -215,7 +215,7 @@ test("the published clone: an allowlisted dumb-HTTP repository that clones over for (const f of files) assert.match(f, REPORT_HISTORY_REPO_FILE_RE); assert.ok(files.includes("info/refs") && files.includes("objects/info/packs")); assert.ok(files.some((f) => f.endsWith(".pack"))); - const published = JSON.parse(readFileSync(path.join(publicDir, "reports", "demo", "history", "history.json"), "utf8")); + const published = JSON.parse(readFileSync(path.join(publicDir, "pages", "demo", "history", "history.json"), "utf8")); assert.deepEqual(published, view); const port = await freePort(); @@ -232,7 +232,7 @@ test("the published clone: an allowlisted dumb-HTTP repository that clones over }); }); const dest = path.join(ROOT, "clone", "cloned"); - execFileSync("git", ["clone", "--quiet", `http://127.0.0.1:${port}/reports/demo/history/repo`, dest], { + execFileSync("git", ["clone", "--quiet", `http://127.0.0.1:${port}/pages/demo/history/repo`, dest], { env: historyGitEnv(), stdio: "pipe", }); diff --git a/common/publish/reportMedia.ts b/common/publish/reportMedia.ts @@ -185,7 +185,7 @@ export async function loadSiteReports( ): Promise<{ reports: Report[]; problems: ReportMediaProblem[] }> { const reports: Report[] = []; const problems: ReportMediaProblem[] = []; - for (const id of site.reports ?? []) { + for (const id of site.pages ?? []) { const file = siteReportFile(paths, site.siteId, id); const read = await readJsonFile(file); if (!read.ok) { @@ -256,7 +256,7 @@ export async function prepareReportMedia(opts: PrepareReportMediaOptions): Promi const cacheDir = reportMediaDir(paths, siteId); const { reports, problems } = await loadSiteReports(paths, site); - log(`${siteId}: ${site.reports?.length ?? 0} published report(s), ${reports.length} readable.`); + log(`${siteId}: ${site.pages?.length ?? 0} published report(s), ${reports.length} readable.`); const moments = citedMoments(reports); log(`${moments.length} cited moment(s) with media.`); diff --git a/editor/app/sites/actions.ts b/editor/app/sites/actions.ts @@ -127,9 +127,9 @@ export async function saveSiteAction( return { ok: false, error: `Unknown publish policy "${publishAutoRaw}".`, values }; } const publishAuto = publishAutoRaw as PublishPolicy; - // Search (opt-out; off = report-only) and the report list, which is not on + // Search (opt-out; off = pages only) and the page list, which is not on // this form: the stored one is carried over. - let storedReports: Pick<Site, "reports"> | undefined; + let storedReports: Pick<Site, "pages"> | undefined; try { storedReports = getSite(siteId, getPaths()); } catch { diff --git a/editor/app/sites/components/SiteForm.tsx b/editor/app/sites/components/SiteForm.tsx @@ -416,16 +416,16 @@ export function SiteForm({ initial, channels, allSites, isNew }: Props) { Search </label> <p className="-mt-2 text-xs text-muted-foreground"> - Off: the site is its reports only. + Off: the site is its pages only, and needs at least one. </p> <div className="flex flex-col gap-1 text-sm"> - <span className="font-medium">Reports</span> - {initial.reports && initial.reports.length > 0 ? ( + <span className="font-medium">Pages</span> + {initial.pages && initial.pages.length > 0 ? ( <ol - aria-label="Published reports" + aria-label="Published pages" className="list-decimal pl-6 font-mono text-xs" > - {initial.reports.map((id) => ( + {initial.pages.map((id) => ( <li key={id}>{id}</li> ))} </ol> @@ -433,9 +433,10 @@ export function SiteForm({ initial, channels, allSites, isNew }: Props) { <span className="text-xs text-muted-foreground">None</span> )} <span className="text-xs text-muted-foreground"> - The published reports, in order (report ids under this site's - reports/ directory). Not edited here: saving this form keeps the list - as it is. + The site's pages, in order (report ids under this site's + reports/ directory), each at /pages/<id>/ and linked from the + header by its title. Not edited here: saving this form keeps the + list as it is. {!isNew && ( <> {" "}Publish, unpublish and reorder them on the{" "} diff --git a/editor/app/sites/lib/reportListServer.ts b/editor/app/sites/lib/reportListServer.ts @@ -17,7 +17,7 @@ import { reportRows, type ReportFileRead, type ReportRow } from "./reportList"; // Every report of the site, published (in order) then drafts, each read and // validated. export async function readSiteReportRows(paths: Paths, site: Site): Promise<ReportRow[]> { - const published = site.reports ?? []; + const published = site.pages ?? []; const dirIds = await listReportDirs(paths, site.siteId); const ids = [...new Set([...published, ...dirIds])]; const reads = new Map<string, ReportFileRead>( @@ -60,7 +60,7 @@ export type ReportExportsRow = { export async function readSiteReportExports(paths: Paths, site: Site): Promise<ReportExportsRow[]> { return Promise.all( - (site.reports ?? []).map(async (reportId) => ({ + (site.pages ?? []).map(async (reportId) => ({ reportId, manifest: await readReportExportManifest(paths, site.siteId, reportId), publishable: await publishableReportExports(paths, site.siteId, reportId), diff --git a/editor/app/sites/lib/reportSiteKeys.test.ts b/editor/app/sites/lib/reportSiteKeys.test.ts @@ -17,15 +17,15 @@ test("search checked writes no key; unchecked (no field) writes search: false", assert.deepEqual(reportSiteKeysFromForm(form({ search: "on", publish: "cited" }), undefined), {}); }); -test("the stored report list is carried over in order; the form cannot set it", () => { - const stored = { reports: ["second", "first"] }; +test("the stored page list is carried over in order; the form cannot set it", () => { + const stored = { pages: ["second", "first"] }; assert.deepEqual( - reportSiteKeysFromForm(form({ search: "on", reports: "injected" }), stored), - { reports: ["second", "first"] }, + reportSiteKeysFromForm(form({ search: "on", pages: "injected" }), stored), + { pages: ["second", "first"] }, ); // An empty or missing stored list writes no key; a bad stored id is dropped. - assert.deepEqual(reportSiteKeysFromForm(form({ search: "on" }), { reports: [] }), {}); - assert.deepEqual(reportSiteKeysFromForm(form({ search: "on" }), { reports: ["ok", "NOT OK"] }), { - reports: ["ok"], + assert.deepEqual(reportSiteKeysFromForm(form({ search: "on" }), { pages: [] }), {}); + assert.deepEqual(reportSiteKeysFromForm(form({ search: "on" }), { pages: ["ok", "NOT OK"] }), { + pages: ["ok"], }); }); diff --git a/editor/app/sites/lib/reportSiteKeys.ts b/editor/app/sites/lib/reportSiteKeys.ts @@ -1,23 +1,24 @@ -// The site form's two report-site keys (site.json `search` and `reports`), +// The site form's two report-site keys (site.json `search` and `pages`), // pure so the parse is tested without a server (saveSiteAction calls it). // // `search` is the form's checkbox, opt-out like `archives`: an unchecked box -// sends no field and is written as `search: false` (report-only). A legacy +// sends no field and is written as `search: false` (pages only). A legacy // `publish: "cited"` read from the file is never written back. -// `reports` is NOT edited by this form (the site's Reports tab manages it): the +// `pages` is NOT edited by this form (the site's Reports tab manages it): the // Site is rebuilt from the form on save, so the list already stored is carried -// over, and saving any other field never drops a published report. +// over, and saving any other field never drops a published page. A search-off +// site with no pages is refused by writeSite (siteSearchProblem). import { parseSiteReports, type Site } from "yt-dlp-transcript-common/lib/site"; export function reportSiteKeysFromForm( formData: FormData, - stored: Pick<Site, "reports"> | undefined, -): Pick<Site, "search" | "reports"> { + stored: Pick<Site, "pages"> | undefined, +): Pick<Site, "search" | "pages"> { const search = formData.get("search") === "on"; - const reports = parseSiteReports(stored?.reports); + const pages = parseSiteReports(stored?.pages); return { ...(search ? {} : { search: false }), - ...(reports.length > 0 ? { reports } : {}), + ...(pages.length > 0 ? { pages } : {}), }; } diff --git a/editor/app/sites/lib/reportsActions.ts b/editor/app/sites/lib/reportsActions.ts @@ -28,7 +28,7 @@ async function editReports(siteId: string, reportId: string, edit: Edit): Promis if (!isReportId(reportId)) return { ok: false, error: `"${reportId}" is not a valid report id` }; let written; try { - written = await patchSite(siteId, (current) => ({ reports: edit(current.reports ?? []) }), getPaths()); + written = await patchSite(siteId, (current) => ({ pages: edit(current.pages ?? []) }), getPaths()); } catch (err) { return { ok: false, error: err instanceof Error ? err.message : String(err) }; } diff --git a/editor/e2e/helpers.ts b/editor/e2e/helpers.ts @@ -180,6 +180,9 @@ export async function writeSite( ...(site.audience !== undefined ? { audience: site.audience } : {}), // The legacy report-only key, written as given (siteSchema migrates it). ...(site.publish !== undefined ? { publish: site.publish } : {}), + ...(site.pages !== undefined ? { pages: site.pages } : {}), + // The pre-release-26 page list, written as given (siteSchema reads it as `pages`). + ...(site.reports !== undefined ? { reports: site.reports } : {}), ...(site.relatedSites ? { relatedSites: site.relatedSites } : {}), }; await writeFile( diff --git a/editor/e2e/sites-crud.spec.ts b/editor/e2e/sites-crud.spec.ts @@ -388,13 +388,15 @@ test("archives + per-video transcript downloads opt-outs round-trip", async ({ await expect(downloads).toBeChecked(); }); -test("the search switch round-trips; a legacy publish: cited reads as off and saves as search: false", async ({ +test("the search switch round-trips; a legacy publish: cited reads as off and saves as search: false; legacy reports saves as pages", async ({ page, }) => { await resetData("empty"); - await writeSite("reportonly", { siteTitle: "Report Only", publish: "cited" }); + // A search-off site needs a page (release 26 A5): the legacy `reports` key + // reads as `pages`, and a save writes `pages`. + await writeSite("reportonly", { siteTitle: "Report Only", publish: "cited", reports: ["demo-page"] }); - type SearchSiteFile = { search?: boolean; publish?: string }; + type SearchSiteFile = { search?: boolean; publish?: string; pages?: string[]; reports?: string[] }; const file = `${testPaths().transcriptsDir}/sites/reportonly/site.json`; const search = page.getByRole("checkbox", { name: "Search", exact: true }); const save = async () => { @@ -412,7 +414,10 @@ test("the search switch round-trips; a legacy publish: cited reads as off and sa const site = await readJson<SearchSiteFile>(file); expect(site.search).toBe(false); expect("publish" in site).toBe(false); + expect(site.pages).toEqual(["demo-page"]); + expect("reports" in site).toBe(false); }).toPass({ timeout: 10_000 }); + await expect(page.getByRole("list", { name: "Published pages" }).getByRole("listitem")).toHaveText(["demo-page"]); await page.goto("/sites/reportonly/reports"); await expect(page.getByText("Reports only — search is off")).toBeVisible(); @@ -432,6 +437,20 @@ test("the search switch round-trips; a legacy publish: cited reads as off and sa await expect(page.getByText("Full archive — search is on")).toBeVisible(); }); + +test("a site with search off and no pages is refused on save", async ({ page }) => { + await resetData("empty"); + await writeSite("nopages", { siteTitle: "No Pages" }); + const file = `${testPaths().transcriptsDir}/sites/nopages/site.json`; + await page.goto("/sites/nopages"); + await page.getByRole("checkbox", { name: "Search", exact: true }).uncheck(); + await page.getByRole("button", { name: /save site/i }).click(); + // Filtered: Next's route announcer is a second (empty) role=alert. + await expect( + page.getByRole("alert").filter({ hasText: /search is off and the site has no pages/i }), + ).toBeVisible(); + expect("search" in (await readJson<{ search?: boolean }>(file))).toBe(false); +}); test("the listed opt-out round-trips, and a save of another field keeps it", async ({ page, }) => { diff --git a/export/app/(workspace)/page.tsx b/export/app/(workspace)/page.tsx @@ -2,19 +2,19 @@ import type { Metadata } from "next"; import { isCitedSite } from "yt-dlp-transcript-common/lib/siteSchema"; import { currentSite } from "../lib/site"; import { instanceMode } from "../lib/mode"; -import { REPORTS_BASE, onlyReportView, readReportIndex, reportMetadata } from "../lib/reports"; +import { REPORTS_BASE, firstReportView, reportMetadata } from "../lib/reports"; import NewSinceLastVisit from "../components/NewSinceLastVisit"; import HubHome from "../components/hub/HubHome"; -import ReportIndex from "yt-dlp-transcript-common/components/report/ReportIndex"; import ReportArticle from "yt-dlp-transcript-common/components/report/ReportArticle"; +import { EmptyState } from "yt-dlp-transcript-common/components/report/parts"; -// A cited site with one report: the home page IS the report, so its tab names -// the report as the report's own page does. Every other home keeps the -// layout's default title (the site's). +// A search-off site: the home page IS its first page, so its tab names the +// page as the page's own route does. Every other home keeps the layout's +// default title (the site's). export function generateMetadata(): Metadata { if (instanceMode() === "hub" || !isCitedSite(currentSite())) return {}; - const only = onlyReportView(); - return only ? reportMetadata(only) : {}; + const first = firstReportView(); + return first ? reportMetadata(first) : {}; } export default async function Home() { @@ -27,18 +27,21 @@ export default async function Home() { } const settings = currentSite(); - // A cited site publishes only its reports and their moments: its home is the - // report index (a static export has no redirect to send it there), and it - // has no summaries manifest, so countTranscripts() — which throws without - // one — is never reached: its module is not even loaded on this path. - // - // With ONE published report the home page IS that report (the header then - // links nothing: there is nowhere else to go). With more, the index -- no - // heading of its own: the header already names the site. + // A search-off site publishes only its pages and their moments: its home + // page IS its first page (the header links every page by its title, and + // links nothing when there is one: there is nowhere else to go). It has no + // summaries manifest, so countTranscripts() — which throws without one — is + // never reached: its module is not even loaded on this path. A search-off + // site with no page is refused on save (siteSearchProblem); one built + // anyway says so. if (isCitedSite(settings)) { - const only = onlyReportView(); - if (only) return <ReportArticle view={only} base={REPORTS_BASE} />; - return <ReportIndex index={readReportIndex()} heading={null} tagline={settings.homeTagline} />; + const first = firstReportView(); + if (first) return <ReportArticle view={first} base={REPORTS_BASE} />; + return ( + <EmptyState title="No pages"> + This site has not published a page yet. + </EmptyState> + ); } const { countTranscripts } = await import("yt-dlp-transcript-common/lib/transcripts"); const count = await countTranscripts(); diff --git a/export/app/components/Header.tsx b/export/app/components/Header.tsx @@ -14,7 +14,7 @@ import { headerMarkPalette } from "../lib/brand"; import { instanceMode } from "../lib/mode"; import { hasArchives } from "../lib/archives"; import { hasDuplicates } from "../lib/duplicates"; -import { hasReports, reportIds } from "../lib/reports"; +import { pageLinks } from "../lib/reports"; import { headerNavLinks } from "../lib/nav"; import { isCitedSite } from "yt-dlp-transcript-common/lib/siteSchema"; import MobileMenu from "./MobileMenu"; @@ -83,8 +83,7 @@ export default function Header() { const cited = isSite && isCitedSite(site); const navLinks = headerNavLinks({ cited, - singleReport: cited && reportIds().length === 1, - reports: isSite && hasReports(), + pages: isSite ? pageLinks() : [], duplicates: !cited && hasDuplicates(), downloads: !cited && hasArchives(), }); diff --git a/export/app/components/NotOnCitedSite.tsx b/export/app/components/NotOnCitedSite.tsx @@ -1,19 +1,17 @@ import Link from "next/link"; import { EmptyState, textLink } from "yt-dlp-transcript-common/components/report/parts"; -import { reportIds } from "../lib/reports"; // What a corpus-shaped route (search's chat, downloads, duplicates, offline) -// renders on a CITED site, which publishes only its reports and their moments. -// The route still exists in the static build (every route does); it shows -// nothing of the corpus and points at the home page -- the index, or the one -// report. +// renders on a CITED site (search off), which publishes only its pages and +// their moments. The route still exists in the static build (every route +// does); it shows nothing of the corpus and points at the home page — the +// site's first page. export function NotOnCitedSite({ title }: { title: string }) { - const one = reportIds().length === 1; return ( <EmptyState title={title}> - This site publishes its reports only.{" "} + This site publishes its pages only.{" "} <Link href="/" className={textLink}> - {one ? "Read the report" : "Read the reports"} + Go to the home page </Link> . </EmptyState> diff --git a/export/app/lib/nav.ts b/export/app/lib/nav.ts @@ -6,25 +6,26 @@ export type NavLink = { href: string; label: string; external?: boolean }; // build has. Ask AI is new: the chat was only reachable from the workspace // control or from Use with AI, which is not where anyone looks for it. Use // with AI is the homepage's AI and MCP doc (release 16 slice DX): off this -// site, so a plain <a> in the same tab, not a client navigation. Reports -// shows when this build has a report (public/reports/index.json). +// site, so a plain <a> in the same tab, not a client navigation. The site's +// pages (site.json `pages`, release 26 A5) are linked each by its title, in +// the site's order, after Ask AI — there is no index of them. // -// A CITED site (site.json `search: false`) publishes only its reports and -// their moments: no search, no chat, no downloads or duplicates, and nothing -// for an AI to read — its nav is Reports alone, or nothing when its one -// report IS the home page (`singleReport`). +// A CITED site (site.json `search: false`) publishes only its pages and their +// moments: no search, no chat, no downloads or duplicates, and nothing for an +// AI to read — its nav is its pages alone, or nothing when its one page IS the +// home page. export function headerNavLinks(has: { cited: boolean; - reports: boolean; + pages: readonly { href: string; label: string }[]; duplicates: boolean; downloads: boolean; - singleReport?: boolean; }): NavLink[] { - if (has.cited) return has.singleReport ? [] : [{ href: "/reports/", label: "Reports" }]; + const pages = has.pages.map((p) => ({ href: p.href, label: p.label })); + if (has.cited) return pages.length > 1 ? pages : []; return [ { href: "/", label: "Search" }, { href: "/ask/", label: "Ask AI" }, - ...(has.reports ? [{ href: "/reports/", label: "Reports" }] : []), + ...pages, ...(has.duplicates ? [{ href: "/duplicates", label: "Duplicates" }] : []), ...(has.downloads ? [{ href: "/downloads", label: "Downloads" }] : []), { href: AI_DOC_URL, label: "Use with AI", external: true }, diff --git a/export/app/lib/reports.test.ts b/export/app/lib/reports.test.ts @@ -22,7 +22,7 @@ fs.mkdirSync(publicDir, { recursive: true }); fs.mkdirSync(path.join(sitesDir, "demo-cited"), { recursive: true }); fs.writeFileSync( path.join(sitesDir, "demo-cited", "site.json"), - JSON.stringify({ siteTitle: "Demo Reports", search: false, reports: ["demo-factcheck"] }), + JSON.stringify({ siteTitle: "Demo Reports", search: false, pages: ["demo-factcheck"] }), ); process.env.EXPORT_PUBLIC_DIR = publicDir; process.env.TRANSCRIPTS_DIR = path.join(root, "transcripts"); @@ -31,23 +31,24 @@ process.env.SITE_ID = "demo-cited"; delete process.env.INSTANCE_MODE; const fixture = await import("../../fixtures/report-site/fixture"); -const reportPage = await import("../reports/[reportId]/page"); +const reportPage = await import("../pages/[reportId]/page"); const momentPage = await import("../m/[...moment]/page"); -const reportsIndexPage = await import("../reports/page"); const home = await import("../(workspace)/page"); const { headerNavLinks } = await import("./nav"); +const reports = await import("./reports"); const { default: ReportArticle } = await import("yt-dlp-transcript-common/components/report/ReportArticle"); const render = (el: React.ReactElement) => renderToStaticMarkup(el); -test("with no reports, each dynamic route builds its one placeholder page, which says so", async () => { +test("with no pages, each dynamic route builds its one placeholder page, which says so", async () => { assert.deepEqual(reportPage.generateStaticParams(), [{ reportId: "_none" }]); assert.deepEqual(momentPage.generateStaticParams(), [{ moment: ["_none"] }]); const r = render(await reportPage.default({ params: Promise.resolve({ reportId: "_none" }) })); - assert.match(r, /No reports/); + assert.match(r, /No pages/); const m = render(await momentPage.default({ params: Promise.resolve({ moment: ["_none"] }) })); assert.match(m, /No moments/); - assert.match(render(reportsIndexPage.default()), /No reports/); + // and a search-off site with none says so on its home page (a save refuses it). + assert.match(render(await home.default()), /No pages/); }); test("the fixture's view JSON is exactly what the builder makes of its report", () => { @@ -93,7 +94,7 @@ test("the report page: header, tally, sections and claims, inline cites, referen ); assert.match( header, - /<\/h1><p data-report-dates=""[^>]*>2026-10-01 · updated 2026-10-04 · <a href="\/reports\/demo-factcheck\/history\/" data-report-revision="2"[^>]*>revision 2<\/a><\/p><p data-report-feeds=""[^>]*>[^]*?Subscribe:[^]*?<\/p><div id="source-s0" data-subject-source="s0"/, + /<\/h1><p data-report-dates=""[^>]*>2026-10-01 · updated 2026-10-04 · <a href="\/pages\/demo-factcheck\/history\/" data-report-revision="2"[^>]*>revision 2<\/a><\/p><p data-report-feeds=""[^>]*>[^]*?Subscribe:[^]*?<\/p><div id="source-s0" data-subject-source="s0"/, ); // the view switch (release 22): right after the header, sticky under the // site's header (so it is in reach wherever the article is scrolled); @@ -140,15 +141,15 @@ test("the report page: header, tally, sections and claims, inline cites, referen assert.match(html, /<h3[^>]*><a href="#claim-2"[^>]*>He went back to the bridge every year.<\/a>/); assert.match(html, /<article id="claim-1"/); // the source sentence's still, under the claim - assert.match(html, /data-source-sentence="a01"[^]*?<img src="\/reports\/demo-factcheck\/stills\/a01.png"/); + assert.match(html, /data-source-sentence="a01"[^]*?<img src="\/pages\/demo-factcheck\/stills\/a01.png"/); // inline citations carry their report numbers and jump to the reference list assert.match(html, /data-inline-cite="c01"[^]*?href="#c-c01" data-cite-number="1"/); assert.match(html, /data-inline-cite="w01"[^]*?data-cite-number="4"/); // every numbered citation has its reference entry, in number order const refs = [...html.matchAll(/<li id="c-([^"]+)" value="(\d+)"/g)].map((m) => `${m[2]}:${m[1]}`); assert.deepEqual(refs, ["1:c01", "2:au1", "3:a01", "4:w01", "5:a02", "6:p01"]); - assert.match(html, /href="\/reports\/demo-factcheck\/citations.json" download=""/); - assert.match(html, /href="\/reports\/demo-factcheck\/citations.csv" download=""/); + assert.match(html, /href="\/pages\/demo-factcheck\/citations.json" download=""/); + assert.match(html, /href="\/pages\/demo-factcheck\/citations.csv" download=""/); const meta = await reportPage.generateMetadata({ params }); assert.equal(meta.title, "Demo Checks: Checking an example article"); // a claim's flag: a pill on its card; an unflagged claim carries none @@ -244,16 +245,16 @@ test("the fixture's own timeline: newest first, its feeds on the site's URL", () assert.deepEqual(view.entries?.map((e) => e.id), ["update-mail", "update-opening"]); assert.equal(view.updated, "2026-10-04"); assert.deepEqual(view.feeds, { - rss: `${fixture.FIXTURE_SITE_URL}/reports/demo-factcheck/feed.xml`, - json: `${fixture.FIXTURE_SITE_URL}/reports/demo-factcheck/feed.json`, + rss: `${fixture.FIXTURE_SITE_URL}/pages/demo-factcheck/feed.xml`, + json: `${fixture.FIXTURE_SITE_URL}/pages/demo-factcheck/feed.json`, }); }); test("a report's timeline: after In brief, before the claims, newest first, dated, each its anchor; Subscribe and the alternates with feeds", async () => { const view = fixture.buildFixtureReportView(); const feeds = { - rss: "https://reports.example.org/reports/demo-factcheck/feed.xml", - json: "https://reports.example.org/reports/demo-factcheck/feed.json", + rss: "https://reports.example.org/pages/demo-factcheck/feed.xml", + json: "https://reports.example.org/pages/demo-factcheck/feed.json", }; const entries = [ { id: "update-2", date: "2026-10-06T09:30:00Z", title: "A second update", body: "More [on stream](cite:c01)." }, @@ -272,8 +273,8 @@ test("a report's timeline: after In brief, before the claims, newest first, date assert.match(html, /updated <time dateTime="2026-10-06">2026-10-06<\/time>/); // The header: Subscribe, to both feeds. const header = html.slice(at("<header"), at("</header>")); - assert.match(header, /data-report-feeds=""[^]*?Subscribe:[^]*?<a href="https:\/\/reports\.example\.org\/reports\/demo-factcheck\/feed\.xml" type="application\/rss\+xml" data-feed="rss"/); - assert.match(header, /<a href="https:\/\/reports\.example\.org\/reports\/demo-factcheck\/feed\.json" type="application\/feed\+json" data-feed="json"/); + assert.match(header, /data-report-feeds=""[^]*?Subscribe:[^]*?<a href="https:\/\/reports\.example\.org\/pages\/demo-factcheck\/feed\.xml" type="application\/rss\+xml" data-feed="rss"/); + assert.match(header, /<a href="https:\/\/reports\.example\.org\/pages\/demo-factcheck\/feed\.json" type="application\/feed\+json" data-feed="json"/); const { reportMetadata } = await import("./reports"); assert.deepEqual(reportMetadata({ ...view, entries, feeds }).alternates, { types: { @@ -292,18 +293,18 @@ test("a video moment: the clip, quote, verification, cue lines, original link, c const html = render( await momentPage.default({ params: Promise.resolve({ moment: ["demo-channel", "abc123", "3126.00-3151.00"] }) }), ); - assert.match(html, /<video data-evidence-clip=""[^>]*poster="\/reports\/demo-factcheck\/stills\/poster.png"[^>]*src="\/media\/clips\/demo-channel\/abc123\/3126.00-3151.00.mp4"/); + assert.match(html, /<video data-evidence-clip=""[^>]*poster="\/pages\/demo-factcheck\/stills\/poster.png"[^>]*src="\/media\/clips\/demo-channel\/abc123\/3126.00-3151.00.mp4"/); assert.ok(html.includes("52:01–52:36"), "the padded clip's own span is stated"); assert.ok(html.includes("The bridge opened in the spring of twenty nineteen, I was there for it.")); assert.match(html, /data-quote-score="97"/); assert.equal([...html.matchAll(/data-in-span=""/g)].length, 2); assert.match(html, /href="https:\/\/media.example.org\/demo-channel\/abc123\?t=3126"[^>]*>Original at 52:06/); assert.match(html, /data-cited-in=""/); - assert.match(html, /href="\/reports\/demo-factcheck\/"[^>]*>Demo Checks: Checking an example article/); - assert.match(html, /href="\/reports\/demo-factcheck\/#claim-1"/); + assert.match(html, /href="\/pages\/demo-factcheck\/"[^>]*>Demo Checks: Checking an example article/); + assert.match(html, /href="\/pages\/demo-factcheck\/#claim-1"/); assert.ok(html.includes("— “He opened it himself”"), "a cited-in entry names the claim by its title"); assert.match(html, /<span>Summary<\/span>/, "a summary citation is named as the summary"); - assert.match(html, /href="\/reports\/demo-factcheck\/#claim-5"/); + assert.match(html, /href="\/pages\/demo-factcheck\/#claim-5"/); }); test("an audio moment plays audio; a post moment shows its shot, text and author", async () => { @@ -321,17 +322,11 @@ test("an audio moment plays audio; a post moment shows its shot, text and author }); test("an unknown moment or report under a listed route renders the empty state, never throws", async () => { - assert.match(render(await reportPage.default({ params: Promise.resolve({ reportId: "nope" }) })), /No reports/); + assert.match(render(await reportPage.default({ params: Promise.resolve({ reportId: "nope" }) })), /No pages/); assert.match(render(await momentPage.default({ params: Promise.resolve({ moment: ["..", "x"] }) })), /No moments/); }); -test("one report: /reports/ is no index, it forwards to the home page (the report)", () => { - const html = render(reportsIndexPage.default()); - assert.match(html, /<meta http-equiv="refresh" content="0; url=\/"/); - assert.doesNotMatch(html, /data-report-index/); -}); - -test("a cited site with one report: its home IS the report, and never counts transcripts", async () => { +test("a search-off site with one page: its home IS the page, and never counts transcripts", async () => { // There is no summaries manifest here: countTranscripts() would throw. const html = render(await home.default()); assert.match(html, /<h1[^>]*><span data-report-series=""[^>]*>Demo Checks<\/span> <span[^>]*>Checking an example article<\/span><\/h1>/); @@ -346,48 +341,46 @@ test("a cited site with one report: its home IS the report, and never counts tra assert.equal(home.generateMetadata().title, "Demo Checks: Checking an example article"); }); -test("a cited site with more than one report: its home is the index, with no heading of its own", async () => { - const file = path.join(publicDir, "reports", "index.json"); +test("a search-off site with more than one page: its home is the first, and the header links each by its title", async () => { + const file = path.join(publicDir, "pages", "index.json"); const original = fs.readFileSync(file, "utf8"); try { const index = JSON.parse(original); - const { series: _series, ...unseried } = index.reports[0]; - index.reports = [unseried, { ...index.reports[0], id: "demo-second", series: "On the Record", title: "A second report", href: "/reports/demo-second/" }]; + index.reports = [index.reports[0], { ...index.reports[0], id: "demo-second", series: "On the Record", title: "A second report", href: "/pages/demo-second/" }]; fs.writeFileSync(file, JSON.stringify(index)); const html = render(await home.default()); - assert.match(html, /data-report-index/); - assert.match(html, /data-report-entry="demo-factcheck"/); - assert.match(html, /data-report-entry="demo-second"/); - assert.doesNotMatch(html, /<h1/, "no heading: the header already names the site"); - assert.deepEqual(home.generateMetadata(), {}, "the index keeps the site's own title"); - // With more than one, /reports/ is the index, tally and all. - const idx = render(reportsIndexPage.default()); - assert.match(idx, /data-report-entry="demo-factcheck"/); - assert.doesNotMatch(idx, /claims ·|data-verdict-tally/, "counts and tally are the report page's"); - assert.doesNotMatch(idx, /http-equiv="refresh"/); - // A series is its own line above the title, in the accent, with no kind eyebrow. - const second = html.slice(html.indexOf('data-report-entry="demo-second"')); - assert.match(second, /<span data-report-series="" class="block font-semibold text-brand">On the Record<\/span> <span class="block font-normal">A second report<\/span>/); - assert.doesNotMatch(second.slice(0, second.indexOf("</li>")), /Fact-check/); - const first = html.slice(html.indexOf('data-report-entry="demo-factcheck"')); - assert.match(first.slice(0, first.indexOf("</li>")), /Fact-check/, "no series: the kind's eyebrow"); + assert.match(html, /<article data-report="demo-factcheck"/); + assert.doesNotMatch(html, /data-report-index/, "no index of pages"); + const reportMeta = await reportPage.generateMetadata({ params: Promise.resolve({ reportId: "demo-factcheck" }) }); + assert.deepEqual(home.generateMetadata(), reportMeta); + assert.deepEqual(reports.pageLinks(), [ + { href: "/pages/demo-factcheck/", label: "Checking an example article" }, + { href: "/pages/demo-second/", label: "A second report" }, + ]); } finally { fs.writeFileSync(file, original); } }); -test("the header nav: Reports when the build has one; a cited site has Reports alone, or nothing with one report", () => { - const full = headerNavLinks({ cited: false, reports: true, duplicates: false, downloads: true }); +test("the header nav: a full site links its pages by title after Ask AI; a search-off site its pages alone, or nothing with one", () => { + const pages = [ + { href: "/pages/one/", label: "Page one" }, + { href: "/pages/two/", label: "Page two" }, + ]; + const full = headerNavLinks({ cited: false, pages, duplicates: false, downloads: true }); assert.deepEqual( full.map((l) => l.label), - ["Search", "Ask AI", "Reports", "Downloads", "Use with AI"], + ["Search", "Ask AI", "Page one", "Page two", "Downloads", "Use with AI"], ); - assert.ok(!headerNavLinks({ cited: false, reports: false, duplicates: false, downloads: false }).some((l) => l.label === "Reports")); - assert.deepEqual(headerNavLinks({ cited: true, reports: true, duplicates: true, downloads: true }), [ - { href: "/reports/", label: "Reports" }, - ]); - // One report is the home page: nowhere else to go. - assert.deepEqual(headerNavLinks({ cited: true, reports: true, duplicates: false, downloads: false, singleReport: true }), []); + assert.equal(full[2].href, "/pages/one/"); + assert.deepEqual( + headerNavLinks({ cited: false, pages: [], duplicates: false, downloads: false }).map((l) => l.label), + ["Search", "Ask AI", "Use with AI"], + ); + assert.deepEqual(headerNavLinks({ cited: true, pages, duplicates: true, downloads: true }), pages); + // One page is the home page: nowhere else to go. + assert.deepEqual(headerNavLinks({ cited: true, pages: pages.slice(0, 1), duplicates: false, downloads: false }), []); + assert.ok(!full.some((l) => l.label === "Reports"), "no Reports index"); }); test.after(() => fs.rmSync(root, { recursive: true, force: true })); diff --git a/export/app/lib/reports.ts b/export/app/lib/reports.ts @@ -2,10 +2,11 @@ import { getPaths } from "yt-dlp-transcript-common/lib/paths"; import { createReportReader, reportMetadata } from "yt-dlp-transcript-common/lib/report/reader-server"; import { SITE_REPORTS_BASE } from "yt-dlp-transcript-common/lib/report/routes"; -// This site's reports and moments, read from its public dir by the shared -// reader (common/lib/report/reader-server.ts) under the site's base. The -// public dir is resolved on every read: getPaths() is cached on first use, and -// a test sets the environment before it is. +// This site's pages (site.json `pages`: its reports, at `/pages/<id>/`) and +// moments, read from its public dir by the shared reader +// (common/lib/report/reader-server.ts) under the site's base. The public dir +// is resolved on every read: getPaths() is cached on first use, and a test +// sets the environment before it is. const reader = createReportReader({ publicDir: () => getPaths().exportPublicDir, base: SITE_REPORTS_BASE }); @@ -13,14 +14,18 @@ const reader = createReportReader({ publicDir: () => getPaths().exportPublicDir, export const REPORTS_BASE = reader.base; export const readReportIndex = () => reader.readReportIndex(); -// Whether this build has a report to link to: drives the header's Reports link. -export const hasReports = () => reader.hasReports(); export const reportIds = () => reader.reportIds(); export const readReportView = (reportId: string) => reader.readReportView(reportId); export const readReportHistory = (reportId: string) => reader.readReportHistory(reportId); -// The build's one report, when it publishes exactly one: a cited site's home -// page IS that report. -export const onlyReportView = () => reader.onlyReportView(); +// The site's first page: a search-off site's home page IS that page. +export const firstReportView = () => reader.firstReportView(); + +// The header's links to the site's pages, in order: each by its title. +export function pageLinks(): { href: string; label: string }[] { + return (reader.readReportIndex()?.reports ?? []).flatMap((r) => + reportIds().includes(r.id) ? [{ href: r.href, label: r.title }] : [], + ); +} export const momentKeys = () => reader.momentKeys(); export const readMomentView = (key: string) => reader.readMomentView(key); diff --git a/export/app/pages/[reportId]/history/page.tsx b/export/app/pages/[reportId]/history/page.tsx @@ -0,0 +1,32 @@ +import type { Metadata } from "next"; +import { REPORT_PLACEHOLDER_ID, reportFullTitle } from "yt-dlp-transcript-common/lib/report/views"; +import ReportHistory from "yt-dlp-transcript-common/components/report/ReportHistory"; +import { EmptyState } from "yt-dlp-transcript-common/components/report/parts"; +import { REPORTS_BASE, readReportHistory, reportIds } from "../../../lib/reports"; + +// /pages/<reportId>/history/: a page's revisions, from +// /pages/<reportId>/history/history.json. Static: built for every page (and, +// with none, the placeholder, as /pages/<reportId>/ is); a page with no +// published history says so. +export const dynamicParams = false; + +export function generateStaticParams(): { reportId: string }[] { + const ids = reportIds(); + return (ids.length > 0 ? ids : [REPORT_PLACEHOLDER_ID]).map((reportId) => ({ reportId })); +} + +type Params = { params: Promise<{ reportId: string }> }; + +export async function generateMetadata({ params }: Params): Promise<Metadata> { + const view = readReportHistory((await params).reportId); + if (!view) return { title: "No history" }; + return { title: `Revision history — ${reportFullTitle(view)}` }; +} + +export default async function ReportHistoryPage({ params }: Params) { + const view = readReportHistory((await params).reportId); + if (!view) { + return <EmptyState title="No history">This page has no published revision history.</EmptyState>; + } + return <ReportHistory view={view} base={REPORTS_BASE} />; +} diff --git a/export/app/pages/[reportId]/page.tsx b/export/app/pages/[reportId]/page.tsx @@ -0,0 +1,36 @@ +import type { Metadata } from "next"; +import { REPORT_PLACEHOLDER_ID } from "yt-dlp-transcript-common/lib/report/views"; +import ReportArticle from "yt-dlp-transcript-common/components/report/ReportArticle"; +import { EmptyState } from "yt-dlp-transcript-common/components/report/parts"; +import { REPORTS_BASE, readReportView, reportIds, reportMetadata } from "../../lib/reports"; + +// /pages/<reportId>/: one of the site's pages (site.json `pages`), a report +// rendered from /pages/<reportId>/page.json. Static: every page is listed, +// nothing else resolves. A site with none builds the one placeholder page (a +// static export refuses an empty generateStaticParams), which says so. +export const dynamicParams = false; + +export function generateStaticParams(): { reportId: string }[] { + const ids = reportIds(); + return (ids.length > 0 ? ids : [REPORT_PLACEHOLDER_ID]).map((reportId) => ({ reportId })); +} + +type Params = { params: Promise<{ reportId: string }> }; + +export async function generateMetadata({ params }: Params): Promise<Metadata> { + const view = readReportView((await params).reportId); + if (!view) return { title: "No pages" }; + return reportMetadata(view); +} + +export default async function ReportPage({ params }: Params) { + const view = readReportView((await params).reportId); + if (!view) { + return ( + <EmptyState title="No pages"> + This site has not published a page yet. + </EmptyState> + ); + } + return <ReportArticle view={view} base={REPORTS_BASE} />; +} diff --git a/export/app/reports/[reportId]/history/page.tsx b/export/app/reports/[reportId]/history/page.tsx @@ -1,32 +0,0 @@ -import type { Metadata } from "next"; -import { REPORT_PLACEHOLDER_ID, reportFullTitle } from "yt-dlp-transcript-common/lib/report/views"; -import ReportHistory from "yt-dlp-transcript-common/components/report/ReportHistory"; -import { EmptyState } from "yt-dlp-transcript-common/components/report/parts"; -import { REPORTS_BASE, readReportHistory, reportIds } from "../../../lib/reports"; - -// /reports/<reportId>/history/: the report's revisions, from -// /reports/<reportId>/history/history.json. Static: built for every published -// report (and, with none, the placeholder, as /reports/<reportId>/ is); a -// report with no published history says so. -export const dynamicParams = false; - -export function generateStaticParams(): { reportId: string }[] { - const ids = reportIds(); - return (ids.length > 0 ? ids : [REPORT_PLACEHOLDER_ID]).map((reportId) => ({ reportId })); -} - -type Params = { params: Promise<{ reportId: string }> }; - -export async function generateMetadata({ params }: Params): Promise<Metadata> { - const view = readReportHistory((await params).reportId); - if (!view) return { title: "No history" }; - return { title: `Revision history — ${reportFullTitle(view)}` }; -} - -export default async function ReportHistoryPage({ params }: Params) { - const view = readReportHistory((await params).reportId); - if (!view) { - return <EmptyState title="No history">This report has no published revision history.</EmptyState>; - } - return <ReportHistory view={view} base={REPORTS_BASE} />; -} diff --git a/export/app/reports/[reportId]/page.tsx b/export/app/reports/[reportId]/page.tsx @@ -1,36 +0,0 @@ -import type { Metadata } from "next"; -import { REPORT_PLACEHOLDER_ID } from "yt-dlp-transcript-common/lib/report/views"; -import ReportArticle from "yt-dlp-transcript-common/components/report/ReportArticle"; -import { EmptyState } from "yt-dlp-transcript-common/components/report/parts"; -import { REPORTS_BASE, readReportView, reportIds, reportMetadata } from "../../lib/reports"; - -// /reports/<reportId>/: one report, from /reports/<reportId>/page.json. -// Static: every published report is listed, nothing else resolves. A site with -// none builds the one placeholder page (a static export refuses an empty -// generateStaticParams), which says so. -export const dynamicParams = false; - -export function generateStaticParams(): { reportId: string }[] { - const ids = reportIds(); - return (ids.length > 0 ? ids : [REPORT_PLACEHOLDER_ID]).map((reportId) => ({ reportId })); -} - -type Params = { params: Promise<{ reportId: string }> }; - -export async function generateMetadata({ params }: Params): Promise<Metadata> { - const view = readReportView((await params).reportId); - if (!view) return { title: "No reports" }; - return reportMetadata(view); -} - -export default async function ReportPage({ params }: Params) { - const view = readReportView((await params).reportId); - if (!view) { - return ( - <EmptyState title="No reports"> - This site has not published a report yet. - </EmptyState> - ); - } - return <ReportArticle view={view} base={REPORTS_BASE} />; -} diff --git a/export/app/reports/page.tsx b/export/app/reports/page.tsx @@ -1,32 +0,0 @@ -import type { Metadata } from "next"; -import ReportIndex from "yt-dlp-transcript-common/components/report/ReportIndex"; -import Link from "next/link"; -import { isCitedSite } from "yt-dlp-transcript-common/lib/siteSchema"; -import { textLink } from "yt-dlp-transcript-common/components/report/parts"; -import { readReportIndex, reportIds } from "../lib/reports"; -import { currentSite } from "../lib/site"; -import { instanceMode } from "../lib/mode"; - -export const metadata: Metadata = { title: "Reports" }; - -// The report index, from /reports/index.json (common/lib/report/views.ts). A -// cited site with more than one report renders the same index as its home -// page. A cited site with ONE report has no index: its home page is the -// report, so this route only forwards there (a static export has no server -// redirect; React hoists the refresh into the head). -export default function ReportsPage() { - const site = currentSite(); - if (instanceMode() === "site" && isCitedSite(site) && reportIds().length === 1) { - return ( - <> - <meta httpEquiv="refresh" content="0; url=/" /> - <p data-reports-forward="" className="mx-auto max-w-2xl text-sm text-muted-foreground"> - <Link href="/" className={textLink}> - {site.siteTitle} - </Link> - </p> - </> - ); - } - return <ReportIndex index={readReportIndex()} />; -} diff --git a/export/e2e-report/audit.spec.ts b/export/e2e-report/audit.spec.ts @@ -19,28 +19,27 @@ test("the built cited site passes the audit every deploy path asks", () => { expect(reportSiteAuditProblem()).toBeNull(); }); -test("it holds the reports, the moments, the cited media and the contract", () => { +test("it holds the pages, the moments, the cited media and the contract", () => { for (const rel of [ "index.html", - "reports/index.html", - "reports/index.json", - "reports/demo-factcheck/index.html", - "reports/demo-factcheck/page.json", - "reports/demo-factcheck/citations.json", - "reports/demo-factcheck/citations.csv", - "reports/demo-factcheck/report.html", - "reports/demo-factcheck/report.pdf", - "reports/demo-factcheck/report.md", - "reports/demo-factcheck/slides.html", - "reports/demo-factcheck/slides.pdf", - "reports/demo-factcheck/evidence-pack.zip", - "reports/demo-factcheck/stills/a01.png", - "reports/demo-factcheck/history/index.html", - "reports/demo-factcheck/history/history.json", - "reports/demo-factcheck/history/repo/HEAD", - "reports/demo-factcheck/history/repo/info/refs", - "reports/demo-factcheck/history/repo/objects/info/packs", - "reports/demo-factcheck/history/repo/refs/heads/main", + "pages/index.json", + "pages/demo-factcheck/index.html", + "pages/demo-factcheck/page.json", + "pages/demo-factcheck/citations.json", + "pages/demo-factcheck/citations.csv", + "pages/demo-factcheck/report.html", + "pages/demo-factcheck/report.pdf", + "pages/demo-factcheck/report.md", + "pages/demo-factcheck/slides.html", + "pages/demo-factcheck/slides.pdf", + "pages/demo-factcheck/evidence-pack.zip", + "pages/demo-factcheck/stills/a01.png", + "pages/demo-factcheck/history/index.html", + "pages/demo-factcheck/history/history.json", + "pages/demo-factcheck/history/repo/HEAD", + "pages/demo-factcheck/history/repo/info/refs", + "pages/demo-factcheck/history/repo/objects/info/packs", + "pages/demo-factcheck/history/repo/refs/heads/main", "m/index.json", "m/demo-channel/abc123/3126.00-3151.00/index.html", "m/demo-channel/abc123/3126.00-3151.00/moment.json", @@ -56,7 +55,10 @@ test("it holds the reports, the moments, the cited media and the contract", () = ]) { expect(has(rel), rel).toBe(true); } + // No index of the pages, and nothing where reports were before release 26. + for (const rel of ["pages/index.html", "reports"]) expect(has(rel), rel).toBe(false); const corpus = JSON.parse(fs.readFileSync(path.join(out, "corpus.json"), "utf8")); + expect(corpus.reports.index).toBe("https://reports.example.org/pages/index.json"); expect(corpus.site).toMatchObject({ id: "reportsite", scope: "cited" }); expect(corpus.reports.count).toBe(1); const site = JSON.parse(fs.readFileSync(path.join(out, "site.json"), "utf8")); diff --git a/export/e2e-report/fixtures/sites/reportsite/site.json b/export/e2e-report/fixtures/sites/reportsite/site.json @@ -5,5 +5,5 @@ "headerTitle": "Demo Reports", "siteUrl": "https://reports.example.org", "search": false, - "reports": ["demo-factcheck"] + "pages": ["demo-factcheck"] } diff --git a/export/e2e-report/overview.spec.ts b/export/e2e-report/overview.spec.ts @@ -6,7 +6,7 @@ import type { Page } from "@playwright/test"; // motion, a narrow screen, a keyboard arrival or the reader's choice — over // the cited fixture site (stage.ts; its deck is listed in slides.spec.ts). -const REPORT = "/reports/demo-factcheck/"; +const REPORT = "/pages/demo-factcheck/"; const switchIn = (page: Page) => page.locator("[data-report-views] [data-view-switch]"); const stage = (page: Page) => page.locator("[data-report-slides]"); diff --git a/export/e2e-report/report-site.spec.ts b/export/e2e-report/report-site.spec.ts @@ -9,10 +9,11 @@ import { reportChangeSummary, type ReportHistoryView } from "yt-dlp-transcript-c import { historyGitEnv } from "yt-dlp-transcript-common/publish/reportHistory"; import { readFixtureReport } from "../fixtures/report-site/fixture"; -// A cited site, as a reader meets it: its one report as the home page, the -// report (verdicts, tally, the source's sentence, numbered inline citations -// with previews, the reference list), the moment pages each citation opens, -// and the shell's pages that say this site publishes its reports only. Every +// A search-off ("cited") site, as a reader meets it: its one page (a report) +// as the home page, the page at /pages/<id>/ (verdicts, tally, the source's +// sentence, numbered inline citations with previews, the reference list), the +// moment pages each citation opens, and the shell's pages that say this site +// publishes its pages only. Every // test also holds the page's own requests to the cited promise (helpers.ts). // // The site is export/fixtures/report-site, staged and built by @@ -21,11 +22,11 @@ import { readFixtureReport } from "../fixtures/report-site/fixture"; // page (w01). It has two revisions (report.v1.json, then report.json), and // publishes their history. -const REPORT = "/reports/demo-factcheck/"; +const REPORT = "/pages/demo-factcheck/"; const VIDEO_MOMENT = "/m/demo-channel/abc123/3126.00-3151.00/"; const AUDIO_MOMENT = "/m/demo-podcast/ep-042/610.50-628.00/"; const POST_MOMENT = "/m/demo-social/1234567890/"; -const HISTORY = "/reports/demo-factcheck/history/"; +const HISTORY = "/pages/demo-factcheck/history/"; const inlineCite = (page: Page, id: string): Locator => page.locator(`[data-inline-cite="${id}"]`).first(); const preview = (page: Page, id: string): Locator => page.locator(`[data-cite-preview="${id}"]`); @@ -35,7 +36,7 @@ async function expectImageLoaded(img: Locator): Promise<void> { await expect.poll(() => img.evaluate((el) => (el as HTMLImageElement).naturalWidth)).toBeGreaterThan(0); } -test("one report: the home page IS the report, and the header links nothing", async ({ page }) => { +test("one page: the home page IS the page, and the header links nothing", async ({ page }) => { await page.goto("/"); // The series on one line, the title on the next, both in the heading. await expect(page.locator("h1")).toHaveText("Demo Checks Checking an example article"); @@ -69,10 +70,10 @@ test("the header at 375 px: the title and the card wrap, nothing scrolls sideway expect(await page.evaluate(() => document.documentElement.scrollWidth)).toBeLessThanOrEqual(375); }); -test("one report: /reports/ is no index, it forwards to the home page", async ({ page }) => { - await page.goto("/reports/"); - await expect(page).toHaveURL("/"); - await expect(page.locator("h1")).toContainText("Checking an example article"); +test("a site has no index of its pages: /pages/ and the old /reports/ are not found", async ({ request }) => { + for (const route of ["/pages/", "/reports/", "/reports/demo-factcheck/"]) { + expect((await request.get(route)).status(), route).toBe(404); + } }); test("the report: verdict chips, the tally, the source's sentence as a still, numbered inline citations", async ({ page }) => { @@ -347,7 +348,7 @@ test("the history lists both revisions, newest first: hashes, the change summary await expect(r2.locator('[data-claim-change="claim-5"]')).toHaveAttribute("data-status", "added"); await expect(page.locator('li[data-revision="1"] [data-claim-change]')).toHaveCount(0); await expect(page.locator("[data-history-clone]")).toHaveText( - "git clone https://reports.example.org/reports/demo-factcheck/history/repo", + "git clone https://reports.example.org/pages/demo-factcheck/history/repo", ); // The footer of every export names the revision and its report sha256. const md = await (await request.get(`${REPORT}report.md`)).text(); @@ -444,10 +445,10 @@ test("a post moment shows the captured shot and the post", async ({ page }) => { }); for (const route of ["/ask/", "/downloads/", "/duplicates/"]) { - test(`${route} says this site publishes its reports only`, async ({ page }) => { + test(`${route} says this site publishes its pages only`, async ({ page }) => { await page.goto(route); - await expect(page.getByText("This site publishes its reports only.")).toBeVisible(); - await expect(page.getByRole("link", { name: "Read the report" })).toHaveAttribute("href", "/"); + await expect(page.getByText("This site publishes its pages only.")).toBeVisible(); + await expect(page.getByRole("link", { name: "Go to the home page" })).toHaveAttribute("href", "/"); await expect(page.locator("header nav a")).toHaveCount(0); }); } diff --git a/export/e2e-report/slides.spec.ts b/export/e2e-report/slides.spec.ts @@ -18,7 +18,7 @@ import type { Page } from "@playwright/test"; // Every test also holds the page's requests to the cited promise (helpers.ts): // the slides are built from the report's own page.json, nothing else. -const REPORT = "/reports/demo-factcheck/"; +const REPORT = "/pages/demo-factcheck/"; // The article's switch (sticky under the site's header) or the overlay's. const switchIn = (page: Page, where: "article" | "overlay") => @@ -133,7 +133,7 @@ test("slides: a citation's number opens its card; the evidence shows the clip's const slide = stage(page).locator('[data-slide="claim:claim-1"]'); await expect(slide.locator('[data-verdict="CONTRADICTED"]')).toBeVisible(); const pic = slide.locator('[data-slide-evidence="c01"] img'); - await expect(pic).toHaveAttribute("src", "/reports/demo-factcheck/stills/poster.png"); + await expect(pic).toHaveAttribute("src", "/pages/demo-factcheck/stills/poster.png"); await expect.poll(() => pic.evaluate((el) => (el as HTMLImageElement).naturalWidth)).toBeGreaterThan(0); const number = slide.locator('[data-inline-cite="c01"] [data-cite-number]'); await number.click(); diff --git a/export/e2e-report/timeline.spec.ts b/export/e2e-report/timeline.spec.ts @@ -11,7 +11,7 @@ import { expect, test } from "./helpers"; // update-opening 2026-10-02 "The opening date, said on air" (updated 2026-10-04) // Both cite only c01, the summary's first citation, so no number moves. -const REPORT = "/reports/demo-factcheck/"; +const REPORT = "/pages/demo-factcheck/"; const SITE = "https://reports.example.org"; const RSS = `${SITE}${REPORT}feed.xml`; const JSON_FEED = `${SITE}${REPORT}feed.json`; diff --git a/export/fixtures/report-site/fixture.ts b/export/fixtures/report-site/fixture.ts @@ -85,7 +85,7 @@ const RECORDS: Record<string, RecordView> = { }, }; -const POSTER = "/reports/demo-factcheck/stills/poster.png"; +const POSTER = "/pages/demo-factcheck/stills/poster.png"; // A post's captured screenshot, where compose copies a cited capture // (publish/citedPostCaptures.ts): committed under public/media/posts/. diff --git a/export/fixtures/report-site/public/m/demo-channel/abc123/3126.00-3151.00/moment.json b/export/fixtures/report-site/public/m/demo-channel/abc123/3126.00-3151.00/moment.json @@ -25,7 +25,7 @@ "src": "/media/clips/demo-channel/abc123/3126.00-3151.00.mp4", "start": 3121, "end": 3156, - "poster": "/reports/demo-factcheck/stills/poster.png" + "poster": "/pages/demo-factcheck/stills/poster.png" }, "cues": [ { @@ -71,7 +71,7 @@ "sectionId": null, "claimId": null, "citationId": "c01", - "href": "/reports/demo-factcheck/", + "href": "/pages/demo-factcheck/", "reportTitle": "Demo Checks: Checking an example article", "number": 1 }, @@ -81,7 +81,7 @@ "claimId": null, "entryId": "update-mail", "citationId": "c01", - "href": "/reports/demo-factcheck/#update-mail", + "href": "/pages/demo-factcheck/#update-mail", "reportTitle": "Demo Checks: Checking an example article", "entryTitle": "A reader asked about another year", "number": 1 @@ -92,7 +92,7 @@ "claimId": null, "entryId": "update-opening", "citationId": "c01", - "href": "/reports/demo-factcheck/#update-opening", + "href": "/pages/demo-factcheck/#update-opening", "reportTitle": "Demo Checks: Checking an example article", "entryTitle": "The opening date, said on air", "number": 1 @@ -102,7 +102,7 @@ "sectionId": "bridge", "claimId": "claim-1", "citationId": "c01", - "href": "/reports/demo-factcheck/#claim-1", + "href": "/pages/demo-factcheck/#claim-1", "reportTitle": "Demo Checks: Checking an example article", "sectionTitle": "The bridge", "claimTitle": "“He opened it himself”", @@ -119,7 +119,7 @@ "sectionId": "moving", "claimId": "claim-5", "citationId": "c01", - "href": "/reports/demo-factcheck/#claim-5", + "href": "/pages/demo-factcheck/#claim-5", "reportTitle": "Demo Checks: Checking an example article", "sectionTitle": "Moving away", "claimText": "He was at the opening.", diff --git a/export/fixtures/report-site/public/m/demo-podcast/ep-042/610.50-628.00/moment.json b/export/fixtures/report-site/public/m/demo-podcast/ep-042/610.50-628.00/moment.json @@ -50,7 +50,7 @@ "sectionId": null, "claimId": null, "citationId": "au1", - "href": "/reports/demo-factcheck/", + "href": "/pages/demo-factcheck/", "reportTitle": "Demo Checks: Checking an example article", "number": 2 }, @@ -59,7 +59,7 @@ "sectionId": "bridge", "claimId": "claim-1", "citationId": "au1", - "href": "/reports/demo-factcheck/#claim-1", + "href": "/pages/demo-factcheck/#claim-1", "reportTitle": "Demo Checks: Checking an example article", "sectionTitle": "The bridge", "claimTitle": "“He opened it himself”", @@ -76,7 +76,7 @@ "sectionId": "bridge", "claimId": "claim-2", "citationId": "au1", - "href": "/reports/demo-factcheck/#claim-2", + "href": "/pages/demo-factcheck/#claim-2", "reportTitle": "Demo Checks: Checking an example article", "sectionTitle": "The bridge", "claimText": "He went back to the bridge every year.", diff --git a/export/fixtures/report-site/public/m/demo-social/1234567890/moment.json b/export/fixtures/report-site/public/m/demo-social/1234567890/moment.json @@ -24,7 +24,7 @@ "sectionId": "moving", "claimId": "claim-3", "citationId": "p01", - "href": "/reports/demo-factcheck/#claim-3", + "href": "/pages/demo-factcheck/#claim-3", "reportTitle": "Demo Checks: Checking an example article", "sectionTitle": "Moving away", "claimText": "He has said many times that he would move away.", diff --git a/export/fixtures/report-site/public/pages/demo-factcheck/page.json b/export/fixtures/report-site/public/pages/demo-factcheck/page.json @@ -0,0 +1,284 @@ +{ + "format": "archilyzer-report-page", + "version": 1, + "id": "demo-factcheck", + "kind": "factcheck", + "series": "Demo Checks", + "title": "Checking an example article", + "subtitle": "Four claims about a demo channel, tested against what was said on air", + "summary": "The article makes four claims. The recordings support one, partly support another, and contradict a third; the fourth cannot be tested. The host said the opening date out loud [on stream](cite:c01), and later [repeated it](cite:au1).", + "method": "Each claim was searched for in the channel's transcripts and the guest's podcast, and checked against the city's public records.", + "published": "2026-10-01", + "updated": "2026-10-04", + "subject": "s0", + "sources": { + "s0": { + "id": "s0", + "kind": "article", + "title": "An example article about a demo channel", + "url": "https://example.org/articles/demo", + "publisher": "Example Gazette", + "author": "A. Writer", + "date": "2026-09-20", + "note": "Read in the edition published on the day; it has since been revised.", + "accent": "#8a6fb0", + "archives": [ + { + "label": "archive.org", + "url": "https://web.archive.org/web/2026/https://example.org/articles/demo", + "context": "as published on the day" + } + ] + } + }, + "verdicts": { + "CORROBORATED": { + "label": "Corroborated", + "color": "#3fbf7f" + }, + "PARTLY": { + "label": "Partly true", + "color": "#e3b23c" + }, + "CONTRADICTED": { + "label": "Contradicted", + "color": "#e5534b" + }, + "NOT_FOUND": { + "label": "Not found", + "color": "#8b93a7" + }, + "UNTESTABLE": { + "label": "Untestable", + "color": "#7d8fd6" + } + }, + "citations": { + "c01": { + "kind": "video", + "id": "c01", + "number": 1, + "quote": "The bridge opened in the spring of twenty nineteen, I was there for it.", + "verification": { + "quoteScore": 0.97, + "quoteCheckedAt": "2026-10-04T12:00:00Z", + "voiceChecked": true, + "method": "cue-window v1" + }, + "origin": "added", + "moment": "demo-channel/abc123/3126.00-3151.00", + "href": "/m/demo-channel/abc123/3126.00-3151.00/", + "start": 3126, + "end": 3151, + "record": { + "channel": "demo-channel", + "channelTitle": "Demo Channel", + "id": "abc123", + "title": "Demo stream: the bridge, the move, and the mail", + "date": "2026-01-10", + "platform": "youtube", + "originalUrl": "https://media.example.org/demo-channel/abc123?t=3126" + }, + "poster": "/pages/demo-factcheck/stills/poster.png" + }, + "au1": { + "kind": "audio", + "id": "au1", + "number": 2, + "quote": "Like I said before, spring twenty nineteen.", + "speaker": "The guest", + "verification": { + "quoteScore": 0.88, + "quoteCheckedAt": "2026-10-04T12:00:00Z" + }, + "moment": "demo-podcast/ep-042/610.50-628.00", + "href": "/m/demo-podcast/ep-042/610.50-628.00/", + "start": 610.5, + "end": 628, + "record": { + "channel": "demo-podcast", + "channelTitle": "Demo Podcast", + "id": "ep-042", + "title": "Episode 42: a guest looks back", + "date": "2026-02-02", + "originalUrl": "https://media.example.org/demo-podcast/ep-042?t=610" + } + }, + "a01": { + "kind": "source", + "id": "a01", + "number": 3, + "quote": "He opened the bridge himself in 2018.", + "sourceId": "s0", + "sourceTitle": "An example article about a demo channel", + "sourceAccent": "#8a6fb0", + "image": "/pages/demo-factcheck/stills/a01.png", + "href": "https://example.org/articles/demo" + }, + "w01": { + "kind": "page", + "id": "w01", + "number": 4, + "quote": "Opened to traffic: April 2019.", + "note": "The city's own record of the opening.", + "origin": "subject", + "href": "https://example.org/city/bridge-history", + "title": "Bridge history — city records", + "archiveUrl": "https://web.archive.org/web/2026/https://example.org/city/bridge-history" + }, + "a02": { + "kind": "source", + "id": "a02", + "number": 5, + "quote": "He has said many times that he would move away.", + "sourceId": "s0", + "sourceTitle": "An example article about a demo channel", + "sourceAccent": "#8a6fb0", + "href": "https://example.org/articles/demo" + }, + "p01": { + "kind": "post", + "id": "p01", + "number": 6, + "quote": "Never said I would move. Not once.", + "date": "2025-03-14", + "moment": "demo-social/1234567890", + "href": "/m/demo-social/1234567890/", + "record": { + "channel": "demo-social", + "channelTitle": "Demo Social", + "id": "1234567890", + "date": "2025-03-14", + "platform": "x", + "originalUrl": "https://media.example.org/demo-social/1234567890" + }, + "author": "@demo_account", + "text": "Never said I would move. Not once.\n\nPosted to settle it.", + "shot": "/media/posts/demo-social/1234567890/shot.png" + } + }, + "entries": [ + { + "id": "update-mail", + "date": "2026-10-04", + "title": "A reader asked about another year", + "body": "No other year turns up: every time he dates the opening it is the year he said [on stream](cite:c01)." + }, + { + "id": "update-opening", + "date": "2026-10-02", + "updated": "2026-10-04", + "title": "The opening date, said on air", + "body": "The host gave the year of the opening [on stream](cite:c01), the year the city's record names." + } + ], + "sections": [ + { + "id": "bridge", + "title": "The bridge", + "body": "The article's first chapter is about the bridge.", + "slide": { + "points": [ + "The article dates the opening to 2018", + "He says 2019 on stream, and [the city's record](cite:w01) agrees" + ], + "cite": "w01" + }, + "claims": [ + { + "id": "claim-1", + "title": "“He opened it himself”", + "text": "He opened the bridge himself in 2018.", + "verdict": "CONTRADICTED", + "gist": "It opened in 2019, as he says on stream and the city's record shows.", + "sourceQuote": "a01", + "findings": "He was there, but the bridge opened in 2019: he says so [on stream](cite:c01), and the [city's record](cite:w01) agrees.", + "citations": [ + "c01", + "w01", + "au1" + ] + }, + { + "id": "claim-2", + "text": "He went back to the bridge every year.", + "verdict": "PARTLY", + "gist": "Once is on record; every year is not.", + "findings": "He mentions going back [once](cite:au1); nothing in the recordings says every year.", + "citations": [ + "au1" + ], + "slide": { + "title": "Every year?", + "points": [ + "He mentions going back [once](cite:au1)", + "Nothing in the recordings says every year" + ] + } + } + ] + }, + { + "id": "moving", + "title": "Moving away", + "claims": [ + { + "id": "claim-3", + "text": "He has said many times that he would move away.", + "verdict": "CONTRADICTED", + "gist": "He denies ever saying it.", + "sourceQuote": "a02", + "findings": "The article [puts it as a habit](cite:a02); he [denies it outright](cite:p01).", + "citations": [ + "p01" + ], + "slide": { + "cite": "p01", + "layout": "quote" + } + }, + { + "id": "claim-4", + "text": "He privately regrets it.", + "verdict": "UNTESTABLE", + "flag": "No source given", + "findings": "Nothing public speaks to a private feeling.", + "citations": [] + }, + { + "id": "claim-5", + "text": "He was at the opening.", + "verdict": "CORROBORATED", + "findings": "He says [he was there](cite:c01).", + "citations": [ + "c01" + ] + } + ] + } + ], + "downloads": { + "html": "/pages/demo-factcheck/report.html", + "pdf": "/pages/demo-factcheck/report.pdf", + "md": "/pages/demo-factcheck/report.md", + "slides": "/pages/demo-factcheck/slides.html", + "slides-pdf": "/pages/demo-factcheck/slides.pdf", + "zip": "/pages/demo-factcheck/evidence-pack.zip", + "json": "/pages/demo-factcheck/citations.json", + "csv": "/pages/demo-factcheck/citations.csv" + }, + "feeds": { + "rss": "https://reports.example.org/pages/demo-factcheck/feed.xml", + "json": "https://reports.example.org/pages/demo-factcheck/feed.json" + }, + "history": { + "revision": 2, + "date": "2026-10-04T12:00:00Z", + "href": "/pages/demo-factcheck/history/", + "current": true + }, + "slides": { + "title": "Five claims, checked against what was said on air", + "closing": "Every citation opens the moment it quotes." + } +} diff --git a/export/fixtures/report-site/public/reports/demo-factcheck/stills/a01.png b/export/fixtures/report-site/public/pages/demo-factcheck/stills/a01.png Binary files differ. diff --git a/export/fixtures/report-site/public/reports/demo-factcheck/stills/poster.png b/export/fixtures/report-site/public/pages/demo-factcheck/stills/poster.png Binary files differ. diff --git a/export/fixtures/report-site/public/pages/index.json b/export/fixtures/report-site/public/pages/index.json @@ -0,0 +1,58 @@ +{ + "format": "archilyzer-report-index", + "version": 1, + "reports": [ + { + "id": "demo-factcheck", + "kind": "factcheck", + "series": "Demo Checks", + "title": "Checking an example article", + "subtitle": "Four claims about a demo channel, tested against what was said on air", + "published": "2026-10-01", + "updated": "2026-10-04", + "href": "/pages/demo-factcheck/", + "citationCount": 6, + "claimCount": 5, + "tally": [ + { + "verdict": "CORROBORATED", + "count": 1 + }, + { + "verdict": "PARTLY", + "count": 1 + }, + { + "verdict": "CONTRADICTED", + "count": 2 + }, + { + "verdict": "UNTESTABLE", + "count": 1 + } + ], + "verdicts": { + "CORROBORATED": { + "label": "Corroborated", + "color": "#3fbf7f" + }, + "PARTLY": { + "label": "Partly true", + "color": "#e3b23c" + }, + "CONTRADICTED": { + "label": "Contradicted", + "color": "#e5534b" + }, + "NOT_FOUND": { + "label": "Not found", + "color": "#8b93a7" + }, + "UNTESTABLE": { + "label": "Untestable", + "color": "#7d8fd6" + } + } + } + ] +} diff --git a/export/fixtures/report-site/public/reports/demo-factcheck/page.json b/export/fixtures/report-site/public/reports/demo-factcheck/page.json @@ -1,284 +0,0 @@ -{ - "format": "archilyzer-report-page", - "version": 1, - "id": "demo-factcheck", - "kind": "factcheck", - "series": "Demo Checks", - "title": "Checking an example article", - "subtitle": "Four claims about a demo channel, tested against what was said on air", - "summary": "The article makes four claims. The recordings support one, partly support another, and contradict a third; the fourth cannot be tested. The host said the opening date out loud [on stream](cite:c01), and later [repeated it](cite:au1).", - "method": "Each claim was searched for in the channel's transcripts and the guest's podcast, and checked against the city's public records.", - "published": "2026-10-01", - "updated": "2026-10-04", - "subject": "s0", - "sources": { - "s0": { - "id": "s0", - "kind": "article", - "title": "An example article about a demo channel", - "url": "https://example.org/articles/demo", - "publisher": "Example Gazette", - "author": "A. Writer", - "date": "2026-09-20", - "note": "Read in the edition published on the day; it has since been revised.", - "accent": "#8a6fb0", - "archives": [ - { - "label": "archive.org", - "url": "https://web.archive.org/web/2026/https://example.org/articles/demo", - "context": "as published on the day" - } - ] - } - }, - "verdicts": { - "CORROBORATED": { - "label": "Corroborated", - "color": "#3fbf7f" - }, - "PARTLY": { - "label": "Partly true", - "color": "#e3b23c" - }, - "CONTRADICTED": { - "label": "Contradicted", - "color": "#e5534b" - }, - "NOT_FOUND": { - "label": "Not found", - "color": "#8b93a7" - }, - "UNTESTABLE": { - "label": "Untestable", - "color": "#7d8fd6" - } - }, - "citations": { - "c01": { - "kind": "video", - "id": "c01", - "number": 1, - "quote": "The bridge opened in the spring of twenty nineteen, I was there for it.", - "verification": { - "quoteScore": 0.97, - "quoteCheckedAt": "2026-10-04T12:00:00Z", - "voiceChecked": true, - "method": "cue-window v1" - }, - "origin": "added", - "moment": "demo-channel/abc123/3126.00-3151.00", - "href": "/m/demo-channel/abc123/3126.00-3151.00/", - "start": 3126, - "end": 3151, - "record": { - "channel": "demo-channel", - "channelTitle": "Demo Channel", - "id": "abc123", - "title": "Demo stream: the bridge, the move, and the mail", - "date": "2026-01-10", - "platform": "youtube", - "originalUrl": "https://media.example.org/demo-channel/abc123?t=3126" - }, - "poster": "/reports/demo-factcheck/stills/poster.png" - }, - "au1": { - "kind": "audio", - "id": "au1", - "number": 2, - "quote": "Like I said before, spring twenty nineteen.", - "speaker": "The guest", - "verification": { - "quoteScore": 0.88, - "quoteCheckedAt": "2026-10-04T12:00:00Z" - }, - "moment": "demo-podcast/ep-042/610.50-628.00", - "href": "/m/demo-podcast/ep-042/610.50-628.00/", - "start": 610.5, - "end": 628, - "record": { - "channel": "demo-podcast", - "channelTitle": "Demo Podcast", - "id": "ep-042", - "title": "Episode 42: a guest looks back", - "date": "2026-02-02", - "originalUrl": "https://media.example.org/demo-podcast/ep-042?t=610" - } - }, - "a01": { - "kind": "source", - "id": "a01", - "number": 3, - "quote": "He opened the bridge himself in 2018.", - "sourceId": "s0", - "sourceTitle": "An example article about a demo channel", - "sourceAccent": "#8a6fb0", - "image": "/reports/demo-factcheck/stills/a01.png", - "href": "https://example.org/articles/demo" - }, - "w01": { - "kind": "page", - "id": "w01", - "number": 4, - "quote": "Opened to traffic: April 2019.", - "note": "The city's own record of the opening.", - "origin": "subject", - "href": "https://example.org/city/bridge-history", - "title": "Bridge history — city records", - "archiveUrl": "https://web.archive.org/web/2026/https://example.org/city/bridge-history" - }, - "a02": { - "kind": "source", - "id": "a02", - "number": 5, - "quote": "He has said many times that he would move away.", - "sourceId": "s0", - "sourceTitle": "An example article about a demo channel", - "sourceAccent": "#8a6fb0", - "href": "https://example.org/articles/demo" - }, - "p01": { - "kind": "post", - "id": "p01", - "number": 6, - "quote": "Never said I would move. Not once.", - "date": "2025-03-14", - "moment": "demo-social/1234567890", - "href": "/m/demo-social/1234567890/", - "record": { - "channel": "demo-social", - "channelTitle": "Demo Social", - "id": "1234567890", - "date": "2025-03-14", - "platform": "x", - "originalUrl": "https://media.example.org/demo-social/1234567890" - }, - "author": "@demo_account", - "text": "Never said I would move. Not once.\n\nPosted to settle it.", - "shot": "/media/posts/demo-social/1234567890/shot.png" - } - }, - "entries": [ - { - "id": "update-mail", - "date": "2026-10-04", - "title": "A reader asked about another year", - "body": "No other year turns up: every time he dates the opening it is the year he said [on stream](cite:c01)." - }, - { - "id": "update-opening", - "date": "2026-10-02", - "updated": "2026-10-04", - "title": "The opening date, said on air", - "body": "The host gave the year of the opening [on stream](cite:c01), the year the city's record names." - } - ], - "sections": [ - { - "id": "bridge", - "title": "The bridge", - "body": "The article's first chapter is about the bridge.", - "slide": { - "points": [ - "The article dates the opening to 2018", - "He says 2019 on stream, and [the city's record](cite:w01) agrees" - ], - "cite": "w01" - }, - "claims": [ - { - "id": "claim-1", - "title": "“He opened it himself”", - "text": "He opened the bridge himself in 2018.", - "verdict": "CONTRADICTED", - "gist": "It opened in 2019, as he says on stream and the city's record shows.", - "sourceQuote": "a01", - "findings": "He was there, but the bridge opened in 2019: he says so [on stream](cite:c01), and the [city's record](cite:w01) agrees.", - "citations": [ - "c01", - "w01", - "au1" - ] - }, - { - "id": "claim-2", - "text": "He went back to the bridge every year.", - "verdict": "PARTLY", - "gist": "Once is on record; every year is not.", - "findings": "He mentions going back [once](cite:au1); nothing in the recordings says every year.", - "citations": [ - "au1" - ], - "slide": { - "title": "Every year?", - "points": [ - "He mentions going back [once](cite:au1)", - "Nothing in the recordings says every year" - ] - } - } - ] - }, - { - "id": "moving", - "title": "Moving away", - "claims": [ - { - "id": "claim-3", - "text": "He has said many times that he would move away.", - "verdict": "CONTRADICTED", - "gist": "He denies ever saying it.", - "sourceQuote": "a02", - "findings": "The article [puts it as a habit](cite:a02); he [denies it outright](cite:p01).", - "citations": [ - "p01" - ], - "slide": { - "cite": "p01", - "layout": "quote" - } - }, - { - "id": "claim-4", - "text": "He privately regrets it.", - "verdict": "UNTESTABLE", - "flag": "No source given", - "findings": "Nothing public speaks to a private feeling.", - "citations": [] - }, - { - "id": "claim-5", - "text": "He was at the opening.", - "verdict": "CORROBORATED", - "findings": "He says [he was there](cite:c01).", - "citations": [ - "c01" - ] - } - ] - } - ], - "downloads": { - "html": "/reports/demo-factcheck/report.html", - "pdf": "/reports/demo-factcheck/report.pdf", - "md": "/reports/demo-factcheck/report.md", - "slides": "/reports/demo-factcheck/slides.html", - "slides-pdf": "/reports/demo-factcheck/slides.pdf", - "zip": "/reports/demo-factcheck/evidence-pack.zip", - "json": "/reports/demo-factcheck/citations.json", - "csv": "/reports/demo-factcheck/citations.csv" - }, - "feeds": { - "rss": "https://reports.example.org/reports/demo-factcheck/feed.xml", - "json": "https://reports.example.org/reports/demo-factcheck/feed.json" - }, - "history": { - "revision": 2, - "date": "2026-10-04T12:00:00Z", - "href": "/reports/demo-factcheck/history/", - "current": true - }, - "slides": { - "title": "Five claims, checked against what was said on air", - "closing": "Every citation opens the moment it quotes." - } -} diff --git a/export/fixtures/report-site/public/reports/index.json b/export/fixtures/report-site/public/reports/index.json @@ -1,58 +0,0 @@ -{ - "format": "archilyzer-report-index", - "version": 1, - "reports": [ - { - "id": "demo-factcheck", - "kind": "factcheck", - "series": "Demo Checks", - "title": "Checking an example article", - "subtitle": "Four claims about a demo channel, tested against what was said on air", - "published": "2026-10-01", - "updated": "2026-10-04", - "href": "/reports/demo-factcheck/", - "citationCount": 6, - "claimCount": 5, - "tally": [ - { - "verdict": "CORROBORATED", - "count": 1 - }, - { - "verdict": "PARTLY", - "count": 1 - }, - { - "verdict": "CONTRADICTED", - "count": 2 - }, - { - "verdict": "UNTESTABLE", - "count": 1 - } - ], - "verdicts": { - "CORROBORATED": { - "label": "Corroborated", - "color": "#3fbf7f" - }, - "PARTLY": { - "label": "Partly true", - "color": "#e3b23c" - }, - "CONTRADICTED": { - "label": "Contradicted", - "color": "#e5534b" - }, - "NOT_FOUND": { - "label": "Not found", - "color": "#8b93a7" - }, - "UNTESTABLE": { - "label": "Untestable", - "color": "#7d8fd6" - } - } - } - ] -} diff --git a/export/fixtures/report-site/write.ts b/export/fixtures/report-site/write.ts @@ -3,7 +3,7 @@ // // pnpm --filter export exec tsx fixtures/report-site/write.ts // -// The stills (public/reports/demo-factcheck/stills/*.png), the post's shot and +// The stills (public/pages/demo-factcheck/stills/*.png), the post's shot and // the two evidence clips (public/media/: a few seconds of lavfi test pattern // and tone, H.264/AAC) are committed files, not generated here. diff --git a/mcp/src/reports.test.ts b/mcp/src/reports.test.ts @@ -90,12 +90,12 @@ async function writeSite(opts: { cited: boolean; reports: boolean }): Promise<st ...(opts.cited ? { scope: "cited", audience: "public" } : {}), }, channels: opts.cited ? [] : [{ slug: "demo-channel", name: "Demo Channel", videoCount: 1 }], - ...(opts.reports ? { reports: { index: `${ORIGIN}/reports/index.json`, count: 1 } } : {}), + ...(opts.reports ? { reports: { index: `${ORIGIN}/pages/index.json`, count: 1 } } : {}), }, }; if (opts.reports) { - files["reports/index.json"] = INDEX; - files["reports/demo-report/page.json"] = VIEW; + files["pages/index.json"] = INDEX; + files["pages/demo-report/page.json"] = VIEW; } for (const [rel, body] of Object.entries(files)) { const file = path.join(dir, rel); @@ -147,7 +147,7 @@ test("list_reports names each report with its counts, tally and page", async () assert.match(out, /- demo-report · A demo fact-check — Of an article/); assert.match(out, /factcheck · 1 claim\(s\) · 3 citation\(s\) · 2026-10-01/); assert.match(out, /verdicts: Contradicted 1/); - assert.match(out, new RegExp(`${ORIGIN}/reports/demo-report/`)); + assert.match(out, new RegExp(`${ORIGIN}/pages/demo-report/`)); } finally { await client.close(); await rm(dir, { recursive: true, force: true }); @@ -174,7 +174,7 @@ test("get_report: claims with their citations' quote, original and moment URLs", assert.match(text, new RegExp(`moment: ${ORIGIN}/m/demo-channel/abc123/61\\.00-75\\.50/`)); assert.match(text, /original: https:\/\/social\.example\/123/); assert.match(text, new RegExp(`moment: ${ORIGIN}/m/demo-social/123/`)); - assert.match(text, new RegExp(`page: ${ORIGIN}/reports/demo-report/`)); + assert.match(text, new RegExp(`page: ${ORIGIN}/pages/demo-report/`)); assert.match(text, /## Section two \(#two\)/); const one = (await call(client, "get_report", { report: "demo-report", section: "two" })).text; diff --git a/mcp/src/reports.ts b/mcp/src/reports.ts @@ -1,8 +1,9 @@ // Cited reports over MCP: list_reports / get_report, and the one sentence every // discovery tool says about a source's reports. // -// A site may publish reports (corpus spec 5): /reports/index.json lists them -// and /reports/<id>/page.json is one report with every citation resolved +// A site may publish reports (corpus spec 5) as its pages: /pages/index.json +// lists them and /pages/<id>/page.json is one report with every citation +// resolved (/reports/ before release 26) // (common/lib/report/views.ts — the export site's pages read the same files). // A CITED site publishes nothing else: no channels, no shards. Its empty // channel list is the site's shape, not a failure, and a tool that reported "no @@ -100,7 +101,7 @@ export function renderReportIndex( if (r.reports.length === 0) { return r.scope === "cited" ? `${label} is a cited-only site, but its report index lists no reports.` - : `${label} publishes no reports (no /reports/index.json — none published, or a site built before corpus spec 5).`; + : `${label} publishes no reports (no /pages/index.json — none published, or a site built before corpus spec 5).`; } const head = r.scope === "cited" diff --git a/plans/FACTS.md b/plans/FACTS.md @@ -173,7 +173,7 @@ A grep for either word finds all three; read the file before assuming which. | Which | Where | What it is | | --- | --- | --- | -| A cited (report-only) site | `common/lib/siteSchema.ts` — `isCitedSite` (`search: false`); corpus.json `site.scope: "cited"`; `isCitedBuild` / `citedBuildProblem` (`lib/builtExport.ts`) | A site that publishes only its reports and the moments they cite. | +| A cited (report-only) site | `common/lib/siteSchema.ts` — `isCitedSite` (`search: false`); corpus.json `site.scope: "cited"`; `isCitedBuild` / `citedBuildProblem` (`lib/builtExport.ts`) | A site that publishes only its pages (site.json `pages`, its reports at `/pages/<id>/` — release 26 A5; its home is the first) and the moments they cite. A save with no pages is refused (`siteSearchProblem`). | | A cited-only channel | `site.json` `citedChannels`; `siteCitableChannelSlugs`, `isCitedOnlyChannel` (`lib/siteSchema.ts`); `builtCitedOnlyProblem` (`lib/builtExport.ts`) | A channel a site's reports may cite without the site publishing it: its moments and clips publish, its corpus does not. `siteChannelSlugs` (and `publishedMemberSlugs`) stay pool-only. | | `citedMoments` | `common/publish/reportMedia.ts` | The moments a site's reports cite, one per span, with the citations that cite each. | | Compose's `citedSite` | `common/publish/composeReports.ts` `resolveSiteReports` | The local `isCitedSite(site)` (renamed from `cited` in release 23). | diff --git a/plans/report-sites.md b/plans/report-sites.md @@ -1,5 +1,11 @@ # Report sites — a site built around cited reports +**Release 26 A5 (plans/reports-on-homepage.md):** a site's published reports are its `pages` (site.json +`pages`; `reports` read as it for release 26 only), served at `/pages/<id>/` (the views under `public/pages/`), +linked from the header by title; the Reports index is gone, a search-off site's home is its first page, and a +search-off site with no pages is refused on save. The `/reports/` routes and the `reports` key below are the +model before it. + Status: BUILT — R0–R8 merged 2026-10-05 (plus R4b page size); first private report site built locally. RH (per-report revision history) built 2026-10-05, see "History". Report-only is derived from a per-site `search` switch (search off); export's `start` serves moment dirs (`scripts/serve-out.mjs`). Follow-ups: cited corpus.json still describes shards, voice checks recorded in citations, saveSiteAction onto patchSite. diff --git a/umtool/app/sites/[site]/[report]/page.tsx b/umtool/app/sites/[site]/[report]/page.tsx @@ -49,7 +49,7 @@ export default async function ArticlePage({ const links = await linkedProjects(site.siteId, reportId, { workspace: source?.workspace ?? null }); const gitDir = path.join(/* turbopackIgnore: true */ siteReportDir(sitesPaths(), site.siteId, reportId), REPORT_HISTORY_GIT_DIRNAME); const head = await readRevisionHead(gitDir).catch(() => null); - const published = (site.reports ?? []).includes(reportId); + const published = (site.pages ?? []).includes(reportId); const r = read.report; const tab = sp.tab === "source" ? "source" : "article"; const base = `/sites/${site.siteId}/${reportId}`; diff --git a/umtool/lib/articles/sites.ts b/umtool/lib/articles/sites.ts @@ -142,9 +142,9 @@ function siteFlags(site: Site) { /** One site with every article, published (in the site's order) then drafts (by id). */ export async function readSiteRow(site: Site, projects?: Awaited<ReturnType<typeof videoProjects>>): Promise<SiteRow> { const all = projects ?? (await videoProjects(REPORTS_ROOT)); - const published = new Set(site.reports ?? []); + const published = new Set(site.pages ?? []); const dirs = await listReportDirs(sitesPaths(), site.siteId); - const ids = [...(site.reports ?? []), ...dirs.filter((d) => !published.has(d))]; + const ids = [...(site.pages ?? []), ...dirs.filter((d) => !published.has(d))]; const articles = await Promise.all(ids.map((id) => articleRow(site, id, published, all))); return { siteId: site.siteId,