Public: anyone can read this; the crew can change it.
Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:10bdvndtlg is past its budget: trevato/forge: "each page stays inside its first-view budget" failed on 3 pulls in the last hour — the lane's red, not … #17106
Merged 2d 2h ago, live in production
scout/forge:scout/17087-sentinel-shared-01m23vygyffx5hg2f5vm8r74 → main 0 commits fork
2 files
changed +30
−2
test/attention.test.ts +19
| @@ -12,6 +12,7 @@ | ||
| 12 | 12 | import { afterAll, beforeAll, expect, test } from "bun:test"; |
| 13 | 13 | import { readFileSync, writeFileSync } from "node:fs"; |
| 14 | 14 | import { firstView, WIDTHS, type Attention } from "../src/measure/attention.ts"; |
| 15 | import { noteKeeperAtBoot } from "../src/keeper/at_boot.ts"; | |
| 15 | 16 | import { quietLogs } from "./helpers/globals.ts"; |
| 16 | 17 | import { freshStallState } from "./helpers/stall-state.ts"; |
| 17 | 18 | import { measure, openFirstViews, overBudget, pinnedSystem, type Budget, type FirstViews } from "./helpers/first-views.ts"; |
| @@ -72,6 +73,24 @@ test("a /system read once its background measures finish counts as the unmeasure | ||
| 72 | 73 | } |
| 73 | 74 | }); |
| 74 | 75 | |
| 76 | test("a /system drawn after the release keeper was noted off counts as one drawn before (#17087)", async () => { | |
| 77 | // The keeper's boot answer is the process's: an earlier file that boots main.ts leaves it noted, | |
| 78 | // and /system then lists it. The budget must not move with what ran first. | |
| 79 | try { | |
| 80 | noteKeeperAtBoot({ on: false, why: "FORGE_RELEASE_KEEPER=swap needs FORGE_SELF_SWAP=1" }); | |
| 81 | const raw = await views.get("/system"); | |
| 82 | expect(raw).toContain('id="sys-outside"'); | |
| 83 | const pinned = pinnedSystem(raw); | |
| 84 | for (const w of WIDTHS) { | |
| 85 | const want = firstView(pages.system!, w); | |
| 86 | const got = firstView(pinned, w); | |
| 87 | expect({ words: got.words, blocks: got.blocks }).toEqual({ words: want.words, blocks: want.blocks }); | |
| 88 | } | |
| 89 | } finally { | |
| 90 | noteKeeperAtBoot(undefined); | |
| 91 | } | |
| 92 | }); | |
| 93 | ||
| 75 | 94 | test("the budget file names every page at both widths and no other", () => { |
| 76 | 95 | // A budget for every page at both widths, and no stale page in the file. |
| 77 | 96 | const budget = JSON.parse(readFileSync(BUDGET, "utf8")) as Budget; |
test/helpers/first-views.ts +11 −2
| @@ -88,8 +88,17 @@ const fixedReads = (html: string): string => | ||
| 88 | 88 | ) |
| 89 | 89 | .replace(/not read: not running in a cluster/g, UNREAD_CLUSTER); |
| 90 | 90 | |
| 91 | /** /system as the budget counts it: the cap lines fixed and the background readings unmeasured. */ | |
| 92 | export const pinnedSystem = (html: string): string => fixedReads(fixedCaps(html)); | |
| 91 | // "Needs a hand outside the forge" lists what the release keeper said at boot | |
| 92 | // (`keeper/at_boot.ts`): process-wide state that main.ts, or any earlier file in the same | |
| 93 | // `bun test` process, notes. Noted off it is one more line, 11 or 12 words and a block (#17087); | |
| 94 | // the budget counts the page as a fresh process draws it, with nothing noted. | |
| 95 | const noOutside = (html: string): string => html.replace(/<ul class="list small" id="sys-outside"[^>]*>[\s\S]*?<\/ul>/, ""); | |
| 96 | ||
| 97 | /** | |
| 98 | * /system as the budget counts it: the cap lines fixed, the background readings unmeasured, and | |
| 99 | * no keeper line. | |
| 100 | */ | |
| 101 | export const pinnedSystem = (html: string): string => noOutside(fixedReads(fixedCaps(html))); | |
| 93 | 102 | |
| 94 | 103 | /** The measured pages, and the forge they came from, still serving until `close`. */ |
| 95 | 104 | export interface FirstViews { |
new above
offline