commit 1f07e90876ed6e921e959e39967d0a7a64029411
parent 2205c5c68d9294d05b4e4f3a683535adae59c316
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Thu, 12 Nov 2026 01:58:37 -0500
report-to-video: deck.goals.baseMaxDays -- a loss goal's base counts only when its weight was said at most that many days before the goal (unset: as before); a staler one is no base, so no "(FROM …)", no target, no tick; the base carries its row's date; umtool look takes --take for the deck's keys
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
11 files changed, 193 insertions(+), 11 deletions(-)
diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md
@@ -1,6 +1,7 @@
# Changelog
## [Unreleased]
+- **umtool: a loss goal no longer takes its base from a weight said years before.** A goal such as "lose 100" is shown against the latest weight he had given by then, however old: on the weight video that put "(FROM 368)" on a goal set eight years after he said 368. `deck.goals.baseMaxDays` (unset: as before) keeps a base only when its weight was said at most that many days before the goal; an older one is no base, so the note carries no "(FROM …)" and the dial draws no goal weight or tick from it. `umtool look <p> deck.goals.baseMaxDays=365`, and `umtool look` now takes `--take <t>` for the deck's keys, which sets them on that take alone.
- **umtool: the dial's finale no longer shows the callout's labels over its hub.** With `deck.dial.rememberedAs: "callout"` the finale's dial drew every remembered weight's label box and the ghost needle and never hid them, so the boxes sat on the hub for the whole finale (take rev9-a9). They are hidden there now; the rim's marker and flag for the last remembered weight stay.
- **umtool: record, filter and listen before anything is kept.** On the record page a recording became a take the moment its last part was in, and hearing it in the character's voice meant importing it on the Voices page and waiting for three takes (operator, 11 Nov: "run the filter and preview it seamlessly in the record UI"). With **Filter before keeping** (on by itself for a post whose character has a stock voice to convert to) the post now waits. **Filter** (`f`) runs the character's recorded preset as one job: clean, cut, convert. Its result is a preview in `narration/.record-preview/<postId>.<label>/`, not a take. The page shows the three stages and the time it has run, and a wait at the editor's queue or the machine's heavy slot reads "waiting for memory … the gate working, not an error". **▶ Raw** and **▶ Filtered** play at one loudness. **Keep** (`Enter`) makes the recorded, cleaned and converted takes from the preview's files, converts nothing again, picks the last and opens the next post not recorded; **Again** (`Backspace` or `r`) drops the preview and records the part again. Each part's waveform carries two **cut marks** at the auto trim's answer; drag one, or press the arrow keys on it, to cut a keyboard click off the start or the end. **Pitch** and **semitones** (a Seed-VC convert) default to the preset's and re-run the convert alone; **Save to character** writes them back, and a post read as the narrator or as nobody offers **Keep in this video only**. Above the record button: the character, its direction line and **▶ <voice> reads it** (its synthetic preset's voice), which plays the read kept from before when there is one and asks the editor only when pressed. Cancel stops the editor's job too. Opened over http from the LAN the page says the microphone is off (a browser opens it only on localhost or https); **Use a sound file…** takes a recording made elsewhere, and Filter, the preview and Keep work there. From a terminal: `umtool posts narrate <p> <item> --recording <file> --preview [--out <file>] [--trim-span 0.4-3.1]` prints the paths and makes no take, `--keep-preview` keeps it, `--discard-preview` drops it. A "start on speech" trigger was not built: it would lose the start of the first word, and the auto trim already cuts the silence before it. ([knobs.md](../umtool/docs/knobs.md#record-filter-preview-on-the-record-page))
- **umtool: a convert made from a take uses its character's voice, not the editor's default.** On 11 Nov `umtool posts narrate <p> <item> --derive <n> --op convert` with no flags made a take in the wrong voice: it asked the editor with nothing, and the editor used its own default target. A convert now takes its engine, stock voice, pitch and semitones from the recorded preset of the character the read is made as (`--as`, else the item's own, this video's for the author, the cast's, the narrator); a flag overrides its own key. With no character and no `--voice` it is refused in one sentence. The post bench's **run AI on take** does the same on the server.
diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md
@@ -48,7 +48,7 @@ Inbox cannot disagree about what is wrong with one.
| `present <project> [--take <take> \| --cut] [--json] [--public] [--open] [--url <origin>]` | **present mode**: the cut as slides, navigated like a deck (`/projects/<p>/present`) — prints the address and every slide (its kind, id — a post's `<channel>/<id>`, a clip's id, `section-<n>`, `day-<YYYY-MM-DD>` — date, words and censor counts); `--json` the payload (each post's card as Play draws it and its censor data by kind, each clip's spans, the dividers); `--public` the payload a public page would carry (censored, no reveal data); `--open` opens it; `<address>#<slide id>` opens a slide ([knobs.md](knobs.md#present-mode-the-cut-as-slides-navigated-like-a-deck)) |
| `set <project> <clip> key=value …` | a clip's **knobs**: `claim.at` `claim.hold` `claim.stamp` `claim.count` `claim.label` (the first mark's, or `--mark <id>`'s), its **marks** `mark.add=<verdict>[@<sec>]` `mark.remove=<id>` `mark.verdict=<verdict>` `marks=<json>`, `audio.offset` `audio.gain` `audio.fadeIn` `audio.fadeOut`, its picture's **blur** `blur.on=true` `blur.caption=…` `blur.strength` `blur.from` `blur.to` (`blur.on=` clears it; [knobs.md](knobs.md#a-clips-picture-blurred)), its **effects** `fx.zoom=<json>` `fx.receipts=<json>` `fx.punch=…` `fx.quote` `fx.punchIn=<json>` `fx.speakers=<json>` (`fx=<json>` all of them, `fx=` clears them; a shot is a file in the project; [knobs.md](knobs.md#effects)); `key=` clears one ([knobs.md](knobs.md#marks)) |
| `intro <project> [key=value …] [--off] [--json]` · `intro <project> --take <take> --off\|--on` | **the intro** the cut opens on (`render.intro`): with no key, prints it as written, what the cut opens with (a `title-card`'s words resolved) and each version's on/off; `key=value` writes it through the look writer (`style` `seconds` 3.5–8 `mark` `ground` `sound` (`false` silent) `site` `title` `lines` (`a\|b`, ≤ 3) and the brand's keys; `key=` clears one; a new intro starts as `boot-dark`); `--off` takes it off the cut; `--take <t> --off` that version opens on no intro (its patch's `render.intro: null`), `--on` on the cut's again. **Exit 1** on a value the build refuses ([knobs.md](knobs.md#the-intro-played-and-edited)) |
-| `look <project> key=value … [--unset render.<key>]…` | the cut's **knobs**: `factcheck.stamp.*`, `factcheck.verdicts.<V>.stampLabel\|label\|color`, `deck.markers=<json>`, `deck.markerLayout`, `variants=<json>`, and the look's keys — `mode=basic\|deck` (the footage alone, [knobs.md](knobs.md#basic-output-the-footage-alone)) and `basic=<json>` (its fades) among them ([knobs.md](knobs.md)) **The deck on, legacy keys off** (`updateRenderKeys`, one write, an undo point `revisions/…auto-render-keys…` first): `chrome.layout=deck` turns the deck on (render.chrome created when the cut has none: engine hyperframes, an empty deck), `--unset render.<key>` (repeatable) drops a legacy render key -- only `rail` `chromeEngine` `railEngine` `chromeRegions` `claimSchedule` `wordmark` `title` `finale` `cut`; the deck beside the old rail is refused in the build's words unless the same command drops it; deck.* keys in the same command land after the chrome exists. Another key named: **exit 2** |
+| `look <project> key=value … [--unset render.<key>]… [--take <t>]` | the cut's **knobs** (`--take <t>`: the `deck.*` keys given are set on that take -- its patch, an undo point of its own, the project's manifest untouched; the other knobs are the project's): `factcheck.stamp.*`, `factcheck.verdicts.<V>.stampLabel\|label\|color`, `deck.markers=<json>`, `deck.markerLayout`, `variants=<json>`, and the look's keys — `mode=basic\|deck` (the footage alone, [knobs.md](knobs.md#basic-output-the-footage-alone)) and `basic=<json>` (its fades) among them ([knobs.md](knobs.md)) **The deck on, legacy keys off** (`updateRenderKeys`, one write, an undo point `revisions/…auto-render-keys…` first): `chrome.layout=deck` turns the deck on (render.chrome created when the cut has none: engine hyperframes, an empty deck), `--unset render.<key>` (repeatable) drops a legacy render key -- only `rail` `chromeEngine` `railEngine` `chromeRegions` `claimSchedule` `wordmark` `title` `finale` `cut`; the deck beside the old rail is refused in the build's words unless the same command drops it; deck.* keys in the same command land after the chrome exists. Another key named: **exit 2** |
| `variants <project> [--take <t>] [--list] [--json]` | **Make variants**: the encode ladder of the build (or of a take's); `--list` what was made and the build's sync report, each clip's lag (past a frame flagged) ([knobs.md](knobs.md)) |
| `corrections <project>` | what the report got wrong (the clip bench's sixth field) and the walk's coverage, as markdown for the next pass |
| `build <project> [--preset preview\|fast\|final] [--only ID]` | **prints** the chain |
diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md
@@ -2569,11 +2569,12 @@ A sticky note per goal on a pile in a corner of the footage box, read off the sc
| Knob | Range · default | From a terminal |
|---|---|---|
-| `deck.goals` | `true` · `false` · `{show, position, x, y, scale, hold, finale, max, color, countdown, base}` · default on with a measure slice | `umtool look <p> deck.goals=false` |
+| `deck.goals` | `true` · `false` · `{show, position, x, y, scale, hold, finale, max, color, countdown, base, baseMaxDays}` · default on with a measure slice | `umtool look <p> deck.goals=false` |
| `deck.goals.position`, `.x`/`.y`, `.scale` | `top-left` `top-right` `bottom-left` `bottom-right` `top-center` `bottom-center` · design px · 0.5–2 · default `bottom-right`, unset, 1 | `umtool look <p> deck.goals.position=bottom-left` |
| `deck.goals.position=shelf` | its shelf form (`deck.shelf`): the count of goals set in a column, then the notes fanned sideways like the diet's tags -- ordered by the dial's goal board (measure-goals.mjs `goalsAt(goalBoard(schedule.measure), t)`, so the shelf and the dial always agree): its headline -- the closest goal in force -- in front with "+N more" for the others in force, the rest by recency; a goal the board misses struck in red, MISSED on it, for the dial's 6 s; with no goal in force, the newest in front; a new goal landing from above as on the pile; each older one showing its goal's words in the strip beside it (all of each when there is room); a repeat comes to the front with its ×n. The fan takes the shelf's spare width (shelfLayout), up to its notes side by side. On the shelf it stays up from the first goal (`hold` unset). What the dial draws of the goal stays on the dial | `umtool look <p> deck.shelf.items='["diet","goals"]' deck.goals.position=shelf` |
| `deck.goals.max`, `.color`, `.countdown` | 1–8 notes · #hex paper · bool · default 4, the palette's amber, `true` | `umtool look <p> deck.goals.max=6` |
| `deck.goals.base` | bool · default `false`: each note also says the weight he had stated when he set the goal -- "LOSE 100 (FROM 346.7)", its qualifier kept ("(FROM ≈390)") -- the slice's own base for that goal, the one the gauge reckons its target from (measure-slice.mjs `goalBase`: the start of the run open when he set it, else the latest weight he gave by the goal's date, stated or remembered). A goal with no base (no weight by then, a target goal such as "250 LB", a base the scale's foot refuses) shows none -- never one made up. On a back card it is a line of its own, right-aligned like the label | `umtool look <p> deck.goals.base=true` |
+| `deck.goals.baseMaxDays` | whole days 0–36500 · unset (default): every base counts. A loss goal's base is a weight he gave by the goal's date, however long before; with this set, a base counts only when its weight was SAID (its row's date, never a remembered weight's as-of) at most that many days before the goal's date. A staler one is no base: the note carries no "(FROM …)", and the slice resolves no target from it -- the dial draws no goal weight and no tick for that goal, his words ("LOSE 100") stay. It is the slice's rule (measure-slice.mjs `goalBaseMaxDays`), so the notes, the shelf and the dial agree; it needs `deck.goals` as settings (`deck.goals.base=true deck.goals.baseMaxDays=365`), and `baseMaxDays=null` takes it off | `umtool look <p> deck.goals.baseMaxDays=365` (`--take <t>` for a take) |
| `deck.goals.hold`, `.finale` | 0 (up from the first goal on) or 2–600 s after each · `hide` `show` · default 20, `hide` | `umtool look <p> deck.goals.hold=0` |
| `deck.goals.flash` | bool · unset (default): follows `deck.measure.flash` -- THE UPDATE FLASH (update-flash.mjs): the note that lands lights as a goal is set -- not the first note (the stack coming up), not the board's own changes; a thin outline in its own colour, up over 0.15 s and gone over 0.7 s, no size change, never on frame 0 or while the deck is away | `umtool look <p> deck.goals.flash=false` |
| `deck.goals.onPosts`, `.onChapters` | `dodge` `hide` `show` · default `dodge`: while a post item's card (its card, slot and strip as postLayout lays them: the schedule's `covers`) or a chapter band is up where it stands, it moves to a free anchor of the footage box -- a size down to half if it must, never onto another measure extra that is up -- and hides when none fits; `hide` hides, `show` stays over it | `umtool look <p> deck.goals.onPosts=hide` |
diff --git a/umtool/lib/cli/groups.mjs b/umtool/lib/cli/groups.mjs
@@ -325,8 +325,8 @@ export const GROUPS = [
" variants=<json>, and the look's keys (transition=0.3, …)",
],
docs: [
- ["`look <project> key=value … [--unset render.<key>]…`",
- "the cut's **knobs**: `factcheck.stamp.*`, `factcheck.verdicts.<V>.stampLabel\\|label\\|color`, `deck.markers=<json>`, `deck.markerLayout`, `variants=<json>`, and the look's keys — `mode=basic\\|deck` (the footage alone, [knobs.md](knobs.md#basic-output-the-footage-alone)) and `basic=<json>` (its fades) among them ([knobs.md](knobs.md)) **The deck on, legacy keys off** (`updateRenderKeys`, one write, an undo point `revisions/…auto-render-keys…` first): `chrome.layout=deck` turns the deck on (render.chrome created when the cut has none: engine hyperframes, an empty deck), `--unset render.<key>` (repeatable) drops a legacy render key -- only `rail` `chromeEngine` `railEngine` `chromeRegions` `claimSchedule` `wordmark` `title` `finale` `cut`; the deck beside the old rail is refused in the build's words unless the same command drops it; deck.* keys in the same command land after the chrome exists. Another key named: **exit 2**"],
+ ["`look <project> key=value … [--unset render.<key>]… [--take <t>]`",
+ "the cut's **knobs** (`--take <t>`: the `deck.*` keys given are set on that take -- its patch, an undo point of its own, the project's manifest untouched; the other knobs are the project's): `factcheck.stamp.*`, `factcheck.verdicts.<V>.stampLabel\\|label\\|color`, `deck.markers=<json>`, `deck.markerLayout`, `variants=<json>`, and the look's keys — `mode=basic\\|deck` (the footage alone, [knobs.md](knobs.md#basic-output-the-footage-alone)) and `basic=<json>` (its fades) among them ([knobs.md](knobs.md)) **The deck on, legacy keys off** (`updateRenderKeys`, one write, an undo point `revisions/…auto-render-keys…` first): `chrome.layout=deck` turns the deck on (render.chrome created when the cut has none: engine hyperframes, an empty deck), `--unset render.<key>` (repeatable) drops a legacy render key -- only `rail` `chromeEngine` `railEngine` `chromeRegions` `claimSchedule` `wordmark` `title` `finale` `cut`; the deck beside the old rail is refused in the build's words unless the same command drops it; deck.* keys in the same command land after the chrome exists. Another key named: **exit 2**"],
],
},
{
diff --git a/umtool/lib/report/knobsCli.mjs b/umtool/lib/report/knobsCli.mjs
@@ -119,7 +119,9 @@ export const SET_USAGE = [
].join("\n");
export const LOOK_USAGE = [
- "usage: umtool look <project> key=value … [--unset render.<key>]… [--json]",
+ "usage: umtool look <project> key=value … [--unset render.<key>]… [--take <t>] [--json]",
+ " --take <t>: the deck.* keys given are set on THAT TAKE (its patch, an undo point of its own:",
+ " umtool timeline <p> --take <t> undo); the project's manifest is untouched. deck.* keys only",
" chrome.layout=deck: the deck on (render.chrome created when the cut has none: engine hyperframes, an empty deck)",
" --unset render.<key>: drop a legacy render key (rail chromeEngine railEngine chromeRegions claimSchedule wordmark",
" title finale cut) -- with chrome.layout=deck in ONE write (the deck refuses the old rail beside it), an undo point first",
@@ -480,6 +482,45 @@ export async function lookCommand(args, { root = REPORTS_ROOT, out = (s) => cons
}
const project = await projectOf(projectArg, root);
const pairs = parseAssignments(rest);
+ // A TAKE'S DECK KEYS (`--take <t>`, 12 Nov: `deck.goals.baseMaxDays` for one take): the same write over the take's
+ // manifest, landing in its patch with an undo point of the take's own (takeScope.mjs) -- the project's manifest
+ // untouched. The deck's keys only: the other knobs here are the project's.
+ if (flags.has("--take")) {
+ const take = typeof flags.get("--take") === "string" && flags.get("--take") ? String(flags.get("--take")) : null;
+ if (!take) throw new CliError("--take needs a take id");
+ const other = pairs.filter(([k]) => !k.startsWith("deck."));
+ if (other.length || flags.has("--unset")) {
+ throw new CliError(`--take sets a take's deck keys (deck.<key>=…); ${other.length ? other.map(([k]) => k).join(", ") : "--unset"} is the project's (set it without --take)`);
+ }
+ const { isTakeId, takesDirOf, TAKE_FILE } = await import("./takes.mjs");
+ if (!isTakeId(take)) throw new CliError(`"${take}" is not a take id (lower-case letters, digits, dashes)`);
+ const { stat } = await import("node:fs/promises");
+ const { default: nodePath } = await import("node:path");
+ if (!(await stat(nodePath.join(takesDirOf(project.dir), take, TAKE_FILE)).catch(() => null))) {
+ err(`${project.id} has no take ${take} (no takes/${take}/${TAKE_FILE})`);
+ return 1;
+ }
+ const busy = await (await import("./takeImport.mjs")).takeRenderingNow(project.dir, take);
+ if (busy) {
+ err(`not edited: ${busy}`);
+ return 1;
+ }
+ const { withTakeScope } = await import("./takeScope.mjs");
+ const lines = [];
+ const code = await withTakeScope(project.dir, take, () =>
+ lookCommand([projectArg, ...rest, ...(json ? ["--json"] : [])], { root, out: (l) => lines.push(l), err }));
+ if (json && code === 0) {
+ for (const l of lines) {
+ let doc = null;
+ try { doc = JSON.parse(l); } catch { /* a line of prose */ }
+ out(doc && typeof doc === "object" ? JSON.stringify({ ...doc, take: { id: take, undo: `umtool timeline ${project.id} --take ${take} undo` } }, null, 2) : l);
+ }
+ } else {
+ for (const l of lines) out(l);
+ if (code === 0) out(`take ${take}: written to its patch (undo: umtool timeline ${project.id} --take ${take} undo)`);
+ }
+ return code;
+ }
// THE DECK ON, LEGACY KEYS OFF (updateRenderKeys): `chrome.layout=deck` (render.chrome created when the cut has
// none) and `--unset render.<key>`, in one write with an undo point -- before any deck.* key, which needs the chrome.
const chromeOn = pairs.filter(([k]) => k === "chrome.layout" || k === "chrome.engine");
diff --git a/umtool/lib/report/knobsCli.test.mjs b/umtool/lib/report/knobsCli.test.mjs
@@ -342,3 +342,28 @@ test("umtool look chrome.layout=deck --unset render.<key>: the deck turned on an
assert.equal(await run("fresh", "chrome.layout=deck", "deck.sectionTitle=true"), 0, lines.join("\n"));
assert.deepEqual((await read(fresh)).render.chrome.deck, { sectionTitle: true });
});
+
+test("umtool look deck.<key>=… --take <t>: the take's patch, an undo point of the take's, the project's manifest untouched; deck keys only", async () => {
+ const dir = await project("looktake");
+ const { lines, run } = runner(lookCommand);
+ const { draftTake } = await import("./takeMaker.mjs");
+ const { resolveTakeManifest } = await import("./takeManifest.mjs");
+ await draftTake(dir, { id: "a9", label: "A9", patch: {} });
+ const before = await readFile(path.join(dir, "video.manifest.json"), "utf8");
+ assert.equal(await run("looktake", "deck.goals.base=true", "deck.goals.baseMaxDays=365", "--take", "a9"), 0, lines.join("\n"));
+ assert.match(lines.join("\n"), /deck\.goals: \{"base":true,"baseMaxDays":365\}/);
+ assert.match(lines.at(-1), /take a9: written to its patch \(undo: umtool timeline looktake --take a9 undo\)/);
+ assert.equal(await readFile(path.join(dir, "video.manifest.json"), "utf8"), before);
+ assert.deepEqual((await resolveTakeManifest(dir, "a9")).manifest.render.chrome.deck.goals, { base: true, baseMaxDays: 365 });
+ // One field off again keeps the rest.
+ assert.equal(await run("looktake", "deck.goals.baseMaxDays=", "--take", "a9"), 0, lines.join("\n"));
+ assert.deepEqual((await resolveTakeManifest(dir, "a9")).manifest.render.chrome.deck.goals, { base: true });
+ // The build's rules still refuse; other knobs and a take that is not there are refused.
+ assert.equal(await run("looktake", "deck.goals.baseMaxDays=-3", "--take", "a9"), 1);
+ assert.match(lines.at(-1), /baseMaxDays must be null \(every base counts\) or whole days/);
+ assert.equal(await run("looktake", "transition=0.3", "--take", "a9"), 2);
+ assert.match(lines.at(-1), /--take sets a take's deck keys/);
+ assert.equal(await run("looktake", "deck.goals.baseMaxDays=365", "--take", "nope"), 1);
+ assert.match(lines.at(-1), /has no take nope/);
+ assert.equal(await readFile(path.join(dir, "video.manifest.json"), "utf8"), before);
+});
diff --git a/umtool/report-to-video/goal-base-max-days.test.mjs b/umtool/report-to-video/goal-base-max-days.test.mjs
@@ -0,0 +1,89 @@
+// `deck.goals.baseMaxDays` (rev9-a9, 12 Nov): a loss goal's base is the latest weight he gave by the goal's date --
+// however long before. On the real record that put "(FROM 368)" on a goal set eight years after he said 368. With
+// the knob a base counts only when its weight was SAID at most that many days before the goal; a staler one is no
+// base -- no "(FROM …)" on the note, no target and no tick on the dial. Unset, every base counts, as before.
+import assert from "node:assert/strict";
+import test from "node:test";
+
+import { goalMarks, goalWords } from "./chrome-instruments.mjs";
+import { estimateSchedule, validateChrome } from "./deck.mjs";
+import { goalStates } from "./measure-extras.mjs";
+import { goalBoard } from "./measure-goals.mjs";
+import { goalBaseMaxDays, measureSlice } from "./measure-slice.mjs";
+
+const PAL = { bg: "#0F1312", fg: "#EDF0EC", muted: "#98A29B", accent: "#22AB83", amber: "#E8A33F" };
+const render = (goals) => ({ width: 1920, height: 1080, fps: 30, transition: 0.4, palette: PAL,
+ chrome: { engine: "hyperframes", layout: "deck", deck: { measure: { scopes: ["weight"], scale: { min: 100, max: 400 }, asOf: "2026-11-12" }, ...(goals === undefined ? {} : { goals }) } } });
+const schema = { kind: "measure", unit: "lb", yMin: 100, yMax: 400, bandGapDays: 60, tracks: [{ key: "weight", role: "value", label: "Weight" }], forms: ["current", "past", "delta", "goal", "goal_loss"] };
+const row = (o) => ({ scope: "weight", scopeBasis: "his words", scopeConfidence: "read", valueKind: "uttered", flags: [], asOf: null, ...o });
+// The gaps the real record has: 8 years, 0 days, 279 days, 434 days.
+const LEDGER = [
+ row({ id: "a1", date: "2015-01-10", population: "current", value: 368, display: "368 lb", entryId: "c1" }),
+ row({ id: "g8y", date: "2023-01-08", population: "goal_loss", value: -100, display: "lose 100", entryId: "c2" }),
+ row({ id: "b1", date: "2023-03-01", population: "current", value: 350, display: "350 lb", entryId: "c3" }),
+ row({ id: "g0", date: "2023-03-01", population: "goal_loss", value: -50, display: "lose 50", entryId: "c4" }),
+ row({ id: "g279", date: "2023-12-05", population: "goal_loss", value: -60, display: "lose 60", entryId: "c5" }),
+ row({ id: "g434", date: "2024-05-08", population: "goal_loss", value: -70, display: "lose 70", entryId: "c6" }),
+];
+
+function sliced(r, ledger = LEDGER) {
+ const timeline = Array.from({ length: 7 }, (_, i) => ({ type: "clip", id: `c${i + 1}`, video: "v", start: 10 * i, end: 10 * i + 8, cite: 1, section: 0, quote: "q", onscreen: { title: `Clip ${i + 1}` } }));
+ const manifest = { slug: "m", title: "M", provenance: {}, render: r, timeline, ledgerSchema: schema, ledger };
+ const doc = estimateSchedule(manifest);
+ const m = measureSlice(manifest, doc, {});
+ const goalAfter = (id) => m.state[m.events.findIndex((e) => e.row === id) + 1].goal;
+ return { m, schedule: { ...doc, measure: m }, goalAfter };
+}
+
+test("unset: every base counts, however old -- and each carries the date its weight was said", () => {
+ assert.equal(goalBaseMaxDays({ render: render(undefined) }), null);
+ assert.equal(goalBaseMaxDays({ render: render(true) }), null);
+ const { goalAfter } = sliced(render({ base: true }));
+ assert.deepEqual(goalAfter("g8y").base, { value: 368, row: "a1", from: "stated", date: "2015-01-10" });
+ assert.equal(goalAfter("g8y").value, 268);
+ assert.deepEqual(["g0", "g279", "g434"].map((id) => [goalAfter(id).base.row, goalAfter(id).base.date, goalAfter(id).value]),
+ [["b1", "2023-03-01", 300], ["b1", "2023-03-01", 290], ["b1", "2023-03-01", 280]]);
+});
+
+test("365: a base said 0 or 279 days before the goal stays; 434 days and eight years are no base -- no target, his words", () => {
+ const r = render({ base: true, baseMaxDays: 365 });
+ assert.deepEqual(validateChrome(r.chrome, r), []);
+ const { m, schedule, goalAfter } = sliced(r);
+ assert.deepEqual(["g8y", "g0", "g279", "g434"].map((id) => goalAfter(id).base?.row ?? null), [null, "b1", "b1", null]);
+ assert.deepEqual(["g8y", "g0", "g279", "g434"].map((id) => goalAfter(id).value), [null, 300, 290, null]);
+ assert.equal(goalWords(goalAfter("g8y")), "LOSE 100");
+ assert.equal(goalWords(goalAfter("g434")), "LOSE 70");
+ assert.match(goalWords(goalAfter("g279")), /^GOAL 290 · LOSE 60/);
+ // The notes: "(FROM …)" only where the base stands.
+ const states = goalStates(schedule, r);
+ const baseOf = (text) => states[states.length - 1].notes.find((n) => n.text === text)?.base ?? null;
+ assert.deepEqual([baseOf("LOSE 100"), baseOf("LOSE 50"), baseOf("LOSE 60"), baseOf("LOSE 70")], [null, "(FROM 350)", "(FROM 350)", null]);
+ // The dial: a goal with no base has no weight to mark -- no tick from a base it does not have.
+ const marks = goalMarks(goalBoard(m), m.scale);
+ const tick = (id) => marks.find((x) => x.goal.row === id).angle !== null;
+ assert.deepEqual(["g8y", "g0", "g279", "g434"].map(tick), [false, true, true, false]);
+ // Unset, all four are marked.
+ const before = sliced(render({ base: true })).m;
+ assert.deepEqual(goalMarks(goalBoard(before), before.scale).map((x) => x.angle !== null), [true, true, true, true]);
+});
+
+test("the day counts from when the weight was SAID, never a remembered weight's as-of; the edge day is inside", () => {
+ const ledger = [
+ row({ id: "p1", date: "2024-06-01", asOf: "2016-01-01", population: "past", value: 390, display: "≈390 lb", entryId: "c1" }),
+ row({ id: "g", date: "2024-06-10", population: "goal_loss", value: -100, display: "lose 100", entryId: "c2" }),
+ ];
+ const kept = sliced(render({ baseMaxDays: 30 }), ledger).goalAfter("g");
+ assert.deepEqual([kept.base.row, kept.base.from, kept.base.date, kept.value], ["p1", "remembered", "2024-06-01", 290]);
+ assert.equal(sliced(render({ baseMaxDays: 9 }), ledger).goalAfter("g").base.row, "p1", "9 days before, 9 allowed");
+ assert.equal(sliced(render({ baseMaxDays: 8 }), ledger).goalAfter("g").base, null);
+ // 0: only a weight said on the goal's own day.
+ assert.equal(sliced(render({ baseMaxDays: 0 })).goalAfter("g0").base.row, "b1");
+ assert.equal(sliced(render({ baseMaxDays: 0 })).goalAfter("g279").base, null);
+});
+
+test("the setting is checked: whole days from 0, or null", () => {
+ const problems = (v) => validateChrome(render({ baseMaxDays: v }).chrome, render({ baseMaxDays: v })).join("\n");
+ assert.equal(problems(null), "");
+ assert.equal(problems(0), "");
+ for (const bad of [-1, 1.5, "365", 40000]) assert.match(problems(bad), /deck\.goals\.baseMaxDays must be null \(every base counts\) or whole days from 0 to 36500/, String(bad));
+});
diff --git a/umtool/report-to-video/measure-slice.mjs b/umtool/report-to-video/measure-slice.mjs
@@ -115,6 +115,16 @@ export function resolveMeasure(manifest, { asOf = null } = {}) {
};
}
+/**
+ * `render.chrome.deck.goals.baseMaxDays` as the slice reads it: whole days (0 = the goal's own day), or null when
+ * unset (or the goal stack is a bare true/false): how long before a loss goal a weight may have been said and still
+ * be the goal's base (measureSlice `goalBase`). The goal stack's settings check its shape (measure-extras-settings.mjs).
+ */
+export function goalBaseMaxDays(manifest) {
+ const v = manifest?.render?.chrome?.deck?.goals?.baseMaxDays;
+ return Number.isInteger(v) && v >= 0 ? v : null;
+}
+
// ---------------------------------------------------------------------------
// The odometer
// ---------------------------------------------------------------------------
@@ -493,17 +503,24 @@ export function measureSlice(manifest, schedule, opts = {}) {
const starts = readings.filter((r) => r.population === "past" && r.asOf && dateKey(r.date) <= dateKey(d) &&
dateKey(r.asOf) <= dateKey(run.start) && Math.round(daysBetween(r.asOf, run.start)) <= s.bandGapDays);
const last = starts[starts.length - 1];
- if (last) return { value: Number(last.value), row: last.id, from: "runStart" };
+ if (last) return { value: Number(last.value), row: last.id, from: "runStart", date: last.date ?? null };
}
const known = readings
.filter((r) => dateKey(r.date) <= dateKey(d))
.sort((a, b) => dateKey(plotDate(a)).localeCompare(dateKey(plotDate(b))) || dateKey(a.date).localeCompare(dateKey(b.date)));
const last = known[known.length - 1];
- return last ? { value: Number(last.value), row: last.id, from: last.population === "past" ? "remembered" : "stated" } : null;
+ return last ? { value: Number(last.value), row: last.id, from: last.population === "past" ? "remembered" : "stated", date: last.date ?? null } : null;
};
+ // `deck.goals.baseMaxDays` (rev9-a9, 12 Nov: "LOSE 100 (FROM 368)" off a weight he gave eight years before): a
+ // base counts only when its weight was SAID -- its row's date, never a remembered one's asOf -- at most that many
+ // days before the goal's date. A staler one is no base: his words stay the goal, no weight, no tick, no "(FROM …)".
+ // Unset: every base counts, as before.
+ const baseMaxDays = goalBaseMaxDays(manifest);
+ const fresh = (base, row) => baseMaxDays === null || !base || (base.date && Math.round(daysBetween(base.date, row.date)) <= baseMaxDays);
const scaleMin = Number.isFinite(settings.scale?.min) ? settings.scale.min : -Infinity;
const goalOf = (row) => {
let base = row.population === "goal_loss" ? goalBase(row) : null;
+ if (!fresh(base, row)) base = null;
let cell = goalCell(row, base, s);
if (base && Number.isFinite(cell.value) && cell.value < scaleMin) {
base = 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.lost, { total: 49, runs: [{ run: 0, start: "2024-01-05", peak: 9, row: "w02" }, { run: 1, start: "2025-04-01", peak: 40, row: "w09" }] });
for (let i = 1; i < sl.state.length; i += 1) assert.ok(sl.state[i].lost.total >= sl.state[i - 1].lost.total, "the odometer only goes up");
// "Lose 65" against the start of its run: the 349 he remembers (asOf 20 March, 12 days before).
- 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.goal, { value: 284, loss: 65, deadline: "by Christmas", due: "2025-12-25", row: "w11", display: "284 lb", base: { value: 349, row: "w07", from: "runStart", date: "2025-05-01" } });
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: [], claims: [], outcome: null }]);
diff --git a/umtool/report-to-video/modules/goals.mjs b/umtool/report-to-video/modules/goals.mjs
@@ -23,16 +23,18 @@ export default measureExtraModule({
{ key: "color", type: "color", label: "Paper (default the palette's amber)" },
{ key: "countdown", type: "boolean", label: "Count a deadline down to the render date", default: true },
{ key: "base", type: "boolean", label: "Say the weight he had stated when he set it", default: false },
+ { key: "baseMaxDays", type: "number", min: MEASURE_LIMITS.baseMaxDays[0], max: MEASURE_LIMITS.baseMaxDays[1], label: "A base weight said at most this many days before the goal (unset: any age)" },
{ key: "flash", type: "boolean", label: "Flash its outline when its value changes (unset: deck.measure.flash)" },
],
docs: {
intro: "A sticky note per goal on a pile in a corner of the footage box, read off the schedule's `measure` slice (`render.chrome.deck.goals`, measure-extras.mjs): each goal or goalLoss event drops one, turned a little, onto the pile; the same goal in the same words (\"lose 100\") merges into its note with a count (\"×8\") and comes to the front; `max` notes show, the newest in front, with the goals set so far under them. A goal with a `deadline` counts down to `measure.asOfRender` (\"by Christmas · 50 days left · needs 226.5\"): Christmas is the next 25 Dec from the day he said it, \"next year\" a year on, a named year that year; words that name no date (\"by my birthday\") keep their label and no countdown. On whenever the cut has a measure slice with a goal on camera; `false` turns it off. Up for `hold` seconds after each goal (default 20), the pile as it stands each time. The four measure extras sit at anchors of the footage box by default, clear of the instrument panel's right column and of the top-left, where the streams' face cam most often is (the diet badge bottom-left, the goal stack bottom-right, the moving start top-right, the promise clock top-centre); `position` or `x`/`y` move one.",
rows: [
- ["`deck.goals`", "`true` · `false` · `{show, position, x, y, scale, hold, finale, max, color, countdown, base}` · default on with a measure slice", "`umtool look <p> deck.goals=false`"],
+ ["`deck.goals`", "`true` · `false` · `{show, position, x, y, scale, hold, finale, max, color, countdown, base, baseMaxDays}` · default on with a measure slice", "`umtool look <p> deck.goals=false`"],
["`deck.goals.position`, `.x`/`.y`, `.scale`", "`top-left` `top-right` `bottom-left` `bottom-right` `top-center` `bottom-center` · design px · 0.5–2 · default `bottom-right`, unset, 1", "`umtool look <p> deck.goals.position=bottom-left`"],
["`deck.goals.position=shelf`", "its shelf form (`deck.shelf`): the count of goals set in a column, then the notes fanned sideways like the diet's tags -- ordered by the dial's goal board (measure-goals.mjs \`goalsAt(goalBoard(schedule.measure), t)\`, so the shelf and the dial always agree): its headline -- the closest goal in force -- in front with \"+N more\" for the others in force, the rest by recency; a goal the board misses struck in red, MISSED on it, for the dial's 6 s; with no goal in force, the newest in front; a new goal landing from above as on the pile; each older one showing its goal's words in the strip beside it (all of each when there is room); a repeat comes to the front with its ×n. The fan takes the shelf's spare width (shelfLayout), up to its notes side by side. On the shelf it stays up from the first goal (`hold` unset). What the dial draws of the goal stays on the dial", "`umtool look <p> deck.shelf.items='[\"diet\",\"goals\"]' deck.goals.position=shelf`"],
["`deck.goals.max`, `.color`, `.countdown`", "1–8 notes · #hex paper · bool · default 4, the palette's amber, `true`", "`umtool look <p> deck.goals.max=6`"],
["`deck.goals.base`", "bool · default `false`: each note also says the weight he had stated when he set the goal -- \"LOSE 100 (FROM 346.7)\", its qualifier kept (\"(FROM ≈390)\") -- the slice's own base for that goal, the one the gauge reckons its target from (measure-slice.mjs `goalBase`: the start of the run open when he set it, else the latest weight he gave by the goal's date, stated or remembered). A goal with no base (no weight by then, a target goal such as \"250 LB\", a base the scale's foot refuses) shows none -- never one made up. On a back card it is a line of its own, right-aligned like the label", "`umtool look <p> deck.goals.base=true`"],
+ ["`deck.goals.baseMaxDays`", "whole days 0–36500 · unset (default): every base counts. A loss goal's base is a weight he gave by the goal's date, however long before; with this set, a base counts only when its weight was SAID (its row's date, never a remembered weight's as-of) at most that many days before the goal's date. A staler one is no base: the note carries no \"(FROM …)\", and the slice resolves no target from it -- the dial draws no goal weight and no tick for that goal, his words (\"LOSE 100\") stay. It is the slice's rule (measure-slice.mjs `goalBaseMaxDays`), so the notes, the shelf and the dial agree; it needs `deck.goals` as settings (`deck.goals.base=true deck.goals.baseMaxDays=365`), and `baseMaxDays=null` takes it off", "`umtool look <p> deck.goals.baseMaxDays=365` (`--take <t>` for a take)"],
["`deck.goals.hold`, `.finale`", "0 (up from the first goal on) or 2–600 s after each · `hide` `show` · default 20, `hide`", "`umtool look <p> deck.goals.hold=0`"],
["`deck.goals.flash`", "bool · unset (default): follows `deck.measure.flash` -- THE UPDATE FLASH (update-flash.mjs): the note that lands lights as a goal is set -- not the first note (the stack coming up), not the board's own changes; a thin outline in its own colour, up over 0.15 s and gone over 0.7 s, no size change, never on frame 0 or while the deck is away", "`umtool look <p> deck.goals.flash=false`"],
],
diff --git a/umtool/report-to-video/modules/measure-extras-settings.mjs b/umtool/report-to-video/modules/measure-extras-settings.mjs
@@ -6,7 +6,7 @@
// SETTINGS), so it imports only instruments.mjs (a leaf too: whether the
// instruments' column is on decides two defaults here).
//
-// render.chrome.deck.goals { show, position, x, y, scale, hold, finale, max, color, countdown, base, flash }
+// render.chrome.deck.goals { show, position, x, y, scale, hold, finale, max, color, countdown, base, baseMaxDays, flash }
// render.chrome.deck.peak { show, position, x, y, scale, hold, finale, title, color, values }
// render.chrome.deck.promise { show, position, x, y, scale, hold, finale, label, verb, kept, broken, checks, speakers, claimVerb, claimColor }
// render.chrome.deck.diet { show, position, x, y, scale, hold, finale, colors, labels, form, tags, overlap, days, flash }
@@ -110,6 +110,7 @@ export const MEASURE_LIMITS = Object.freeze({
x: Object.freeze([0, 1920]),
y: Object.freeze([0, 1080]),
max: Object.freeze([1, 8]),
+ baseMaxDays: Object.freeze([0, 36500]),
text: 40,
quote: 160,
});
@@ -123,8 +124,10 @@ export const MEASURE_DEFAULTS = Object.freeze({
// after each goal; `max` notes show, the newest in front; `color` is the
// paper (default the palette's amber).
// `base`: each note also says the weight he had stated when he set it, "(FROM 346.7)" (the slice's goal base).
+ // `baseMaxDays`: a weight said more than this many days before a loss goal is not its base (measure-slice.mjs
+ // goalBase reads it): no "(FROM …)", no target, no tick from it. null: every base counts.
// `flash`: the update flash (update-flash.mjs) -- null follows deck.measure.flash, true/false for this module.
- goals: Object.freeze({ ...COMMON, position: "bottom-right", hold: 20, max: 4, color: null, countdown: true, base: false, flash: null }),
+ goals: Object.freeze({ ...COMMON, position: "bottom-right", hold: 20, max: 4, color: null, countdown: true, base: false, baseMaxDays: null, flash: null }),
// The moving start: up for `hold` seconds after each retelling.
peak: Object.freeze({ ...COMMON, position: "top-right", hold: 12, title: "The start keeps moving", color: null, values: "drift" }),
// The promise clock: up from the promise on, through the finale.
@@ -265,6 +268,9 @@ export function validateMeasureExtra(id, v, where = `render.chrome.deck.${id}`,
color(v.color, `${where}.color`, errors);
if (v.countdown !== undefined && typeof v.countdown !== "boolean") errors.push(`${where}.countdown must be true or false`);
if (v.base !== undefined && typeof v.base !== "boolean") errors.push(`${where}.base must be true or false`);
+ if (v.baseMaxDays !== undefined && v.baseMaxDays !== null && !(Number.isInteger(v.baseMaxDays) && numIn(v.baseMaxDays, L.baseMaxDays[0], L.baseMaxDays[1]))) {
+ errors.push(`${where}.baseMaxDays must be null (every base counts) or whole days from ${L.baseMaxDays[0]} to ${L.baseMaxDays[1]}`);
+ }
}
if (id === "goals" || id === "diet") {
if (v.flash !== undefined && v.flash !== null && typeof v.flash !== "boolean") errors.push(`${where}.flash must be true, false or null (deck.measure.flash)`);