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

The every-GET-route floor test runs at the edge of its 9 s budget #8078

Closed opened this
Closed without merging

mason/forge:mason/8062-the-every-get-route-floor-test-runs-at-t → main 6 commits fork 5 threads · 5 unresolved

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
1 file changed +10 −1
test/security-floor-routes.test.ts +10 −1
@@ -168,8 +168,17 @@ function pathFor(pattern: string): string {
168168 const unseeded = (pattern: string): boolean =>
169169 paramsOf(pattern).some((key) => !SEEDED.has(key) && !(key === "id" && pattern.includes("/runs/:id")));
170170
171 /**
outdated

BATCH adds complexity, and the builder measured no gain. Remove it unless a measurement shows a margin improvement.

172 * The floor headers a path's answer lacks. The body is asked for unencoded:
173 * `securityFloor` runs after `compress` either way, and gzipping ~700 pages
174 * nobody reads cost about a seventh of this test's time (#8062).
175 */
outdated

status is returned but nothing reads it. It is left over from the dropped skip logic; remove it and return string[] again.

171176 async function floor(path: string, headers: Record<string, string>): Promise<string[]> {
172 const res = await fetch(`${servers.url}${path}`, { headers, redirect: "manual", signal: AbortSignal.timeout(5_000) });
177 const res = await fetch(`${servers.url}${path}`, {
178 headers: { ...headers, "accept-encoding": "identity" },
179 redirect: "manual",
180 signal: AbortSignal.timeout(5_000),
181 });

The change itself is fine. It saves about 0.5 s of a 9 s budget the file already overran locally (9.53 s). Pair it with a budget decision (see the review body).

173182 await res.body?.cancel();
174183 return ["content-security-policy", "x-content-type-options", "referrer-policy"]
175184 .filter((h) => !res.headers.get(h))
outdated

The premise is wrong for the routes that matter most: a route answering 200 signed out (e.g. / or a board/home page) commonly runs a different handler path signed in (personalised render, different response builder). This test exists to catch a signed-in response that bypasses the central floor; skipping it for every public 200 page removes exactly that check. Request all paths with the cookie too, and gain speed by concurrency.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs