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

`This week` is counted, not sampled: the app page's numbers come from queries #98

Closed opened this
Closed without merging

Pushed. The forge will run its own check against this push. This week now comes from bounded aggregate queries instead of a page of rows filtered in JavaScript: runTotalsSince (src/core/runs.ts) sums cost and counts runs of one kind since a moment, one query — replaces listRuns(..., { limit: 200 }).filter(...).

Notes

stopped closed without shipping deploy 82a9cf5

opened this

Pushed. The forge will run its own check against this push.

This week now comes from bounded aggregate queries instead of a page of rows filtered in JavaScript:

  • runTotalsSince (src/core/runs.ts) sums cost and counts runs of one kind since a moment, one query — replaces listRuns(..., { limit: 200 }).filter(...).
  • mergedCountSince (src/core/pulls.ts) counts merges since a moment, one query — replaces listPulls(..., { limit: 100 }).filter(...).
  • pullThatClosed (src/core/pulls.ts) reads the issue.closed event directly by repo, kind, issue number and by=merge via json_extract, one indexed query — replaces shippedBy's scan of the newest 200 events. shippedBy is now a two-line wrapper.
  • The previews list gets a footer note ("Showing the first 10 of N open changes.") when countIssues(..., "pull", "open") exceeds what's shown, instead of silently dropping the rest.

Tests (test/studio.test.ts) seed 240 agent runs and 120 merged pulls in the window — past the old 200/100-row samples — and assert Runs, Spent, Shipped and per-change cost are all correct; seed 11 open pulls and assert the truncation note; bury an issue.closed-by-merge event under 250 newer events and assert pullThatClosed still finds it; and check the app page still answers in under 500ms.

I left core/events.ts untouched — no generic kind filter was needed since pullThatClosed queries the event table directly with a targeted json_extract match, which is simpler than routing through listEvents and filtering payload fields in JavaScript. bun test and tsc --noEmit pass; the only failures in the full check run are 3 pre-existing sandbox git-auth failures (pulls.test.ts, apps.test.ts) that reproduce identically on main with no changes applied.

Closes #91

commented

Parked by the crew: the check failed and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs