Archilyzer · Source

archilyzer

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

commit 6e1a67784d317d65e893be14daedef2f044b231a
parent 73a36bf5b9cda281b47cd82a9432c1f07984e276
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Thu, 15 Oct 2026 08:26:16 -0400

umtool: M8/V1 review fixes — the proposals panel sends the verdict and `at` shown and shows a refusal, counts stale proposals and shows an unreadable sidecar; the Inbox's `unreadable-proposals` (Blocking, "Repair verdicts.proposed.json"); the bar saves the run's window as settings.generation.verdicts.window (else keeps the one set); verdict-proposed.spec (a stale proposal, a rewrite between view and click) and verdict-bench.spec (the window)

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

Diffstat:
Mumtool/app/tools/bench/page.tsx | 2+-
Mumtool/components/articles/ArticlePage.tsx | 2+-
Mumtool/components/articles/VerdictProposals.tsx | 34+++++++++++++++++++++++++++++-----
Mumtool/components/bench/BarForm.tsx | 12++++++++++--
Mumtool/e2e/verdict-bench.spec.ts | 4+++-
Mumtool/e2e/verdict-proposed.spec.ts | 28+++++++++++++++++++++++-----
Mumtool/lib/articles/verdicts.ts | 61+++++++++++++++++++++++++++++++------------------------------
Mumtool/lib/bench.ts | 10+++++++++-
Mumtool/lib/inbox.ts | 13++++++-------
Mumtool/lib/inbox/groups.mjs | 4+++-
Mumtool/lib/inbox/verdicts.mjs | 19+++++++++++++++++++
Mumtool/lib/inbox/verdicts.test.mjs | 12+++++++++++-
Mumtool/lib/inbox/what.mjs | 1+
13 files changed, 147 insertions(+), 55 deletions(-)

diff --git a/umtool/app/tools/bench/page.tsx b/umtool/app/tools/bench/page.tsx @@ -141,7 +141,7 @@ function RunView({ <div className="flex flex-wrap items-start gap-3"> <section aria-label="the bar" className="min-w-[24rem] flex-1 rounded border border-[var(--color-line)] bg-[var(--color-panel)] p-3"> {policy ? ( - <BarForm initial={policy} models={score.models} /> + <BarForm initial={policy} models={score.models} window={{ mode: s.windowMode ?? "seconds", seconds: s.windowS }} /> ) : ( <p role="alert" className="text-[var(--color-bad)]"> the bar cannot be read: {policyError} diff --git a/umtool/components/articles/ArticlePage.tsx b/umtool/components/articles/ArticlePage.tsx @@ -471,7 +471,7 @@ async function ArticleTab({ proposals ? ( <> {line} - <VerdictProposals article={reportId} waiting={proposals.waiting} /> + <VerdictProposals article={reportId} waiting={proposals.waiting} stale={proposals.stale} {...(proposals.error ? { error: proposals.error } : {})} /> </> ) : ( line diff --git a/umtool/components/articles/VerdictProposals.tsx b/umtool/components/articles/VerdictProposals.tsx @@ -10,9 +10,24 @@ import type { WaitingProposal } from "@/lib/articles/verdicts"; // model and its prompt version — and Approve (the claim's verdict is set, by // the editor's verdict-review through the registry) or Reject (the claim // stays unruled), each with an optional note. Proposed verdicts are plain -// text: a verdict's colour is a ruling's, and these are not rulings yet. +// text: a verdict's colour is a ruling's, and these are not rulings yet. The +// review sends the verdict and `at` shown (a compare-and-set: a proposal that +// changed since is refused, and the refusal shown). Stale proposals are +// counted, an unreadable sidecar said. -export default function VerdictProposals({ article, waiting }: { article: string; waiting: WaitingProposal[] }) { +export default function VerdictProposals({ + article, + waiting, + stale = 0, + error, +}: { + article: string; + waiting: WaitingProposal[]; + // Proposals on claims changed since they were made: not shown, not reviewable. + stale?: number; + // The sidecar did not read: nothing in it is shown until it is repaired. + error?: string; +}) { const router = useRouter(); const [left, setLeft] = useState(waiting); const [notes, setNotes] = useState<Record<string, string>>({}); @@ -24,7 +39,11 @@ export default function VerdictProposals({ article, waiting }: { article: string setStatus(null); try { const note = notes[p.claim]?.trim(); - const r = await fetch("/api/articles/verdicts", { method: "POST", body: JSON.stringify({ article, claim: p.claim, decision, ...(note ? { note } : {}) }) }); + // The proposal shown: the review is refused (409) if it changed since. + const r = await fetch("/api/articles/verdicts", { + method: "POST", + body: JSON.stringify({ article, claim: p.claim, decision, verdict: p.verdict, at: p.at, ...(note ? { note } : {}) }), + }); const body = await r.json(); if (!r.ok) throw new Error(body.error ?? `HTTP ${r.status}`); setLeft((xs) => xs.filter((x) => x.claim !== p.claim)); @@ -37,12 +56,17 @@ export default function VerdictProposals({ article, waiting }: { article: string } } - if (!left.length && !status) return null; + if (!left.length && !status && !error && !stale) return null; return ( <section aria-label="verdict proposals" id="verdict-proposals" className="w-full rounded-[3px] border border-seam bg-panel px-3 py-2 text-[12px] text-text"> <div className="micro"> - verdict proposals · {left.length} waiting + verdict proposals · {left.length} waiting{stale ? ` · ${stale} stale (the claim changed since)` : ""} </div> + {error && ( + <p role="alert" data-proposals-error="" className="mt-1 text-[var(--color-bad)]"> + verdicts.proposed.json does not read: {error} + </p> + )} {status && ( <p role="status" className={status.ok ? "mt-1 text-text-2" : "mt-1 text-[var(--color-bad)]"}> {status.text} diff --git a/umtool/components/bench/BarForm.tsx b/umtool/components/bench/BarForm.tsx @@ -20,7 +20,11 @@ const KEYS: { key: keyof VerdictBar; label: string }[] = [ const field = "w-16 rounded border border-[var(--color-line)] bg-[var(--color-ink)] px-1.5 py-0.5 text-[12px] text-[var(--color-text)]"; const toPct = (v: number) => String(Math.round(v * 1000) / 10); -export default function BarForm({ initial, models }: { initial: GenerationVerdicts; models: ModelScore[] }) { +// The window proposals read is the run's the bar is set on: saved with it +// (settings.generation.verdicts.window, release 29). +const windowWords = (w: { mode: string; seconds: number }) => (w.mode === "turn" ? `the speaker's turn within ${w.seconds} s` : `±${w.seconds} s`); + +export default function BarForm({ initial, models, window }: { initial: GenerationVerdicts; models: ModelScore[]; window: GenerationVerdicts["window"] }) { const [typed, setTyped] = useState(() => Object.fromEntries(KEYS.map((k) => [k.key, toPct(initial.bar[k.key])])) as Record<keyof VerdictBar, string>); const [ticked, setTicked] = useState<string[]>(initial.models); const [status, setStatus] = useState<{ ok: boolean; text: string } | null>(null); @@ -35,7 +39,7 @@ export default function BarForm({ initial, models }: { initial: GenerationVerdic setStatus(null); const keep = ticked.filter((m) => !here.has(m) || passesBar(models.find((x) => x.model === m)!, bar).pass); try { - const r = await fetch("/api/bench/bar", { method: "POST", body: JSON.stringify({ bar, models: keep }) }); + const r = await fetch("/api/bench/bar", { method: "POST", body: JSON.stringify({ bar, models: keep, window }) }); const body = await r.json(); if (!r.ok) throw new Error(body.error ?? `HTTP ${r.status}`); const v = body.verdicts as GenerationVerdicts; @@ -89,6 +93,10 @@ export default function BarForm({ initial, models }: { initial: GenerationVerdic </label> ); })} + <span className="text-[var(--color-dim)]" data-window={`${window.mode}:${window.seconds}`}> + proposals read {windowWords(window)} (this run&apos;s window) + {initial.window && (initial.window.mode !== window.mode || initial.window.seconds !== window.seconds) ? ` · now ${windowWords(initial.window)}` : ""} + </span> <Button type="submit" size="sm" disabled={busy}> Save the bar </Button> diff --git a/umtool/e2e/verdict-bench.spec.ts b/umtool/e2e/verdict-bench.spec.ts @@ -83,10 +83,12 @@ test("the bar: saved through the editor's settings action; a passing model ticke const use = form.getByRole("checkbox", { name: `use ${SONNET}` }); await expect(use).toBeEnabled(); await use.check(); + await expect(form.locator("[data-window]")).toHaveText(/^proposals read ±60 s \(this run's window\)/); await form.getByRole("button", { name: "Save the bar" }).click(); await expect(form.getByRole("status")).toHaveText("Saved."); expect(stubAsked("settings").at(-1)).toMatchObject({ - patch: { generation: { verdicts: { bar: { agreement: 0.5, contradictedRecall: 0.5, notFoundRecall: 0.5 }, models: [SONNET] } } }, + // The window proposals read is the run's the bar was set on (release 29). + patch: { generation: { verdicts: { bar: { agreement: 0.5, contradictedRecall: 0.5, notFoundRecall: 0.5 }, models: [SONNET], window: { mode: "seconds", seconds: 60 } } } }, authorization: "Bearer umtool-e2e-token", }); // Read back: the tiles say who passes the saved bar. diff --git a/umtool/e2e/verdict-proposed.spec.ts b/umtool/e2e/verdict-proposed.spec.ts @@ -3,6 +3,7 @@ import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; import { WARM_TIMEOUT, warm } from "./warm"; +import { claimFingerprint } from "yt-dlp-transcript-common/lib/report/verdictProposals"; // --------------------------------------------------------------------------- // Verdict proposals (release 29 M8): a synthetic fact-check in the fixture's @@ -10,7 +11,9 @@ import { WARM_TIMEOUT, warm } from "./warm"; // (`verdicts.proposed.json` beside it). The Inbox's `verdict-proposed` card // (Review) → the article's tab → Approve sets the claim's verdict (the stub // editor runs the REAL verdict-review over the fixture's store), Reject -// leaves the claim unruled; the card goes once nothing waits. +// leaves the claim unruled; the card goes once nothing waits. Release 29's +// review fixes: a stale proposal (its claim changed) is counted, not shown; a +// proposal rewritten between view and click is refused. // --------------------------------------------------------------------------- const HERE = path.dirname(fileURLToPath(import.meta.url)); @@ -37,18 +40,23 @@ const report = { { id: "c1", text: "The article says she opened the shop in spring.", verdict: "CORROBORATED", citations: ["q1"] }, { id: "c2", text: "The article says the oven was broken for a month.", citations: ["q1"] }, { id: "c3", text: "The article says she sold the van.", citations: ["q1"] }, + { id: "c4", text: "The article says she moved the shop.", citations: ["q1"] }, ], }, ], }; +// Each proposal carries the fingerprint of the claim it judged; c4's judged +// another claim (a revision moved the ids): stale, never shown. +const fp = (id: string) => claimFingerprint(report.sections[0]!.claims.find((c) => c.id === id)!, report.citations); const proposals = { format: "archilyzer-verdict-proposals", version: 1, article: ID, proposals: { - c2: { verdict: "PARTLY", reason: "She says the oven ran hot, not that it was broken.", model: MODEL, promptVersion: "2", at: AT, status: "proposed" }, - c3: { verdict: "CONTRADICTED", reason: "She says she kept the van.", model: MODEL, promptVersion: "2", at: AT, status: "proposed" }, + c2: { verdict: "PARTLY", reason: "She says the oven ran hot, not that it was broken.", model: MODEL, promptVersion: "2", at: AT, fingerprint: fp("c2"), status: "proposed" }, + c3: { verdict: "CONTRADICTED", reason: "She says she kept the van.", model: MODEL, promptVersion: "2", at: AT, fingerprint: fp("c3"), status: "proposed" }, + c4: { verdict: "CORROBORATED", reason: "Another claim's.", model: MODEL, promptVersion: "2", at: AT, fingerprint: "0000000000000000", status: "proposed" }, }, updatedAt: AT, }; @@ -88,6 +96,7 @@ test("an Inbox row → the article's proposals → Approve sets the verdict, Rej const panel = page.getByRole("region", { name: "verdict proposals" }); await expect(panel.locator("[data-proposal]")).toHaveCount(2); + await expect(panel).toContainText("2 waiting · 1 stale (the claim changed since)"); const c2 = panel.locator('[data-proposal="c2"]'); await expect(c2.locator("[data-proposed]")).toHaveText("PARTLY"); await expect(c2).toContainText("She says the oven ran hot"); @@ -97,10 +106,19 @@ test("an Inbox row → the article's proposals → Approve sets the verdict, Rej expect(claims().find((c) => c.id === "c2")!.verdict).toBe("PARTLY"); expect(sidecar().proposals.c2.status).toBe("approved"); - const c3 = panel.locator('[data-proposal="c3"]'); + // Another run rewrites c3's proposal after the page showed it: the review is refused. + const doc = sidecar(); + writeFileSync(path.join(DIR, "verdicts.proposed.json"), JSON.stringify({ ...doc, proposals: { ...doc.proposals, c3: { ...doc.proposals.c3, verdict: "PARTLY", at: "2026-10-15T11:00:00.000Z" } } }, null, 2) + "\n"); + await panel.locator('[data-proposal="c3"]').getByRole("button", { name: "Reject" }).click(); + await expect(panel.getByRole("status")).toContainText("changed since it was shown"); + expect(sidecar().proposals.c3.status).toBe("proposed"); + // Read again, it is the new one; reject that. + await page.reload(); + const c3 = page.getByRole("region", { name: "verdict proposals" }).locator('[data-proposal="c3"]'); + await expect(c3.locator("[data-proposed]")).toHaveText("PARTLY"); await c3.getByRole("textbox", { name: "note on c3" }).fill("the window is too short"); await c3.getByRole("button", { name: "Reject" }).click(); - await expect(panel.getByRole("status")).toHaveText("Rejected: c3 stays unruled."); + await expect(page.getByRole("region", { name: "verdict proposals" }).getByRole("status")).toHaveText("Rejected: c3 stays unruled."); expect(claims().find((c) => c.id === "c3")!.verdict).toBeUndefined(); expect(sidecar().proposals.c3).toMatchObject({ status: "rejected", note: "the window is too short" }); // The operator's ruling stayed as it was. diff --git a/umtool/lib/articles/verdicts.ts b/umtool/lib/articles/verdicts.ts @@ -1,4 +1,4 @@ -import { readVerdictProposals, waitingProposals, type VerdictProposal } from "yt-dlp-transcript-common/lib/report/verdictProposals"; +import { currentClaims, proposalIsCurrent, readVerdictProposals, waitingProposals, type CurrentClaim, type VerdictProposal } from "yt-dlp-transcript-common/lib/report/verdictProposals"; import { articleFile } from "yt-dlp-transcript-common/lib/report/registry"; import { readJsonFile } from "yt-dlp-transcript-common/lib/jsonFile-server"; import { isVerdict, type Verdict } from "yt-dlp-transcript-common/lib/report/verdicts"; @@ -14,6 +14,10 @@ import { sitesPaths } from "./sites"; // reject goes to the editor's `verdict-review` (the one writer: approve sets // the claim's verdict through the registry). // +// A waiting proposal whose claim changed under its id (a revision) is STALE: +// counted, never shown (review fix 1). A sidecar that does not read is an +// error the tab shows and the Inbox raises (review fix 7). +// // SERVER-ONLY. export type WaitingProposal = { @@ -31,51 +35,46 @@ export type ArticleProposals = { waiting: WaitingProposal[]; approved: number; rejected: number; + // Waiting proposals whose claim is not the one they judged now (a revision + // moved the ids, or changed the claim or its citations): never shown, never + // reviewable (review fix 1). + stale: number; // The sidecar did not read (it is never taken for empty). error?: string; }; -type ClaimRow = { id: string; text: string; section: string; verdict?: unknown }; - -async function claimsOf(article: string): Promise<Map<string, ClaimRow> | null> { - const read = await readJsonFile(articleFile(sitesPaths(), article)); - if (!read.ok) return null; - const r = read.value as { kind?: unknown; sections?: { title?: string; claims?: { id?: string; text?: string; verdict?: unknown }[] }[] }; - if (r.kind !== "factcheck") return null; - const out = new Map<string, ClaimRow>(); - for (const s of r.sections ?? []) { - for (const c of s.claims ?? []) if (typeof c.id === "string") out.set(c.id, { id: c.id, text: String(c.text ?? ""), section: String(s.title ?? ""), verdict: c.verdict }); - } - return out; -} - -/** An article's proposals: the waiting ones on still-unruled claims, in the report's order. */ +/** An article's proposals: the waiting ones on still-unruled, unchanged claims, in the report's order. */ export async function readArticleProposals(article: string): Promise<ArticleProposals | null> { if (!isReportId(article)) return null; let f; try { f = await readVerdictProposals(article, sitesPaths()); } catch (e) { - return { waiting: [], approved: 0, rejected: 0, error: (e as Error).message }; + return { waiting: [], approved: 0, rejected: 0, stale: 0, error: (e as Error).message }; } if (!f) return null; - const claims = await claimsOf(article); + const read = await readJsonFile(articleFile(sitesPaths(), article)); + const raw = read.ok ? (read.value as { kind?: unknown }) : null; + const claims = raw && raw.kind === "factcheck" ? currentClaims(raw) : new Map<string, CurrentClaim>(); + const order = [...claims.keys()]; const all = Object.values(f.proposals) as VerdictProposal[]; - const order = claims ? [...claims.keys()] : []; - const waiting = waitingProposals(f) - .filter(([id]) => { - const c = claims?.get(id); - return !!c && !isVerdict(c.verdict); - }) - .map(([id, p]) => { - const c = claims!.get(id)!; - return { claim: id, text: c.text, section: c.section, verdict: p.verdict, reason: p.reason, model: p.model, promptVersion: p.promptVersion, at: p.at }; - }) - .sort((a, b) => order.indexOf(a.claim) - order.indexOf(b.claim)); + let stale = 0; + const waiting: WaitingProposal[] = []; + for (const [id, p] of waitingProposals(f)) { + const c = claims.get(id); + if (c?.ruled) continue; + if (!c || !proposalIsCurrent(p, c)) { + stale++; + continue; + } + waiting.push({ claim: id, text: c.text, section: c.section, verdict: p.verdict, reason: p.reason, model: p.model, promptVersion: p.promptVersion, at: p.at }); + } + waiting.sort((a, b) => order.indexOf(a.claim) - order.indexOf(b.claim)); return { waiting, approved: all.filter((p) => p.status === "approved").length, rejected: all.filter((p) => p.status === "rejected").length, + stale, }; } @@ -85,7 +84,9 @@ export async function reviewArticleProposal(body: unknown): Promise<{ proposal: if (typeof b.article !== "string" || typeof b.claim !== "string") throw new EditorError('send {"article", "claim", "decision": "approve" | "reject", "note"?}', 400); if (b.decision !== "approve" && b.decision !== "reject") throw new EditorError('"decision" is "approve" or "reject"', 400); if (b.note !== undefined && typeof b.note !== "string") throw new EditorError('"note" is text', 400); - const sent = { article: b.article, claim: b.claim, decision: b.decision, ...(typeof b.note === "string" && b.note.trim() ? { note: b.note.trim() } : {}) }; + // The proposal the operator was shown: the editor's review is a compare-and-set on it. + if (!isVerdict(b.verdict) || typeof b.at !== "string" || !b.at) throw new EditorError('send the "verdict" and "at" of the proposal shown', 400); + const sent = { article: b.article, claim: b.claim, decision: b.decision, verdict: b.verdict, at: b.at, ...(typeof b.note === "string" && b.note.trim() ? { note: b.note.trim() } : {}) }; const answer = await askEditor<{ proposal?: unknown }>("/api/ops/verdict-review", { method: "POST", body: sent }); return { proposal: answer.proposal ?? null }; } diff --git a/umtool/lib/bench.ts b/umtool/lib/bench.ts @@ -207,7 +207,15 @@ export async function writeVerdictsPolicy(v: unknown): Promise<GenerationVerdict if (typeof x !== "number" || !Number.isFinite(x) || x < 0 || x > 1) throw new EditorError(`bar.${k} is a fraction from 0 to 1`, 400); } if (!Array.isArray(o.models) || !o.models.every((m) => typeof m === "string")) throw new EditorError("models is a list of model names", 400); - const verdicts = sanitizeGeneration({ verdicts: { bar: b, models: o.models } }).verdicts; + // The window proposals read (release 29): the run's the bar is set on, when + // the form sends it; else the one in settings is kept (the block is written whole). + let window = o.window as Record<string, unknown> | undefined; + if (window !== undefined) { + if (!window || typeof window !== "object" || (window.mode !== "seconds" && window.mode !== "turn") || typeof window.seconds !== "number" || window.seconds < 0 || window.seconds > 600) { + throw new EditorError('window is {mode: "seconds" | "turn", seconds: 0–600}', 400); + } + } else window = (await readVerdictsPolicy()).window; + const verdicts = sanitizeGeneration({ verdicts: { bar: b, models: o.models, window } }).verdicts; await askEditor("/api/ops/settings", { method: "POST", body: { patch: { generation: { verdicts } } } }); return readVerdictsPolicy(); } diff --git a/umtool/lib/inbox.ts b/umtool/lib/inbox.ts @@ -10,7 +10,7 @@ import { readManifest, reportSignature } from "./projects/report.mjs"; import { draftsView } from "./report/drafts.mjs"; import { articleHref, generationPolicyHref, reviewHref, triageHref } from "./hrefs"; import { awaitingReview, draftsDecisions } from "./inbox/drafts.mjs"; -import { verdictsDecisions } from "./inbox/verdicts.mjs"; +import { unreadableProposalsDecision, verdictsDecisions } from "./inbox/verdicts.mjs"; import { readArticleProposals } from "./articles/verdicts"; import { readFieldProvenance } from "./report/draft-provenance.mjs"; import { pieceOfDecision, readPieceGraph, type Piece, type PieceGraph } from "./pieces"; @@ -63,7 +63,8 @@ import { refreshDecisions } from "./inbox/refresh"; // claim (release 29 M8; the article's // verdicts.proposed.json, lib/inbox/verdicts.mjs), one row // per proposal, gone once approved or rejected (or the -// claim ruled by hand) +// claim ruled by hand, or changed: a stale proposal) +// unreadable-proposals that file does not read: one Blocking row // // -- each row given its piece, category, group, one action, lifecycle and // `hidden` (lib/inbox/groups.mjs), ranked. One row per decision, never dropped: @@ -356,12 +357,10 @@ async function proposalDecisions(graph: PieceGraph): Promise<Decision[]> { const per = await Promise.all( storeArticles(graph).map(async (p) => { const got = await readArticleProposals(p.report as string).catch(() => null); + const href = articleHref({ site: ARTICLES_KEY, id: p.report as string }, { tab: "article" }); + if (got?.error) return [unreadableProposalsDecision({ base: articleRow(p), href, error: got.error, at: p.newestMs })] as Decision[]; if (!got?.waiting.length) return [] as Decision[]; - return verdictsDecisions({ - base: articleRow(p), - href: articleHref({ site: ARTICLES_KEY, id: p.report as string }, { tab: "article" }), - waiting: got.waiting, - }) as Decision[]; + return verdictsDecisions({ base: articleRow(p), href, waiting: got.waiting }) as Decision[]; }), ); return per.flat(); diff --git a/umtool/lib/inbox/groups.mjs b/umtool/lib/inbox/groups.mjs @@ -67,6 +67,7 @@ const KIND_CATEGORY = { // Release 29 M8: a model's proposed verdicts for a fact-check's unruled // claims, each waiting on the operator's approve or reject. "verdict-proposed": "review", + "unreadable-proposals": "fix", }; const CATEGORY_GROUP = { @@ -95,7 +96,7 @@ export function groupOf(d) { // Within a group: the brief's order first (proposals before failed runs), then // everything else as equals. -const KIND_RANK = { "worth-researching": 0, "research-proposal": 0, "iteration-failed": 1, "tick-held": 2, "tick-failed": 2, "tick-partial": 2, "iteration-ready": 0, "edition-ready": 0, "drafts-unreviewed": 1, "verdict-proposed": 1, "unreadable-notes": 0, "refresh-held": 2, "refresh-available": 2 }; +const KIND_RANK = { "worth-researching": 0, "research-proposal": 0, "iteration-failed": 1, "tick-held": 2, "tick-failed": 2, "tick-partial": 2, "iteration-ready": 0, "edition-ready": 0, "drafts-unreviewed": 1, "verdict-proposed": 1, "unreadable-notes": 0, "unreadable-proposals": 0, "refresh-held": 2, "refresh-available": 2 }; const SEVERITY_RANK = { blocking: 0, open: 1, info: 2 }; // ONE primary action per decision, its button copy naming the result. @@ -105,6 +106,7 @@ const ACTION_LABEL = { "iteration-ready": (d) => `Make ${d.target} current`, "drafts-unreviewed": "Review drafts", "verdict-proposed": "Review verdicts", + "unreadable-proposals": "Repair verdicts.proposed.json", "open-note": "Answer note", "unreadable-notes": "Repair notes.json", "link-ambiguous": "Link the video", diff --git a/umtool/lib/inbox/verdicts.mjs b/umtool/lib/inbox/verdicts.mjs @@ -36,3 +36,22 @@ export function verdictsDecisions({ base, href, waiting }) { const at = Math.max(0, ...waiting.map((w) => Date.parse(w.at) || 0)); return waiting.map((w) => ({ ...base, kind: "verdict-proposed", target: w.claim, what, why, href, severity: "open", at })); } + +/** + * An article whose `verdicts.proposed.json` does not read (review fix 7): one + * blocking row, as an unreadable notes.json is — nothing is shown from it, + * and nothing writes it, until it is repaired. + * + * @param {{ base: { project: string, projectKind?: string, projectTitle: string, piece?: string }, href: string, error: string, at?: number }} o + */ +export function unreadableProposalsDecision({ base, href, error, at = Date.now() }) { + return { + ...base, + kind: "unreadable-proposals", + target: "verdicts.proposed.json", + why: `verdicts.proposed.json does not read (${error}); no proposal is shown or written until it is fixed`, + href, + severity: "blocking", + at, + }; +} diff --git a/umtool/lib/inbox/verdicts.test.mjs b/umtool/lib/inbox/verdicts.test.mjs @@ -2,7 +2,7 @@ // card's words, in the Review group with its one action. import { test } from "node:test"; import assert from "node:assert/strict"; -import { verdictsDecisions, verdictsWhy } from "./verdicts.mjs"; +import { unreadableProposalsDecision, verdictsDecisions, verdictsWhy } from "./verdicts.mjs"; import { annotate, groupOf, summarizeGroups } from "./groups.mjs"; import { whatOf } from "./what.mjs"; @@ -27,3 +27,13 @@ test("verdict-proposed: a row per proposal, the card's words, the Review group, assert.equal(review.cards[0].what, "2 verdicts proposed"); assert.deepEqual(verdictsDecisions({ base: { project: "x", projectTitle: "x" }, href: "/", waiting: [] }), []); }); + +test("unreadable-proposals: one Blocking row, its action the repair", () => { + const d = unreadableProposalsDecision({ base: { project: "sites/articles/fc", projectTitle: "A check", piece: "a:articles/fc" }, href: "/articles/fc?tab=article", error: "unparseable", at: 5 }); + assert.equal(d.kind, "unreadable-proposals"); + assert.equal(groupOf(d), "blocking"); + assert.match(d.why, /does not read \(unparseable\)/); + const [a] = annotate([d], { pieceOf: () => "a:articles/fc", lifecycleOf: () => "active", isMuted: () => false }); + assert.equal(a.action.label, "Repair verdicts.proposed.json"); + assert.equal(whatOf("unreadable-proposals"), "verdicts.proposed.json does not read"); +}); diff --git a/umtool/lib/inbox/what.mjs b/umtool/lib/inbox/what.mjs @@ -9,6 +9,7 @@ export const WHAT = { "iteration-ready": "iteration ready", "drafts-unreviewed": "drafts to review", "verdict-proposed": "verdicts proposed", + "unreadable-proposals": "verdicts.proposed.json does not read", "open-note": "open notes", "unreadable-notes": "notes.json does not read", "link-ambiguous": "video not linked",