Public: anyone can read this; the crew can change it.

The nightly release was held: tests failed on 2aec48903 #15507

Merged opened this in answer to

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/15504-the-nightly-release-was-held-tests-faile → main 0 commits fork

  • Merged. scout/15504-the-nightly-release-was-held-tests-faile was merged into main as d5d3ed2.

Review

Sign in to review this change.
1 file changed +38 −1
test/attention.test.ts +38 −1
@@ -59,6 +59,25 @@ const fixedCaps = (html: string): string =>
5959 const fixedWait = (html: string): string =>
6060 html.replace(/has waited \d+s/g, "has waited 0s").replace(/(data-label="Oldest" >)\d+s/g, "$10s");
6161
62 // /system holds three readings that finish in the background (the largest directories, the
63 // database's tables, the node's cluster read). The first request waits up to 0.8 s for the first
64 // two, so a quiet machine shows them measured and a loaded one, or a later request, does not: +3
65 // words and +2 blocks on a page held at its budget exactly (#15504). The budget was set on the
66 // unmeasured form, so the test pins that form whatever the machine managed to read.
67 const UNREAD_CLUSTER = "the cluster is being read; reload in a moment";
68 const fixedReads = (html: string): string =>
69 html
70 .replace(
71 /<section class="settings-block" id="sys-largest">[\s\S]*?<\/section>/,
72 `<section class="settings-block" id="sys-largest"><h2>Largest under the forge's data</h2><p class="muted small">Being measured; reload in a moment.</p></section>`,
73 )
74 .replace(/<div class="status-row"><dt>Free inside<\/dt>[\s\S]*?<\/div>/, "")
75 .replace(
76 /<div class="table-scroll"><table class="table" data-dense aria-label="The \d+ largest tables[\s\S]*?<\/table><\/div>\s*<p class="muted small">Measured[\s\S]*?at most once an hour\.<\/p>/,
77 `<p class="muted small">Its tables are being measured; reload in a moment.</p>`,
78 )
79 .replace(/not read: not running in a cluster/g, UNREAD_CLUSTER);
80
6281 beforeAll(async () => {
6382 root = mkdtempSync(join(tmpdir(), "forge-attention-"));
6483 app = createApp({ dataDir: root, port: 0, forgeRepo: "alice/forge" });
@@ -104,7 +123,7 @@ beforeAll(async () => {
104123 const res = await fetch(`${servers.url}${path}`, { headers: { cookie }, redirect: "follow" });
105124 if (res.status !== 200) throw new Error(`${name} ${path} answered ${res.status}`);
106125 const text = await res.text();
107 pages[name] = name === "system" ? fixedCaps(text) : name === "boards" ? fixedWait(text) : text;
126 pages[name] = name === "system" ? fixedReads(fixedCaps(text)) : name === "boards" ? fixedWait(text) : text;
108127 }
109128 // A milestone (#14795), made after the pages above so their counts stay put:
110129 // one open step and one done, which folds behind its count.
@@ -154,6 +173,24 @@ test("each page stays inside its first-view budget", () => {
154173 expect(over).toEqual([]);
155174 });
156175
176 test("a /system read once its background measures finish counts as the unmeasured page", async () => {
177 // The unmeasured page is what the budget holds; the measured one is the machine's luck. Each
178 // read waits up to 0.8 s for the measures, so asking again is the wait.
179 let measured = "";
180 for (let i = 0; i < 20 && !measured.includes("at most once an hour"); i++) {
181 measured = await (await fetch(`${servers.url}/system`, { headers: { cookie } })).text();
182 }
183 expect(measured).toContain("at most once an hour");
184 const pinned = fixedReads(fixedCaps(measured));
185 expect(pinned).not.toContain("at most once an hour");
186 expect(pinned).not.toContain("not running in a cluster");
187 for (const w of WIDTHS) {
188 const want = firstView(pages.system!, w);
189 const got = firstView(pinned, w);
190 expect({ words: got.words, blocks: got.blocks }).toEqual({ words: want.words, blocks: want.blocks });
191 }
192 });
193
157194 test("the budget file names every page at both widths and no other", () => {
158195 // A budget for every page at both widths, and no stale page in the file.
159196 const budget = JSON.parse(readFileSync(BUDGET, "utf8")) as Budget;

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs