Archilyzer · Source

archilyzer

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

commit b3c32fc4931af0423cd337851a2e9104528a9d5f
parent 53cbdb10126c1100d44e3b41bb297dea407bb451
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 14 Oct 2026 04:20:20 -0400

umtool: the decisions API says how many rows are muted; a new store article is a piece at once

The pieces memo (15 s) now also drops when the article store's directory list
changes: an article the editor's generation starts was missing from Work until
the memo ran out (article-new.spec, once in three runs).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Mumtool/app/api/browse/decisions/route.ts | 9++++++---
Mumtool/lib/pieces.ts | 27++++++++++++++++++++++-----
2 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/umtool/app/api/browse/decisions/route.ts b/umtool/app/api/browse/decisions/route.ts @@ -16,9 +16,10 @@ export const dynamic = "force-dynamic"; // `items[]` is ONE ROW PER DECISION, never grouped and never filtered: the MCP // reads it (mcp/src/archivalTools.ts: `open-note` rows, `project` as the notes // target, `href` ending in `note=<id>`). The inbox's fields on each row -- -// `piece`, `category`, `group`, `action`, `lifecycle`, `hidden` -- are -// additive (lib/inbox.ts), and so is `groups`, the same rows as per-group -// cards, and `hidden`, how many rows sit on parked or done pieces. +// `piece`, `category`, `group`, `action`, `lifecycle`, `muted`, `hidden`, +// `hiddenBy` -- are additive (lib/inbox.ts), and so is `groups`, the same rows +// as per-group cards; `hidden`, how many rows are hidden (a parked or done +// piece, or a mute); and `muted`, how many of those a mute hides. export async function GET(request: Request) { const project = new URL(request.url).searchParams.get("project"); if (project && !isSegment(project)) { @@ -36,7 +37,9 @@ export async function GET(request: Request) { counts: countBySeverity(items), groups: inbox.groups, hidden: inbox.hidden, + muted: inbox.muted, ...(inbox.lifecycleError ? { lifecycleError: inbox.lifecycleError } : {}), + ...(inbox.mutesError ? { mutesError: inbox.mutesError } : {}), }, { headers: { "cache-control": "no-store" } }, ); diff --git a/umtool/lib/pieces.ts b/umtool/lib/pieces.ts @@ -1,3 +1,4 @@ +import { readdir } from "node:fs/promises"; import { listPendingArticles } from "yt-dlp-transcript-common/lib/report/registry"; import { ARTICLES_KEY, REPORTS_ROOT } from "./paths"; import { articleHref } from "./articles/href"; @@ -30,7 +31,8 @@ export { articlePieceId, casePieceId, formatPieceId, isPieceId, parsePieceId, pr // SERVER ONLY. The article side re-reads every report.json (lib/articles/ // sites.ts), so the graph is memoised for MEMO_MS -- and dropped at once by // anything that clears the links cache (a project or an article deleted), the -// way clearLinksCache already drops the links. The lifecycle is NOT memoised: +// way clearLinksCache already drops the links, or by a change in the article +// store's directory list (an article started by the editor's generation). The lifecycle is NOT memoised: // it is one small file, and a park has to show on the next read. // --------------------------------------------------------------------------- @@ -89,7 +91,7 @@ export type PieceGraph = { }; const MEMO_MS = 15_000; -type Memo = { at: number; epoch: number; value: Promise<PieceGraph> }; +type Memo = { at: number; epoch: number; sig: string; value: Promise<PieceGraph> }; // On globalThis, not in module scope: each Next bundle has its own copy of this // module, and the epoch it compares (links.mjs) is per process. const MEMO = ((globalThis as { __umtoolPieces?: { memo: Memo | null } }).__umtoolPieces ??= { memo: null }); @@ -99,12 +101,27 @@ export function clearPiecesCache(): void { MEMO.memo = null; } -export function readPieceGraph(): Promise<PieceGraph> { +/** + * The article store's directory names: one readdir. An article started (or + * deleted) by a route this module never hears from -- the editor's generation + * writes the store itself -- changes it, so a new article is listed at once + * rather than when the memo runs out. + */ +async function storeSignature(): Promise<string> { + try { + return (await readdir(/* turbopackIgnore: true */ sitesPaths().articlesDir)).sort().join("\u0000"); + } catch { + return ""; + } +} + +export async function readPieceGraph(): Promise<PieceGraph> { const epoch = linksCacheEpoch(); + const sig = await storeSignature(); const memo = MEMO.memo; - if (memo && memo.epoch === epoch && Date.now() - memo.at < MEMO_MS) return memo.value; + if (memo && memo.epoch === epoch && memo.sig === sig && Date.now() - memo.at < MEMO_MS) return memo.value; const value = buildGraph(); - const entry = { at: Date.now(), epoch, value }; + const entry = { at: Date.now(), epoch, sig, value }; MEMO.memo = entry; value.catch(() => { if (MEMO.memo === entry) MEMO.memo = null;