Archilyzer · Source

archilyzer

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

commit de0c4b443914f08401d1c851473ded8b81ce37ff
parent 59aa5d45b3f2459c13f5e7bc09642d51218df330
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 18 Nov 2026 07:50:06 -0500

privacy pins: the judge view stays behind every publishing door -- the detail listing is shown to carry a kept post's note and its capture's context (names only: no address, no bytes, no path) while nothing a build or a report door wrote does; the ids listing, the one-line summary and a purge's dry run carry no post's words; no build, publisher, export, homepage or MCP source names the judge view's reads or the purge, and the MCP's trending tools ask for a topic and a limit only; nothing of umtool's Posts library imports a way into a project, a report, an article, the post archive or a site, asks the editor for anything but the listing and its three presses, or writes the corpus; the media route's resolver refuses a channel that is no library

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

Diffstat:
Mcommon/bin/xTrendingPrivacy.test.ts | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
Mcommon/publish/xTrendingReportDoor.test.ts | 21+++++++++++++++++++++
Mmcp/src/xTrendingPrivacy.test.ts | 21+++++++++++++++++++++
Mumtool/lib/report/xTrendingLibrary.test.mjs | 76++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 171 insertions(+), 0 deletions(-)

diff --git a/common/bin/xTrendingPrivacy.test.ts b/common/bin/xTrendingPrivacy.test.ts @@ -251,3 +251,56 @@ test("the search itself catches a leak", () => { assert.throws(() => assertNoLeak([{ rel: "corpus.json", text: `{"slug":"${LIB}"}` }], "x")); assert.doesNotThrow(() => assertNoLeak([{ rel: "page-0001.json", text: PUBLIC_POST }], "x")); }); + +// ── lane posts-library: what the judge view added stays behind the same doors ── + +const JUDGE_VIEW_ONLY = ["xTrending/purge", "purgeXTrendingDropped", "removeXTrendingPostCapture", "summarizeXTrending", "xTrendingCaptureFiles", "purge-trending"]; + +function sourcesUnder(dir: string): { rel: string; text: string }[] { + const out: { rel: string; text: string }[] = []; + const walk = (d: string) => { + for (const e of readdirSync(d, { withFileTypes: true })) { + if (e.name === "node_modules" || e.name.startsWith(".")) continue; + const p = path.join(d, e.name); + if (e.isDirectory()) walk(p); + else if (/\.(ts|tsx|mjs)$/.test(e.name) && !/\.test\.|\.unit\./.test(e.name)) out.push({ rel: p, text: readFileSync(p, "utf8") }); + } + }; + if (existsSync(dir)) walk(dir); + return out; +} + +test("the judge view's listing carries the kept post's note and its capture's context; no build wrote them, and it gives no address or path", async () => { + const { SLICE2_MARKS } = await import("../lib/xTrending/__fixtures__/slice2Library"); + const { purgeXTrendingDropped } = await import("../lib/xTrending/purge"); + const { summarizeXTrending } = await import("../lib/xTrending/store"); + const detail = JSON.stringify(await listXTrending(libRoot, { detail: true })); + // It IS there for the one door that asks (so the search below watches the right words). + assert.ok(detail.includes(SLICE2_MARKS.note), "the detail listing carries the judgement's note"); + assert.ok(detail.includes(SLICE2_MARKS.context), "the detail listing carries the capture's context"); + // Names only: no media address, no bytes, no path on disk. + assert.ok(!detail.includes(SLICE2_MARKS.address) && !detail.includes(SLICE2_MARKS.media) && !detail.includes(SLICE2_MARKS.shot)); + assert.ok(!detail.includes(libRoot) && !detail.includes("responses.jsonl")); + // The ids listing, the one-line summary and a purge's dry run say nothing of a post's words. + const idsOnly = await listXTrending(libRoot, { ids: true }); + assert.deepEqual(idsOnly.posts, []); + for (const answer of [idsOnly.ids, await summarizeXTrending(libRoot), await purgeXTrendingDropped(libRoot, { slug: LIB, dryRun: true, captureInFlight: () => false })]) { + const text = JSON.stringify(answer); + for (const mark of [...MARKS, ...SLICE2_MARK_LIST]) assert.ok(!text.includes(mark), `an answer carries ${mark}`); + assert.ok(!text.includes(libRoot)); + } + // And still nothing of it in what the builds above wrote. + assertNoLeak([...filesUnder(paths.exportIndexDir), ...filesUnder(paths.exportPublicDir)], "index and public dirs, after the judge view's reads"); +}); + +test("no build, publisher, export, homepage or MCP module reaches the judge view's reads or the purge", () => { + const repo = path.resolve(path.dirname(new URL(import.meta.url).pathname), "..", ".."); + const dirs = ["common/bin", "common/publish", "common/views", "export/app", "export/lib", "homepage/app", "homepage/lib", "mcp/src"].map((d) => path.join(repo, d)); + const files = [...dirs.flatMap(sourcesUnder), ...sourcesUnder(path.join(repo, "common", "controller")).filter((f) => /buildIndex|compose|report/i.test(path.basename(f.rel)))]; + assert.ok(files.length > 50, "the sweep read the publishing sources"); + for (const f of files) { + for (const word of JUDGE_VIEW_ONLY) assert.ok(!f.text.includes(word), `${path.relative(repo, f.rel)} names ${word}`); + // The listing is asked there with a topic and a limit at most: never the judge view's detail, ids or filter. + if (f.text.includes("listXTrending(")) assert.ok(!/listXTrending\([^)]*\b(detail|ids|filter|offset)\b/.test(f.text), `${path.relative(repo, f.rel)} asks the listing for the judge view's fields`); + } +}); diff --git a/common/publish/xTrendingReportDoor.test.ts b/common/publish/xTrendingReportDoor.test.ts @@ -267,3 +267,24 @@ test("N8a: behind such a host, preparing media refuses a library's post, and no [[LIB, "vid00000001", "not-in-site", X_TRENDING_NOT_CITABLE(LIB)]], ); }); + +// Lane posts-library: the judge view's reads (the detail listing) are the one +// place a kept post's note and its capture's context are given out. No report +// door wrote them, and no report module can ask for them or for the purge. +test("posts-library: the detail listing holds the note and the context; what the report doors wrote holds neither, and no report source names the judge view's reads or the purge", async () => { + const { listXTrending } = await import("../lib/xTrending/store"); + const { SLICE2_MARKS } = await import("../lib/xTrending/__fixtures__/slice2Library"); + const detail = JSON.stringify(await listXTrending(libRoot, { detail: true })); + assert.ok(detail.includes(SLICE2_MARKS.note) && detail.includes(SLICE2_MARKS.context), "the judge view's listing carries them"); + assert.ok(!detail.includes(SLICE2_MARKS.address), "and never a media address"); + assertNoSlice2(filesUnder(paths.exportPublicDir), "the public dir, after the judge view's read"); + const here = path.dirname(new URL(import.meta.url).pathname); + const sources = filesUnder(here).filter((f) => /\.(ts|mjs)$/.test(f.rel) && !f.rel.includes(".test.")); + assert.ok(sources.length > 5, "the publish sources were read"); + for (const f of sources) { + for (const word of ["xTrending/purge", "purgeXTrendingDropped", "removeXTrendingPostCapture", "summarizeXTrending", "xTrendingCaptureFiles"]) { + assert.ok(!f.text.includes(word), `publish/${f.rel} names ${word}`); + } + assert.ok(!/listXTrending\([^)]*\b(detail|ids|filter|offset)\b/.test(f.text), `publish/${f.rel} asks the listing for the judge view's fields`); + } +}); diff --git a/mcp/src/xTrendingPrivacy.test.ts b/mcp/src/xTrendingPrivacy.test.ts @@ -168,3 +168,24 @@ test("every read-only corpus tool over the composed site: the account's post, ne await corpus.close(); } }); + +// Lane posts-library: the judge view's asks of the editor's listing (detail, +// ids, the filters) and the purge are umtool's and `pnpm ops`'s. The MCP's two +// trending tools ask for a topic and a limit, and gain no purge. +test("posts-library: no MCP source asks the listing for the judge view's fields, or names the purge", async () => { + const { readdirSync, readFileSync } = await import("node:fs"); + const here = path.dirname(new URL(import.meta.url).pathname); + const sources = readdirSync(here).filter((n) => /\.ts$/.test(n) && !n.includes(".test.")); + assert.ok(sources.length > 5, "the MCP's sources were read"); + for (const name of sources) { + const text = readFileSync(path.join(here, name), "utf8"); + for (const word of ["purge-trending", "purgeXTrending", "removeXTrendingPostCapture", "/api/library", "judge-trending\"", "watch-trending\""]) { + assert.ok(!text.includes(word), `mcp/src/${name} names ${word}`); + } + if (text.includes("/api/ops/trending")) { + for (const param of ["detail", "ids", "offset", "author", "since", "state=", "gone", "q="]) { + assert.ok(!new RegExp(`[?&"'\`]${param.replace("=", "")}=|set\\("${param.replace("=", "")}"`).test(text), `mcp/src/${name} asks the listing for ${param}`); + } + } + } +}); diff --git a/umtool/lib/report/xTrendingLibrary.test.mjs b/umtool/lib/report/xTrendingLibrary.test.mjs @@ -97,3 +97,79 @@ test("a library with posts in the ordinary place is refused by its marker: not o } }); + +// Lane posts-library (slice 3): the Posts library page reads a library ON +// PURPOSE, through the editor, and serves its captured media from one route. +// It is still no way into a project, a report, an article, the post archive or +// a site: nothing of it imports a writer of those, and the media route is the +// one reader of the corpus that REQUIRES the marker. +import { readdir, readFile as readSource } from "node:fs/promises"; +import { fileURLToPath } from "node:url"; +import { resolveLibraryMedia } from "../library/media.mjs"; + +const UMTOOL = fileURLToPath(new URL("../../", import.meta.url)); + +async function sourcesUnder(rel) { + const out = []; + const walk = async (dir) => { + for (const e of await readdir(dir, { withFileTypes: true }).catch(() => [])) { + const p = path.join(dir, e.name); + if (e.isDirectory()) await walk(p); + else if (/\.(ts|tsx|mjs)$/.test(e.name) && !e.name.includes(".test.")) out.push({ rel: path.relative(UMTOOL, p), text: await readSource(p, "utf8") }); + } + }; + await walk(path.join(UMTOOL, rel)); + return out; +} + +test("posts-library: nothing of the page, its routes or its CLI imports a way into a project, a report, an article, the post archive or a site", async () => { + const files = (await Promise.all(["lib/library", "app/tools/library", "app/api/library", "components/tools/library"].map(sourcesUnder))).flat(); + assert.ok(files.length >= 14, `the Posts library's sources were read (${files.length})`); + const WAYS_OUT = [ + "addPostFromArchive", "postsCli", "postCards", "postReel", "postContext", "timelineCli", "timelineApi", "report/chain", "report/manifest", + "lib/projects", "@/lib/articles/sites", "publish", "report-draft", "build-deploy", "capture-posts", "create-channel", "writeManifest", + ]; + for (const f of files) { + const imports = [...f.text.matchAll(/from\s+"([^"]+)"|import\("([^"]+)"\)/g)].map((m) => m[1] ?? m[2]); + for (const spec of imports) { + for (const way of WAYS_OUT) assert.ok(!spec.includes(way), `${f.rel} imports ${spec}`); + } + // The editor is asked for the listing and the three presses, and nothing else. + for (const m of f.text.matchAll(/["'`](\/api\/ops\/[a-z-]+)/g)) { + assert.ok(["/api/ops/trending", "/api/ops/judge-trending", "/api/ops/watch-trending", "/api/ops/purge-trending"].includes(m[1]), `${f.rel} asks the editor for ${m[1]}`); + } + // No request of X or of any outside host is built here. + assert.ok(!/fetch\(\s*["'`]https?:\/\//.test(f.text), `${f.rel} fetches an outside address`); + // The corpus is never written from here. + if (!f.rel.endsWith("seen.mjs")) assert.ok(!/\b(writeFile|rename|rm|unlink|mkdir|appendFile|copyFile|symlink|link)\(/.test(f.text), `${f.rel} writes a file`); + } + // Mark seen writes umtool's own state, under the reports root's .umtool/, and nowhere in the corpus. + const seen = files.find((f) => f.rel.endsWith("seen.mjs")); + assert.match(seen.text, /reportsRoot, "\.umtool", "posts-library\.json"/); + assert.ok(!/channels|trending\//.test(seen.text.replace(/^\/\/.*$/gm, ""))); +}); + +test("posts-library: the media route's resolver serves a marked library's captured picture, and refuses the same file of a channel that is no library", async () => { + const channels = await mkdtemp(path.join(tmpdir(), "umtool-x-trending-media-")); + try { + for (const [slug, config] of [["trending-lib", { handling: "transcribe", sourceKind: "social", platform: "twitter", xTrending: {} }], ["kettle-org-x", { handling: "transcribe", sourceKind: "social", platform: "twitter", url: "https://x.com/kettle_org" }]]) { + await mkdir(path.join(channels, slug, "trending", "posts-media", "1900000000000006001"), { recursive: true }); + await mkdir(path.join(channels, slug, "posts-media", "1900000000000006001"), { recursive: true }); + await writeFile(path.join(channels, slug, "config.json"), JSON.stringify(config)); + await writeFile(path.join(channels, slug, "trending", "posts-media", "1900000000000006001", "shot.png"), "shot trendshotmarkert6b"); + await writeFile(path.join(channels, slug, "trending", "posts-media", "1900000000000006001", "capture.json"), "{}"); + await writeFile(path.join(channels, slug, "posts-media", "1900000000000006001", "shot.png"), "an ordinary capture"); + } + const ask = (lib, name = "shot.png") => resolveLibraryMedia({ channelsDir: channels, lib, id: "1900000000000006001", name }); + assert.equal((await ask("trending-lib")).ok, true); + assert.deepEqual(await ask("kettle-org-x"), { ok: false, status: 404 }); + assert.equal((await ask("trending-lib", "capture.json")).ok, false); + // It reaches only trending/posts-media: an ordinary channel's own captures are not its to serve. + assert.match((await ask("trending-lib")).abs, /trending[\\/]posts-media[\\/]1900000000000006001[\\/]shot\.png$/); + // And the readers a video project uses still find nothing of the library. + assert.deepEqual((await postChannels(channels, null)).map((c) => c.slug), []); + assert.deepEqual(await readPostsArchive(channels, "trending-lib"), []); + } finally { + await rm(channels, { recursive: true, force: true }); + } +});