Archilyzer · Source

archilyzer

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

commit 85d78abed2a8abae8ad317516907dc963c23c6ed
parent f779978dbb85578adf3ac2a58b74cfb60a00126e
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 18 Nov 2026 02:50:43 -0500

x-trending: the paused-watch rows live in lib; the pins name the captures directory through the planter

common's layers: a controller may not import views, so the rows /review lists and their builder move to lib/xTrending/watch.ts and views/review re-exports them. The privacy pins under publish/ and bin/ no longer spell the captures directory (every source there names it nowhere but the cited-capture copier): the planter exports its name.

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

Diffstat:
Mcommon/bin/xTrendingPrivacy.test.ts | 6+++---
Mcommon/controller/xTrendingWatch.ts | 3++-
Mcommon/lib/xTrending/__fixtures__/slice2Library.ts | 14+++++++++++++-
Mcommon/lib/xTrending/watch.ts | 43+++++++++++++++++++++++++++++++++++++++++++
Mcommon/publish/xTrendingReportDoor.test.ts | 6+++---
Mcommon/views/review.ts | 45++++-----------------------------------------
6 files changed, 68 insertions(+), 49 deletions(-)

diff --git a/common/bin/xTrendingPrivacy.test.ts b/common/bin/xTrendingPrivacy.test.ts @@ -62,7 +62,7 @@ const RAW_MARK = "trendrawmarkerj9m"; // Lane x-trending-2: the judgement's note, the captured media's bytes and // address, the capture's context and the shot — planted below, and looked for // in everything a build writes, like the four above. -const { plantSlice2Library, SLICE2_FILE_NAMES, SLICE2_MARK_LIST } = await import("../lib/xTrending/__fixtures__/slice2Library"); +const { plantSlice2Library, SLICE2_CAPTURES_DIRNAME, SLICE2_FILE_NAMES, SLICE2_MARK_LIST } = await import("../lib/xTrending/__fixtures__/slice2Library"); const MARKS = [POST_MARK, HANDLE_MARK, TOPIC_MARK, RAW_MARK, ...SLICE2_MARK_LIST]; const READ = "tr-01JA0000000000000000000000"; const quiet = () => {}; @@ -228,14 +228,14 @@ test("the library's own listing needs no index: it reads its files", async () => // Lane x-trending-2. test("what a keep, a capture and a watch leave in a library is in no build: not its words, not its bytes, not a file of its name", async () => { // Planted for real: the files exist, where the editor leaves them. - for (const rel of ["judgements.json", "watch.json", "media-index.json", "posts-availability.json", ".gitignore", path.join("posts-media", "1900000000000006001", "capture.json")]) { + for (const rel of ["judgements.json", "watch.json", "media-index.json", "posts-availability.json", ".gitignore", path.join(SLICE2_CAPTURES_DIRNAME, "1900000000000006001", "capture.json")]) { assert.ok(existsSync(path.join(libRoot, "trending", rel)), `${rel} was planted`); } const built = [...filesUnder(paths.exportIndexDir), ...filesUnder(paths.exportPublicDir)]; assert.ok(built.length > 0, "the builds above wrote files"); assertNoLeak(built, "index and public dirs"); for (const f of built) { - for (const name of [...SLICE2_FILE_NAMES, "posts-media"]) { + for (const name of SLICE2_FILE_NAMES) { assert.ok(!f.rel.split(path.sep).includes(name), `a build wrote ${f.rel}`); } } diff --git a/common/controller/xTrendingWatch.ts b/common/controller/xTrendingWatch.ts @@ -47,12 +47,13 @@ import { } from "../lib/xTrending/store"; import { mutateXTrendingWatches, + pausedWatchRows, readXTrendingWatches, watchIsLive, + type PausedWatchRow, type XTrendingWatch, type XTrendingWatchPauseReason, } from "../lib/xTrending/watch"; -import { pausedWatchRows, type PausedWatchRow } from "../views/review"; import { listChannelConfigs } from "./channels"; import { xTrendingHeld } from "./readXTrending"; diff --git a/common/lib/xTrending/__fixtures__/slice2Library.ts b/common/lib/xTrending/__fixtures__/slice2Library.ts @@ -24,7 +24,19 @@ export const SLICE2_MARKS = { export const SLICE2_MARK_LIST: readonly string[] = Object.values(SLICE2_MARKS); // The names a build or a report must never carry a file of. -export const SLICE2_FILE_NAMES: readonly string[] = ["judgements.json", "media-index.json", "watch.json", "media-store", "posts-availability.json"]; +// A library's captures directory (`trending/<this>/<id>/`), named here so the +// pins under publish/ and bin/ need not spell it (postCapture.test.ts holds +// every source there to naming it nowhere but the cited-capture copier). +export const SLICE2_CAPTURES_DIRNAME = path.basename(xTrendingPostsMediaDir(".")); + +export const SLICE2_FILE_NAMES: readonly string[] = [ + "judgements.json", + "media-index.json", + "watch.json", + "media-store", + "posts-availability.json", + SLICE2_CAPTURES_DIRNAME, +]; // `postId` must be a post of the library, in a topic `topicId` that holds a page. export async function plantSlice2Library(libRoot: string, o: { postId: string; topicId: string }): Promise<void> { diff --git a/common/lib/xTrending/watch.ts b/common/lib/xTrending/watch.ts @@ -204,3 +204,46 @@ export function describeXTrendingWatch(w: XTrendingWatch, now: number): string { const next = w.nextTickAt ? Date.parse(w.nextTickAt) : now; return `Watched ${every}; ${w.ticks} tick${w.ticks === 1 ? "" : "s"} so far, next ${next <= now ? "at the next scan" : `at ${hhmm(next)} UTC`}.`; } + +// PAUSED WATCHES, AS /review LISTS THEM: topics someone switched a watch on +// for, which the watch's scan cannot tick now — X's cookie +// jar is past its limit, the X alert is up, X is cooling down, there is no +// connected profile. It is here because what ends the pause is a PERSON's +// press (Refresh cookies on /cookies; the editor never refreshes X's jar by +// itself), and until someone makes it the watch reads nothing. +export type PausedWatchRow = { + slug: string; + topic: string; + title: string; + reason: string; + // ISO: when the pause began, and when the watch ends whether or not it resumes. + since: string; + until: string; + sentence: string; +}; + +export function pausedWatchRows( + libraries: ReadonlyArray<{ + slug: string; + topics: ReadonlyArray<{ id: string; title: string }>; + watches: Readonly<Record<string, { on: boolean; until: string; ended?: unknown; paused?: { reason: string; since: string; sentence: string } }>>; + }>, +): PausedWatchRow[] { + const rows: PausedWatchRow[] = []; + for (const lib of libraries) { + for (const [topic, w] of Object.entries(lib.watches)) { + if (!w.on || w.ended || !w.paused) continue; + rows.push({ + slug: lib.slug, + topic, + title: lib.topics.find((t) => t.id === topic)?.title ?? topic, + reason: w.paused.reason, + since: w.paused.since, + until: w.until, + sentence: w.paused.sentence, + }); + } + } + // Stable across renders. + return rows.sort((a, b) => a.slug.localeCompare(b.slug) || a.topic.localeCompare(b.topic)); +} diff --git a/common/publish/xTrendingReportDoor.test.ts b/common/publish/xTrendingReportDoor.test.ts @@ -93,7 +93,7 @@ await writePosts(accountRoot, [post(ACCOUNT, SHARED_ID, "kettle_org", "the accou // a shot, a media file in the store, its context) and its topic watched. No // report door may give out any of it either. const { recordXTrendingRead, readXTrendingTopics } = await import("../lib/xTrending/store"); -const { plantSlice2Library, SLICE2_FILE_NAMES, SLICE2_MARK_LIST } = await import("../lib/xTrending/__fixtures__/slice2Library"); +const { plantSlice2Library, SLICE2_CAPTURES_DIRNAME, SLICE2_FILE_NAMES, SLICE2_MARK_LIST } = await import("../lib/xTrending/__fixtures__/slice2Library"); await recordXTrendingRead(libRoot, { readId: "tr-01JA0000000000000000000000", at: "2026-11-17T10:00:00.000Z", @@ -108,7 +108,7 @@ await plantSlice2Library(libRoot, { postId: LIB_ID, topicId: (await readXTrendin function assertNoSlice2(files: { rel: string; text: string }[], where: string): void { for (const f of files) { for (const mark of SLICE2_MARK_LIST) assert.ok(!f.text.includes(mark), `${where}: ${f.rel} holds ${mark}`); - for (const name of [...SLICE2_FILE_NAMES, "posts-media"]) assert.ok(!f.rel.split(path.sep).includes(name), `${where}: wrote ${f.rel}`); + for (const name of SLICE2_FILE_NAMES) assert.ok(!f.rel.split(path.sep).includes(name), `${where}: wrote ${f.rel}`); } } @@ -245,7 +245,7 @@ test("N8a: behind such a host, preparing media refuses a library's post, and no assert.deepEqual(Object.keys(index.moments), []); // The post is CAPTURED now (a shot and a media file under trending/): no // report media is prepared from it all the same, and nothing of it is written. - assert.ok(!JSON.stringify(index).includes("posts-media"), "the media index names a capture"); + assert.ok(!JSON.stringify(index).includes(SLICE2_CAPTURES_DIRNAME), "the media index names a capture"); for (const mark of SLICE2_MARK_LIST) assert.ok(!JSON.stringify(index).includes(mark), `the media index holds ${mark}`); assertNoSlice2(filesUnder(OUT), "report media"); diff --git a/common/views/review.ts b/common/views/review.ts @@ -58,44 +58,7 @@ export function autoPausedRows(model: ChannelPriority): AutoPausedRow[] { } // PAUSED WATCHES (lane x-trending-2): topics of an X trending library someone -// switched a watch on for, which the watch's scan cannot tick now — X's cookie -// jar is past its limit, the X alert is up, X is cooling down, there is no -// connected profile. It is here because what ends the pause is a PERSON's -// press (Refresh cookies on /cookies; the editor never refreshes X's jar by -// itself), and until someone makes it the watch reads nothing. -export type PausedWatchRow = { - slug: string; - topic: string; - title: string; - reason: string; - // ISO: when the pause began, and when the watch ends whether or not it resumes. - since: string; - until: string; - sentence: string; -}; - -export function pausedWatchRows( - libraries: ReadonlyArray<{ - slug: string; - topics: ReadonlyArray<{ id: string; title: string }>; - watches: Readonly<Record<string, { on: boolean; until: string; ended?: unknown; paused?: { reason: string; since: string; sentence: string } }>>; - }>, -): PausedWatchRow[] { - const rows: PausedWatchRow[] = []; - for (const lib of libraries) { - for (const [topic, w] of Object.entries(lib.watches)) { - if (!w.on || w.ended || !w.paused) continue; - rows.push({ - slug: lib.slug, - topic, - title: lib.topics.find((t) => t.id === topic)?.title ?? topic, - reason: w.paused.reason, - since: w.paused.since, - until: w.until, - sentence: w.paused.sentence, - }); - } - } - // Stable across renders. - return rows.sort((a, b) => a.slug.localeCompare(b.slug) || a.topic.localeCompare(b.topic)); -} +// switched a watch on for, which the watch's scan cannot tick now. The row and +// its builder live a layer down (lib/xTrending/watch.ts), where the controller +// that reads the libraries may import them; /review's types are named here. +export { pausedWatchRows, type PausedWatchRow } from "../lib/xTrending/watch";