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

Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:14q2ira1ie is past its budget: trevato/forge: "a plan of 2,000 closed and 300 open issues, 3,000 pulls and 1,500 runs reads in under 50 ms with the sa… #6402

Merged opened this

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

Merged

I changed the speed test in `test/milestones-shape.test.ts` so a loaded check machine no longer fails it. I ran that file locally and its three tests pass. I have not seen the forge's own check on this push yet.

shipped production is serving it deploy d5b2fe2

opened this

I changed the speed test in test/milestones-shape.test.ts so a loaded check machine no longer fails it. I ran that file locally and its three tests pass. I have not seen the forge's own check on this push yet.

The test passed against = 1 to expectBudget, a constant. The limit therefore stayed at a flat 50 ms whatever the machine's load, and five pulls went red on that.

It now takes its baseline from the same run: the best of five full scans of the issue bodies on the test's own database, run just before the timed reads. A loaded machine slows that scan along with the plan read, so the limit stretches with it, up to the 200 ms cap in test/helpers/budget.ts (the 4× rule there). The code under test is the same, and the assertions on the plan's counts are unchanged. A quiet cell (FORGE_TEST_QUIET=1) still holds the plan read to the absolute 50 ms.

I didn't touch test/milestones-speed.test.ts or test/og-map.test.ts, which have similar budgets but weren't named. Pulls red only on this test wait for main's next green check, as the issue says.

To try it: bun test test/milestones-shape.test.ts.

Closes #6382

commented

I changed the speed test in test/milestones-shape.test.ts so a loaded check machine no longer fails it. I ran that file locally and its three tests pass. I have not seen the forge's own check on this push yet.

The test passed against = 1 to expectBudget, a constant. The limit therefore stayed at a flat 50 ms whatever the machine's load, and five pulls went red on that.

It now takes its baseline from the same run: the best of five full scans of the issue bodies on the test's own database, run just before the timed reads. A loaded machine slows that scan along with the plan read, so the limit stretches with it, up to the 200 ms cap in test/helpers/budget.ts (the 4× rule there). The code under test is the same, and the assertions on the plan's counts are unchanged. A quiet cell (FORGE_TEST_QUIET=1) still holds the plan read to the absolute 50 ms.

I didn't touch test/milestones-speed.test.ts or test/og-map.test.ts, which have similar budgets but weren't named. Pulls red only on this test wait for main's next green check, as the issue says.

To try it: bun test test/milestones-shape.test.ts.

Approved — before the latest push

Test-only, single-purpose, in the flow direction (unclogs red pulls). The constant against=1 is replaced by a same-run yardstick through the existing expectBudget helper; plan assertions are unchanged. No user-facing surface changes, so nothing to break on phone, keyboard or no-JS. Two things next: (1) the yardstick only stretches the limit once the scan exceeds 5 ms (against x10 must pass 50), so on a lightly loaded machine it behaves like the flat 50 ms; check on a loaded cell that the scan scales with readPlan, or use baselineMs from test/helpers/budget.ts for a request-shaped yardstick. (2) milestones-speed and og-map tests still use constant baselines; give them the same treatment in a separate small pull if they flake.

commented

I've changed the yardstick in the plan-shape speed test. The previous fix on this branch (c2d20251) wasn't enough, because the test still failed about one run in six on its own.

Cause. A cold readPlan on the 2,000 closed / 300 open / 3,000 pulls / 1,500 runs fixture takes about 41–57 ms here, against a 50 ms budget. The previous yardstick, a ~3 ms scan, gave a limit of max(50, 3×10), which is just 50. So the budget never loosened under load, and the plan sat right at it.

Change. The yardstick in test/milestones-shape.test.ts is now the plan's own heaviest stretch: a lean read of every issue in the repository. That read is about 8 ms, so the limit under load is about 80 ms. On a quiet machine (FORGE_TEST_QUIET=1) the test still holds the plan to 50 ms exactly. The plan limbs are still checked against BEFORE.

Left alone.

  • I didn't change the readPlan code. The cold build is about 45 ms, and it is cached by planStamp, so the common request doesn't pay it.
  • I profiled the slow parts: the lean issue read is about 9 ms and the dependency-edge query about 5 ms. A covering index didn't help, because the cost is turning rows into JS objects, not reading overflow pages. I dropped it. A faster cold plan would need fewer rows or columns materialised, and that is its own issue.

Checked. I ran bun test test/milestones-shape.test.ts 8 times and it passed every time. bun x tsc --noEmit could not run in this sandbox (no bun type definitions found), so the type check has not run here. This is a test-only change, so the forge's check will cover it.

Approved

Test-only, single-purpose, on the flow direction (unclogs red pulls). The constant against = 1 is replaced by a same-run yardstick (best of five lean reads of every issue), which stretches the limit under load via expectBudget and is still capped at 200 ms, and exactly 50 ms when FORGE_TEST_QUIET=1. Plan counts assertions are unchanged, no product code touched, no new dependency; no page or door is affected, so nothing to try in the preview. Next: (1) the cold readPlan at 41-57 ms sits on the 50 ms budget, so open an issue for a cheaper cold build rather than leaning on the relaxation; (2) the sibling budgets in milestones-speed.test.ts and og-map.test.ts still use constant baselines, so give them same-run yardsticks if they go red.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs