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

The hunters get a speed lane: each top page's median over five GETs, a finding when it passes its page budget #15274

Merged opened this

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

Merged

The hunters now have a speed lane. src/hunt/speed.ts goes through the pages in src/perf/pagebudgets/ that don't need a repository in their path: /, /explore, /map, /changelog, /maintenance, /pricing, /forges/new, /claim and /templates.

Notes

shipped production is serving it deploy 496afdb

opened this

The hunters now have a speed lane. src/hunt/speed.ts goes through the pages in src/perf/page_budgets/ that don't need a repository in their path: /, /explore, /map, /changelog, /maintenance, /pricing, /forges/new, /claim and /templates. It asks each one 5 times and files a speed:<path> finding (kind defect) when the median passes the page's medianMs.

What to look at:

  • Server time, not wall time. Network time in a sandbox is not server time, so the lane judges only the app;dur= value from each answer's server-timing header. src/hunt/probe.ts reads it into a new Seen.serverMs field with appDuration; it is null when the header doesn't give it.
  • Pages it can't judge are skipped. A page that doesn't answer 200 on every try, or doesn't give its time, gets no speed finding; the front-door lane already reports a page that fails.
  • Evidence is numbers only, for example GET /explore ×5 → 200; server app ms: 120.0, …; median 120.0 > budget 50. The evidence block's ms is the median.
  • Wiring. The lane is registered in LANES in src/hunt/hunt.ts, so bun scripts/hunt.ts <origin> runs it without any change to the script. speed is added to DETECTOR_KINDS, and docs/HUNT.md has a Speed row.
  • Still GET-only and same-origin: every request goes through probe.get.

Left out: the repository pages (/:owner/:name, /next, /space, /space.json), because the hunter is given only an origin and has no repository to fill in. docs/HUNT.md still lists them as not built. Pages are timed signed out, since the hunter has no session.

Tests: test/hunt-speed.test.ts serves a slow stub and checks for exactly one finding with the same key on two runs, with no page-body text in it. It also checks that:

  • one slow answer out of five is not a finding;
  • a probe that reports slow wall time but fast server time is not a finding;
  • pages with no timing are skipped;
  • each page is asked five times, by GET only;
  • the lane runs inside a full hunt.

The tests fail on main, where speed.ts doesn't exist. bun x tsc --noEmit and bun scripts/gate.ts --fix are clean. scripts/fast.ts named 3,239 test files, because probe.ts and finding.ts are imported widely, so I chose the suites myself: the hunt, evidence, page-budget-roster, sentinel, perf-watch, red-apps, chapter-stall and contract-probe tests all pass. There is no page change, so no review steps.

Try it: bun test test/hunt-speed.test.ts, or bun scripts/hunt.ts https://lab--forge-trevato-apps.open-platform.sh.

🤖 Generated with Claude Code

Closes #15258

2 earlier comments
commented

The hunters now have a speed lane. src/hunt/speed.ts goes through the pages in src/perf/page_budgets/ that don't need a repository in their path: /, /explore, /map, /changelog, /maintenance, /pricing, /forges/new, /claim and /templates. It asks each one 5 times and files a speed:<path> finding (kind defect) when the median passes the page's medianMs.

What to look at:

  • Server time, not wall time. Network time in a sandbox is not server time, so the lane judges only the app;dur= value from each answer's server-timing header. src/hunt/probe.ts reads it into a new Seen.serverMs field with appDuration; it is null when the header doesn't give it.
  • Pages it can't judge are skipped. A page that doesn't answer 200 on every try, or doesn't give its time, gets no speed finding; the front-door lane already reports a page that fails.
  • Evidence is numbers only, for example GET /explore ×5 → 200; server app ms: 120.0, …; median 120.0 > budget 50. The evidence block's ms is the median.
  • Wiring. The lane is registered in LANES in src/hunt/hunt.ts, so bun scripts/hunt.ts <origin> runs it without any change to the script. speed is added to DETECTOR_KINDS, and docs/HUNT.md has a Speed row.
  • Still GET-only and same-origin: every request goes through probe.get.

Left out: the repository pages (/:owner/:name, /next, /space, /space.json), because the hunter is given only an origin and has no repository to fill in. docs/HUNT.md still lists them as not built. Pages are timed signed out, since the hunter has no session.

Tests: test/hunt-speed.test.ts serves a slow stub and checks for exactly one finding with the same key on two runs, with no page-body text in it. It also checks that:

  • one slow answer out of five is not a finding;
  • a probe that reports slow wall time but fast server time is not a finding;
  • pages with no timing are skipped;
  • each page is asked five times, by GET only;
  • the lane runs inside a full hunt.

The tests fail on main, where speed.ts doesn't exist. bun x tsc --noEmit and bun scripts/gate.ts --fix are clean. scripts/fast.ts named 3,239 test files, because probe.ts and finding.ts are imported widely, so I chose the suites myself: the hunt, evidence, page-budget-roster, sentinel, perf-watch, red-apps, chapter-stall and contract-probe tests all pass. There is no page change, so no review steps.

Try it: bun test test/hunt-speed.test.ts, or bun scripts/hunt.ts https://lab--forge-trevato-apps.open-platform.sh.

🤖 Generated with Claude Code

commented

Adds a speed lane to the hunters. src/hunt/speed.ts takes each page in src/perf/page_budgets/ whose pattern needs no repository (/, /explore, /map, /changelog, /maintenance, /pricing, /forges/new, /claim, /templates) and asks it 5 times. When the median passes the page's medianMs, it files a speed:<path> finding of kind defect.

What to look at:

  • Server time, not wall time: network time in a sandbox is not server time, so the lane judges only the app;dur= value of each answer's server-timing header. The probe stores it as Seen.serverMs, reusing serverAppMs from src/maintain/wait_split.ts. The median comes from src/flow/pipeline.ts.
  • Pages left unjudged: a page that doesn't answer 200 every time, or doesn't report its time on every answer, gets no finding from this lane. The front-door lane reports a failing page.
  • Evidence: numbers only, e.g. GET /explore ×5 → 200; server app ms: 120.0, …; median 120.0 > budget 50. Nothing from the page body.
  • Still GET-only and same-origin: every request goes through probe.get.
  • Pipeline change: scripts/hunt.ts now takes --lane <name> (repeatable) through lanesNamed and huntTarget(base, fetcher, only), so the speed lane can run alone after a release. An unknown lane name exits 2 with the usage line before any request is sent. docs/HUNT.md gains a Speed row and the --lane usage.

Not built: the repository pages (/:owner/:name, …/next, …/space, …/space.json). The hunter only gets an origin, so it has no repository to fill in, and docs/HUNT.md still lists them as not built. Pages are timed signed out, because the hunter has no session.

Tests: test/hunt-speed.test.ts fails without this change, since the module doesn't exist on main. It serves a slow stub and gets exactly one finding, with the same key across two runs and no body text in it. It also checks that:

  • one slow answer out of five gives no finding;
  • a probe with slow wall time but fast server time gives no finding;
  • pages that report no time are skipped;
  • each page is asked five times, by GET only;
  • the probe reads app;dur;
  • --lane speed runs only that lane, and an unknown lane name is refused.

bun scripts/gate.ts and bun x tsc --noEmit pass on the pushed commits. I ran the hunt, evidence, sentinel, perf-watch, red-apps, chapter-stall and contract-probe tests and they pass. I didn't use scripts/fast.ts: it named 3,239 files because src/hunt/probe.ts and src/hunt/finding.ts are imported widely. The gate still prints a non-blocking similarity note about the test stub's inner fetcher. No page changes, so no review steps.

Try it: bun test test/hunt-speed.test.ts, or bun scripts/hunt.ts https://lab--forge-trevato-apps.open-platform.sh --lane speed.

🤖 Generated with Claude Code

commented

The hunters get a speed lane (#15258): src/hunt/speed.ts asks each top page in src/perf/page_budgets/ five times and reports a speed:<path> finding when the median server-timing: app;dur= goes past the page's medianMs. Wall time is never judged. bun scripts/hunt.ts <origin> --lane speed runs only this lane.

This push merges main, which added filing (#15259):

  • scripts/hunt.ts: one argument loop now takes any number of --lane <name> plus --file in any order. --file still needs FORGE_URL and FORGE_TOKEN, and the usage line and header comment cover both flags.
  • docs/HUNT.md: keeps this branch's "not built yet" line, with "filing issues" taken out because main built it, and main's Filing paragraph.
  • test/hunt-file.test.ts: two test probes built on main had no serverMs, which this branch makes required on Seen, so tsc failed after the merge. They now carry serverMs: null. Only the test data was out of date; the tested code was fine.

bun scripts/gate.ts --fix and bun x tsc --noEmit pass. test/hunt.test.ts, test/hunt-speed.test.ts and test/hunt-file.test.ts pass (28 tests); the rest of the suite is left to the forge's check on this push.

To try it: bun scripts/hunt.ts https://lab--15274--forge-trevato-apps.open-platform.sh --lane speed prints the speed findings as JSON and exits 1 when there are any.

🤖 Generated with Claude Code

Approved

The speed lane works and the preview emits server-timing (/explore: app;dur=22.5), so the lane has something to judge. Server time not wall time, median of 5, numbers-only evidence, stable key speed:<path>, and the test fails without the change. Two things I would do next: (1) the --lane flag, lanesNamed and the CLI arg-loop rewrite in scripts/hunt.ts are beyond what #15258 asked and have no test of the script itself (only lanesNamed is covered); split that into its own small pull or add a CLI test. (2) Add the repository pages to the speed lane once the hunter can be told a repository, and have the lane report a page that answers 200 but omits server-timing instead of silently skipping it. No page change, so no review steps or looks are owed.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs