Archilyzer · Source

archilyzer

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

commit 6b8faf3333cdccf2005673ec9f972c240beafb28
parent ad05a31e18163fb5908cf30961a65009c6df73a2
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 11 Nov 2026 11:37:00 -0500

publish: a private site's input signature signs the transcript tree it copies

Re-review follow-up F2. siteInputSig signed every member's SHARED transcript
tree, but a private-audience site copies a channel's full tree under
shared/private/transcripts where it has one (compose-site
transcriptsSourceFor): a change only there (a local recording's transcript)
was seen only through the site-index signature. A private site now signs that
tree for such a member (members and cited-only channels alike); a public site,
and a member without one, sign the shared tree as before, so their signatures
do not change. Test: a public site does not move on a private-tree change; the
same site made private does. Fails without the change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Diffstat:
Mcommon/publish/inputSig.test.ts | 27+++++++++++++++++++++++++++
Mcommon/publish/inputSig.ts | 18++++++++++++++----
2 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/common/publish/inputSig.test.ts b/common/publish/inputSig.test.ts @@ -250,3 +250,30 @@ test("hubSig: the stamp, homepage.json, and each listed site's id + url + title" rmSync(s.root, { recursive: true, force: true }); } }); + +// Re-review F2 (lane/local-media): a PRIVATE-audience site signs the transcript +// tree it actually copies — a channel's full tree under shared/private where it +// has one; a public site keeps signing the shared tree and does not move when +// only the private tree does. +test("a private site signs a member's private transcript tree; a public site does not see it", async () => { + const s = setup(); + try { + (s.paths as { exportSharedDir: string }).exportSharedDir = path.join(s.root, ".export-index", "shared"); + const privateTree = path.join(s.root, ".export-index", "shared", "private", "transcripts", "a"); + s.write(path.join(privateTree, "page-0000.json"), "[1,\"local\"]"); + const publicBefore = await s.sig(); + s.write(path.join(privateTree, "page-0001.json"), "[\"another local\"]"); + assert.equal(await s.sig(), publicBefore, "a public site does not sign the private tree"); + + (s.site as { audience?: string }).audience = "private"; + const privateBefore = await s.sig(); + s.write(path.join(privateTree, "page-0002.json"), "[\"a third local\"]"); + assert.notEqual(await s.sig(), privateBefore, "a private site signs the tree it copies"); + // A member with no private tree is still signed by its shared tree. + const before = await s.sig(); + s.write(path.join(s.paths.exportSharedPostsDir, "x", "page-0009.json"), "[9]"); + assert.notEqual(await s.sig(), before); + } finally { + rmSync(s.root, { recursive: true, force: true }); + } +}); diff --git a/common/publish/inputSig.ts b/common/publish/inputSig.ts @@ -34,7 +34,7 @@ import path from "node:path"; import { open } from "lmdb"; import { dirSignature } from "../lib/dirSignature"; import { DUPLICATES_FILENAME, DUPLICATE_OVERRIDES_FILENAME } from "../lib/duplicates"; -import type { Paths } from "../lib/paths"; +import { sharedPrivateTranscriptsDir, type Paths } from "../lib/paths"; import { publishedMemberSlugs } from "../lib/postsVisibility"; import type { SiteSettings } from "../lib/settings"; import { @@ -46,7 +46,7 @@ import { siteIndexDir, type Site, } from "../lib/site"; -import { isCitedOnlyChannel, isListedSite } from "../lib/siteSchema"; +import { isCitedOnlyChannel, isListedSite, isPrivateSite } from "../lib/siteSchema"; import { INDEX_SCANNED_AT_KEY } from "../lib/stats"; import { readChannelConfig } from "../controller/channels"; import type { ChannelConfig } from "../lib/channelConfig"; @@ -112,9 +112,19 @@ export async function siteInputSig(i: SiteSigInputs): Promise<string> { const indexDir = siteIndexDir(paths, site.siteId); lines.push(`site-index\t${await dirSignature(indexDir, CHART_TEMPLATES)}`); lines.push(`${CHART_TEMPLATES}\t${await fileBytesSig(path.join(indexDir, CHART_TEMPLATES))}`); + // The transcript tree a member's copy comes from: for a PRIVATE-audience + // site, a channel's full tree (local recordings included) where it has one — + // what compose copies (bin/compose-site.ts transcriptsSourceFor; re-review + // F2). Every other site, and a channel with none, signs the shared tree, so + // their signatures are unchanged. + const privateSite = isPrivateSite(site); + const transcriptsRoot = (slug: string): string => + privateSite && existsSync(path.join(sharedPrivateTranscriptsDir(paths), slug)) + ? sharedPrivateTranscriptsDir(paths) + : paths.exportSharedTranscriptsDir; for (const slug of members) { for (const [tree, root] of [ - ["transcripts", paths.exportSharedTranscriptsDir], + ["transcripts", transcriptsRoot(slug)], ["subs", paths.exportSharedSubsDir], ["posts", paths.exportSharedPostsDir], ["digests", paths.exportSharedDigestsDir], @@ -130,7 +140,7 @@ export async function siteInputSig(i: SiteSigInputs): Promise<string> { if (citedOnly.length > 0) lines.push(`cited-only\t${citedOnly.join(",")}`); for (const slug of citedOnly) { for (const [tree, root] of [ - ["transcripts", paths.exportSharedTranscriptsDir], + ["transcripts", transcriptsRoot(slug)], ["posts", paths.exportSharedPostsDir], ] as const) { lines.push(`cited/${tree}/${slug}\t${await channelTreeSig(root, slug, cache)}`);