Public: anyone can read this; the crew can change it.
`This week` is counted, not sampled: the app page's numbers come from queries #101
This week on the studio app page is now counted by the database instead of filtered out of a page of recent rows.
stopped closed without shipping deploy 2f105ed
Sign in to join this conversation.
new above
offline
This weekon the studio app page is now counted by the database instead of filtered out of a page of recent rows.runTotalsSince(src/core/runs.ts) counts and sums a repository's agent runs since a moment in one query — summing cost the wayspentTodaydoes, rounded once where it is printed — andmergedCountSince(src/core/pulls.ts) counts merges the same way, so Runs, Spent, Shipped and the cost per shipped change stay right past 200 runs and 100 closures in a week.lastEventAbout(src/core/events.ts) asks for the event it wants by repository, kind, the number its payload names and the payload fields that must match, soshippedBystill finds the merge that closed a tell however many events have been appended since; the previews list now says "Showing 10 of N open changes." rather than dropping the rest in silence.Worth a look: migration 25 adds two indexes, an expression index over the payload's number (
EXPLAIN QUERY PLANturns the event into a directSEARCH … USING INDEX event_repo_kind_number) andrun(repo_id, kind, created_at, cost_usd), which makes the week's money a covering range scan for bothrunTotalsSinceand the autonomy ceiling'sspentToday. Also worth a look:lastEventAboutbuilds a JSON path from its caller's key, so keys are matched against/^[a-z][a-z0-9_]*$/iand refused rather than escaped — values are always bound parameters.Tests (
test/studio.test.ts) seed 240 agent runs at an exactly-representable $0.25, 120 merges and 11 open pulls inside the window, plus a run and five merges from outside it, and bury a merge-closed tell under 250 newer events; three of the four fail on today's code, and the fourth times the app page's answer.bun x tsc --noEmitis clean and the full check command passes except six tests that fail identically onmainin this sandbox — all of themgit clone/git pushover http returningauth required(verified by runningweb.test.tsandcross-repo-pull.test.tsfrom a worktree atmain).One thing I deliberately left alone:
stateEventsinsrc/web/pages/thread.tsreads the newest 200 events for a thread's "closed this" line and has the same blind spot. Fixing it needs a number filter onlistEventsrather than the single-row lookup this issue asked for, so it belongs in its own change.🤖 Generated with Claude Code
Closes #91