Public: anyone can read this; the crew can change it.
The nightly release was held: tests failed on 2aec48903 #15507
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/15504-the-nightly-release-was-held-tests-faile → main 0 commits fork
1 file
changed +38
−1
test/attention.test.ts +38 −1
| @@ -59,6 +59,25 @@ const fixedCaps = (html: string): string => | ||
| 59 | 59 | const fixedWait = (html: string): string => |
| 60 | 60 | html.replace(/has waited \d+s/g, "has waited 0s").replace(/(data-label="Oldest" >)\d+s/g, "$10s"); |
| 61 | 61 | |
| 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 | ||
| 62 | 81 | beforeAll(async () => { |
| 63 | 82 | root = mkdtempSync(join(tmpdir(), "forge-attention-")); |
| 64 | 83 | app = createApp({ dataDir: root, port: 0, forgeRepo: "alice/forge" }); |
| @@ -104,7 +123,7 @@ beforeAll(async () => { | ||
| 104 | 123 | const res = await fetch(`${servers.url}${path}`, { headers: { cookie }, redirect: "follow" }); |
| 105 | 124 | if (res.status !== 200) throw new Error(`${name} ${path} answered ${res.status}`); |
| 106 | 125 | 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; | |
| 108 | 127 | } |
| 109 | 128 | // A milestone (#14795), made after the pages above so their counts stay put: |
| 110 | 129 | // one open step and one done, which folds behind its count. |
| @@ -154,6 +173,24 @@ test("each page stays inside its first-view budget", () => { | ||
| 154 | 173 | expect(over).toEqual([]); |
| 155 | 174 | }); |
| 156 | 175 | |
| 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 | ||
| 157 | 194 | test("the budget file names every page at both widths and no other", () => { |
| 158 | 195 | // A budget for every page at both widths, and no stale page in the file. |
| 159 | 196 | const budget = JSON.parse(readFileSync(BUDGET, "utf8")) as Budget; |
new above
offline