commit 0f29717bdf467164e472359134bd69728a1ba711
parent 66c825681dabcbe3e6d78182c4c40f1cb25370ca
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Thu, 5 Nov 2026 23:36:20 -0500
measure: promises with a second speaker -- promise_claim, promise_outcome, `speaker`
Contract addenda (5-6 Nov): a ledger row may carry `speaker` (absent: the
subject; e.g. "madamsavvy"), and a row by another speaker moves none of his
numbers -- current, lost, net, goals, diet, every total -- it only feeds
the promises. Two new promise forms, built into every measure schema:
`promise_claim` (another party's statement about a promise: `promise`,
`paidOn`, `citeUrl`) and `promise_outcome` (how it ended: `outcome` kept,
refunded or withdrawn). The slice's state.promises[] (and totals.promises)
gain `claims: [{row, speaker, date, paidOn, label}]` and `outcome: {kind,
date, row} | null`; an outcome "kept" keeps it. Events carry `speaker` and
`outcome`; their kinds are promiseClaim and promiseOutcome.
`umtool ledger add` accepts them: a promise_claim and promise_outcome name
a promise row; `outcome` is one of the three; `paidOn` is a claim's; a
promise_check is the subject's own word (another speaker's is a claim);
`speaker` is a lower-case key. Tests: another speaker's claim, reading,
loss and goal change no total and no state number; a refunded outcome
leaves the totals as they were, a kept one keeps the promise.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
11 files changed, 168 insertions(+), 31 deletions(-)
diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md
@@ -69,7 +69,7 @@ Inbox cannot disagree about what is wrong with one.
| `takes cancel <project> <take> [--json]` · `takes fork <project> <take> [--name N] [--json]` · `takes compare <project> <a> <b> [--json]` | **take housekeeping, the rest**: **Cancel render** (asked of the process rendering it, which stops its render's process group, marks the take cancelled and lets render mode go; exit 1 when it has not stopped); **Fork as variant** (a project beside this one, default `v-<take>`: the take's manifest, `variant.json`, the parent's media and assets linked, the take in it); two takes **side by side** (`<take>` or `<project>:<take>`: the facts, the cut's changes A → B, the look's differences) ([knobs.md](knobs.md#takes-relabel-supersede-cancel-delete-fork-as-variant-compare)) |
| `trailer <project> --take <t> (--beats FILE \| --beats-json JSON) [--intro] [--finale S] [--xfade 0.3] [--no-snap] [--out NAME] [--dry-run] [--json]` | a **trailer cut from the take's finished master**: spans of the master's own frames (the deck shows the whole timeline), clip beats in source seconds mapped by the take's build records, each clip beat's end moved forward into the next pause (through its sentence when one ends within 1 s) and its start back into the one before, so the crossfade lands in quiet, each move said (`--no-snap`: the edges as written), crossfaded, the take's encode, in the heavy slot; writes `takes/<t>/out/<slug>.trailer.mp4` and `.trailer.json`; **exit 1** on a refusal ([report-video.md](report-video.md#trailer-from-the-master)) · `--reel <name> [--take <t>]`: a **beat reel** -- its own beats file (`promo/<name>-beats.json`), crossfade, intro (one rendered for the reel when the master has none, or the reel's own) and outro card (the title, the call to action, an image, the site's name; faded in from the last beat, held to the end), written to `<slug>.<name>.mp4`; no `--take`: its pinned take, else the one it was last cut from, else the latest finished master ([report-video.md](report-video.md#beat-reels)) |
| `trailer-beats <project> [ls] [--json]` · `add <clip> [<from>-<to>] [--at N] [--label L]` · `add-raw <at> <dur>` · `set <n> <from>-<to>` · `remove <n>` · `move <n> --to <m>` · `order` · `limit <s\|m:ss\|x\|instagram\|shorts\|tiktok>` · `xfade <s>` · `intro on\|off\|'<render.intro JSON>'` · `outro on\|off\|none\|'{title,text,image,seconds}'` · `candidates [--add]` · `verdict <n> confirmed\|note\|clear` · `title <text>\|none` · `take <t>\|none` · `undo` · `reels [--json]` · `new-reel <name> [--from <reel>] [--title T]` · `gap <n> add <from>-<to>\|remove <s>\|clear` · `status [--take <t>] [--json]` · `anchor [<n>…] --take <t>` · `clamp <n>` · `repoint <n> <clip>` · `history [--json]` · `--take <t>` on an edit · `--reel <name>` on any | **the trailer's beats** (`promo/trailer-beats.json`, the Trailer page's file, what `trailer --beats` reads) or another **beat reel's** (`--reel`: `promo/<name>-beats.json`): each beat's length, the running length against the platform limit (X 2:20 by default), beats outside their clip's window, the cut's order, the walk's ★ clips; the reel's own intro and its outro card (`ls`: `· outro 3.5 s`, counted in the length); every write an undo point and a history entry; a beat's gaps (two moments of one clip as one beat of jump cuts); each beat read against the take now -- what it was cut against, what changed (`status`), and the fixes ([knobs.md](knobs.md#the-trailers-beats), [reels track their source](knobs.md#reels-track-their-source)) |
-| `ledger <project> [ls] [--scope S] [--population P] [--json]` · `ledger <project> add <id> --date D --scope S --population P [--value V] --scopeBasis "…" [--<key> V …] [--row '{…}']` · `ledger <project> set <id> --<key> V … [--unset k,k]` · `ledger <project> rm <id>` | a **measure ledger's rows** (`ledgerSchema.kind "measure"`), the only writer of them: each row is checked against the schema -- a track, a form (and the promise forms `promise` / `promise_check`), a number in its unit or a declared regime with an event, the six adjudication fields (a new row defaults `scopeConfidence` read, `valueKind` uttered, `flags` []; `--scopeBasis` is never defaulted), the declared fields, and the instruments' own keys: `run` (a loss claim's run), `retro` (a loss told in the past with no `asOf`: off the odometer), `promise`, `kept`, `due`. `rm` refuses a row an entry pins or another row names ([knobs.md](knobs.md#the-measure-slice-the-weight-instruments)) |
+| `ledger <project> [ls] [--scope S] [--population P] [--json]` · `ledger <project> add <id> --date D --scope S --population P [--value V] --scopeBasis "…" [--<key> V …] [--row '{…}']` · `ledger <project> set <id> --<key> V … [--unset k,k]` · `ledger <project> rm <id>` | a **measure ledger's rows** (`ledgerSchema.kind "measure"`), the only writer of them: each row is checked against the schema -- a track, a form (and the promise forms `promise` / `promise_check`), a number in its unit or a declared regime with an event, the six adjudication fields (a new row defaults `scopeConfidence` read, `valueKind` uttered, `flags` []; `--scopeBasis` is never defaulted), the declared fields, and the instruments' own keys: `run` (a loss claim's run), `retro` (a loss told in the past with no `asOf`: off the odometer), `promise`, `kept`, `due`, `speaker` (another party's key: her rows move none of his numbers), `paidOn`, `outcome` (a `promise_outcome`'s: kept, refunded, withdrawn); the promise forms are `promise`, `promise_check`, `promise_claim`, `promise_outcome`. `rm` refuses a row an entry pins or another row names ([knobs.md](knobs.md#the-measure-slice-the-weight-instruments)) |
| `measure <project> [--take <t>] [--scopes a,b] [--scale MIN-MAX] [--as-of YYYY-MM-DD] [--json]` | the **measure slice** the instruments draw from (`render.chrome.deck.measure`; the flags override it): each row in scope the cut shows at the cut second its figure is said, the hidden rows, and the totals -- the odometer's runs, NET, the goals, the diets, the promises. The take's built `schedule.json` with `--take`, else an estimate; `--json` prints the slice. Reads only ([knobs.md](knobs.md#the-measure-slice-the-weight-instruments)) |
| `rulings <project> [--json]` · `rulings <project> import [--dry-run] [--json]` · `rulings <project> set <clip\|key> keep\|cut\|not-him\|read-aloud [--reason R] [--match M]` · `rulings <project> clear <clip\|key>` | a montage's **clip rulings** (`montage-rulings.json`, the clip deck's): each clip and its ruling and the next render's kept clips; the earlier rulings in the seed's `edits.json`, once; one ruling set or cleared. A render leaves out every clip ruled cut, not-him or read-aloud ([report-video.md](report-video.md#ruling-the-clips)) |
| `fetch <project> --body` · `fetch <project> --dry-run [--json]` · `fetch <project> [--wait] [--json]` · `fetch <project> --status [--json]` · `… [--reason R]` · `… --refetch <clipId>[,…]` · `… --refetch-video <slug>/<id>` · `… --take <take>` | **Fetch windows** (the Cut tab's and the clip deck's button): every clip's window asked of the editor as ONE fetch-windows batch — `--body` prints the body and asks nobody; `--dry-run` the editor's plan (groups per platform, cached, in flight, unresolved); no flag starts it (one paced job per platform queue), `--wait` follows the jobs to their end and names each window a job failed; `--status` follows the last run's jobs once. Clips the montage rulings leave out are not asked for. `--refetch <clipId>[,<clipId>…]` evicts the cached windows that OVERLAP those clips' fetch spans first (the editor's `evict-clips` `{slug, id, covering}`, one job per video, waited for), then fetches as usual — for windows known bad (cut from a corrupt saved video); `--refetch-video <slug>/<id>` does it for every window the project asks of that video; with `--dry-run` the eviction is a dry run too and names what it would remove. `--take <take>` asks for a TAKE's clips instead — its manifest as its walk reads it (the project's now with the take's patches; a draft's too, nothing rendered), so a clip only the take has is fetched; the run is recorded with `take`, and `--status --take` follows the take's last run (the cut's never reads a take's). Every run is recorded in `<project>/fetch-runs.json` (a refetch's evictions under `refetch`). Needs WORKER_TOKEN (else the editor's env files) and the editor at ARCHILYZER_EDITOR_URL. **Exit 1** when a job failed or the editor refused ([report-video.md](report-video.md#fetching-the-windows-and-stand-ins)) |
diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md
@@ -470,8 +470,11 @@ places it where his words say ("since I started"), else a gap over `bandGapDays`
sum of the runs. A **goal_loss** is a target weight against the start of the run open when he set it (a remembered
weight about a day within `bandGapDays` before the run's first claim), else against the last weight he stated. A
**diet** is the regime cell: an off closes only the regime it names. A **promise** (`promise`: what he says he will
-do, `due` when he gave a day) is checked by later `promise_check` rows naming it (`promise`); `kept: true` on either
-keeps it.
+do, `due` when he gave a day) is checked by his later `promise_check` rows naming it (`promise`), claimed about by
+another party's `promise_claim` rows (`speaker`, e.g. `madamsavvy`; `paidOn`; a `citeUrl`), and ended by a
+`promise_outcome` (`outcome`: `kept` · `refunded` · `withdrawn`); `kept: true` on the promise or a check, or an
+outcome `kept`, keeps it. A row with a `speaker` is someone else's: it moves none of his numbers (current, lost, net,
+goals, diet, the totals) and only feeds the promises (`state.promises[].claims`, `.outcome`).
Rows are written through `umtool ledger` only; `umtool measure` prints the slice:
@@ -479,6 +482,8 @@ Rows are written through `umtool ledger` only; `umtool measure` prints the slice
umtool look <p> deck.measure='{"scopes":["weight","regime"],"scale":{"min":220,"max":400}}'
umtool ledger <p> add p01 --date 2026-10-23 --scope weight --population promise --display "post a video of the scale" --scopeBasis "his own post" --citeUrl https://x.com/…/status/…
umtool ledger <p> add p02 --date 2026-11-03 --scope weight --population promise_check --promise p01 --display "pull up a video from three months ago" --scopeBasis "about the scale video"
+umtool ledger <p> add s01 --date 2026-10-23 --scope weight --population promise_claim --promise p01 --speaker madamsavvy --paidOn 2026-10-23 --display "bought the 5 bags" --scopeBasis "her post" --citeUrl https://x.com/…/status/…
+umtool ledger <p> add o01 --date 2026-10-31 --scope weight --population promise_outcome --promise p01 --outcome refunded --speaker madamsavvy --label "refunded by 31 Oct" --scopeBasis "his email, read in her video"
umtool ledger <p> set w14 --retro true # a loss told in the past: off the odometer
umtool ledger <p> set w75 --run 6 # his words put it in the 2025 run
umtool measure <p> --take <t> --json
diff --git a/umtool/lib/report/ledgerCli.mjs b/umtool/lib/report/ledgerCli.mjs
@@ -20,13 +20,15 @@ export const LEDGER_USAGE = [
" umtool ledger <project> rm <id> [--json]",
"",
"A measure ledger's rows (ledgerSchema.kind \"measure\"), written only through these: each row is checked against",
- "the schema -- a scope that is a track, a form it names (and the promise forms, promise / promise_check), a",
- "number in its unit or a declared regime with an event, the six adjudication fields (a new row defaults",
+ "the schema -- a scope that is a track, a form it names (and the promise forms: promise / promise_check /",
+ "promise_claim / promise_outcome), a number in its unit or a declared regime with an event, the six adjudication fields (a new row defaults",
"scopeConfidence read, valueKind uttered, flags []; --scopeBasis is never defaulted) and the declared fields.",
"--<key> sets any built-in key (date asOf scope population value event display label quote deadline src channel",
"video cite citeFrom scopeBasis scopeConfidence valueKind flags (a|b) hedged unsourced entryId authorNote, and the",
"instruments' own: run (a loss claim's run, his words placing it), retro (a loss told in the past with no asOf:",
- "off the odometer), promise (a promise_check's promise), kept, due (YYYY-MM-DD)) or a declared field; `null`",
+ "off the odometer), promise (a promise_check's or promise_claim's promise), kept, due (YYYY-MM-DD), speaker (another",
+ "party's key: a promise_claim's -- her rows move none of his numbers), paidOn (YYYY-MM-DD), outcome (a",
+ "promise_outcome's: kept, refunded, withdrawn)) or a declared field; `null`",
"clears a value. rm refuses a row a timeline entry pins or another row names.",
].join("\n");
@@ -81,6 +83,9 @@ const line = (r) =>
Number.isInteger(r.run) ? `run ${r.run}` : "",
r.retro ? "retro" : "",
r.promise ? `-> ${r.promise}` : "",
+ r.speaker ? `by ${r.speaker}` : "",
+ r.paidOn ? `paid ${r.paidOn}` : "",
+ r.outcome ? String(r.outcome).toUpperCase() : "",
r.kept ? "kept" : "",
String(r.label ?? "").slice(0, 70),
].filter(Boolean).join(" ");
diff --git a/umtool/lib/report/ledgerCli.test.mjs b/umtool/lib/report/ledgerCli.test.mjs
@@ -102,6 +102,24 @@ test("umtool ledger: add, set, unset, rm -- through the writers, on the file", a
assert.equal(JSON.parse(lines.at(-1)).added.citeUrl, "https://x.com/a/status/1");
assert.equal(await run(ledgerCommand, "weigh", "add", "p02", "--date", "2026-11-03", "--scope", "weight", "--population", "promise_check",
"--promise", "p01", "--display", "pull up a video from three months ago", "--scopeBasis", "the scale video"), 0, lines.join("\n"));
+ // Another party's word about it: a promise_claim, with her key and the day she says she paid.
+ assert.equal(await run(ledgerCommand, "weigh", "add", "s01", "--date", "2026-10-24", "--scope", "weight", "--population", "promise_claim",
+ "--promise", "p01", "--speaker", "madamsavvy", "--paidOn", "2026-10-24", "--display", "bought the 5 bags", "--scopeBasis", "her post",
+ "--citeUrl", "https://x.com/MadamSavvy/status/2"), 0, lines.join("\n"));
+ assert.equal(await run(ledgerCommand, "weigh", "add", "s02", "--date", "2026-10-24", "--scope", "weight", "--population", "promise_check",
+ "--promise", "p01", "--speaker", "madamsavvy", "--scopeBasis", "her post"), 1);
+ assert.match(lines.at(-1), /a promise_check is the subject's own word: madamsavvy's is a promise_claim/);
+ assert.equal(await run(ledgerCommand, "weigh", "add", "s02", "--date", "2026-10-24", "--scope", "weight", "--population", "current",
+ "--value", "250", "--paidOn", "2026-10-24", "--speaker", "Madam Savvy", "--scopeBasis", "her post"), 1);
+ assert.match(lines.at(-1), /speaker must be a speaker's key.*paidOn is a promise_claim's|paidOn is a promise_claim's/);
+ // How it ended: a promise_outcome, refunded by her account.
+ assert.equal(await run(ledgerCommand, "weigh", "add", "o01", "--date", "2026-10-31", "--scope", "weight", "--population", "promise_outcome",
+ "--promise", "p01", "--outcome", "refunded", "--speaker", "madamsavvy", "--label", "refunded by 31 Oct", "--scopeBasis", "her video"), 0, lines.join("\n"));
+ assert.equal(await run(ledgerCommand, "weigh", "add", "o02", "--date", "2026-10-31", "--scope", "weight", "--population", "promise_outcome",
+ "--promise", "p01", "--outcome", "forgotten", "--scopeBasis", "x"), 1);
+ assert.match(lines.at(-1), /outcome kept, refunded, withdrawn/);
+ assert.equal(await run(ledgerCommand, "weigh", "rm", "o01"), 0);
+ assert.equal(await run(ledgerCommand, "weigh", "rm", "s01"), 0);
// A loss told in the past: off the odometer; then put back on it.
assert.equal(await run(ledgerCommand, "weigh", "set", "w04", "--retro", "true"), 0, lines.join("\n"));
let m = await manifestOf(dir);
@@ -114,7 +132,7 @@ test("umtool ledger: add, set, unset, rm -- through the writers, on the file", a
assert.equal(await run(ledgerCommand, "weigh", "set", "w02", "--run", "3"), 1);
assert.match(lines.at(-1), /ERR umtool ledger: run is a loss claim's/);
assert.equal(await run(ledgerCommand, "weigh", "rm", "p01"), 1);
- assert.match(lines.at(-1), /p01 is still named: row p02 checks it/);
+ assert.match(lines.at(-1), /p01 is still named: row p02 names it/);
assert.equal(await run(ledgerCommand, "weigh", "rm", "w01"), 1);
assert.match(lines.at(-1), /timeline entry c1 pins it/);
assert.equal(await readFile(path.join(dir, "video.manifest.json"), "utf8"), before);
diff --git a/umtool/lib/report/ledgerRows.mjs b/umtool/lib/report/ledgerRows.mjs
@@ -10,10 +10,15 @@
// arithmetic keeps (measureGaps): a scope that is a track, a form the schema
// names, the six adjudication fields, and on a regime track a declared
// regime and an event. The promise forms are every measure ledger's:
-// `promise` (what he says he will do) and `promise_check` (a later word
-// about it, naming the promise in `promise`); `kept: true` on either.
+// `promise` (what he says he will do), `promise_check` (his later word about
+// it) and `promise_claim` (another party's statement about it, with its
+// `speaker` and `paidOn`), the last two naming the promise in `promise`;
+// `kept: true` on a promise or a check; `promise_outcome` says how it ended
+// (`outcome`: kept, refunded, withdrawn). A row's `speaker` (absent: the
+// subject) is a lower-case key; another speaker's row moves none of his
+// numbers (measure-slice.mjs).
import {
- EVENTS, LEDGER_BUILTIN_KEYS, PROMISE_FORMS, SCOPE_CONFIDENCE, VALUE_KINDS, measureDisplay, measureGaps, measureSchema, validateFields,
+ EVENTS, LEDGER_BUILTIN_KEYS, PROMISE_FORMS, PROMISE_OUTCOMES, SCOPE_CONFIDENCE, VALUE_KINDS, measureDisplay, measureGaps, measureSchema, validateFields,
} from "umtool-report-to-video/ledger-totals";
const isObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
@@ -30,7 +35,7 @@ export const LEDGER_KEY_TYPES = Object.freeze({
display: "text?", label: "text?", quote: "text?", deadline: "text?", src: "text?", channel: "text?", video: "text?",
cite: "seconds?", citeFrom: "text?", scopeBasis: "text", scopeConfidence: "text", valueKind: "text", flags: "list",
hedged: "bool?", unsourced: "bool?", plotted: "bool?", hidden: "bool?", entryId: "text?", authorNote: "text?",
- run: "run?", retro: "bool?", promise: "text?", kept: "bool?", due: "day?",
+ run: "run?", retro: "bool?", promise: "text?", kept: "bool?", due: "day?", speaker: "speaker?", paidOn: "day?", outcome: "text?",
});
/** Is this manifest's ledger a measure ledger (the one these writers write)? */
@@ -117,6 +122,7 @@ export function ledgerRowOf(manifest, base, patch, { unset = [] } = {}) {
const v = row[k];
if (v === undefined || v === null) continue;
if (type.startsWith("text") && typeof v !== "string") errors.push(`${k} must be text`);
+ if (type === "speaker?" && !(typeof v === "string" && /^[a-z0-9][a-z0-9._-]{0,63}$/.test(v))) errors.push(`${k} must be a speaker's key (lower case: "madamsavvy")`);
if (type === "bool?" && typeof v !== "boolean") errors.push(`${k} must be true or false`);
if (type === "seconds?" && !(Number.isFinite(v) && v >= 0)) errors.push(`${k} must be a source second, 0 or more`);
if (type === "day?" && !DAY_RE.test(String(v))) errors.push(`${k} must be a day (YYYY-MM-DD)`);
@@ -133,12 +139,18 @@ export function ledgerRowOf(manifest, base, patch, { unset = [] } = {}) {
else if (!isDelta) errors.push("run is a loss claim's (a delta row)");
}
if (row.retro !== undefined && row.retro !== null && !isDelta) errors.push("retro is a loss claim's (a delta row)");
- if (row.kept !== undefined && row.kept !== null && !promiseForm) errors.push("kept is a promise's (a promise or promise_check row)");
- if (row.population === "promise_check") {
+ if (row.kept !== undefined && row.kept !== null && !["promise", "promise_check"].includes(row.population)) errors.push("kept is a promise's (a promise or promise_check row)");
+ if (row.population === "promise_outcome") {
+ if (!PROMISE_OUTCOMES.includes(row.outcome)) errors.push(`a promise_outcome says how it ended: outcome ${PROMISE_OUTCOMES.join(", ")}`);
+ } else if (row.outcome !== undefined && row.outcome !== null) errors.push("outcome is a promise_outcome's");
+ if (["promise_check", "promise_claim", "promise_outcome"].includes(row.population)) {
const p = ledger.find((r) => r?.id === row.promise);
- if (!row.promise) errors.push("a promise_check names its promise (--promise <row id>)");
+ if (!row.promise) errors.push(`a ${row.population} names its promise (--promise <row id>)`);
else if (!p || p.population !== "promise") errors.push(`promise must name a promise row (${row.promise} is ${p ? `a ${p.population} row` : "not in the ledger"})`);
- } else if (row.promise !== undefined && row.promise !== null) errors.push("promise is a promise_check's");
+ } else if (row.promise !== undefined && row.promise !== null) errors.push("promise is a promise_check's, promise_claim's or promise_outcome's");
+ if (row.paidOn !== undefined && row.paidOn !== null && row.population !== "promise_claim") errors.push("paidOn is a promise_claim's");
+ // A promise_check is HIS later word; another party's is a promise_claim.
+ if (row.population === "promise_check" && row.speaker) errors.push(`a promise_check is the subject's own word: ${row.speaker}'s is a promise_claim`);
if (row.entryId !== undefined && row.entryId !== null && !(manifest.timeline ?? []).some((e) => e?.id === row.entryId)) {
errors.push(`entryId ${row.entryId} is not an entry of the timeline`);
}
@@ -175,7 +187,7 @@ export function ledgerRowReferences(manifest, id) {
const refs = isMeasureLedger(manifest) ? measureSchema(manifest.ledgerSchema).fields.filter((f) => f.kind === "rowRef").map((f) => f.key) : [];
for (const r of manifest.ledger ?? []) {
if (!isObj(r) || r.id === id) continue;
- if (r.promise === id) out.push(`row ${r.id} checks it (promise)`);
+ if (r.promise === id) out.push(`row ${r.id} names it (promise)`);
for (const k of refs) if (r[k] === id) out.push(`row ${r.id} refers to it (${k})`);
}
return out;
diff --git a/umtool/report-to-video/ledger-shared.mjs b/umtool/report-to-video/ledger-shared.mjs
@@ -99,4 +99,9 @@ export const LEDGER_BUILTIN_KEYS = new Set([
// (`retro`), a promise check's promise, whether it was kept, and a day a
// goal or a promise is due
"run", "retro", "promise", "kept", "due",
+ // who said it, when it is not the subject (a promise_claim's counterparty;
+ // such a row never moves the subject's numbers), and the day she says she paid
+ "speaker", "paidOn",
+ // how a promise ended (a promise_outcome's: kept, refunded, withdrawn)
+ "outcome",
]);
diff --git a/umtool/report-to-video/ledger-totals.mjs b/umtool/report-to-video/ledger-totals.mjs
@@ -52,6 +52,7 @@ export {
MEASURE_PREDICATES,
MEASURE_THRESHOLDS,
PROMISE_FORMS,
+ PROMISE_OUTCOMES,
allRegimeGaps,
freshestReading,
goalAbsolute,
diff --git a/umtool/report-to-video/measure-slice.mjs b/umtool/report-to-video/measure-slice.mjs
@@ -188,6 +188,8 @@ export function kindOf(row, schema) {
case "overweight_by": return "overBy";
case "promise": return "promise";
case "promise_check": return "promiseCheck";
+ case "promise_claim": return "promiseClaim";
+ case "promise_outcome": return "promiseOutcome";
case "status": return role === "regime" ? "diet" : "status";
default: return row?.population ?? null;
}
@@ -220,9 +222,19 @@ function eventOf(row, schema, runOf) {
regime: role === "regime" ? String(row.value) : null,
event: role === "regime" ? row.event ?? null : null,
run: kind === "lost" && runOf.has(row.id) ? runOf.get(row.id) : null,
+ speaker: speakerOf(row),
+ outcome: row.population === "promise_outcome" && typeof row.outcome === "string" ? row.outcome : null,
};
}
+/**
+ * Who said the row: null for the subject (no `speaker`), else the speaker's
+ * key ("madamsavvy"). A row by another speaker never moves the subject's
+ * numbers -- current, lost, net, goals, diet, the totals -- it only feeds the
+ * promises (a promise_claim).
+ */
+export const speakerOf = (row) => (typeof row?.speaker === "string" && row.speaker.trim() ? row.speaker.trim() : null);
+
// ---------------------------------------------------------------------------
// When a row lands: the spoken number in the clip's words
// ---------------------------------------------------------------------------
@@ -363,7 +375,9 @@ export function measureSlice(manifest, schedule, opts = {}) {
const ledger = (opts.ledger ?? manifest.ledger ?? []).filter((r) => isObj(r) && typeof r.id === "string");
const rows = ledger.filter((r) => scopes.has(r.scope));
const byId = new Map(rows.map((r) => [r.id, r]));
- const { runs, runOf, claims: lossClaims, total } = lossRuns(rows, s);
+ // HIS rows: every number the instruments draw is the subject's own.
+ const own = rows.filter((r) => speakerOf(r) === null);
+ const { runs, runOf, claims: lossClaims, total } = lossRuns(own, s);
const runById = new Map(runs.map((r) => [r.run, r]));
// ---- events: each pinned row at the cut second it lands -------------------
@@ -415,7 +429,7 @@ export function measureSlice(manifest, schedule, opts = {}) {
// ---- the record's own figures, for the state's fixed ends -----------------
const valueTrack = s.tracks.find((t) => t.role === "value")?.key ?? null;
const regimeTrack = s.tracks.find((t) => t.role === "regime" && scopes.has(t.key))?.key ?? null;
- const readings = chronological(rows.filter((r) => r.scope === valueTrack && (r.population === "current" || r.population === "past") && Number.isFinite(Number(r.value))));
+ const readings = chronological(own.filter((r) => r.scope === valueTrack && (r.population === "current" || r.population === "past") && Number.isFinite(Number(r.value))));
const firstReading = [...readings].sort((a, b) => dateKey(plotDate(a)).localeCompare(dateKey(plotDate(b))) || String(a.id).localeCompare(String(b.id)))[0] ?? null;
const netFrom = firstReading ? { value: Number(firstReading.value), date: plotDate(firstReading), row: firstReading.id } : null;
@@ -454,6 +468,11 @@ export function measureSlice(manifest, schedule, opts = {}) {
return { value: cell.value, loss: cell.loss, deadline: cell.deadline, due: isIso(row.due) ? row.due : null, row: row.id, display: cell.display, base };
};
+ /** A promise_claim as a promise carries it: who, when said, the day she says she paid, his-or-her words. */
+ /** A promise_outcome as a promise carries it. */
+ const outcomeOf = (row) => ({ kind: row.outcome, date: row.date ?? null, row: row.id });
+ const claimOf = (row) => ({ row: row.id, speaker: speakerOf(row), date: row.date ?? null, paidOn: isIso(row.paidOn) ? row.paidOn : null, label: row.label ?? row.display ?? null });
+
// ---- the state after each event -------------------------------------------
let current = null;
const remembered = [];
@@ -479,12 +498,14 @@ export function measureSlice(manifest, schedule, opts = {}) {
value: netFrom && current ? r1(current.value - netFrom.value) : null,
},
diet: regime && regime.key !== off ? { regime: regime.key, display: regime.display, row: regime.row, n: dietN, since: regime.since } : null,
- promises: [...promises.values()].map((p) => ({ ...p, checks: [...p.checks] })),
+ promises: [...promises.values()].map((p) => ({ ...p, checks: [...p.checks], claims: p.claims.map((c) => ({ ...c })), outcome: p.outcome ? { ...p.outcome } : null })),
};
};
const state = [snapshot(0)];
for (const ev of events) {
const row = byId.get(ev.row);
+ // Another speaker's row feeds the promises and nothing else.
+ if (ev.speaker !== null && ev.kind !== "promiseClaim" && ev.kind !== "promiseOutcome") { state.push(snapshot(ev.t)); continue; }
if (ev.kind === "stated" && ev.value !== null) current = { value: ev.value, qualifier: ev.qualifier, row: ev.row, date: ev.date, asOf: ev.asOf };
else if (ev.kind === "remembered" && ev.value !== null) remembered.push({ value: ev.value, asOf: ev.asOf, row: ev.row, date: ev.date });
else if (ev.kind === "goal" || ev.kind === "goalLoss") { goal = goalOf(row); goals.push(ev.row); }
@@ -498,10 +519,17 @@ export function measureSlice(manifest, schedule, opts = {}) {
const off = offOf(s, regimeTrack)?.key ?? null;
if (regime && regime.key !== off && (!was || was.key !== regime.key)) dietN += 1;
} else if (ev.kind === "promise") {
- promises.set(ev.row, { row: ev.row, said: ev.date, what: ev.display, due: ev.due, kept: row.kept === true, checks: [] });
+ promises.set(ev.row, { row: ev.row, said: ev.date, what: ev.display, due: ev.due, kept: row.kept === true, checks: [], claims: [], outcome: null });
} else if (ev.kind === "promiseCheck") {
const p = promises.get(row.promise);
if (p) { p.checks.push(ev.row); if (row.kept === true) p.kept = true; }
+ } else if (ev.kind === "promiseClaim") {
+ const p = promises.get(row.promise);
+ if (p) p.claims.push(claimOf(row));
+ } else if (ev.kind === "promiseOutcome") {
+ // How it ended: the latest outcome shown; "kept" keeps it.
+ const p = promises.get(row.promise);
+ if (p && ev.outcome) { p.outcome = outcomeOf(row); if (ev.outcome === "kept") p.kept = true; }
}
state.push(snapshot(ev.t));
}
@@ -510,7 +538,7 @@ export function measureSlice(manifest, schedule, opts = {}) {
for (const st of state) if (st.current) delete st.current.asOf;
// ---- totals over the whole record in scope --------------------------------
- const all = chronological(rows);
+ const all = chronological(own);
const lastStated = [...readings].filter((r) => r.population === "current").pop() ?? null;
const goalRows = all.filter((r) => r.population === "goal" || r.population === "goal_loss");
const repeats = {};
@@ -533,9 +561,11 @@ export function measureSlice(manifest, schedule, opts = {}) {
const dates = all.map((r) => plotDate(r)).filter(Boolean).map(dateKey).sort();
const promiseRows = all.filter((r) => r.population === "promise");
const checksOf = (id) => all.filter((r) => r.population === "promise_check" && r.promise === id);
+ const outcomeRowOf = (id) => chronological(rows).filter((r) => r.population === "promise_outcome" && r.promise === id && typeof r.outcome === "string").pop() ?? null;
+ const claimsOf = (id) => chronological(rows).filter((r) => r.population === "promise_claim" && r.promise === id).map(claimOf);
let diets = 0;
try {
- diets = measureTotals(rows, s, { strict: false }).switches;
+ diets = measureTotals(own, s, { strict: false }).switches;
} catch {
diets = 0;
}
@@ -557,7 +587,12 @@ export function measureSlice(manifest, schedule, opts = {}) {
under300: { said: under.length, rows: under.map((r) => r.id) },
promises: promiseRows.map((p) => {
const checks = checksOf(p.id);
- return { row: p.id, said: p.date, what: measureDisplay(p, s), due: isIso(p.due) ? p.due : null, kept: p.kept === true || checks.some((c) => c.kept === true), checks: checks.map((c) => c.id) };
+ const end = outcomeRowOf(p.id);
+ return {
+ row: p.id, said: p.date, what: measureDisplay(p, s), due: isIso(p.due) ? p.due : null,
+ kept: p.kept === true || checks.some((c) => c.kept === true) || end?.outcome === "kept",
+ checks: checks.map((c) => c.id), claims: claimsOf(p.id), outcome: end ? outcomeOf(end) : null,
+ };
}),
span: { from: dates[0] ?? null, to: dates[dates.length - 1] ?? null },
};
diff --git a/umtool/report-to-video/measure-slice.test.mjs b/umtool/report-to-video/measure-slice.test.mjs
@@ -175,7 +175,7 @@ test("state: after each event, from the shown rows only", () => {
assert.deepEqual(last.goal, { value: 284, loss: 65, deadline: "by Christmas", due: "2025-12-25", row: "w11", display: "284 lb", base: { value: 349, row: "w07", from: "runStart" } });
assert.deepEqual(last.goals, ["w11"]);
assert.deepEqual(last.remembered.map((r) => r.row), ["w01", "w07"]);
- assert.deepEqual(last.promises, [{ row: "p01", said: "2025-06-05", what: "post a video of the scale", due: null, kept: false, checks: [] }]);
+ assert.deepEqual(last.promises, [{ row: "p01", said: "2025-06-05", what: "post a video of the scale", due: null, kept: false, checks: [], claims: [], outcome: null }]);
});
test("totals: the whole record in scope", () => {
@@ -185,7 +185,7 @@ test("totals: the whole record in scope", () => {
assert.equal(t.runs, 2);
assert.deepEqual(t.net, { from: 368, to: 335, value: -33, fromRow: "w01", toRow: "w08" });
assert.equal(t.goals, 1);
- assert.deepEqual(t.promises, [{ row: "p01", said: "2025-06-05", what: "post a video of the scale", due: null, kept: false, checks: ["p02"] }]);
+ assert.deepEqual(t.promises, [{ row: "p01", said: "2025-06-05", what: "post a video of the scale", due: null, kept: false, checks: ["p02"], claims: [], outcome: null }]);
assert.deepEqual(t.span, { from: "2008-06-30", to: "2025-09-01" });
assert.deepEqual(t.under300, { said: 0, rows: [] });
assert.equal(t.diets, 1, "keto -> carnivore is one change; off GLP-1 none");
@@ -227,3 +227,52 @@ test("the deck schedule carries `measure` only for a measure cut, and the slices
assert.deepEqual(pinnedRows(TIMELINE, LEDGER).get("c4"), ["w08", "w09", "r02", "d01"]);
assert.deepEqual(validateClaims(m), []);
});
+
+test("another speaker's rows feed the promises and move none of his numbers", () => {
+ const plain = measureSlice(manifest(), { segments: SEGMENTS }, { words: WORDS, clock: CLOCK, asOf: "2025-07-10" });
+ const savvy = [
+ row({ id: "s01", date: "2025-06-06", population: "promise_claim", value: null, speaker: "madamsavvy", promise: "p01", paidOn: "2025-06-06",
+ display: "bought the 5 bags", label: "\"I bought the 5 bags\"", citeUrl: "https://x.com/MadamSavvy/status/1", entryId: "c5" }),
+ // Her figures are hers: no reading, loss or goal of his.
+ row({ id: "s02", date: "2025-06-07", population: "current", value: 250, speaker: "madamsavvy", display: "250 lb", entryId: "c5" }),
+ row({ id: "s03", date: "2025-06-07", population: "delta", value: -99, speaker: "madamsavvy", display: "-99", entryId: "c5" }),
+ row({ id: "s04", date: "2025-06-08", population: "goal_loss", value: -10, speaker: "madamsavvy", display: "lose 10" }),
+ ];
+ const m = { ...manifest(), ledger: [...LEDGER, ...savvy] };
+ const sl = measureSlice(m, { segments: SEGMENTS }, { words: WORDS, clock: CLOCK, asOf: "2025-07-10" });
+ const strip = (t) => JSON.stringify({ ...t, promises: t.promises.map(({ claims: _c, ...p }) => p) });
+ assert.equal(strip(sl.totals), strip(plain.totals), "the totals are his alone");
+ const claim = sl.events.find((e) => e.row === "s01");
+ assert.equal(claim.kind, "promiseClaim");
+ assert.equal(claim.speaker, "madamsavvy");
+ assert.equal(sl.events.find((e) => e.row === "s03").run, null, "her loss is no run of his");
+ const last = sl.state[sl.state.length - 1];
+ const was = plain.state[plain.state.length - 1];
+ for (const k of ["current", "lost", "net", "goal", "goals", "diet", "remembered"]) assert.deepEqual(last[k], was[k], k);
+ assert.deepEqual(last.promises[0].claims, [{ row: "s01", speaker: "madamsavvy", date: "2025-06-06", paidOn: "2025-06-06", label: "\"I bought the 5 bags\"" }]);
+ assert.deepEqual(sl.totals.promises[0].claims.map((c) => c.row), ["s01"]);
+ assert.deepEqual(plain.state.at(-1).promises[0].claims, [], "a promise with no claim has an empty list");
+});
+
+test("a promise's outcome: how it ended, and \"kept\" keeps it -- the totals untouched", () => {
+ const plain = measureSlice(manifest(), { segments: SEGMENTS }, { words: WORDS, clock: CLOCK, asOf: "2025-07-10" });
+ const strip = (t) => JSON.stringify({ ...t, promises: t.promises.map(({ outcome: _o, kept: _k, ...p }) => p) });
+ const withOutcome = (outcome, speaker) => measureSlice({
+ ...manifest(),
+ ledger: [...LEDGER, row({ id: "o01", date: "2025-06-20", population: "promise_outcome", value: null, promise: "p01", outcome, ...(speaker ? { speaker } : {}),
+ display: outcome, label: `${outcome} by 20 June`, entryId: "c5" })],
+ }, { segments: SEGMENTS }, { words: WORDS, clock: CLOCK, asOf: "2025-07-10" });
+ const refunded = withOutcome("refunded", "madamsavvy");
+ assert.equal(strip(refunded.totals), strip(plain.totals), "an outcome moves no total");
+ const ev = refunded.events.find((e) => e.row === "o01");
+ assert.deepEqual([ev.kind, ev.outcome, ev.speaker], ["promiseOutcome", "refunded", "madamsavvy"]);
+ const p = refunded.state.at(-1).promises[0];
+ assert.deepEqual(p.outcome, { kind: "refunded", date: "2025-06-20", row: "o01" });
+ assert.equal(p.kept, false, "refunded is not kept");
+ assert.deepEqual(refunded.totals.promises[0].outcome, { kind: "refunded", date: "2025-06-20", row: "o01" });
+ for (const k of ["current", "lost", "net", "goal", "diet"]) assert.deepEqual(refunded.state.at(-1)[k], plain.state.at(-1)[k], k);
+ const kept = withOutcome("kept");
+ assert.equal(kept.state.at(-1).promises[0].kept, true);
+ assert.equal(kept.totals.promises[0].kept, true);
+ assert.equal(plain.state.at(-1).promises[0].outcome, null);
+});
diff --git a/umtool/report-to-video/measure-totals.mjs b/umtool/report-to-video/measure-totals.mjs
@@ -83,12 +83,19 @@ export function offCloses(openKey, named, offKey = null) {
export const DEFAULT_FORMS = ["current", "past", "delta", "goal", "overweight_by", "status"];
/**
- * The two forms a PROMISE is written in (weight video rev 9): `promise`, what
- * he says he will do ("post a video of the scale"; `due` when he gave a day),
- * and `promise_check`, a later statement about it (`promise` names the row;
- * `kept: true` on either says it was kept). Built into every measure schema.
+ * The forms a PROMISE is written in (weight video rev 9): `promise`, what he
+ * says he will do ("post a video of the scale"; `due` when he gave a day);
+ * `promise_check`, his own later word about it; and `promise_claim`, ANOTHER
+ * party's statement about it ("I bought the 5 bags"; `speaker`, `paidOn`);
+ * and `promise_outcome`, how it ended (`outcome`: kept, refunded or
+ * withdrawn -- a promise can end without being kept). `promise` names the
+ * promise row on the last three; `kept: true` on a promise or a check, or an
+ * outcome "kept", says it was kept. Built into every measure schema.
*/
-export const PROMISE_FORMS = ["promise", "promise_check"];
+export const PROMISE_FORMS = ["promise", "promise_check", "promise_claim", "promise_outcome"];
+
+/** How a promise ended (a promise_outcome's `outcome`). */
+export const PROMISE_OUTCOMES = ["kept", "refunded", "withdrawn"];
/** The two forms that are a reading of the quantity itself, so they plot. */
export const PLOTTING_FORMS = new Set(["current", "past"]);
diff --git a/umtool/report-to-video/measure-totals.test.mjs b/umtool/report-to-video/measure-totals.test.mjs
@@ -138,7 +138,7 @@ test("the kind, and the vocabulary, come off the schema", () => {
const v = claimVocab(SAMPLE);
assert.deepEqual(v.scopes, ["weight", "regime"]);
// The schema's forms, then the promise forms every measure ledger carries.
- assert.deepEqual(v.populations, ["current", "past", "delta", "goal", "overweight_by", "status", "promise", "promise_check"]);
+ assert.deepEqual(v.populations, ["current", "past", "delta", "goal", "overweight_by", "status", "promise", "promise_check", "promise_claim", "promise_outcome"]);
assert.deepEqual(v.events, EVENTS);
assert.deepEqual(v.regimes, ["keto", "carnivore", "off"]);
assert.equal(v.unit, "lb");