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

The signed-in home answers its first page inside a stated budget on a forge with 5,000 events, measured by query plan and Server-Timing #13595

Merged opened this

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

Merged

The signed-in home already meets the budget on a 5,000-event forge, so this pull adds only the test that proves it and the budget text in docs/FEED.md. src/feed/timeline.ts is unchanged.

Notes

shipped production is serving it deploy 59903fa

opened this

The signed-in home already meets the budget on a 5,000-event forge, so this pull adds only the test that proves it and the budget text in docs/FEED.md. src/feed/timeline.ts is unchanged.

test/home-feed-budget.test.ts seeds 5,000 events and checks four things, and all pass:

  • Query plan: every read of the event table, by the ranked feed (readFeedPage) and by readTimeline, has no SCAN and no TEMP B-TREE. It follows the pattern in test/hot-reads-indexed.test.ts.
  • Row count: a cold first page reads at most 900 rows in all.
  • Timeline page: the first page is a full 20 items with a cursor to go on.
  • Server-Timing: for a signed-in person on /, /feed and /api/v1/feed, the app phase of a warm read is under 50 ms. It takes the best of three warm reads, so the clock is only the generous second check.

The new docs/FEED.md "Budget" section states the budget and says the plan and row count are the judges, with the clock second.

I did not add the same budget to the terminal door or MCP feed.

To try it, run bun test test/home-feed-budget.test.ts. I also ran bun scripts/gate.ts --fix and bun x tsc --noEmit before pushing; neither reported a problem.

Closes #13581

commented

The signed-in home already meets the budget on a 5,000-event forge, so this pull adds only the test that proves it and the budget text in docs/FEED.md. src/feed/timeline.ts is unchanged.

test/home-feed-budget.test.ts seeds 5,000 events and checks four things, and all pass:

  • Query plan: every read of the event table, by the ranked feed (readFeedPage) and by readTimeline, has no SCAN and no TEMP B-TREE. It follows the pattern in test/hot-reads-indexed.test.ts.
  • Row count: a cold first page reads at most 900 rows in all.
  • Timeline page: the first page is a full 20 items with a cursor to go on.
  • Server-Timing: for a signed-in person on /, /feed and /api/v1/feed, the app phase of a warm read is under 50 ms. It takes the best of three warm reads, so the clock is only the generous second check.

The new docs/FEED.md "Budget" section states the budget and says the plan and row count are the judges, with the clock second.

I did not add the same budget to the terminal door or MCP feed.

To try it, run bun test test/home-feed-budget.test.ts. I also ran bun scripts/gate.ts --fix and bun x tsc --noEmit before pushing; neither reported a problem.

Approved

Test and docs only, no runtime code touched, so no new attack surface. The test proves the budget by query plan (no SCAN or TEMP B-TREE on event reads) and by a 900-row cap, and uses the clock only as a second check. Docs are in docs/FEED.md, not README. No new dependency. One note, not a blocker: the 50 ms Server-Timing assertion depends on machine load. It takes the best of three warm reads, which makes a flake unlikely. If it ever flakes, drop it and keep the plan and row checks.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs