commit b3d53c78f83fd4f1edaaf8e1ed5fc9e45a950f6f
parent e7ca446fac8be4e9e5d20ee8a3c72f2145599c93
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 14 Oct 2026 04:06:53 -0400
umtool: Mute is the server's (mutes.json beside lifecycle.json); /articles keeps parity; the rail lights Research
POST /api/pieces/mute {piece, kind, muted} writes REPORTS_ROOT/.umtool/mutes.json
(atomic, serialised, never over an unreadable file). readInbox marks a muted
kind's rows hidden with hiddenBy "muted" (a parked or done piece's reason
wins); the Inbox lists them under Muted N with Unmute, and the Undo bar takes a
mute back too. The localStorage mute is gone. /articles lands on the store's
articles (/work?kind=article&site=articles). shell.spec lights Research on
/research and /research/archive. CHANGELOG: P1's rail and lit-list bullets
name what is there now.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
18 files changed, 591 insertions(+), 196 deletions(-)
diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md
@@ -33,15 +33,15 @@
- **New settings key `generation.verdicts`** (SETTINGS.md): the verdict bench's bar (`agreement`, `contradictedRecall`, `notFoundRecall`, fractions) and the passing models you ticked (`models`, never set automatically).
- **umtool has a new look, in dark and light: the desk and the reader.** Tool chrome is a warm-ink desk (warm grey in light) and anything a source said — a quote, a post, a transcript window, the clip and claim benches' transcripts — sits on a pale green-grey reader surface, so a quote is never mistaken for a claim about it. Colours are roles: Signal (teal) only for focus, the lit line and the one primary action; Meter (violet) for counts and spend; the three verdicts always as glyph and word (✓ ? ✕), never on the reader. The faces are vendored (Archivo, IBM Plex Sans and Mono, Source Serif 4 for the reader) and load with no network.
- **umtool: Auto / Light / Dark at the foot of the rail.** Auto follows the system; a choice is a cookie the server reads, so the page is served in it with no flash.
-- **umtool: every page has the rail.** The mark and the wordmark (home), the places (unchanged: home · browse · decisions · articles · mix · find · song ▸), + Create (a new article or a new project), Pinned, what umtool is running, and the theme. The page's name is its title under the breadcrumb. The clip, claim and takes benches drop the rail and take the full width.
-- **umtool: /browse/decisions is a lit list.** One line per decision, grouped by project; `j` / `k` (or the arrows) move the lit line from anywhere on the page, and focus goes with it. The head glides 120 ms, and jumps under reduced motion.
+- **umtool: every page has the rail.** The mark and the wordmark (home), the places (Inbox · Research · Work · Tools · Settings), + Create (a new article or a new project), Jump to… ⌘K, Pinned, what umtool is running, and the theme. The page's name is its title under the breadcrumb. The clip, claim and takes benches drop the rail and take the full width.
+- **umtool: a list is a lit list.** One line per item (the Inbox's cards, Work's pieces, the tools); `j` / `k` (or the arrows) move the lit line from anywhere on the page, and focus goes with it. The head glides 120 ms, and jumps under reduced motion.
- **umtool's decisions API carries the inbox: each decision's piece, group and one action.** `GET /api/browse/decisions` still answers one row per decision (`items[]`, each row's `project`, `href` and `counts` as before; a note's `href` still ends in `note=<id>`), and each row now also names its `piece` — `a:<site>/<report>` for an article and the video projects made from it, `p:<project>` for a project no article claims — its `category`, its `group` (Your call → Review → Blocking → Notes → Open → Ready to finish → Quiet), one `action` whose label names the result ("Make i3 current", "Adjudicate claim", "Answer note"), the piece's `lifecycle` and `hidden`. A new `groups` key holds the same rows as cards, one per piece and kind, with counts; `hidden` counts the rows on parked or done pieces. Five decisions are read from disk for the first time: `iteration-ready` (a finished iteration newer than the current one), `iteration-failed` (with what it spent), `research-proposal` (an acquisition waiting on a yes or no, read from `proposals.json`, never through the editor), `link-ambiguous` and `looks-done`.
- **umtool: a piece can be parked or marked done.** `POST /api/pieces/lifecycle {piece, state}` sets `active`, `parked` or `done`, kept in `REPORTS_ROOT/.umtool/lifecycle.json` with when and by whom; a parked or done piece's decisions stay in the list, `hidden`. "Looks done" — a song with every cut, a final video with a `share-*` batch, a published article with its video — is only ever a suggestion (a `looks-done` decision) and never sets it. `GET /api/pieces` lists every piece with its stage, lifecycle, linked projects and how many decisions wait on it.
- **`umtool inbox [--all] [--json]`** prints the decisions grouped and ranked as the inbox shows them, one card per piece and kind, and how many are hidden; `--all` lists the hidden ones and the quiet group.
- **umtool links an article's video by its iterations first.** A project an article's iteration made (`projectDir`) is that article's, and no other article matches it by slug, so a generated article no longer lists its own `…/i1` as "possible"; `current.video` picks the one its Cut opens, and a project outside the reports root is listed as not reachable here. Then a manifest's `article`, then a unique slug in the article's workspace — the only step that can be ambiguous.
-- **umtool's front door is the Inbox: the calls waiting on you, in one list.** `/` shows one number — the calls waiting on active pieces — and a line under it (rows, pieces ready to finish, quiet, hidden), then the cards: Your call → Review → Blocking → Notes → Open → Ready to finish, with Quiet folded. A card is one piece and one kind of decision (483 unadjudicated claims on one video are one card) with its count and ONE action named for its result ("Make i1 current", "Adjudicate claim", "Answer note"); `j` / `k` move the lit card, and the lit card's action is the filled one. **Park** and **Mark done** (on a piece that looks done) set the piece's lifecycle, with **Undo** for a few seconds; **Show hidden** lists the calls on parked and done pieces with **Reactivate**. **Mute** hides a card in this browser only (**Muted N** shows them). A required tool missing at the last check, or a disk under 5 GB free, is a card too. `/?from=<channel>/<id>` (the editor's "make a video") still opens the new-project form prefilled. Needs a restart of umtool.
+- **umtool's front door is the Inbox: the calls waiting on you, in one list.** `/` shows one number — the calls waiting on active pieces — and a line under it (rows, pieces ready to finish, quiet, hidden), then the cards: Your call → Review → Blocking → Notes → Open → Ready to finish, with Quiet folded. A card is one piece and one kind of decision (483 unadjudicated claims on one video are one card) with its count and ONE action named for its result ("Make i1 current", "Adjudicate claim", "Answer note"); `j` / `k` move the lit card, and the lit card's action is the filled one. **Park** and **Mark done** (on a piece that looks done) set the piece's lifecycle, with **Undo** for a few seconds; **Show hidden** lists the calls on parked and done pieces with **Reactivate**. **Mute** stops showing one kind of call on one piece (kept in `REPORTS_ROOT/.umtool/mutes.json` beside the lifecycle; `POST /api/pieces/mute {piece, kind, muted}`): its rows stay in the decisions API, `hidden` with `hiddenBy: "muted"`, and **Muted N** lists them with **Unmute**. A required tool missing at the last check, or a disk under 5 GB free, is a card too. `/?from=<channel>/<id>` (the editor's "make a video") still opens the new-project form prefilled. Needs a restart of umtool.
- **umtool: Work lists every piece.** `/work` is every article (with the video projects made from it) and every project no article claims, one lit line each: its stage on a four-step bar, what it is, its lifecycle and how many calls wait on it, with **Park**, **Mark done** and **Reactivate** on the line. Facets: stage, kind, site, lifecycle (active by default) and a search (`/` puts the cursor there); **By site** groups by site, each site's name linking its page. It reads the old lists' keys, so an old link lands on the same set.
-- **umtool's addresses moved, and every old one redirects.** `/browse` → `/work`; `/browse/<project>[/…]` → `/projects/<project>[/…]` (cuts, clip and claim benches, takes, narration, review); `/browse/decisions` → `/`; `/browse/find`, `/browse/faces`, `/browse/sources`, `/browse/trim/<set>` → `/tools/…`; `/mix` → `/tools/mix`; `/sort`, `/salvage`, `/verify`, `/keeps` → `/tools/song/<pile>`; `/bench` → `/tools/bench`; `/articles` → `/work?kind=article`; `/sites` → `/work?by=site`. Redirects are temporary (307) and keep the query string, so a decision's `…?note=<id>` link and every bookmark still land. `/projects` is the project grid by folder (the old `/browse` page, with **+ new project**); `/tools` and `/tools/song` list the tools; `/sites/<site>` and the article pages are unchanged. A project named `find`, `faces`, `sources`, `trim` or `decisions` is no longer shadowed by a tool page; only `at` (`/projects/at?path=`, for a name that cannot be a URL) is reserved.
+- **umtool's addresses moved, and every old one redirects.** `/browse` → `/work`; `/browse/<project>[/…]` → `/projects/<project>[/…]` (cuts, clip and claim benches, takes, narration, review); `/browse/decisions` → `/`; `/browse/find`, `/browse/faces`, `/browse/sources`, `/browse/trim/<set>` → `/tools/…`; `/mix` → `/tools/mix`; `/sort`, `/salvage`, `/verify`, `/keeps` → `/tools/song/<pile>`; `/bench` → `/tools/bench`; `/articles` → `/work?kind=article&site=articles` (the store's articles, as before); `/sites` → `/work?by=site`. Redirects are temporary (307) and keep the query string, so a decision's `…?note=<id>` link and every bookmark still land. `/projects` is the project grid by folder (the old `/browse` page, with **+ new project**); `/tools` and `/tools/song` list the tools; `/sites/<site>` and the article pages are unchanged. A project named `find`, `faces`, `sources`, `trim` or `decisions` is no longer shadowed by a tool page; only `at` (`/projects/at?path=`, for a name that cannot be a URL) is reserved.
- **umtool: the rail is Inbox · Research · Work · Tools · Settings, and ⌘K jumps anywhere.** Inbox and Work show their counts; Tools opens into its tools (find, mix, the song piles, faces, sources, the verdict bench) while you are in one; Settings is `/settings/system`, which holds the old dashboard's panels (tools and disk, recent jobs, project states, sources, deliverables) and links the generation policy. ⌘K (or Ctrl+K), from any page including a bench, opens a jump list of every piece, place, tool and create action: type to narrow, ↑ / ↓, Enter. Research is linked ahead of its page. The "resume" chip on the Inbox offers where an old remembered address lands now.
- **Articles, iterations, report-video projects and takes can be deleted, and every delete shows its plan first.** `archilyzer reports delete <id>` prints what would go — each path with its size, what is kept and why, and anything that stops it — and deletes nothing until `--apply`; `--iteration <n>` deletes one iteration. Deleting an article removes its directory (report, video, history, notes, iterations), each iteration's video project under `settings.generation.projectsRoot` and its staged exports. A published article is refused unless `--force`, which unpublishes it first; an article with a running iteration is always refused. An iteration is refused while it is the current article or video, the one the article's report came from, running, or the parent or original of another iteration, and its number is never given out again. The usage ledger, the shared prepared-media cache and the corpus's git history are kept. The same deletes run over HTTP as `pnpm ops delete-article {id, force?, dryRun?}` and `pnpm ops delete-iteration {id, n, dryRun?}`, which answer a refusal as a 409 with the plan.
- **umtool: Delete article, `Delete i<n>`, Delete project and `Delete take <id>`.** Each button reads the plan, shows it (what goes with sizes, what is kept, what refuses) and deletes only on **Confirm delete**; **Keep it** closes it. **Delete article** is on an article's page (one in the making too) and returns to `/articles`, which says what went; `Delete i<n>` is on each iteration of the Iterations tab. **Delete project** on a report-video project removes its directory, and its `out/` or deliverables on the media drive when they are its own copy; it is refused while a job works in the project, for an article's current video, and — unless you tick **delete anyway** — for a project whose manifest names an article with a video attached. `Delete take <id>` removes `takes/<id>/`; the take whose manifest is the project's own needs **delete anyway**, and its verdict and notes are kept.
diff --git a/umtool/app/api/pieces/mute/route.ts b/umtool/app/api/pieces/mute/route.ts
@@ -0,0 +1,38 @@
+import { MuteError, setMute } from "@/lib/mutes";
+import { parsePieceId, readPieceGraph } from "@/lib/pieces";
+import { clearRailCounts } from "@/lib/rail";
+
+export const dynamic = "force-dynamic";
+
+// Mute or unmute one kind of call on one piece (lib/mutes.ts): the Inbox stops
+// (or starts again) showing it. Not a ruling: the rows stay in the decisions
+// API, `hidden` with `hiddenBy: "muted"`.
+//
+// POST { piece: "a:<site>/<report>" | "p:<project>", kind: "<decision kind>", muted: true | false }
+// → { piece, kind, muted, at }
+//
+// 400 for a body that is not a piece id, a kind and a boolean; 404 for a piece
+// nothing on disk is (a research case `c:` has no inbox); 409 when mutes.json
+// does not parse (it is never overwritten).
+const NO_STORE = { "cache-control": "no-store" };
+const fail = (status: number, error: string) => Response.json({ error }, { status, headers: NO_STORE });
+
+export async function POST(request: Request) {
+ const body = (await request.json().catch(() => null)) as { piece?: unknown; kind?: unknown; muted?: unknown } | null;
+ if (!body || typeof body !== "object") return fail(400, "the body is { piece, kind, muted }");
+ const parsed = parsePieceId(body.piece);
+ if (!parsed) return fail(400, `not a piece id: ${JSON.stringify(body.piece ?? null)} (a:<site>/<report> or p:<project>)`);
+ if (typeof body.kind !== "string") return fail(400, `kind is a decision kind, not ${JSON.stringify(body.kind ?? null)}`);
+ if (typeof body.muted !== "boolean") return fail(400, `muted is true or false, not ${JSON.stringify(body.muted ?? null)}`);
+ if (parsed.kind === "case") return fail(404, "research cases have no inbox");
+ const graph = await readPieceGraph();
+ if (!graph.byId.has(body.piece as string)) return fail(404, `no piece ${body.piece}`);
+ try {
+ const e = await setMute(body.piece as string, body.kind, body.muted);
+ clearRailCounts();
+ return Response.json(e, { headers: NO_STORE });
+ } catch (err) {
+ if (err instanceof MuteError) return fail((err as MuteError & { status: number }).status, err.message);
+ return fail(500, (err as Error).message);
+ }
+}
diff --git a/umtool/app/page.tsx b/umtool/app/page.tsx
@@ -8,7 +8,7 @@ import { buttonVariants } from "@/components/ui/button";
import { Panel } from "@/components/ui/panel";
import { machineCalls } from "@/lib/machine";
import { homeHref, systemHref } from "@/lib/hrefs";
-import { readInbox, type GroupCard } from "@/lib/inbox";
+import { readInbox, type GroupCard, type GroupSummary } from "@/lib/inbox";
import { summarizeGroups } from "@/lib/inbox/groups.mjs";
import { headlineNote, inboxHeadline } from "@/lib/inbox/headline.mjs";
import { KINDS } from "@/lib/projects";
@@ -31,7 +31,8 @@ export const dynamic = "force-dynamic";
// `?from=<slug>/<id>` is the editor's "make a video" hand-off (VideoPanel,
// VideoNavStrip). Until /create (P5) it opens the new-project form here,
// prefilled, as the dashboard did. `?hidden=1` lists the calls on parked and
-// done pieces, each with Reactivate.
+// done pieces, each with Reactivate; `?muted=1` the muted ones (lib/mutes.ts),
+// each with Unmute.
// ---------------------------------------------------------------------------
/** What a decision kind is, in a few words after the piece's title. */
@@ -96,7 +97,7 @@ async function machineCards(): Promise<InboxCard[]> {
}));
}
-function toCard(group: string, c: GroupCard, lifecycle: LifecycleState): InboxCard {
+function toCard(group: string, c: GroupCard, lifecycle: LifecycleState, muted = false): InboxCard {
return {
key: `${group}:${c.piece ?? c.project}:${c.kind}`,
piece: c.piece,
@@ -108,16 +109,25 @@ function toCard(group: string, c: GroupCard, lifecycle: LifecycleState): InboxCa
severity: c.severity,
action: c.action,
lifecycle,
+ ...(muted ? { muted } : {}),
finish: c.kind === "looks-done",
};
}
+/** Hidden rows of one reason, as cards of their own: grouped the way the Inbox groups. */
+function hiddenCards(items: Decision[], keep: (d: Decision) => boolean, lifeOf: Map<string, LifecycleState>, prefix: string, muted: boolean): InboxCard[] {
+ const rows = items.filter((d) => d.hidden && keep(d)).map((d) => ({ ...d, hidden: false })) as Decision[];
+ return (summarizeGroups(rows) as GroupSummary[]).flatMap((g) =>
+ g.cards.map((c) => toCard(`${prefix}-${g.id}`, c, c.piece ? (lifeOf.get(c.piece) ?? "active") : "active", muted)),
+ );
+}
+
export default async function Inbox({
searchParams,
}: {
- searchParams: Promise<{ from?: string; hidden?: string }>;
+ searchParams: Promise<{ from?: string; hidden?: string; muted?: string }>;
}) {
- const { from, hidden: showHidden } = await searchParams;
+ const { from, hidden: showHidden, muted: showMuted } = await searchParams;
const inbox = await readInbox();
const lifeOf = new Map<string, LifecycleState>();
for (const d of inbox.items) if (d.piece && d.lifecycle) lifeOf.set(d.piece, d.lifecycle as LifecycleState);
@@ -139,23 +149,17 @@ export default async function Inbox({
groups.map((g) => ({ ...g, decisions: g.decisions + (g.id === "blocking" ? machine.reduce((n, c) => n + c.count, 0) : 0) })),
);
- // The calls on parked and done pieces, as cards of their own: grouped the
- // same way, every one with Reactivate.
- let hiddenGroup: InboxGroup | null = null;
+ // The calls on parked and done pieces, and the muted ones, as groups of
+ // their own at the end, every card with its way back.
+ const parkedN = inbox.hidden - inbox.muted;
+ const extra: InboxGroup[] = [];
+ if (showMuted) {
+ const cards = hiddenCards(inbox.items, (d) => d.hiddenBy === "muted", lifeOf, "muted", true);
+ extra.push({ id: "muted", label: "Muted", note: "muted here; every count but the cards still has them", collapsed: false, decisions: inbox.muted, hidden: 0, cards });
+ }
if (showHidden) {
- const rows = inbox.items.filter((d) => d.hidden).map((d) => ({ ...d, hidden: false })) as Decision[];
- const cards = (summarizeGroups(rows) as typeof inbox.groups).flatMap((g) =>
- g.cards.map((c) => toCard(`hidden-${g.id}`, c, c.piece ? (lifeOf.get(c.piece) ?? "parked") : "parked")),
- );
- hiddenGroup = {
- id: "hidden",
- label: "Hidden",
- note: "on parked and done pieces",
- collapsed: false,
- decisions: rows.length,
- hidden: 0,
- cards,
- };
+ const cards = hiddenCards(inbox.items, (d) => d.hiddenBy === "parked" || d.hiddenBy === "done", lifeOf, "hidden", false);
+ extra.push({ id: "hidden", label: "Hidden", note: "on parked and done pieces", collapsed: false, decisions: parkedN, hidden: 0, cards });
}
const kinds = KINDS.map((k) => ({ id: k.id, label: k.label, scaffold: k.scaffold }));
@@ -168,14 +172,26 @@ export default async function Inbox({
actions={
<>
<ResumeChip />
- {inbox.hidden > 0 && (
+ {inbox.muted > 0 && (
+ <Link
+ href={homeHref({ muted: !showMuted, hidden: !!showHidden })}
+ prefetch={false}
+ data-show-muted={showMuted ? "1" : "0"}
+ aria-pressed={!!showMuted}
+ className={buttonVariants({ variant: "quiet", size: "md" })}
+ >
+ {showMuted ? "Hide muted" : `Muted ${inbox.muted}`}
+ </Link>
+ )}
+ {parkedN > 0 && (
<Link
- href={homeHref({ hidden: !showHidden })}
+ href={homeHref({ hidden: !showHidden, muted: !!showMuted })}
+ prefetch={false}
data-show-hidden={showHidden ? "1" : "0"}
aria-pressed={!!showHidden}
className={buttonVariants({ variant: "quiet", size: "md" })}
>
- {showHidden ? "Hide hidden" : `Show hidden ${inbox.hidden}`}
+ {showHidden ? "Hide hidden" : `Show hidden ${parkedN}`}
</Link>
)}
</>
@@ -193,6 +209,11 @@ export default async function Inbox({
{inbox.lifecycleError} — every piece reads as active until it is fixed.
</p>
)}
+ {inbox.mutesError && (
+ <p role="alert" className="mb-3 text-[12.5px] text-reject-text">
+ {inbox.mutesError} — nothing reads as muted until it is fixed.
+ </p>
+ )}
<div className="mb-1 mt-1 flex items-end gap-3.5" data-inbox-count={head.calls}>
<span className="display text-[72px] font-[850] leading-[0.8]">{head.calls}</span>
@@ -204,7 +225,7 @@ export default async function Inbox({
</span>
</div>
- <InboxList groups={hiddenGroup ? [...groups, hiddenGroup] : groups} />
+ <InboxList groups={[...groups, ...extra]} />
</main>
<UndoBar />
</div>
diff --git a/umtool/components/dashboard/InboxList.tsx b/umtool/components/dashboard/InboxList.tsx
@@ -1,13 +1,12 @@
"use client";
import Link from "next/link";
-import { useEffect, useMemo, useState } from "react";
+import { useState } from "react";
import { buttonVariants } from "@/components/ui/button";
import { LitList } from "@/components/ui/lit-list";
import { LitActions, LitGroup, LitLine } from "@/components/ui/lit-line";
-import { useHydrated } from "@/components/ui/use-hydrated";
import { cn } from "@/lib/utils";
-import { LifecycleButton, type LifecycleState } from "./Lifecycle";
+import { LifecycleButton, MuteButton, type LifecycleState } from "./Lifecycle";
// ---------------------------------------------------------------------------
// The Inbox's cards as ONE lit list (canvas "Inbox"): a group head, then a
@@ -15,11 +14,10 @@ import { LifecycleButton, type LifecycleState } from "./Lifecycle";
// primary action (filled Signal on the lit line only, app/globals.css
// `.lit-go`), then Park and Mute.
//
-// Mute is this browser's: a card muted here (`umtool:inbox-muted`, piece and
-// kind) is left out until it is unmuted from "Muted N". It is a way to stop
-// looking at something, not a ruling -- the decision stays in the API and in
-// every count but the big one's cards. Park and Mark done are the piece's
-// lifecycle (lib/lifecycle.ts), which everything reads.
+// Park and Mark done are the piece's lifecycle (lib/lifecycle.ts); Mute is one
+// kind of call on one piece (lib/mutes.ts, beside it). Both are the server's,
+// so every page and the API agree; a muted or parked card is listed again under
+// "Muted N" / "Show hidden" with Unmute / Reactivate.
// ---------------------------------------------------------------------------
export type InboxCard = {
@@ -34,6 +32,8 @@ export type InboxCard = {
action: { label: string; href: string };
/** The piece's lifecycle (a hidden card's is parked or done). */
lifecycle: LifecycleState;
+ /** This kind of call is muted on the piece: the action is Unmute. */
+ muted?: boolean;
/** Mark done is the action (POST), not a link. */
finish?: boolean;
};
@@ -48,127 +48,73 @@ export type InboxGroup = {
cards: InboxCard[];
};
-const MUTE_KEY = "umtool:inbox-muted";
-
-function readMuted(): string[] {
- try {
- const raw = JSON.parse(localStorage.getItem(MUTE_KEY) ?? "[]");
- return Array.isArray(raw) ? raw.filter((x): x is string => typeof x === "string") : [];
- } catch {
- return [];
- }
-}
-function writeMuted(keys: string[]) {
- try {
- localStorage.setItem(MUTE_KEY, JSON.stringify(keys));
- } catch {
- /* not remembering a mute is not an error */
- }
-}
-
-/** A card's mute key: the piece (or project) and the kind, not the group. */
-export const muteKey = (c: Pick<InboxCard, "piece" | "kind" | "key">) => `${c.piece ?? c.key}\u0000${c.kind}`;
-
export default function InboxList({ groups }: { groups: InboxGroup[] }) {
- const hydrated = useHydrated();
- const [muted, setMuted] = useState<string[]>([]);
- const [showMuted, setShowMuted] = useState(false);
const [open, setOpen] = useState<Record<string, boolean>>({});
- useEffect(() => setMuted(readMuted()), []);
-
- const all = useMemo(() => groups.flatMap((g) => g.cards), [groups]);
- const mutedHere = all.filter((c) => muted.includes(muteKey(c)));
- const toggleMute = (c: InboxCard) => {
- const k = muteKey(c);
- const next = muted.includes(k) ? muted.filter((x) => x !== k) : [...muted, k];
- setMuted(next);
- writeMuted(next);
- };
-
- const shown = groups
- .map((g) => ({
- ...g,
- cards: g.cards.filter((c) => showMuted === muted.includes(muteKey(c))),
- }))
- .filter((g) => g.cards.length > 0);
+ const shown = groups.filter((g) => g.cards.length > 0);
+ if (shown.length === 0) {
+ return (
+ <p data-empty="" className="py-6 text-[12.5px] text-text-2">
+ Nothing waiting on you
+ </p>
+ );
+ }
return (
- <>
- <div className="mb-2 flex items-center justify-end gap-2">
- {(mutedHere.length > 0 || showMuted) && (
+ <LitList label="Inbox" global>
+ {shown.map((g) =>
+ g.collapsed && !open[g.id] ? (
<button
+ key={g.id}
type="button"
- disabled={!hydrated}
- aria-pressed={showMuted}
- data-show-muted={showMuted ? "1" : "0"}
- onClick={() => setShowMuted((v) => !v)}
- className={buttonVariants({ variant: "quiet", size: "sm" })}
+ data-group={g.id}
+ data-collapsed=""
+ aria-expanded={false}
+ onClick={() => setOpen((o) => ({ ...o, [g.id]: true }))}
+ className="mt-[18px] flex w-full items-center gap-2.5 border-b border-seam py-2 pl-5 pr-3 text-left text-[12.5px] text-muted-2 hover:text-text"
>
- {showMuted ? "Back to the inbox" : `Muted ${mutedHere.length}`}
+ <span className="micro">{g.label}</span>
+ <span className="font-mono text-[12px] text-meter">{g.decisions}</span>
+ <span className="truncate">{g.note}</span>
+ <span aria-hidden="true" className="ml-auto">
+ ▸
+ </span>
</button>
- )}
- </div>
- {shown.length === 0 ? (
- <p data-empty="" className="py-6 text-[12.5px] text-text-2">
- {showMuted ? "Nothing muted" : "Nothing waiting on you"}
- </p>
- ) : (
- <LitList label="Inbox" global>
- {shown.map((g) =>
- g.collapsed && !open[g.id] && !showMuted ? (
- <button
- key={g.id}
- type="button"
- data-group={g.id}
- data-collapsed=""
- aria-expanded={false}
- onClick={() => setOpen((o) => ({ ...o, [g.id]: true }))}
- className="mt-[18px] flex w-full items-center gap-2.5 border-b border-seam py-2 pl-5 pr-3 text-left text-[12.5px] text-muted-2 hover:text-text"
- >
- <span className="micro">{g.label}</span>
- <span className="font-mono text-[12px] text-meter">{g.decisions}</span>
- <span className="truncate">{g.note}</span>
- <span aria-hidden="true" className="ml-auto">
- ▸
- </span>
- </button>
- ) : (
- <LitGroup
- key={g.id}
- data-group={g.id}
- className="mt-[18px]"
- title={g.label}
- count={g.cards.length}
- note={
- g.collapsed && !showMuted ? (
- <button type="button" onClick={() => setOpen((o) => ({ ...o, [g.id]: false }))} className="hover:text-text">
- collapse ▾
- </button>
- ) : (
- g.note
- )
- }
- >
- {g.cards.map((c) => (
- <Card key={c.key} card={c} muted={muted.includes(muteKey(c))} onMute={() => toggleMute(c)} />
- ))}
- </LitGroup>
- ),
- )}
- </LitList>
+ ) : (
+ <LitGroup
+ key={g.id}
+ data-group={g.id}
+ className="mt-[18px]"
+ title={g.label}
+ count={g.cards.length}
+ note={
+ g.collapsed ? (
+ <button type="button" onClick={() => setOpen((o) => ({ ...o, [g.id]: false }))} className="hover:text-text">
+ collapse ▾
+ </button>
+ ) : (
+ g.note
+ )
+ }
+ >
+ {g.cards.map((c) => (
+ <Card key={c.key} card={c} />
+ ))}
+ </LitGroup>
+ ),
)}
- </>
+ </LitList>
);
}
-function Card({ card: c, muted, onMute }: { card: InboxCard; muted: boolean; onMute: () => void }) {
- const hidden = c.lifecycle !== "active";
+function Card({ card: c }: { card: InboxCard }) {
+ const parked = c.lifecycle !== "active";
return (
<LitLine
id={c.key}
data-card={c.kind}
data-piece={c.piece ?? undefined}
data-severity={c.severity}
+ data-muted={c.muted ? "" : undefined}
className="grid grid-cols-[minmax(0,1fr)_56px_190px_112px] items-center gap-x-3.5"
>
<div className="min-w-0">
@@ -181,7 +127,9 @@ function Card({ card: c, muted, onMute }: { card: InboxCard; muted: boolean; onM
{c.count}
</span>
<span className="justify-self-end">
- {hidden && c.piece ? (
+ {c.muted && c.piece ? (
+ <MuteButton piece={c.piece} kind={c.kind} title={c.title} muted variant="outline" size="md" className="lit-go" />
+ ) : parked && c.piece ? (
<LifecycleButton piece={c.piece} title={c.title} from={c.lifecycle} to="active" label="Reactivate" variant="outline" size="md" className="lit-go" />
) : c.finish && c.piece ? (
<LifecycleButton piece={c.piece} title={c.title} from={c.lifecycle} to="done" label="Mark done" variant="outline" size="md" className="lit-go" />
@@ -192,12 +140,12 @@ function Card({ card: c, muted, onMute }: { card: InboxCard; muted: boolean; onM
)}
</span>
<LitActions className="gap-0.5">
- {!hidden && c.piece && (
- <LifecycleButton piece={c.piece} title={c.title} from={c.lifecycle} to="parked" label="Park" />
+ {!parked && !c.muted && c.piece && (
+ <>
+ <LifecycleButton piece={c.piece} title={c.title} from={c.lifecycle} to="parked" label="Park" />
+ <MuteButton piece={c.piece} kind={c.kind} title={c.title} muted={false} label={c.finish ? "Not yet" : "Mute"} />
+ </>
)}
- <button type="button" data-mute="" aria-pressed={muted} onClick={onMute} className={buttonVariants({ variant: "quiet", size: "sm" })}>
- {muted ? "Unmute" : c.finish ? "Not yet" : "Mute"}
- </button>
</LitActions>
</LitLine>
);
diff --git a/umtool/components/dashboard/Lifecycle.tsx b/umtool/components/dashboard/Lifecycle.tsx
@@ -7,27 +7,31 @@ import { useHydrated } from "@/components/ui/use-hydrated";
import { cn } from "@/lib/utils";
// ---------------------------------------------------------------------------
-// A piece's lifecycle, from a list: Park, Mark done, Reactivate
-// (POST /api/pieces/lifecycle). Reversible, so no plan-then-confirm: the page's
+// A piece's lifecycle and its mutes, from a list: Park, Mark done, Reactivate
+// (POST /api/pieces/lifecycle), Mute / Unmute one kind of call on it
+// (POST /api/pieces/mute). Reversible, so no plan-then-confirm: the page's
// <UndoBar> offers the way back for a few seconds instead.
//
-// The button says what it did by an event the bar hears (`umtool:lifecycle`),
+// A button says what it did by an event the bar hears (`umtool:lifecycle`),
// because the line it sat on is gone after the refresh -- a parked piece's
-// calls are hidden.
+// calls, and a muted kind, are hidden.
// ---------------------------------------------------------------------------
export type LifecycleState = "active" | "parked" | "done";
-type Change = { piece: string; title: string; from: LifecycleState; to: LifecycleState };
+/** What was done, and the POST that takes it back. */
+type Change = { piece: string; title: string; word: string; undo: { url: string; body: Record<string, unknown> } };
const EVENT = "umtool:lifecycle";
const DONE_WORD: Record<LifecycleState, string> = { active: "Reactivated", parked: "Parked", done: "Marked done" };
+const LIFECYCLE = "/api/pieces/lifecycle";
+const MUTE = "/api/pieces/mute";
-async function post(piece: string, state: LifecycleState): Promise<string | null> {
+async function send(url: string, body: Record<string, unknown>): Promise<string | null> {
try {
- const res = await fetch("/api/pieces/lifecycle", {
+ const res = await fetch(url, {
method: "POST",
headers: { "content-type": "application/json" },
- body: JSON.stringify({ piece, state }),
+ body: JSON.stringify(body),
cache: "no-store",
});
if (res.ok) return null;
@@ -73,13 +77,14 @@ export function LifecycleButton({
onClick={async () => {
setBusy(true);
setError(null);
- const err = await post(piece, to);
+ const err = await send(LIFECYCLE, { piece, state: to });
setBusy(false);
if (err) {
setError(err);
return;
}
- window.dispatchEvent(new CustomEvent<Change>(EVENT, { detail: { piece, title, from, to } }));
+ const detail: Change = { piece, title, word: DONE_WORD[to], undo: { url: LIFECYCLE, body: { piece, state: from } } };
+ window.dispatchEvent(new CustomEvent<Change>(EVENT, { detail }));
router.refresh();
}}
>
@@ -94,6 +99,65 @@ export function LifecycleButton({
);
}
+/** Mute (or Unmute) one kind of call on a piece: the server's, beside the lifecycle. */
+export function MuteButton({
+ piece,
+ kind,
+ title,
+ muted,
+ label,
+ variant = "quiet",
+ size = "sm",
+ className,
+}: {
+ piece: string;
+ kind: string;
+ title: string;
+ /** Muted now: the button unmutes. */
+ muted: boolean;
+ label?: string;
+ variant?: ButtonVariants["variant"];
+ size?: ButtonVariants["size"];
+ className?: string;
+}) {
+ const hydrated = useHydrated();
+ const router = useRouter();
+ const [busy, setBusy] = useState(false);
+ const [error, setError] = useState<string | null>(null);
+ return (
+ <>
+ <button
+ type="button"
+ disabled={!hydrated || busy}
+ data-mute={muted ? "unmute" : "mute"}
+ aria-pressed={muted}
+ title={error ?? undefined}
+ className={cn(buttonVariants({ variant, size }), error && "text-reject-text", className)}
+ onClick={async () => {
+ setBusy(true);
+ setError(null);
+ const err = await send(MUTE, { piece, kind, muted: !muted });
+ setBusy(false);
+ if (err) {
+ setError(err);
+ return;
+ }
+ const detail: Change = { piece, title, word: muted ? "Unmuted" : "Muted", undo: { url: MUTE, body: { piece, kind, muted } } };
+ window.dispatchEvent(new CustomEvent<Change>(EVENT, { detail }));
+ router.refresh();
+ }}
+ >
+ {busy ? "…" : (label ?? (muted ? "Unmute" : "Mute"))}
+ </button>
+ {error && (
+ <span role="alert" className="text-[11.5px] text-reject-text">
+ {error}
+ </span>
+ )}
+ </>
+ );
+}
+
/** "Parked Quartering diet · Undo", for eight seconds after a change. */
export function UndoBar() {
const router = useRouter();
@@ -118,11 +182,10 @@ export function UndoBar() {
<div
role="status"
data-undo={last.piece}
- data-undo-to={last.from}
className="fixed bottom-4 left-1/2 z-30 flex -translate-x-1/2 items-center gap-3 rounded-[3px] border border-seam-2 bg-panel-2 px-3.5 py-2 text-[12.5px] text-text shadow-lg"
>
<span>
- {DONE_WORD[last.to]} <b className="font-medium">{last.title}</b>
+ {last.word} <b className="font-medium">{last.title}</b>
</span>
<button
type="button"
@@ -130,7 +193,7 @@ export function UndoBar() {
className={buttonVariants({ variant: "outline", size: "sm" })}
onClick={async () => {
setBusy(true);
- const err = await post(last.piece, last.from);
+ const err = await send(last.undo.url, last.undo.body);
setBusy(false);
if (err) {
setError(err);
diff --git a/umtool/e2e/articles.spec.ts b/umtool/e2e/articles.spec.ts
@@ -20,7 +20,7 @@ const NOTES = path.join(HERE, "..", ".e2e-song", "articles", "delta", "notes.jso
test.beforeAll(async ({ playwright }) => {
test.setTimeout(WARM_TIMEOUT);
await warm(playwright, [
- "/work?kind=article",
+ "/work?kind=article&site=articles",
"/articles/delta",
"/articles/delta/evidence",
"/api/notes?article=articles/delta",
@@ -30,13 +30,13 @@ test.beforeAll(async ({ playwright }) => {
test.beforeEach(() => rmSync(NOTES, { force: true }));
test.afterAll(() => rmSync(NOTES, { force: true }));
-test("/articles is Work's articles; the store is its site facet, each article with its status and audience", async ({ page }) => {
+test("/articles is Work's store articles (site facet `articles`), each with its status and audience", async ({ page }) => {
const res = await page.goto("/articles");
expect(res?.status()).toBe(200);
- await expect(page).toHaveURL(/\/work\?kind=article$/);
+ await expect(page).toHaveURL(/\/work\?kind=article&site=articles$/);
await expect(page.locator("[data-app-rail] [data-place=work]")).toHaveAttribute("aria-current", "page");
- await page.locator("[data-facet=site]").getByRole("link", { name: /^articles \d+$/ }).click();
- await expect(page).toHaveURL(/site=articles/);
+ // Only the store's articles: no site's report is listed.
+ expect(await page.locator("[data-lit-line][data-piece]").evaluateAll((els) => els.every((e) => e.getAttribute("data-piece")!.startsWith("a:articles/")))).toBe(true);
// The store has no site page of its own.
await expect(page.locator("[data-site-page]")).toHaveCount(0);
const delta = page.locator("[data-piece='a:articles/delta']");
diff --git a/umtool/e2e/inbox.spec.ts b/umtool/e2e/inbox.spec.ts
@@ -12,7 +12,8 @@ import { warm, WARM_TIMEOUT } from "./warm";
// ranked, as one lit list, each with ONE primary action, Park and Mute.
//
// WRITES the fixture's REPORTS_ROOT/.umtool/lifecycle.json (zeta and
-// polemic-alpha parked or done, then active again) and this browser's mutes.
+// polemic-alpha parked or done, then active again) and mutes.json (zeta's
+// ready iterations muted, then unmuted).
// ---------------------------------------------------------------------------
const HERE = path.dirname(fileURLToPath(import.meta.url));
@@ -133,23 +134,54 @@ test("Mark done on a piece that looks done takes it off the Inbox; Undo puts it
}
});
-test("Mute is this browser's: a muted card leaves, Muted N shows it, Unmute brings it back", async ({ page }) => {
- await page.goto(urls.homeHref());
- const ready = card(page, ZETA, "iteration-ready");
- await expect(ready).toBeVisible();
- await expect(page.locator("[data-lit-list]").first()).toHaveAttribute("data-hydrated", "");
- await ready.click();
- await ready.locator("[data-mute]").click();
- await expect(ready).toHaveCount(0);
- // A reload keeps it muted: it is remembered here, not on the server.
- await page.reload();
- await expect(card(page, ZETA, "iteration-ready")).toHaveCount(0);
- await page.locator("[data-show-muted]").click();
- await expect(card(page, ZETA, "iteration-ready")).toBeVisible();
- await card(page, ZETA, "iteration-ready").locator("[data-mute]").click();
- await page.locator("[data-show-muted]").click();
- await expect(card(page, ZETA, "iteration-ready")).toBeVisible();
- await page.evaluate(() => localStorage.removeItem("umtool:inbox-muted"));
+test("Mute is the server's: the card leaves, its rows stay hidden-by-muted, Muted N lists it with Unmute", async ({ page, request }) => {
+ const rows = async () =>
+ ((await (await request.get("/api/browse/decisions")).json()) as { items: { piece?: string; kind: string; hidden: boolean; hiddenBy?: string }[]; muted: number })
+ try {
+ await page.goto(urls.homeHref());
+ const ready = card(page, ZETA, "iteration-ready");
+ await expect(ready).toBeVisible();
+ await expect(page.locator("[data-lit-list]").first()).toHaveAttribute("data-hydrated", "");
+ await ready.click();
+ await ready.locator("[data-mute=mute]").click();
+ await expect(page.locator(`[data-undo='${ZETA}']`)).toContainText("Muted");
+ await expect(ready).toHaveCount(0);
+
+ // Never dropped: every row is still in the API, hidden, and says why.
+ const after = await rows();
+ const zeta = after.items.filter((d) => d.piece === ZETA && d.kind === "iteration-ready");
+ expect(zeta.length).toBeGreaterThan(0);
+ expect(zeta.every((d) => d.hidden && d.hiddenBy === "muted")).toBe(true);
+ expect(after.muted).toBeGreaterThanOrEqual(zeta.length);
+ // The other kinds on the same piece are not muted.
+ expect(after.items.some((d) => d.piece === ZETA && d.kind === "iteration-failed" && !d.hidden)).toBe(true);
+
+ // Another browser (a reload with no storage) sees the same.
+ await page.evaluate(() => localStorage.clear());
+ await page.reload();
+ await expect(card(page, ZETA, "iteration-ready")).toHaveCount(0);
+ await expect(page.locator("[data-show-muted]")).toHaveText(/^Muted \d+$/);
+ await page.locator("[data-show-muted]").click();
+ await expect(page).toHaveURL(/muted=1/);
+ const muted = page.locator(`[data-group=muted] [data-lit-line][data-piece='${ZETA}'][data-card='iteration-ready']`);
+ await expect(muted).toHaveAttribute("data-muted", "");
+ await muted.click();
+ await muted.locator("[data-mute=unmute]").click();
+ await expect(muted).toHaveCount(0);
+ await expect(page.locator(`[data-group=review] [data-lit-line][data-piece='${ZETA}'][data-card='iteration-ready']`)).toBeVisible();
+ expect((await rows()).items.filter((d) => d.piece === ZETA && d.kind === "iteration-ready").every((d) => !d.hidden)).toBe(true);
+ } finally {
+ await request.post("/api/pieces/mute", { data: { piece: ZETA, kind: "iteration-ready", muted: false } });
+ }
+});
+
+test("POST /api/pieces/mute refuses junk", async ({ request }) => {
+ const post = (data: unknown) => request.post("/api/pieces/mute", { data });
+ expect((await post({ piece: "articles/zeta", kind: "iteration-ready", muted: true })).status()).toBe(400);
+ expect((await post({ piece: ZETA, kind: "Not A Kind", muted: true })).status()).toBe(400);
+ expect((await post({ piece: ZETA, kind: "iteration-ready", muted: "yes" })).status()).toBe(400);
+ expect((await post({ piece: ZETA })).status()).toBe(400);
+ expect((await post({ piece: "p:no-such-project", kind: "unbuilt", muted: true })).status()).toBe(404);
});
test("the Inbox opens the new-project form prefilled from ?from= (the editor's hand-off)", async ({ page }) => {
diff --git a/umtool/e2e/shell.spec.ts b/umtool/e2e/shell.spec.ts
@@ -1,5 +1,6 @@
import { test, expect, type Page } from "@playwright/test";
import * as urls from "./urls";
+import { researchArchiveHref, researchHref } from "../lib/research/hrefs";
// ---------------------------------------------------------------------------
// The shell (plans/umtool-redesign.md, P1, P3): the rail on every page --
@@ -15,6 +16,9 @@ const place = (page: Page, id: string) => rail(page).locator(`nav[aria-label=Mai
// place's own page, "true" on a page under it.
const PLACES: { url: string; lit: string; current: "page" | "true" }[] = [
{ url: urls.homeHref(), lit: "inbox", current: "page" },
+ // Research (R1): both its pages are the place's own.
+ { url: researchHref(), lit: "research", current: "page" },
+ { url: researchArchiveHref(), lit: "research", current: "page" },
{ url: urls.workHref(), lit: "work", current: "page" },
{ url: urls.projectsHref(), lit: "work", current: "true" },
{ url: urls.articleHref({ site: "articles", id: "delta" }), lit: "work", current: "true" },
@@ -42,8 +46,7 @@ test("the rail's places, in order, with Research beside them and counts in Meter
await page.goto(urls.homeHref());
const places = rail(page).locator("nav[aria-label=Main] > a[data-place]");
await expect(places).toHaveText([/^Inbox/, "Research", /^Work/, "Tools", "Settings"]);
- // Research is R1's; the rail links it whether or not this build has it.
- await expect(place(page, "research")).toHaveAttribute("href", urls.researchHref());
+ await expect(place(page, "research")).toHaveAttribute("href", researchHref());
await expect(place(page, "settings")).toHaveAttribute("href", urls.systemHref());
await expect(rail(page).locator("[data-rail-count=inbox]")).toHaveText(/^\d+$/);
await expect(rail(page).locator("[data-rail-count=work]")).toHaveText(/^\d+$/);
diff --git a/umtool/lib/decisions.ts b/umtool/lib/decisions.ts
@@ -91,6 +91,10 @@ export type Decision = {
lifecycle?: "active" | "parked" | "done";
/** On a parked or done piece: kept in the list, out of the way. */
hidden?: boolean;
+ /** This kind of call is muted on its piece (lib/mutes.mjs). */
+ muted?: boolean;
+ /** Why a hidden row is hidden: its piece is parked or done, or it is muted. */
+ hiddenBy?: "parked" | "done" | "muted";
};
export const SEVERITIES: Severity[] = ["blocking", "open", "info"];
diff --git a/umtool/lib/hrefs.test.mjs b/umtool/lib/hrefs.test.mjs
@@ -55,7 +55,7 @@ test("articles open in the store or on their site", () => {
test("the places: Inbox, Work (and the lists it replaced), Settings", () => {
assert.equal(H.decisionsHref({ severity: "blocking" }), "/");
assert.equal(H.browseHref({ kind: "k1" }), "/work?kind=k1");
- assert.equal(H.articlesHref({ status: "draft" }), "/work?kind=article&status=draft");
+ assert.equal(H.articlesHref({ status: "draft" }), "/work?kind=article&site=articles&status=draft");
assert.equal(H.systemHref(), "/settings/system");
assert.equal(H.researchHref(), "/research");
});
diff --git a/umtool/lib/hrefs.ts b/umtool/lib/hrefs.ts
@@ -72,7 +72,7 @@ type NoteOpt = { note?: string | null };
* (`/?from=<slug>/<id>`, editor VideoPanel/VideoNavStrip): the Inbox opens the
* new-project form prefilled until /create exists (P5).
*/
-export function homeHref(q: { from?: string; hidden?: boolean } = {}): string {
+export function homeHref(q: { from?: string; hidden?: boolean; muted?: boolean } = {}): string {
return withQuery("/", q);
}
@@ -139,9 +139,9 @@ export function decisionsHref(_q: DecisionsQuery = {}): string {
}
export type ArticlesQuery = { status?: string; notes?: string; audience?: string; deleted?: string; freed?: string };
-/** The article store's articles: Work, kind article. */
+/** The article store's articles: Work, kind article, site `articles` (the store). */
export function articlesHref(q: ArticlesQuery = {}): string {
- return workHref({ kind: "article", ...q });
+ return workHref({ kind: "article", site: ARTICLES_KEY, ...q });
}
/** A new article (release 27). */
diff --git a/umtool/lib/inbox.ts b/umtool/lib/inbox.ts
@@ -8,6 +8,7 @@ import { decisionsForSong, type Decision } from "./decisions";
import { openDecisions } from "./projects";
import { pieceOfDecision, readPieceGraph, type Piece, type PieceGraph } from "./pieces";
import { lifecycleOf, readLifecycle, type LifecycleRead } from "./lifecycle";
+import { isMuted, readMutes } from "./mutes";
import { GROUPS, annotate, rankDecisions, summarizeGroups } from "./inbox/groups.mjs";
// ---------------------------------------------------------------------------
@@ -62,9 +63,14 @@ export type GroupSummary = {
export type Inbox = {
items: Decision[];
groups: GroupSummary[];
+ /** Rows hidden for any reason: a parked or done piece, or a mute. */
hidden: number;
+ /** Of those, the muted ones (on active pieces). */
+ muted: number;
/** lifecycle.json could not be read: every piece reads as active. */
lifecycleError?: string;
+ /** mutes.json could not be read: nothing reads as muted. */
+ mutesError?: string;
};
export const INBOX_GROUPS = GROUPS as { id: string; label: string; collapsed: boolean }[];
@@ -224,10 +230,11 @@ export async function diskDecisions(graph: PieceGraph, life: LifecycleRead): Pro
* `?project=`), annotated the same way, with no disk sources added.
*/
export async function readInbox({ project }: { project?: string | null } = {}): Promise<Inbox> {
- const [base, graph, life] = await Promise.all([
+ const [base, graph, life, mutes] = await Promise.all([
project ? decisionsForSong(project) : openDecisions(),
readPieceGraph(),
readLifecycle(),
+ readMutes(),
]);
// A disk source that cannot be read adds nothing; it never hides the rest.
const extra = project ? [] : await diskDecisions(graph, life).catch(() => [] as Decision[]);
@@ -235,12 +242,15 @@ export async function readInbox({ project }: { project?: string | null } = {}):
annotate([...base, ...extra], {
pieceOf: (d: Decision) => pieceOfDecision(d, graph),
lifecycleOf: (id: string) => lifecycleOf(life, id),
+ isMuted: (piece: string, kind: string) => isMuted(mutes, piece, kind),
}),
) as Decision[];
return {
items,
groups: summarizeGroups(items) as GroupSummary[],
hidden: items.filter((d) => d.hidden).length,
+ muted: items.filter((d) => d.hiddenBy === "muted").length,
...(life.error ? { lifecycleError: life.error } : {}),
+ ...(mutes.error ? { mutesError: mutes.error } : {}),
};
}
diff --git a/umtool/lib/inbox/groups.mjs b/umtool/lib/inbox/groups.mjs
@@ -131,24 +131,35 @@ export function actionOf(d) {
/**
* Add the inbox's fields to each row: `piece`, `category`, `group`, `action`,
- * `lifecycle`, `hidden`. Never drops or merges a row.
+ * `lifecycle`, `hidden`, and -- when hidden -- `hiddenBy`, why: the piece is
+ * `parked` or `done` (its lifecycle, which wins), or this kind of call on it is
+ * `muted` (lib/mutes.mjs). Never drops or merges a row.
*
* @template {{ kind: string, severity: string, target: string, href: string, project: string }} D
* @param {D[]} items
- * @param {{ pieceOf: (d: D) => string | null, lifecycleOf: (piece: string) => string }} how
+ * @param {{
+ * pieceOf: (d: D) => string | null,
+ * lifecycleOf: (piece: string) => string,
+ * isMuted?: (piece: string, kind: string) => boolean,
+ * }} how
*/
-export function annotate(items, { pieceOf, lifecycleOf }) {
+export function annotate(items, { pieceOf, lifecycleOf, isMuted = () => false }) {
return items.map((d) => {
const piece = d.piece ?? pieceOf(d);
const lifecycle = piece ? lifecycleOf(piece) : "active";
+ const quiet = lifecycle === "parked" || lifecycle === "done";
+ const muted = !!piece && isMuted(piece, d.kind);
+ const { hiddenBy: _was, ...row } = d;
return {
- ...d,
+ ...row,
...(piece ? { piece } : {}),
category: categoryOf(d),
group: groupOf(d),
action: actionOf(d),
lifecycle,
- hidden: lifecycle === "parked" || lifecycle === "done",
+ muted,
+ hidden: quiet || muted,
+ ...(quiet ? { hiddenBy: lifecycle } : muted ? { hiddenBy: "muted" } : {}),
};
});
}
diff --git a/umtool/lib/inbox/groups.test.mjs b/umtool/lib/inbox/groups.test.mjs
@@ -112,3 +112,28 @@ test("the summary: one card per piece and kind, counts that add up, hidden count
assert.equal(parked.find((g) => g.id === "blocking").decisions, 1);
assert.equal(parked.find((g) => g.id === "blocking").hidden, 483);
});
+
+test("a muted kind on a piece is hidden by `muted`; a parked piece's reason wins", () => {
+ const items = annotate(
+ [row("clip-mid-sentence", "open", { project: "a" }), row("stale-build", "open", { project: "a" }), row("clip-mid-sentence", "open", { project: "b" })],
+ {
+ pieceOf: (d) => `p:${d.project}`,
+ lifecycleOf: (p) => (p === "p:b" ? "parked" : "active"),
+ isMuted: (p, k) => k === "clip-mid-sentence",
+ },
+ );
+ assert.deepEqual(
+ items.map((d) => [d.piece, d.kind, d.hidden, d.hiddenBy ?? null, d.muted]),
+ [
+ ["p:a", "clip-mid-sentence", true, "muted", true],
+ ["p:a", "stale-build", false, null, false],
+ ["p:b", "clip-mid-sentence", true, "parked", true],
+ ],
+ );
+ // Counted as hidden, never dropped, never a card.
+ const g = summarizeGroups(items);
+ assert.equal(g.reduce((n, x) => n + x.decisions + x.hidden, 0), 3);
+ assert.equal(g.flatMap((x) => x.cards).length, 1);
+ // A row with no piece cannot be muted.
+ assert.equal(annotate([row("unbuilt", "open")], { pieceOf: () => null, lifecycleOf: () => "active", isMuted: () => true })[0].hidden, false);
+});
diff --git a/umtool/lib/mutes.mjs b/umtool/lib/mutes.mjs
@@ -0,0 +1,134 @@
+// MUTES: "stop showing me this kind of call on this piece" (plans/umtool-redesign.md,
+// P3 follow-up). Beside the lifecycle, and the same shape of store:
+//
+// REPORTS_ROOT/.umtool/mutes.json
+// { format: "umtool-mutes", version: 1,
+// mutes: { "<piece id>": { "<decision kind>": { at } } } }
+//
+// A mute is not a ruling: the decision stays in the API, one row per decision,
+// marked `hidden` with `hiddenBy: "muted"` (lib/inbox/groups.mjs annotate), and
+// the Inbox lists it under "Muted N" with Unmute. Unmuting removes the entry.
+//
+// STATE, NOT CACHE (the walk skips dot-dirs). One writer, serialised
+// in-process; every write is a whole file to a temp name and a rename. A file
+// that does not parse is never overwritten: a write refuses (409) until it is
+// fixed; a read treats it as "nothing muted" and says so in `error`.
+//
+// Plain ESM, so a CLI and a unit test read it the way the app does.
+import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
+import path from "node:path";
+import { isPieceId } from "./pieces/ids.mjs";
+
+export const MUTES_FORMAT = "umtool-mutes";
+export const MUTES_VERSION = 1;
+
+/** A decision kind: lower-case words and dashes (`claim-unadjudicated`). */
+export const KIND_RE = /^[a-z][a-z0-9-]{0,63}$/;
+
+export class MuteError extends Error {
+ constructor(message, status = 400) {
+ super(message);
+ this.name = "MuteError";
+ this.status = status;
+ }
+}
+
+/** The file under a reports root. */
+export function mutesFile(reportsRoot) {
+ return path.join(/* turbopackIgnore: true */ reportsRoot, ".umtool", "mutes.json");
+}
+
+/**
+ * Every mute: `{ mutes: { [piece]: { [kind]: { at } } }, error? }`. A missing
+ * file is empty; an unreadable one is empty with `error`. Entries that are not a
+ * piece id and a kind are skipped, never fatal.
+ *
+ * @param {string} reportsRoot
+ */
+export async function readMutes(reportsRoot) {
+ let text;
+ try {
+ text = await readFile(/* turbopackIgnore: true */ mutesFile(reportsRoot), "utf8");
+ } catch (err) {
+ if (err?.code === "ENOENT") return { mutes: {} };
+ return { mutes: {}, error: `mutes.json cannot be read: ${err?.message ?? err}` };
+ }
+ let raw;
+ try {
+ raw = JSON.parse(text);
+ } catch (err) {
+ return { mutes: {}, error: `mutes.json is not JSON: ${err.message}` };
+ }
+ if (!raw || typeof raw !== "object" || raw.format !== MUTES_FORMAT || typeof raw.mutes !== "object" || !raw.mutes) {
+ return { mutes: {}, error: "mutes.json is not a umtool-mutes file" };
+ }
+ const mutes = {};
+ for (const [piece, kinds] of Object.entries(raw.mutes)) {
+ if (!isPieceId(piece) || !kinds || typeof kinds !== "object") continue;
+ for (const [kind, e] of Object.entries(kinds)) {
+ if (!KIND_RE.test(kind) || !e || typeof e !== "object") continue;
+ (mutes[piece] ??= {})[kind] = { at: typeof e.at === "string" ? e.at : "" };
+ }
+ }
+ return { mutes };
+}
+
+/** Is this kind of call muted on this piece? */
+export function isMuted(read, piece, kind) {
+ return !!(piece && read?.mutes?.[piece]?.[kind]);
+}
+
+/** How many (piece, kind) pairs are muted. */
+export function muteCount(read) {
+ return Object.values(read?.mutes ?? {}).reduce((n, kinds) => n + Object.keys(kinds).length, 0);
+}
+
+let chain = Promise.resolve();
+
+/**
+ * Mute or unmute one kind of call on one piece. Answers `{ piece, kind, muted, at }`.
+ *
+ * @param {string} reportsRoot
+ * @param {string} piece a piece id (lib/pieces/ids.mjs)
+ * @param {string} kind a decision kind
+ * @param {boolean} muted
+ * @param {{ now?: Date }} [opts]
+ */
+export function setMute(reportsRoot, piece, kind, muted, { now } = {}) {
+ if (!isPieceId(piece)) return Promise.reject(new MuteError(`not a piece id: ${JSON.stringify(piece)}`));
+ if (typeof kind !== "string" || !KIND_RE.test(kind)) return Promise.reject(new MuteError(`not a decision kind: ${JSON.stringify(kind)}`));
+ if (typeof muted !== "boolean") return Promise.reject(new MuteError(`muted is true or false, not ${JSON.stringify(muted)}`));
+ const run = chain.then(() => write(reportsRoot, piece, kind, muted, now ?? new Date()));
+ // The next write waits for this one, whether it failed or not.
+ chain = run.catch(() => {});
+ return run;
+}
+
+async function write(reportsRoot, piece, kind, muted, now) {
+ const file = mutesFile(reportsRoot);
+ const read = await readMutes(reportsRoot);
+ if (read.error) throw new MuteError(`${read.error}; fix or remove ${file} first`, 409);
+ const mutes = structuredClone(read.mutes);
+ const at = now.toISOString();
+ if (muted) (mutes[piece] ??= {})[kind] = { at };
+ else if (mutes[piece]) {
+ delete mutes[piece][kind];
+ if (!Object.keys(mutes[piece]).length) delete mutes[piece];
+ }
+ const sorted = (o) => Object.fromEntries(Object.entries(o).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)));
+ const doc = {
+ format: MUTES_FORMAT,
+ version: MUTES_VERSION,
+ mutes: sorted(Object.fromEntries(Object.entries(mutes).map(([p, kinds]) => [p, sorted(kinds)]))),
+ };
+ await mkdir(/* turbopackIgnore: true */ path.dirname(file), { recursive: true });
+ const tmp = `${file}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;
+ try {
+ await writeFile(/* turbopackIgnore: true */ tmp, `${JSON.stringify(doc, null, 2)}\n`);
+ await rename(/* turbopackIgnore: true */ tmp, file);
+ } catch (err) {
+ await rm(/* turbopackIgnore: true */ tmp, { force: true }).catch(() => {});
+ throw err;
+ }
+ return { piece, kind, muted, at };
+}
diff --git a/umtool/lib/mutes.test.mjs b/umtool/lib/mutes.test.mjs
@@ -0,0 +1,86 @@
+// Mutes, read and written in a temp reports root.
+import assert from "node:assert/strict";
+import { mkdir, mkdtemp, readdir, readFile, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import path from "node:path";
+import test from "node:test";
+import { isMuted, muteCount, mutesFile, readMutes, setMute } from "./mutes.mjs";
+
+const root = () => mkdtemp(path.join(tmpdir(), "umtool-mutes-"));
+
+test("absent is nothing muted, and a read never creates the file", async () => {
+ const r = await root();
+ const read = await readMutes(r);
+ assert.deepEqual(read, { mutes: {} });
+ assert.equal(isMuted(read, "a:articles/zeta", "iteration-ready"), false);
+ assert.deepEqual(await readdir(r), []);
+});
+
+test("mute and unmute round-trip, keyed by piece and kind, with when", async () => {
+ const r = await root();
+ const now = new Date("2026-10-14T12:00:00.000Z");
+ assert.deepEqual(await setMute(r, "p:quartering-diet", "clip-mid-sentence", true, { now }), {
+ piece: "p:quartering-diet",
+ kind: "clip-mid-sentence",
+ muted: true,
+ at: "2026-10-14T12:00:00.000Z",
+ });
+ await setMute(r, "p:quartering-diet", "stale-build", true, { now });
+ await setMute(r, "a:articles/zeta", "iteration-ready", true, { now });
+ let read = await readMutes(r);
+ assert.equal(isMuted(read, "p:quartering-diet", "clip-mid-sentence"), true);
+ assert.equal(isMuted(read, "p:quartering-diet", "claim-unadjudicated"), false);
+ assert.equal(isMuted(read, null, "clip-mid-sentence"), false);
+ assert.equal(muteCount(read), 3);
+ const doc = JSON.parse(await readFile(mutesFile(r), "utf8"));
+ assert.equal(doc.format, "umtool-mutes");
+ assert.deepEqual(Object.keys(doc.mutes), ["a:articles/zeta", "p:quartering-diet"]);
+ assert.deepEqual(doc.mutes["p:quartering-diet"]["stale-build"], { at: "2026-10-14T12:00:00.000Z" });
+
+ // Unmuting removes the entry, and the piece once it has none left.
+ await setMute(r, "a:articles/zeta", "iteration-ready", false);
+ read = await readMutes(r);
+ assert.equal(isMuted(read, "a:articles/zeta", "iteration-ready"), false);
+ assert.equal(JSON.parse(await readFile(mutesFile(r), "utf8")).mutes["a:articles/zeta"], undefined);
+ // Unmuting what is not muted is a no-op write, not an error.
+ await setMute(r, "p:nothing", "unbuilt", false);
+ assert.equal(muteCount(await readMutes(r)), 2);
+ assert.deepEqual(await readdir(path.dirname(mutesFile(r))), ["mutes.json"]);
+});
+
+test("concurrent writes all land", async () => {
+ const r = await root();
+ const kinds = ["unbuilt", "stale-build", "loudness", "no-plan", "missing-cut", "unattributed"];
+ await Promise.all(kinds.map((k) => setMute(r, "p:song", k, true)));
+ assert.equal(muteCount(await readMutes(r)), kinds.length);
+});
+
+test("junk is refused, and nothing is written", async () => {
+ const r = await root();
+ await assert.rejects(setMute(r, "articles/zeta", "unbuilt", true), /not a piece id/);
+ await assert.rejects(setMute(r, "p:x", "Not A Kind", true), /not a decision kind/);
+ await assert.rejects(setMute(r, "p:x", "../x", true), /not a decision kind/);
+ await assert.rejects(setMute(r, "p:x", "unbuilt", "yes"), /muted is true or false/);
+ assert.deepEqual(await readdir(r), []);
+});
+
+test("an unreadable file is reported, and never overwritten", async () => {
+ const r = await root();
+ await mkdir(path.dirname(mutesFile(r)), { recursive: true });
+ await writeFile(mutesFile(r), "{ not json");
+ const read = await readMutes(r);
+ assert.deepEqual(read.mutes, {});
+ assert.match(read.error, /not JSON/);
+ await assert.rejects(setMute(r, "p:x", "unbuilt", true), (err) => err.status === 409);
+ assert.equal(await readFile(mutesFile(r), "utf8"), "{ not json");
+});
+
+test("entries that are not a piece and a kind are skipped on read", async () => {
+ const r = await root();
+ await mkdir(path.dirname(mutesFile(r)), { recursive: true });
+ await writeFile(
+ mutesFile(r),
+ JSON.stringify({ format: "umtool-mutes", version: 1, mutes: { "bare/id": { unbuilt: { at: "" } }, "p:ok": { "Bad Kind": {}, unbuilt: { at: "t" } } } }),
+ );
+ assert.deepEqual((await readMutes(r)).mutes, { "p:ok": { unbuilt: { at: "t" } } });
+});
diff --git a/umtool/lib/mutes.ts b/umtool/lib/mutes.ts
@@ -0,0 +1,19 @@
+import { REPORTS_ROOT } from "./paths";
+import { MuteError, isMuted as isMutedRead, muteCount, readMutes as readAt, setMute as setAt } from "./mutes.mjs";
+
+// The app's view of lib/mutes.mjs, typed and bound to REPORTS_ROOT. The logic,
+// the file format and the rules are there (plain ESM, unit-tested).
+
+export type MutesRead = { mutes: Record<string, Record<string, { at: string }>>; error?: string };
+
+export { MuteError, muteCount };
+
+export async function readMutes(): Promise<MutesRead> {
+ return (await readAt(REPORTS_ROOT)) as MutesRead;
+}
+
+export const isMuted = (read: MutesRead, piece: string | null | undefined, kind: string): boolean => isMutedRead(read, piece, kind);
+
+export async function setMute(piece: string, kind: string, muted: boolean): Promise<{ piece: string; kind: string; muted: boolean; at: string }> {
+ return (await setAt(REPORTS_ROOT, piece, kind, muted)) as { piece: string; kind: string; muted: boolean; at: string };
+}
diff --git a/umtool/redirects.mjs b/umtool/redirects.mjs
@@ -61,8 +61,9 @@ export const REDIRECTS = [
p3("/browse/at", "/projects/at"),
// Every project, cut and bench: /browse/<id>[/<view>…] → /projects/<id>[/<view>…].
p3("/browse/:path*", "/projects/:path*"),
- // The article lists are Work's facets now.
- p3("/articles", "/work?kind=article"),
+ // The article lists are Work's facets now. /articles was the article
+ // store's list, so it lands on the store's articles (site `articles`).
+ p3("/articles", "/work?kind=article&site=articles"),
p3("/sites", "/work?by=site"),
// The song tools.
p3("/mix", "/tools/mix"),