Public: anyone can read this; the crew can change it.
Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:3o7ggfoxcg is past its budget: trevato/forge: "GET /settings/cloud/audit names its phases and answers within its budget" failed on 3 pulls in the last… #7532
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/7519-sentinel-shared-01m23vygyffx5hg2f5vm8r74 → main 2 commits fork 2 threads · 2 unresolved
1 file
changed +11
−3
test/cloud-org-apps-timing.test.ts +11 −3
| @@ -52,6 +52,12 @@ const PAGES: [string, string[]][] = [ | ||
| 52 | 52 | ["/apps/open", ["session", "render"]], |
| 53 | 53 | ]; |
| 54 | 54 | |
| 55 | /** The page's budget (ms), and the most a request may spend between its named phases (ms) when quiet. */ | |
| 56 | const BUDGET_MS = 50; | |
| 57 | const ACCOUNTING_MS = 1.5; | |
| 58 | /** Requests judged per page; each assertion takes its own best, so one stalled request cannot fail it. */ | |
| 59 | const SAMPLES = 7; | |
| 60 | ||
| 55 | 61 | for (const [path, names] of PAGES) |
| 56 | 62 | test(`GET ${path} names its phases and answers within its budget`, async () => { |
| 57 | 63 | const against = await baselineMs(servers.url); |
| @@ -60,7 +66,7 @@ for (const [path, names] of PAGES) | ||
| 60 | 66 | // Timers jitter on a busy machine: judge the best of several requests. |
| 61 | 67 | let left = Infinity; |
| 62 | 68 | let total = Infinity; |
| 63 | for (let i = 0; i < 7; i++) { | |
| 69 | for (let i = 0; i < SAMPLES; i++) { | |
| 64 | 70 | const res = await get(); |
| 65 | 71 | await res.text(); |
| 66 | 72 | const parts = (res.headers.get("server-timing") ?? "").split(", "); |
| @@ -71,8 +77,10 @@ for (const [path, names] of PAGES) | ||
| 71 | 77 | // Phases name the whole request: what is left over is small. |
| 72 | 78 | left = Math.min(left, Math.abs(dur("app") - names.reduce((sum, n) => sum + dur(n), 0))); |
| 73 | 79 | } |
| 74 | expectBudget(total, { ms: 50, against }); | |
| 75 | expect(left).toBeLessThanOrEqual(1.5); // accounting, not speed: each phase is rounded to 0.1 | |
| 80 | expectBudget(total, { ms: BUDGET_MS, against }); | |
| 81 | // The unnamed stretch (routing, before `session`) is fixed work, ~0.9 ms quiet and ~1.7 ms in a loaded | |
| 82 | // shard (#7519): it stretches with the machine, so it is judged against the same-run baseline like speed. | |
| 83 | expectBudget(left, { ms: ACCOUNTING_MS, against }); | |
| 76 | 84 | }); |
| 77 | 85 | |
| 78 | 86 | // Signed out, the redirect to sign-in is still a named phase. |
new above
offline
Name these as constants (
MIN_SAMPLES,MAX_SAMPLES) with the reason for 30; today it is an arbitrary cap.