commit fee21d2dc3c9654d65522c74731f097b0ee2502b
parent 07122c8d722b8668ea8f0413bdeca9327542c59c
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 4 Nov 2026 06:06:33 -0500
umtool: a threaded card's follow frames are shot whenever a frame differs from the page as drawn, not only when something moves -- and the build refuses a read that is not on screen while it is said (readInViewErrors)
post-render.mjs shootFollow returned null (no follow frames) when fewer than two blocks were read and the pan had no segment. A threaded card with one part read and nothing to pan still has a state on every frame: its context parent small and dim, its column placed. With no frames shot the segment showed the card page as drawn -- every tile full and lit, the column at the top -- so in Mr. Obvious mid-5 (p-2117259673917386879, p-2117216053952655778; side layout beside a video, the take re-read without the parent) the context parent drew full over his post and his post ran past the card's foot with one line in view. Play and the bench apply the state every tick and were never wrong.
- read-follow.mjs: isDrawnState (a state that draws the page as drawn), followRuns (the frames as runs of one state, shared with shootFollow); shootFollow returns null only when every run is the page as drawn.
- THE INVARIANT, readInViewErrors (pure): over the frames as shot (or the page as drawn when none are), each block a part reads is in the window -- its tile whole when it fits, else the block, else half the window -- at full size and strength and lit, from when its pan and tile change settle until the next begin (0.25 s slack); a context tile is never over its context size, a carried or scene tile at its own once it has given way. renderPostCards runs it on the measured page; buildPostSegment refuses the segment naming the item, part and moment (READ_IN_VIEW=warn: a note instead).
- post-thread.test.mjs: the mid-5 case (one part read under a long context parent, with a video attachment: the page as drawn is refused, the shot frames pass), a context quote, a carried parent, a block off the foot, a tile small while read, a plain post that needs no frames.
- docs: report-video.md "Thread reads" and knobs.md.
Over the real cut (139 post items) and mid-5 (84), read-only: the old build breaches it on these two items (and, mid-5, p-2117380143098524063's context parent full and lit); the new build on none.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
5 files changed, 287 insertions(+), 22 deletions(-)
diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md
@@ -802,7 +802,9 @@ A narrated post item that reads the post it answers or quotes draws the conversa
build's words (`threadKnobErrors`); a `thread`/`follow` change that would narrate a post the card
hides is refused with the fix. Its bench is the post bench's **thread read** block; Play the cut
draws the same states the build shoots. A quoted post read before his words is its own tile above
-his post; a tile that fits the window is shown whole while it is read. One conversation played
+his post; a tile that fits the window is shown whole while it is read — the build checks it over
+the frames it shoots and refuses a post item whose read is ever out of view or whose context post
+is drawn over its context size (`readInViewErrors`; `READ_IN_VIEW=warn` builds it with a note). One conversation played
back to back is ONE SCENE (`report-to-video/post-conversation.mjs` planContext): the posts the
item before left on screen open this item's card, an ancestor kept on top as context, the branch
before collapsing away as this item's first piece comes in — automatic, no knob (a run is
diff --git a/umtool/docs/report-video.md b/umtool/docs/report-video.md
@@ -891,7 +891,21 @@ post bench's **thread read** block shows the refusal before Save.
**The render and Play** are read-follow's: the state at a second carries each tile's scale and
opacity (`tiles`), the page's slots are closed up to match (`data-thread-slot`,
`data-thread-tile`), the geometry is measured once at full size and worked out under the scales
-(threadGeoAt), and the build shoots each distinct state once. The plan's `follow.thread` is
+(threadGeoAt), and the build shoots each distinct state once — and shoots them whenever ANY frame
+differs from the page as drawn (`isDrawnState`), not only when something moves: a context post is
+small and dim from the first frame, so one part read with no pan is still shot (Mr. Obvious mid-5,
+p-2117259673917386879 and p-2117216053952655778, side layout beside a video: the build had shot
+no frames, so the parent drew full and lit and his post ran past the card's foot).
+
+**The invariant, in the build** (`readInViewErrors`, read-follow.mjs; operator, 4 Nov: "no hidden
+text is ever narrated"). Over the frames as they are shot (or the page as drawn when none are),
+for every block a part reads, from the moment its pan and its tile's change settle until the next
+one's begin: its tile is in the window WHOLE when it fits (else the block, else — taller than the
+window — half the window), at full size and strength, the block lit; and over the whole item a
+context post is never over its context size (`shrink`×`dim`; a quote inside his post `dim`), a
+carried or scene post at its own once it has given way. A block may be out of view 0.25 s in all
+(a pan in passing). A breach REFUSES the post's segment, naming the item, the part and the moment;
+`READ_IN_VIEW=warn` builds it anyway with a note. The plan's `follow.thread` is
the tiles' schedule; `postItemPlan(entry, render, { prev, scene })` takes the item before it and
the scene its run leaves on screen (`planContext`: the build, Play, the bench, the card route, the
writers' guard and the lint all pass it). Not narrated, or with no context post
diff --git a/umtool/report-to-video/post-render.mjs b/umtool/report-to-video/post-render.mjs
@@ -20,7 +20,7 @@ import path from "node:path";
import { pathToFileURL } from "node:url";
import { POST_PICTURE_XFADE, POST_PUSH, fxRedactionErrors, postCardHtml, postItemPlan, postLayout, stepBoxes } from "./post-item.mjs";
import { isNarrated, narrationLevelDb, pickedTake, postNarrationFilters, rootTakeOf } from "./post-narration.mjs";
-import { applyFollowState, followPath, followStateAt, followStateKey, measureFollow } from "./read-follow.mjs";
+import { applyFollowState, followPath, followRuns, followStateAt, isDrawnState, measureFollow, readInViewErrors, shotStateAt } from "./read-follow.mjs";
import { redactEntry, redactionOn, shownLine, termsFor } from "./post-redact.mjs";
import { bleepFilters, slursOn, takeBleeps } from "./post-slurs.mjs";
import { blurFilters, blurOn, censorEntry, labelFilter } from "./post-censor.mjs";
@@ -267,7 +267,15 @@ export async function renderPostCards(entry, { box, render, dir, manifestDir, la
const png = path.join(dir, `${phase}.png`);
await page.screenshot({ path: png, clip: { x: 0, y: 0, width: box.width, height: box.height } });
out[phase] = png;
- if (phase === "read" && follow) out.follow = await shootFollow(page, { follow, total, fps: render.fps ?? 30, box, dir });
+ if (phase === "read" && follow) {
+ const fps = render.fps ?? 30;
+ const geo = await page.evaluate(measureFollow);
+ out.follow = await shootFollow(page, { follow, total, fps, box, dir, geo });
+ // THE INVARIANT (read-follow.mjs readInViewErrors): what each part reads is in view, whole and lit, in the
+ // frames as they are shot -- or, with none shot, in the page as drawn.
+ const fpath = out.follow?.path ?? followPath(follow, geo);
+ out.inView = readInViewErrors(follow, geo, shotStateAt(follow, fpath, fps, !!out.follow), { total, id: entry.id });
+ }
}
await ctx.close();
if (zooms.length) out.zooms = await shootZooms(browser, entry, { box, render, dir, fonts, parentShotUrl, avatars, zooms, redaction, follow });
@@ -279,17 +287,21 @@ export async function renderPostCards(entry, { box, render, dir, manifestDir, la
/**
* READ-FOLLOW's FRAMES (read-follow.mjs): on the drawn card page, the pan's
- * path from its geometry, then every frame's state (followStateAt at frame
- * i / fps); each distinct state applied and the card's region shot once, and
- * a concat list holding each shot for its frames. Null when nothing would
- * move (fewer than two blocks read and no pan). `{ list, clip, shots, frames,
+ * path from its geometry (`geo`, measureFollow's: measured here when not
+ * given), then every frame's state (followStateAt at frame i / fps); each
+ * distinct state applied and the card's region shot once, and a concat list
+ * holding each shot for its frames. Null only when every frame is the page
+ * as drawn (isDrawnState: nothing dimmed, panned or shrunk) -- a threaded
+ * card's context post is small and dim from its first frame, so it is shot
+ * even when one part is read and nothing moves. `{ list, clip, shots, frames,
* geo, path }`.
*/
-export async function shootFollow(page, { follow, total, fps, box, dir }) {
- const geo = await page.evaluate(measureFollow);
+export async function shootFollow(page, { follow, total, fps, box, dir, geo = null }) {
+ geo ??= await page.evaluate(measureFollow);
const path0 = followPath(follow, geo);
- const read = follow.blocks.filter((b) => b.start !== null).length;
- if (read < 2 && !path0.segments.length) return null;
+ const frames = Math.max(1, Math.round(total * fps));
+ const runs = followRuns(follow, path0, total, fps);
+ if (runs.every((run) => isDrawnState(run.st))) return null;
const r = await page.evaluate(() => {
const b = document.querySelector("[data-post-card]")?.getBoundingClientRect();
return b ? { x: b.left, y: b.top, width: b.width, height: b.height } : null;
@@ -301,15 +313,6 @@ export async function shootFollow(page, { follow, total, fps, box, dir }) {
const fdir = path.join(dir, "follow");
await rm(fdir, { recursive: true, force: true });
await mkdir(fdir, { recursive: true });
- const frames = Math.max(1, Math.round(total * fps));
- const runs = [];
- for (let i = 0; i < frames; i += 1) {
- const st = followStateAt(follow, path0, i / fps);
- const key = followStateKey(st);
- const last = runs[runs.length - 1];
- if (last && last.key === key) last.n += 1;
- else runs.push({ key, st, n: 1 });
- }
const shots = new Map();
for (const run of runs) {
if (shots.has(run.key)) continue;
@@ -489,6 +492,13 @@ export async function buildPostSegment(entry, { render, outDir, manifestDir, box
const cardDir = path.join(outDir, "cards", `post-${entry.id}`);
const zoomPlan = postZoomPlan(entry, render, plan.total);
const cards = await renderPostCards(entry, { box, render, dir: cardDir, manifestDir, layout, avatars, zooms: zoomPlan, redaction, follow: plan.follow ?? null, total: plan.total });
+ // NO HIDDEN TEXT IS EVER NARRATED (operator, 4 Nov): a part whose words are not in view, whole and lit, while it
+ // is said -- or a context post drawn over its context size -- refuses the build (READ_IN_VIEW=warn: a note).
+ if (cards.inView?.length) {
+ const msg = `${entry.id}: the read is not on screen while it is said (read-follow.mjs readInViewErrors):\n ${cards.inView.join("\n ")}`;
+ if (process.env.READ_IN_VIEW === "warn") emit("note", { message: `warning: ${msg}` });
+ else throw new Error(`${msg}\n(READ_IN_VIEW=warn builds it anyway)`);
+ }
const zooms = (cards.zooms ?? []).map((z) => ({ ...z, target: zoomTarget(z.region, { ...z.word }, z.span.scale) }));
// Its video attachments' words, when transcribed: one textfile per cue.
const captions = [];
diff --git a/umtool/report-to-video/post-thread.test.mjs b/umtool/report-to-video/post-thread.test.mjs
@@ -7,7 +7,7 @@ import assert from "node:assert/strict";
import { test } from "node:test";
import { postCardHtml, postItemPlan, validatePostItem } from "./post-item.mjs";
import { validatePostNarrationRender } from "./post-narration.mjs";
-import { followPath, followStateAt, followStateKey } from "./read-follow.mjs";
+import { followPath, followRuns, followStateAt, followStateKey, isDrawnState, readInViewErrors, shotStateAt } from "./read-follow.mjs";
import {
THREAD_DEFAULTS, partRoles, readPieces, threadGeoAt, threadKnobs, threadLayout, threadReadErrors, threadStateAt, tileStateAt, validateThreadReads,
threadReadWarnings, urlParts, validateThreadReadWarnings, isTruncated,
@@ -284,3 +284,69 @@ test("TRUNCATED archive text: a text the read reads that ends in X's \"…\" (no
// Not read, not warned (a context post shows only a strip of it).
assert.deepEqual(threadReadWarnings(narrate(base({ parents: [cut] }), [[REPLY]])), []);
});
+
+test("THE READ IN VIEW (readInViewErrors): his post read alone under a long context parent, beside its attachment -- the build must shoot the frames (the parent small and dim, his post whole), and the page as drawn is refused (Mr. Obvious mid-5, p-2117259673917386879)", () => {
+ const longParent = Array.from({ length: 8 }, (_, i) => `Paragraph ${i + 1} of the long post he answers goes on about the coalition and the people in it again.`).join("\n\n");
+ const video = { src: "posts-media/acct-x/1001/1001_1.mp4", kind: "video", width: 1280, height: 720, seconds: 20, audio: true };
+ const one = "I returned from being asleep and the whole street is still arguing about the generator we never bought.";
+ const e = { ...narrate(base({ text: one, parents: [parentRef({ text: longParent })], media: [video] }), [[one, "post"]], { roles: true }), thread: { parent: ["context", "auto"] } };
+ // The card beside its attachment (side), threaded: the parent context, his post the one tile read.
+ const html = postCardHtml(e, { width: 1600, height: 900, follow: true, thread: postItemPlan(e, {}).follow.thread });
+ assert.match(html, /data-post-layout="side"/);
+ assert.match(html, /data-thread-mode="context"/);
+ const plan = postItemPlan(e, { postNarration: { lead: 0.25 } });
+ const th = plan.follow.thread;
+ assert.deepEqual(th.tiles.map((t) => [t.scope, t.mode, t.from]), [["parent:0", "context", [THREAD_DEFAULTS.shrink, THREAD_DEFAULTS.dim]], ["post", "full", [1, 1]]]);
+ assert.equal(plan.follow.blocks.filter((b) => b.start !== null).length, 1, "one part read");
+ const geo = fakeGeo(plan);
+ assert.ok(geo.tiles.post.top + 100 > geo.H, "at full size the parent pushes his post past the window's foot");
+ const path = followPath(plan.follow, geo);
+ assert.equal(path.segments.length, 0, "nothing moves: no pan");
+ // The frames are not the page as drawn -- so the build shoots them (post-render.mjs shootFollow).
+ const runs = followRuns(plan.follow, path, plan.total, 30);
+ assert.ok(!runs.every((r) => isDrawnState(r.st)), "the build must shoot the follow frames");
+ assert.deepEqual(readInViewErrors(plan.follow, geo, shotStateAt(plan.follow, path, 30, true), { total: plan.total, id: e.id }), []);
+ // The page as drawn (no frames shot: the bug): his post cut off at the foot, the parent full and lit.
+ const bad = readInViewErrors(plan.follow, geo, () => null, { total: plan.total, id: e.id });
+ assert.equal(bad.length, 2, bad.join("\n"));
+ assert.match(bad[0], /^p-1: part 1 \(his post, block \d+\) is not in full view for [\d.]+ s of its read .* past the window's foot/);
+ assert.match(bad[1], /^p-1: the post it answers \(parent:0\) \(context, never read\) is drawn at 1\.00× and 1\.00 strength at 0 s/);
+});
+
+test("THE READ IN VIEW: a context quote inside his post only dims; a carried parent gives way; a block read off the window's foot or a tile drawn small while read is named; a page with nothing to apply needs no frames", () => {
+ // A quoted post set to context, his words read: inside his post, at its context strength.
+ const q = { ...narrate(base({ quoted: { author: "Other", handle: "other", text: QUOTED } }), [[REPLY, "post"]], { roles: true }), thread: { quoted: "context" } };
+ const qp = postItemPlan(q, {});
+ const qg = fakeGeo(qp);
+ const qpath = followPath(qp.follow, qg);
+ assert.deepEqual(readInViewErrors(qp.follow, qg, shotStateAt(qp.follow, qpath, 30), { total: qp.total, id: "q" }), []);
+ assert.match(readInViewErrors(qp.follow, qg, () => null, { total: qp.total, id: "q" }).join("\n"), /q: the quoted post \(context, never read\) is drawn at 1\.00× and 1\.00 strength/);
+ // A carried parent: in full at the first frame, then given way -- the page as drawn never gives way.
+ const own = narrate(base({ parents: [parentRef()] }), [[REPLY]]);
+ const cp = postItemPlan(own, {}, { prev: { post: "acct-x/900" } });
+ const cg = fakeGeo(cp);
+ const cpath = followPath(cp.follow, cg);
+ assert.deepEqual(readInViewErrors(cp.follow, cg, shotStateAt(cp.follow, cpath, 30), { total: cp.total, id: "c" }), []);
+ assert.match(readInViewErrors(cp.follow, cg, () => null, { total: cp.total, id: "c" }).join("\n"), /c: the post it answers \(parent:0\) \(carry, given way\)/);
+ // A state that frames another place, or draws the tile being read small, is named.
+ const e = narrate(base({ parents: [parentRef()] }), [[PARENT], [REPLY]]);
+ const plan = postItemPlan(e, {});
+ const geo = fakeGeo(plan);
+ const path = followPath(plan.follow, geo);
+ const good = shotStateAt(plan.follow, path, 30);
+ assert.deepEqual(readInViewErrors(plan.follow, geo, good, { total: plan.total, id: "t" }), []);
+ const off = readInViewErrors(plan.follow, geo, (s) => ({ ...good(s), offset: -geo.H }), { total: plan.total, id: "t" });
+ assert.match(off.join("\n"), /t: part 1 \(the post it answers \(parent:0\), block 0\) is not in full view .* past the window's foot/);
+ const small = readInViewErrors(plan.follow, geo, (s) => { const st = good(s); return { ...st, tiles: { ...st.tiles, post: [0.62, 0.5, st.tiles.post[2]] } }; }, { total: plan.total, id: "t" });
+ assert.match(small.join("\n"), /t: part 4 \(his post, block \d+\) .* his post is drawn at 0\.62× and 0\.50 strength/);
+ // A plain post read in one block that fits: every frame the page as drawn -- no frames to shoot.
+ const plain = narrate(base(), [[REPLY]]);
+ const pp = postItemPlan({ ...plain, narration: { ...plain.narration, takes: [{ ...plain.narration.takes[0], parts: [{ ...plain.narration.takes[0].parts[0], text: REPLY }] }] } }, {});
+ const pgeo = { H: 520, C: 200, blocks: Object.fromEntries(pp.follow.blocks.map((b, i) => [b.k, { top: i * 90, bottom: i * 90 + 80 }])) };
+ const ppath = followPath(pp.follow, pgeo);
+ assert.ok(followRuns(pp.follow, ppath, pp.total, 30).every((r) => isDrawnState(r.st)));
+ assert.deepEqual(readInViewErrors(pp.follow, pgeo, () => null, { total: pp.total, id: "plain" }), []);
+ assert.equal(isDrawnState(null), true);
+ assert.equal(isDrawnState({ op: {}, offset: 0, fadeTop: 0, fadeBottom: 0, tiles: { post: [1, 1, 300] } }), true);
+ assert.equal(isDrawnState({ op: {}, offset: 0, fadeTop: 0, fadeBottom: 0, tiles: { "parent:0": [0.62, 0.5, 300] } }), false);
+});
diff --git a/umtool/report-to-video/read-follow.mjs b/umtool/report-to-video/read-follow.mjs
@@ -618,6 +618,179 @@ export function followStateAt(follow, path, s) {
/** A state's key: two frames with the same key draw the same card (the build shoots each key once). */
export const followStateKey = (st) => JSON.stringify([st.op, st.offset, st.fadeTop, st.fadeBottom, ...(st.tiles ? [st.tiles] : [])]);
+/**
+ * Whether a state draws the card PAGE AS DRAWN (no state applied): nothing
+ * dimmed, no pan, no fading edge, every tile full size and full strength. A
+ * build whose every frame is in such a state needs no follow frames; one
+ * frame that is not (a threaded card's context post small and dim, its column
+ * placed) must be shot -- the page as drawn has every tile full and lit, the
+ * column at the top (Mr. Obvious mid-5, p-2117259673917386879: one part read,
+ * no pan, so no frames were shot and the parent drew full over his post).
+ */
+export function isDrawnState(st) {
+ if (!st) return true;
+ if (Object.values(st.op ?? {}).some((o) => fin(o) && o < 0.9995)) return false;
+ if (fin(st.offset) && Math.abs(st.offset) >= 0.5) return false;
+ if ((st.fadeTop ?? 0) > 0 || (st.fadeBottom ?? 0) > 0) return false;
+ return !Object.values(st.tiles ?? {}).some((v) => Array.isArray(v) && ((fin(v[0]) && v[0] < 0.9995) || (fin(v[1]) && v[1] < 0.9995)));
+}
+
+// ---------------------------------------------------------------------------
+// THE INVARIANT: what is being read is in view while it is read (operator,
+// 4 Nov: "no hidden text is ever narrated").
+// ---------------------------------------------------------------------------
+
+/**
+ * The tolerances of readInViewErrors: `tol` px a block may run past the
+ * window's edge; `slack` s it may be out of view in all (a pan or a tile's
+ * change in passing); `share` of the window a block taller than it must fill;
+ * `step` s between the moments looked at; `size` the slack on a context
+ * tile's size and strength.
+ */
+export const READ_IN_VIEW = Object.freeze({ tol: 2, slack: 0.25, share: 0.5, step: 0.05, size: 0.005 });
+
+const pct = (v) => `${Math.round(v * 100)}%`;
+const tileName = (scope) => (scope === "post" ? "his post" : scope === "quoted" ? "the quoted post" : String(scope).startsWith("parent:") ? `the post it answers (${scope})` : String(scope));
+
+/**
+ * THE READ IN VIEW, pure: every reason the words being read are not on screen,
+ * whole and lit, while they are said -- as sentences naming the item (empty:
+ * they always are). `geo` is measureFollow's (the page at every tile's full
+ * size); `stateAt(s)` the state the frames at item second `s` are DRAWN in
+ * (null: the page as drawn, no state applied -- what a build that shoots no
+ * follow frames shows). For each block a part reads, from the moment its pan
+ * and its tile's change have settled until the next one's begin:
+ *
+ * - a tile that fits the window (less its margin) is in it WHOLE; a block of a
+ * tile taller than that is in it whole, and one taller than the window fills
+ * `share` of it (it pans on through);
+ * - its tile (a quoted post inside his: his too) at full size and strength,
+ * and the block itself lit;
+ *
+ * and, the whole item, a context tile never larger nor stronger than its
+ * context size (a parent `shrink`×`dim`, a quoted post inside his `dim`), a
+ * carried or scene tile at its own once it has given way. A part read off an
+ * attachment lights no block and is not looked at.
+ *
+ * @param {Record<string, any> | null} follow the plan's (followSchedule)
+ * @param {Record<string, any> | null} geo
+ * @param {(s: number) => Record<string, any> | null} stateAt
+ * @param {{ total?: number | null, id?: string }} [o]
+ * @returns {string[]}
+ */
+export function readInViewErrors(follow, geo, stateAt, { total = null, id = "?" } = {}) {
+ if (!follow || !geo || !fin(geo.H) || geo.H <= 0) return [];
+ const T = READ_IN_VIEW;
+ const H = geo.H;
+ const m = Math.round(H * FOLLOW_PAN.margin);
+ const th = follow.thread ?? null;
+ const lead = FOLLOW_PAN.lead;
+ const settle = Math.max(0, (th ? Math.max(th.pan, th.seconds) : FOLLOW_PAN.seconds) - lead) + 0.05;
+ const end = fin(total) && total > 0 ? total : follow.readEnd ?? 0;
+ const errors = [];
+ const memo = new Map();
+ const look = (s) => {
+ const key = Math.round(s * 1000);
+ if (memo.has(key)) return memo.get(key);
+ const st = stateAt(s);
+ const tiles = st?.tiles ?? {};
+ const scaleOf = (sc) => (Array.isArray(tiles[sc]) && fin(tiles[sc][0]) ? tiles[sc][0] : 1);
+ const opOf = (sc) => (Array.isArray(tiles[sc]) && fin(tiles[sc][1]) ? tiles[sc][1] : 1);
+ const g = th ? threadGeoAt(geo, Object.fromEntries(Object.keys(geo.tiles ?? {}).map((sc) => [sc, scaleOf(sc)]))) : { blocks: geo.blocks ?? {}, tiles: {} };
+ const v = { st, g, off: fin(st?.offset) ? st.offset : 0, scaleOf, opOf };
+ memo.set(key, v);
+ return v;
+ };
+ const read = (follow.blocks ?? []).filter((b) => b.start !== null && b.part !== null && geo.blocks?.[b.k] && !String(b.scope).startsWith("media:"));
+ for (const b of read) {
+ const bEnd = fin(b.end) ? b.end : b.start;
+ const a = b.start + settle;
+ const z = bEnd - lead;
+ const times = [];
+ if (z <= a) times.push(r3((b.start + bEnd) / 2));
+ else for (let s = a; s <= z + 1e-9; s += T.step) times.push(r3(s));
+ let bad = 0;
+ let worst = null;
+ for (const s of times) {
+ const v = look(s);
+ const bb = v.g.blocks[b.k];
+ if (!bb) continue;
+ const why = [];
+ const tile = th ? tileScopeOf(b.scope) : null;
+ const tb = tile ? v.g.tiles[tile] : null;
+ // In view: the tile whole when it fits, else the block whole, else (taller than the window) most of the window.
+ const box = tb && tb.bottom - tb.top <= H - m ? tb : bb;
+ const top = box.top - v.off;
+ const bottom = box.bottom - v.off;
+ const h = bottom - top;
+ const seen = Math.max(0, Math.min(bottom, H) - Math.max(top, 0));
+ if (h <= H + T.tol ? top < -T.tol || bottom > H + T.tol : seen < T.share * H) {
+ why.push(h <= H + T.tol ? `${box === tb ? "its tile" : "the block"} runs ${top < -T.tol ? `${Math.round(-top)} px above the window` : `${Math.round(bottom - H)} px past the window's foot`} (${pct(seen / Math.max(1, h))} of it in view)` : `only ${pct(seen / H)} of the window shows it`);
+ }
+ if (tile) {
+ const sc = v.scaleOf(tile);
+ const op = v.opOf(tile);
+ if (sc < 0.99 || op < 0.99) why.push(`${tileName(tile)} is drawn at ${sc.toFixed(2)}× and ${op.toFixed(2)} strength`);
+ if (tile === "quoted" && th.quotedAt !== "above" && (v.scaleOf("post") < 0.99 || v.opOf("post") < 0.99)) why.push(`his post, the quote's tile, is drawn at ${v.scaleOf("post").toFixed(2)}× and ${v.opOf("post").toFixed(2)} strength`);
+ }
+ const bop = v.st?.op?.[b.k];
+ if (fin(bop) && bop < 0.99) why.push(`the block is dimmed to ${bop}`);
+ if (why.length) {
+ bad += 1;
+ worst ??= { s, why };
+ }
+ }
+ const secs = times.length > 1 ? bad * T.step : bad ? Math.max(0.1, bEnd - b.start) : 0;
+ if (bad && secs > T.slack + 1e-9) {
+ errors.push(`${id}: part ${b.part + 1} (${tileName(b.scope)}, block ${b.k}) is not in full view for ${secs.toFixed(2)} s of its read (${r3(b.start)}–${r3(bEnd)} s) -- at ${worst.s} s ${worst.why.join("; ")}`);
+ }
+ }
+ // A CONTEXT tile is never larger nor stronger than its context size; a carried or scene tile, once it has given way.
+ for (const row of th?.tiles ?? []) {
+ const ctxMode = row.mode === "context";
+ const gave = (row.mode === "carry" || row.mode === "scene") && fin(row.t1) && row.t1 > row.t0 && !row.then;
+ if (!ctxMode && !gave) continue;
+ const lim = ctxMode ? (row.scope === "quoted" && th.quotedAt !== "above" ? [1, th.dim] : [th.shrink, th.dim]) : row.to;
+ const from = ctxMode ? 0 : row.t1 + 0.05;
+ for (let s = from; s <= end + 1e-9; s += 0.1) {
+ const v = look(r3(s));
+ const sc = v.scaleOf(row.scope);
+ const op = v.opOf(row.scope);
+ if (sc > lim[0] + T.size || op > lim[1] + T.size) {
+ errors.push(`${id}: ${tileName(row.scope)} (${ctxMode ? "context, never read" : `${row.mode}, given way`}) is drawn at ${sc.toFixed(2)}× and ${op.toFixed(2)} strength at ${r3(s)} s -- over its size there (${lim[0]}× and ${lim[1]})`);
+ break;
+ }
+ }
+ }
+ return errors;
+}
+
+/**
+ * The item's FRAMES as runs of one state, pure: `[{ key, st, n }]` -- frame i
+ * at followStateAt(i / fps), `total` s at `fps`, consecutive frames of one
+ * state one run (the build shoots each distinct state once). It needs no
+ * frames shot only when every run is the page as drawn (isDrawnState).
+ */
+export function followRuns(follow, path, total, fps) {
+ const frames = Math.max(1, Math.round(total * fps));
+ const runs = [];
+ for (let i = 0; i < frames; i += 1) {
+ const st = followStateAt(follow, path, i / fps);
+ const key = followStateKey(st);
+ const last = runs[runs.length - 1];
+ if (last && last.key === key) last.n += 1;
+ else runs.push({ key, st, n: 1 });
+ }
+ return runs;
+}
+
+/**
+ * The frames' state at item second `s`, as the build shoots them: the state of
+ * frame floor(s·fps) (followStateAt at i / fps); `shot` false (no follow
+ * frames shot) the page as drawn, null.
+ */
+export const shotStateAt = (follow, path, fps, shot = true) => (s) => (shot ? followStateAt(follow, path, Math.floor(s * fps + 1e-6) / fps) : null);
+
// ---------------------------------------------------------------------------
// In the page: self-contained (the build passes them to page.evaluate; Play
// calls them on its frame's document). They reach for nothing outside.