Archilyzer · Source

archilyzer

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

commit 9ad6c5fec4c37ab9fcb80671ce64a257e9cef460
parent fcbc356fdfe4656e1202b184fc65e29a75f2bfbc
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 11 Nov 2026 13:16:05 -0500

test: the archive-origin record test lives beside its controller (common's layering gate)

lib/archiveTrust.test.ts imported controller/remoteOnlyChannel, a back-edge the
architecture test refuses; the test moves to controller/remoteOnlyChannel.test.ts
unchanged.

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

Diffstat:
Mcommon/controller/remoteOnlyChannel.test.ts | 17+++++++++++++++++
Mcommon/lib/archiveTrust.test.ts | 17-----------------
2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/common/controller/remoteOnlyChannel.test.ts b/common/controller/remoteOnlyChannel.test.ts @@ -116,3 +116,20 @@ test("a whole recording is refused with its length and estimated size, and the k assert.match(msg, /"allowWholeRecording": true/); assert.match(wholeRecordingRefusal({ platform: "rumble", slug: "rum", id: "r1" }), /length is not known to its archive/); }); + +// demo epic D1 review, blocker 2b: an archive is read on its own origin only. +test("a manifest the corpus names on another origin is not followed: the archive's own is read", async () => { + const asked: string[] = []; + const docs: Record<string, unknown> = { + "https://stub.test/corpus.json": { channels: [{ slug: "a", manifests: { transcripts: "http://192.168.1.1/admin.json" } }] }, + "https://stub.test/transcripts/a/manifest.json": { slugToPage: { v1: 0 } }, + "https://stub.test/transcripts/a/page-0000.json": [{ id: "v1", webpageUrl: "https://www.youtube.com/watch?v=v1" }], + }; + const getJson = async (url: string) => { + asked.push(url); + if (!(url in docs)) throw new Error("404"); + return docs[url]; + }; + assert.equal((await archiveRecordOf("https://stub.test", "a", "v1", { getJson }))?.webpageUrl, "https://www.youtube.com/watch?v=v1"); + assert.equal(asked.some((u) => u.includes("192.168")), false); +}); diff --git a/common/lib/archiveTrust.test.ts b/common/lib/archiveTrust.test.ts @@ -3,7 +3,6 @@ import assert from "node:assert/strict"; import { recordPageRefusal, sameOrigin } from "./remoteArchives"; import { fetchOnOrigin, OffOriginError, plainGetJson, type FetchLike } from "./remoteArchives-server"; import { detectPlatform } from "./detectPlatform.mjs"; -import { archiveRecordOf } from "../controller/remoteOnlyChannel"; // demo epic D1 review, blocker 2: an archive is untrusted input. @@ -44,19 +43,3 @@ test("an archive's documents are read on its own origin: a same-origin redirect assert.equal(sameOrigin("https://stub.test:443/x", "https://stub.test"), true); assert.equal(sameOrigin("https://stub.test:8443/x", "https://stub.test"), false); }); - -test("a manifest the corpus names on another origin is not followed: the archive's own is read", async () => { - const asked: string[] = []; - const docs: Record<string, unknown> = { - "https://stub.test/corpus.json": { channels: [{ slug: "a", manifests: { transcripts: "http://192.168.1.1/admin.json" } }] }, - "https://stub.test/transcripts/a/manifest.json": { slugToPage: { v1: 0 } }, - "https://stub.test/transcripts/a/page-0000.json": [{ id: "v1", webpageUrl: "https://www.youtube.com/watch?v=v1" }], - }; - const getJson = async (url: string) => { - asked.push(url); - if (!(url in docs)) throw new Error("404"); - return docs[url]; - }; - assert.equal((await archiveRecordOf("https://stub.test", "a", "v1", { getJson }))?.webpageUrl, "https://www.youtube.com/watch?v=v1"); - assert.equal(asked.some((u) => u.includes("192.168")), false); -});