Archilyzer · Source

archilyzer

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

commit dec43f5fc1de067dba397e3058b15c7813b8e050
parent 3c5c912979d38c5b305354262d7b6db9c94c9289
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Thu,  5 Nov 2026 22:59:26 -0500

measure: main accepts a measure ledger -- ledger pins, and its own gate

A timeline entry's `claim` written as a string ("w118") is a LEDGER PIN, the
row the entry shows (the diet-series cut names its rows that way). It is read
as one where the manifest has a measure ledger (ledgerSchema.kind "measure")
or no fact-check marks at all, and must name a row of the ledger; a manifest
that stamps verdicts refuses a string exactly as before. rawMarksOf no
longer lists a pin as a mark; ledgerPinOf / pinsLedgerRows say what it is.

The inbox (report.mjs) and the claim bench hand the manifest to
adjudicationGaps / unadjudicatedOf / ledgerTotals, so a measure ledger is
gated on its own vocabulary: the diet ledger's 530 rows were 530 blocking
"unadjudicated" rows under the headcount scopes, and are none now. A
headcount manifest reads exactly what it did.

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

Diffstat:
Mumtool/components/projects/ClaimBenchPage.tsx | 2+-
Mumtool/lib/projects/report.mjs | 8+++++---
Mumtool/report-to-video/factcheck.mjs | 34++++++++++++++++++++++++++++++++++
Mumtool/report-to-video/factcheck.test.mjs | 27++++++++++++++++++++++++++-
4 files changed, 66 insertions(+), 5 deletions(-)

diff --git a/umtool/components/projects/ClaimBenchPage.tsx b/umtool/components/projects/ClaimBenchPage.tsx @@ -37,7 +37,7 @@ export default async function ClaimBenchPage({ // while somebody is standing on this page. let fired: Array<{ rule: string; text: string }> = []; try { - const totals = ledgerTotals(ledger, { strict: false }); + const totals = ledgerTotals(ledger, { strict: false, manifest }); fired = totals.steps.find((s: { id: string }) => s.id === claimId)?.flags ?? []; } catch { /* a malformed ledger shows as gaps, not as a broken page */ diff --git a/umtool/lib/projects/report.mjs b/umtool/lib/projects/report.mjs @@ -1491,8 +1491,10 @@ export async function reportDecisions(ctx, summary) { // One row per entry, not one collapsed row. Forty unpunctuated sources are // the same true thing said forty times; forty unadjudicated claims are // forty DIFFERENT decisions, and the inbox being empty is the sign-off. - for (const e of unadjudicatedOf(ledger)) { - const gaps = adjudicationGaps(e); + // The manifest picks the arithmetic: a measure ledger (ledgerSchema.kind + // "measure") is gated on ITS vocabulary, never the headcount one. + for (const e of unadjudicatedOf(ledger, m)) { + const gaps = adjudicationGaps(e, m); add( "claim-unadjudicated", e.id, @@ -1507,7 +1509,7 @@ export async function reportDecisions(ctx, summary) { // proceeds rather than all at once at the end. let totals = null; try { - totals = ledgerTotals(ledger, { strict: false }); + totals = ledgerTotals(ledger, { strict: false, manifest: m }); } catch { /* a malformed ledger is already reported as unadjudicated rows */ } diff --git a/umtool/report-to-video/factcheck.mjs b/umtool/report-to-video/factcheck.mjs @@ -394,10 +394,36 @@ export function claimKnobs(claim) { export function rawMarksOf(entry) { if (!isObj(entry)) return []; if (Array.isArray(entry.claims)) return entry.claims; + // A `claim` written as a string is a LEDGER PIN (ledgerPinOf), not a mark. + if (typeof entry.claim === "string") return []; return entry.claim === undefined || entry.claim === null ? [] : [entry.claim]; } /** + * An entry's LEDGER PIN: its `claim` written as a ledger row's id (`"w118"`) + * -- the row the entry shows, the way a measure ledger's cut names its rows -- + * or null. A pin is not a fact-check mark: it stamps nothing and counts + * nothing here (measure-slice.mjs reads it). + */ +export function ledgerPinOf(entry) { + if (!isObj(entry) || typeof entry.claim !== "string") return null; + const id = entry.claim.trim(); + return id || null; +} + +/** + * Whether this manifest reads a string `claim` as a ledger pin: a measure + * ledger (`ledgerSchema.kind: "measure"`), or a manifest with no fact-check + * marks at all. A manifest that stamps verdicts keeps refusing a string, as + * it always has: there, `claim` is `{ id, verdict }`. + */ +export function pinsLedgerRows(manifest) { + if (isObj(manifest?.ledgerSchema) && manifest.ledgerSchema.kind === "measure") return true; + const timeline = Array.isArray(manifest?.timeline) ? manifest.timeline : []; + return !timeline.some((e) => rawMarksOf(e).some(isObj)); +} + +/** * A `claims` value, normalised: each mark through normalizeClaim (its errors * named `claims[k].…`), 1 to CLAIM_MARKS_MAX of them, each id once. Throws a * sentence on a shape no writer should store. @@ -461,6 +487,8 @@ export function validateClaims(manifest) { const series = resolveCounter(manifest?.render).order; const verdictOf = new Map(); const timeline = Array.isArray(manifest?.timeline) ? manifest.timeline : []; + const pins = pinsLedgerRows(manifest); + const rowIds = new Set((Array.isArray(manifest?.ledger) ? manifest.ledger : []).map((r) => (isObj(r) ? r.id : null))); // The last entry carrying each id: a mark stamps there, and only there. const lastOf = new Map(); timeline.forEach((e, i) => { @@ -474,6 +502,12 @@ export function validateClaims(manifest) { const key = many ? "claims" : "claim"; if (many && one) { errors.push(`${where}: claim and claims are both set -- one mark is \`claim\`, two or more \`claims\``); return; } if (e.type === "teaser") { errors.push(`${where}.${key}: a teaser is not evidence for a claim`); return; } + // A ledger pin (`claim: "<row id>"`), where the manifest reads one: it + // must name a row of the ledger, and is nothing more to check here. + if (!many && typeof e.claim === "string" && pins) { + if (!rowIds.has(e.claim.trim())) errors.push(`${where}.claim "${e.claim}" names no ledger row`); + return; + } let marks; try { marks = many ? normalizeMarks(e.claims, { series }) : [normalizeClaim(e.claim, { series })]; diff --git a/umtool/report-to-video/factcheck.test.mjs b/umtool/report-to-video/factcheck.test.mjs @@ -11,7 +11,7 @@ import path from "node:path"; import test from "node:test"; import { - claimOf, FACTCHECK_DEFAULTS, FACTCHECK_LIMITS, normalizeClaim, originalUrlAt, resolveFactcheck, roundStamps, STAMP_MOTION, stampSchedule, + claimOf, FACTCHECK_DEFAULTS, FACTCHECK_LIMITS, ledgerPinOf, marksOf, normalizeClaim, pinsLedgerRows, rawMarksOf, originalUrlAt, resolveFactcheck, roundStamps, STAMP_MOTION, stampSchedule, TALLY_LABEL, TALLY_POP, tallyCues, tallyLabelOf, tallyLabelWidth, tallyOf, tallyPopIns, tallyShowAt, tallySteps, tallyVerdicts, validateClaims, validateFactcheck, VERDICTS, } from "./factcheck.mjs"; import { @@ -90,6 +90,31 @@ test("validateClaims: shape, never on a teaser, one verdict per claim id; the re assert.match(errs[2], /timeline\[3\] \(c9\)\.claim\.verdict must be one of/); }); +test("a ledger pin (claim: \"<row id>\") is a measure ledger's, and a stamping manifest still refuses one", () => { + const ledger = [{ id: "w118" }, { id: "r96" }]; + const measure = { + ledgerSchema: { kind: "measure" }, + ledger, + timeline: [{ type: "clip", id: "c46", claim: "w118" }, { type: "clip", id: "c36", claim: "r96" }, { ...ENTRIES[0] }], + }; + // A measure ledger reads a string as the row the entry shows, beside any marks. + assert.deepEqual(validateClaims(measure), []); + assert.equal(ledgerPinOf(measure.timeline[0]), "w118"); + assert.equal(ledgerPinOf(ENTRIES[0]), null); + assert.deepEqual(rawMarksOf(measure.timeline[0]), [], "a pin is not a mark"); + assert.deepEqual(marksOf(measure.timeline[0]), []); + assert.equal(pinsLedgerRows(measure), true); + // …and it must name a row. + const bad = validateClaims({ ...measure, timeline: [{ type: "clip", id: "c1", claim: "w999" }] }); + assert.deepEqual(bad, ['timeline[0] (c1).claim "w999" names no ledger row']); + // A manifest with no fact-check marks reads one the same way. + assert.deepEqual(validateClaims({ ledger, timeline: [{ type: "clip", id: "c1", claim: "w118" }] }), []); + // One that stamps verdicts refuses it, as it always did. + const stamping = { ledger, timeline: [ENTRIES[0], { type: "clip", id: "c1", claim: "w118" }] }; + assert.equal(pinsLedgerRows(stamping), false); + assert.match(validateClaims(stamping).join("\n"), /timeline\[1\] \(c1\)\.claim must be \{ id, verdict \}/); +}); + // ---- the settings --------------------------------------------------------------- test("resolveFactcheck: every default, a verdict's label and colour filled on their own", () => {