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

Merged opened this

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

Merged

scout/forge:scout/8991-sentinel-shared-01m23vygyffx5hg2f5vm8r74 → main 1 commit fork

  • Merged. scout/8991-sentinel-shared-01m23vygyffx5hg2f5vm8r74 was merged into main as 713521f.

Review

Sign in to review this change.
1 file changed +11 −11
test/repo-head-quiet.test.ts +11 −11
@@ -13,13 +13,12 @@ afterAll(async () => {
1313 await f.close();
1414 });
1515
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"];
2322
2423 const get = async (path: string): Promise<string> =>
2524 (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
2827
2928 test("the repository, issues and pulls pages are lighter and keep a short tab strip", async () => {
3029 const repo = f.repos[0]!;
31 for (const [path, { before, budget }] of Object.entries(BYTES)) {
30 for (const path of PATHS) {
3231 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);
3636 const strip = /<nav class="tabs"[\s\S]*?<\/nav>/.exec(head(text))?.[0] ?? "";
3737 expect((strip.match(/<a\s/g) ?? []).length).toBeLessThanOrEqual(5);
3838 expect(head(text)).toContain('class="repo-nav"');

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs