Public: anyone can read this; the crew can change it.
Fleet graph: the selection's spend and runs over time beside the table #456
This adds a fleet graph: one chart per window showing a set of repositories' spend and runs, for the last 24 hours by UTC hour and the last 14 days by UTC day. Bars are stacked per repository, and the same numbers sit in a table beside the chart. The SVG is drawn on the server (no chart library).
stopped closed without shipping deploy 057ae23
4 earlier comments
The fleet graph shows a selection's spend and runs by UTC hour or day, next to the selection's table. It reads one aggregate from the ledger: usageBuckets in src/core/usage.ts groups runs by the hour or day prefix of their ISO end time. reposWithUsage lists the repositories with ledger lines since a given time. The graph is drawn server-side by actions/fleet-graph.ts and covered by test/fleet-graph.test.ts.
Main is now merged in. It had two conflicts:
forge.json: uses main's shortened check command, withfleet-graphadded afterusageso the graph's tests still run in the check.src/core/usage.ts: keeps this branch'susageBucketsandreposWithUsageand main's newtopUsageside by side; neither changes the others.
The full check (type check plus the three test shards) ran once with one failure: a test in apps-adversarial ("private grant: forged, tampered, expired, wrong-env, and open-redirect are all refused") went over its 60-second limit. This change doesn't touch that file. It passed on a rerun of that file alone (68/68), and fleet-graph and usage pass (23/23), but the whole check hasn't been rerun clean. If the slowness under the full parallel run happens again, the forge's check on this push will fail the same way.
To try it, open a fleet selection on the preview and switch the graph between hours and days.
🤖 Generated with Claude Code
The fleet graph shows a selection's spend and runs by UTC hour or day, next to the selection's table. It reads one aggregate from the ledger: usageBuckets in src/core/usage.ts groups runs by the hour or day prefix of their ISO end time. reposWithUsage lists the repositories with ledger lines since a given time. The graph is drawn server-side by actions/fleet-graph.ts and covered by test/fleet-graph.test.ts.
Main is merged in again. The only conflict was the check command in forge.json. It now uses main's list, which adds crew-parks, and keeps fleet-graph after usage so the graph's tests still run in the check. The earlier merge kept main's topUsage next to usageBuckets and reposWithUsage in src/core/usage.ts; that is unchanged.
The full check from forge.json passes locally after the merge: the type check plus all three test shards, 700 tests across 48 files, none failing.
To try it, open a fleet selection on the preview and switch the graph between hours and days.
🤖 Generated with Claude Code
The fleet graph shows a selection's spend and runs by UTC hour or day, next to the selection's table. It reads one aggregate from the ledger: usageBuckets in src/core/usage.ts groups runs by the hour or day prefix of their ISO end time. reposWithUsage lists the repositories with ledger lines since a given time. The graph is drawn server-side by actions/fleet-graph.ts and covered by test/fleet-graph.test.ts.
Main is merged in again. The only conflict was the check command in forge.json. It now uses main's list, which adds told-by, and keeps fleet-graph after usage so the graph's tests still run in the check. The earlier merges are unchanged: main's topUsage sits next to usageBuckets and reposWithUsage in src/core/usage.ts, and the check also runs crew-parks.
The full check from forge.json passes locally after the merge: the type check plus all three test shards, 705 tests across 49 files, none failing.
To try it, open a fleet selection on the preview and switch the graph between hours and days.
🤖 Generated with Claude Code
This adds a fleet graph: one chart per window showing a set of repositories' spend and runs, for the last 24 hours by UTC hour and the last 14 days by UTC day. Bars are stacked per repository, and the same numbers sit in a table beside the chart. The SVG is drawn on the server (no chart library). It reads from the usage ledger, so a run counts in the hour or day it ended, at the provider's reported cost in US dollars. The full
forge.jsoncheck passed (610 tests), and the newtest/fleet-graph.test.tsis now part of that check.What to look at
src/core/usage.ts:usageBucketsadds up the ledger per repository per hour or day in one grouped query. It groups by the first characters of the timestamp, so a run near midnight can't land on the wrong side because of rounding.src/actions/fleet-graph.ts: the shared data behind the page, the CSV and the API.?repo=owner/name, repeated) is checked at the boundary. A malformed name, or more than 100 names, gets a 422.?repo=, it shows every repository the viewer can write that spent anything in the last 14 days.fleetGraphForlets the fleet table (#446) pass in a selection it has already resolved and checked.src/web/fleet-graph.ts: the SVG, the table, the stated assumptions, and a small redraw script. The scale is written down in the file. The redraw fetches/fleet/graph/liveevery 30 s while the tab is visible, and at once on aforge:fleet-opDOM event, so an operation's effect shows within a minute.src/web/pages/fleet-graph.tsand routes:GET /fleet/graph(the page, with the selection in its URL),/fleet/graph/live,/fleet/graph.csv, andGET /api/v1/fleet/graph(JSON).docs/APPS.mddescribes it.The tests check bucket boundaries and bar heights against hand calculations, that one owner can't see another's spend, and that a bad repository name echoed back in the error is escaped. One fixture changed while writing them: the first account is the site admin and can write everything, so the test makes a separate admin first. One assertion was too strict: the response repeats the caller's own
askednames, so the test now checks only what is drawn.Left out on purpose
repo autonomy:… spent>50query language belongs to #446 and the operations to #447; both are in progress elsewhere. For now the selection is a list ofowner/name.forge:fleet-op— nothing does yet, so until #447/#448 do, the 30-second poll is what shows the effect. That's within a minute either way.Try it: sign in, open
/fleet/graph(or/fleet/graph?repo=owner/name&repo=owner/other), then use the "Table file" and "JSON" buttons, or print the page.🤖 Generated with Claude Code
Closes #449