commit 18c4a22f96a70e0577bf5f8e48e1afc48a3c8c9d
parent 321782dae1249b50b942a775efabf758b8214d76
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 6 Nov 2026 01:26:38 -0500
umtool: the promise clock's PAID and AS OF dates
rev9-base read "PAID 24 OCT" (the latest claim's date) where her first
claim says she paid on 23 Oct (s01 paidOn), and an AS OF that could run ahead
of the promise: the latest date of ANY event seen so far in cut order.
- PAID: the first claim carrying `paidOn`, else the first claim (its date).
- AS OF: the latest date among the promise's OWN rows so far -- the promise,
its checks, the claims on it, its outcome -- so a goal said on 31 Oct
between them moves nothing; the count-up to the render date is unchanged,
and kept still stops it on its day.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/umtool/report-to-video/measure-extras.mjs b/umtool/report-to-video/measure-extras.mjs
@@ -337,7 +337,8 @@ export const PROMISE_OUTCOMES = Object.freeze(["kept", "refunded", "withdrawn"])
/**
* The promise clock's states: `{ at, rows: [row], asOf }`, one row (the latest
* promise): `{ row, what, said, days, to, kept, outcome: { kind, date } | null,
- * claim: { speaker, date, paidOn } | null, word: { text, date, speaker, his } |
+ * claim: { speaker, date, paidOn } | null (the first claim with a `paidOn`, else
+ * the first), `to` the latest of the promise's own rows' dates so far, word: { text, date, speaker, his } |
* null, fresh }` -- `to` the date the days are counted to, `claim` another
* party's (her) latest claim on it (CONTRACT addendum: "PAID 23 OCT BY
* @MadamSavvy"), `word` the latest words said about it -- his check, her
@@ -365,14 +366,15 @@ export function promiseStates(schedule, render) {
const o = isObj(p.outcome) && PROMISE_OUTCOMES.includes(p.outcome.kind) ? p.outcome : null;
return o ? { kind: o.kind, date: o.date ?? null } : p.kept === true ? { kind: "kept", date: null } : null;
};
- const rowsAt = (s, dateNow, freshRow) => (Array.isArray(s?.promises) ? s.promises : [])
+ const rowsAt = (s, freshRow) => (Array.isArray(s?.promises) ? s.promises : [])
.filter((p) => p && p.said)
.slice(-1)
.map((p) => {
const ev = byRow.get(p.row);
const outcome = outcomeOf(p);
const claims = Array.isArray(p.claims) ? p.claims.filter((c) => isObj(c)) : [];
- const c = claims[claims.length - 1] ?? null;
+ // "PAID <date>": the first claim that says when she paid (`paidOn`), else the first claim.
+ const c = claims.find((x) => typeof x.paidOn === "string" && x.paidOn) ?? claims[0] ?? null;
// His checks named by the state (an older slice has no events for the words: the row's).
const checks = Array.isArray(p.checks) ? p.checks : [];
let word = lastWord.get(p.row) ?? null;
@@ -383,7 +385,12 @@ export function promiseStates(schedule, render) {
}
// Kept stops the count on the day it was kept.
const stop = outcome?.kind === "kept" && outcome.date ? outcome.date : null;
- const to = stop ?? (dateNow && dateNow > p.said ? dateNow : p.said);
+ // AS OF: the latest of the promise's OWN rows so far -- the promise, its
+ // checks, the claims on it, its outcome -- never a later date another row
+ // showed earlier in cut order.
+ const own = [p.said, ...checks.map((r) => byRow.get(r)?.date), ...claims.map((x) => x.date), outcome?.date].filter((d) => typeof d === "string" && /^\d{4}-\d{2}-\d{2}$/.test(d));
+ const latest = own.reduce((a, b) => (b > a ? b : a), p.said);
+ const to = stop ?? latest;
return {
row: p.row,
what: cfg.label ?? ev?.display ?? p.what ?? "promise",
@@ -398,11 +405,9 @@ export function promiseStates(schedule, render) {
};
});
const out = [];
- let dateNow = null;
let lastSig = null;
let lastS = null;
for (const { e, s } of steps) {
- if (e.date && (!dateNow || e.date > dateNow)) dateNow = e.date;
if (e.t < first.e.t) continue;
let fresh = null;
if ((e.kind === "promiseCheck" || e.kind === "promiseClaim" || e.kind === "promiseOutcome") && e.promise) {
@@ -412,7 +417,7 @@ export function promiseStates(schedule, render) {
fresh = e.row;
}
}
- const rows = rowsAt(s, dateNow, fresh);
+ const rows = rowsAt(s, fresh);
lastS = s;
if (!rows.length) continue;
const sig = JSON.stringify(rows);
@@ -429,7 +434,7 @@ export function promiseStates(schedule, render) {
const from = fin ? Math.max(lastAt + 0.5, fin.from) : lastAt + PROMISE_SETTLE;
const asOf = m.asOfRender;
if (asOf && from < total - 0.2) {
- const base = rowsAt(lastS, dateNow, null);
+ const base = rowsAt(lastS, null);
const target = base.map((r) => (r.kept && r.outcome?.date ? r.days : Math.max(0, daysBetween(r.said, asOf) ?? 0)));
const toOf = (r) => (r.kept && r.outcome?.date ? r.to : asOf);
const steps2 = Math.max(0, ...target.map((d, i) => d - base[i].days));
diff --git a/umtool/report-to-video/measure-extras.test.mjs b/umtool/report-to-video/measure-extras.test.mjs
@@ -95,7 +95,10 @@ test("peak: a tick per telling of a start in the drift, a count per retelling, t
test("promise: the days to the clip's in-record date, her claim and the outcome, the words flashed, then counted on to the render date", () => {
const states = promiseStates(schedule(), RENDER);
- assert.deepEqual(states.map((s) => s.rows[0].days), [0, 1, 8, 8, 11, 12, 13]);
+ // AS OF is the promise's own rows' latest date: the goal said on 31 Oct between them moves nothing.
+ // (The goal's state at 720.09 is its own only because her words stop flashing there.)
+ assert.deepEqual(states.map((s) => s.rows[0].days), [0, 1, 1, 8, 11, 12, 13]);
+ assert.deepEqual(states.map((s) => s.rows[0].to), ["2026-10-23", "2026-10-24", "2026-10-24", "2026-10-31", "2026-11-03", "2026-11-05", "2026-11-05"]);
assert.equal(states[0].at, 712.18, "from the promise on");
assert.equal(states[0].rows[0].what, "scale video");
assert.equal(states[0].rows[0].claim, null);
@@ -122,6 +125,18 @@ test("promise: the days to the clip's in-record date, her claim and the outcome,
const kept = promiseStates(schedule(m), RENDER);
assert.equal(kept.at(-1).rows[0].kept, true);
assert.equal(kept.at(-1).rows[0].days, 8, "stopped on 31 Oct");
+ // PAID: the first claim that carries a paidOn (s01 23 Oct), not the latest claim's date.
+ const paid = clone(MEASURE);
+ for (const s of paid.state) for (const p of s.promises ?? []) {
+ if (p.claims?.length) p.claims = [{ row: "s01", speaker: "madamsavvy", date: "2026-10-23", paidOn: "2026-10-23" }, { row: "s02", speaker: "madamsavvy", date: "2026-10-24" }, { row: "s03", speaker: "madamsavvy", date: "2026-10-25" }];
+ }
+ const ps = promiseStates(schedule(paid), RENDER);
+ assert.deepEqual(ps[1].rows[0].claim, { speaker: "madamsavvy", date: "2026-10-23", paidOn: "2026-10-23" });
+ assert.equal(ps[1].rows[0].to, "2026-10-25", "AS OF: the latest of its own rows, the claims' too");
+ // No paidOn anywhere: the first claim, by its date.
+ const unpaid = clone(paid);
+ for (const s of unpaid.state) for (const p of s.promises ?? []) for (const c of p.claims ?? []) delete c.paidOn;
+ assert.equal(promiseStates(schedule(unpaid), RENDER)[1].rows[0].claim.date, "2026-10-23");
// An older slice's `kept: true` reads as kept.
const old = clone(MEASURE);
for (const s of old.state) for (const p of s.promises ?? []) { delete p.outcome; p.kept = true; }