Public: anyone can read this; the crew can change it.
Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:oknjrkg7c8 is past its budget: trevato/forge: "the repository, issues and pulls pages are lighter and keep a short tab strip" failed on 7 pulls in the… #9005
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/8991-sentinel-shared-01m23vygyffx5hg2f5vm8r74 → main 1 commit fork
1 file
changed +11
−11
test/repo-head-quiet.test.ts +11 −11
| @@ -13,13 +13,12 @@ afterAll(async () => { | ||
| 13 | 13 | await f.close(); |
| 14 | 14 | }); |
| 15 | 15 | |
| 16 | // Bytes on the snappy fixture as the owner: [before the head folded its rare steps away, measured now]. | |
| 17 | // The budget is the measurement plus a few bytes for port digits, not room. The shortcut keys beside tabs, the top bar and the menu's New issue (#8854) are the whole of the ~315 bytes added on each page: eleven `<kbd class="keyhint">` of ~30 bytes, shown on a pointer-fine desktop and hidden by CSS elsewhere. | |
| 18 | const BYTES: Record<string, { before: number; budget: number }> = { | |
| 19 | "": { before: 25_929, budget: 25_540 }, | |
| 20 | "/issues": { before: 51_705, budget: 51_330 }, | |
| 21 | "/pulls": { before: 25_151, budget: 24_760 }, | |
| 22 | }; | |
| 16 | // Bytes of the repository head on the snappy fixture as the owner: [before it folded its rare steps away (#8802), measured now plus room]. | |
| 17 | // Only the head is weighed: it is what this test is about, and it holds no port, clock or host, so the verdict is the head's code | |
| 18 | // and nothing else. Weighing the whole page tripped every pull that added a few bytes to the top bar, the palette or a list (#8991). | |
| 19 | // The head now weighs 2,700 bytes on each page, the shortcut keys beside its tabs (#8895) included; the budget leaves ~100 bytes for one more. | |
| 20 | const HEAD_BYTES = { before: 3_808, budget: 2_800 }; | |
| 21 | const PATHS = ["", "/issues", "/pulls"]; | |
| 23 | 22 | |
| 24 | 23 | const get = async (path: string): Promise<string> => |
| 25 | 24 | (await fetch(`${f.base}${path}`, { headers: { cookie: f.ownerCookie } })).text(); |
| @@ -28,11 +27,12 @@ const head = (page: string): string => /<header class="repo-head">[\s\S]*?<\/hea | ||
| 28 | 27 | |
| 29 | 28 | test("the repository, issues and pulls pages are lighter and keep a short tab strip", async () => { |
| 30 | 29 | const repo = f.repos[0]!; |
| 31 | for (const [path, { before, budget }] of Object.entries(BYTES)) { | |
| 30 | for (const path of PATHS) { | |
| 32 | 31 | const text = await get(`/${repo.ownerName}/${repo.name}${path}`); |
| 33 | const size = new TextEncoder().encode(text).length; | |
| 34 | expect(size).toBeLessThan(before); | |
| 35 | expect(size).toBeLessThan(budget); | |
| 32 | const size = new TextEncoder().encode(head(text)).length; | |
| 33 | expect(size).toBeGreaterThan(0); | |
| 34 | expect(size).toBeLessThan(HEAD_BYTES.before); | |
| 35 | expect(size).toBeLessThan(HEAD_BYTES.budget); | |
| 36 | 36 | const strip = /<nav class="tabs"[\s\S]*?<\/nav>/.exec(head(text))?.[0] ?? ""; |
| 37 | 37 | expect((strip.match(/<a\s/g) ?? []).length).toBeLessThanOrEqual(5); |
| 38 | 38 | expect(head(text)).toContain('class="repo-nav"'); |
new above
offline