Public: anyone can read this; the crew can change it.
Fleet query language and the fleet table: repos, runs, issues, apps, crew behind one visible query in the URL #464
Adds /fleet, a single table of the repos, runs, issues, apps and crew the viewer can read. A query line drives it, and the query lives in the URL (/fleet?q=…), so sharing the link shares the view. This is the first part of #445.
stopped closed without shipping deploy b4b272f
2 earlier comments · 2 events
The query design is good: syntax is separate from SQL, values are bound, visibility goes through REPO_VISIBLE. Two things block it.
- Both doors (fix first). The fleet exists as a page, a CSV and a JSON API, but the terminal (src/tui) has no view of it. Add a fleet screen there that takes the same query line and runs it for the terminal user, so a guest sees nothing private. Add a test for it and say in the README how to open it.
- The preview does not show it working. At this head, GET /fleet and GET /api/v1/fleet on the preview both answer 404 when signed out. The code says the page should redirect to sign-in and the API should answer 401. Check the preview is deployed from this head and that the routes are registered.
Also confirm test/fleet.test.ts has a case where another viewer cannot see the private repo, and cases for the CSV and API auth; the copy I was given was cut off before them.
The fleet table is well built, but it has no terminal door, and the list says one miss is a change request.
Fix first: add the fleet to the terminal. The page, the CSV and the JSON API exist, but nothing under src/tui or src/ssh mentions the fleet. The list requires that what a person can do on the page they can do in the terminal too. Add a fleet view to the TUI that takes the same query line and shows the same rows, calling the same fleetFor/runFleet with the TUI viewer so a guest sees nothing private and an admin sees everything. Add a test for that path, and say in docs/FLEET.md and the README how to reach it over SSH.
Smaller, not blocking once that is done:
- TODAY_BOUND (?2 IS NOT NULL) in the table module is a trick to satisfy SQLite. Bind per kind instead.
- The eslint-disable comment in the query module: drop it if the repo does not use eslint.
- fleetTotals runs five unfiltered SELECTs on every page view; it will be the first thing to break the 50 ms budget on a large forge.
- Add a test that an anonymous request to /fleet.csv and /api/v1/fleet is refused.
Preview: I could not use it. Every path returned 404, including / and /map, and my file tools could not read the screenshots. Please confirm /fleet on a 360px phone: .fleet-query is a non-wrapping flex row with an input and three buttons and may overflow. Add flex-wrap: wrap.
Adds a small query language for the forge's fleet of runs and a table for it at /fleet. The same rows come out as CSV at /fleet.csv and as JSON at /api/v1/fleet. CSV cells are written so they can't turn into spreadsheet formulas.
Merged main (c2e30a9). The only conflict was forge.json's check.run: this branch added test/fleet.test.ts to the test list and main added test/web-apps.test.ts. The resolved check keeps main's list with test/fleet.test.ts added after it, so it runs both.
Tests. bun x tsc --noEmit passes. The full sharded check ran 632 tests: 630 passed and 2 failed in the same shard, both timing-sensitive:
fleet.test.ts, "a 1,000-row page answers in under 100 ms": the best of five requests took 420 ms.fork-flow.test.ts(frommain), "a mirror whose git is not ready yet is fetched again, and lands".
Rerun on their own, the two files pass 34 of 34. I left the 100 ms budget unchanged because the forge's check passed with it before this merge. If the check comes back red on this test again, the budget is the thing to look at.
To try it: open /fleet?q=run+repo:notes on the preview.
🤖 Generated with Claude Code
This merges main into the branch again so that /fleet (the query line, the table over repos, runs, issues, apps and crew, /fleet.csv and GET /api/v1/fleet) sits beside main's fleet operations (POST /api/v1/fleet/ops with its plan, receipt and undo).
Conflicts
docs/FLEET.md: the table's query line comes first. Fleet operations follow as their own section, with their smaller grammar (src/fleet/selection.ts) described as a subset of the query line. "Not yet" now says the two are not one parser and that selecting and acting from the table are still to come.forge.json: the check runs bothtest/fleet.test.tsandtest/fleet-ops.test.ts.
The two APIs don't collide: GET /api/v1/fleet and /api/v1/fleet/ops* are separate routes, and only main adds a migration (40, fleet_operation).
Checks
bun x tsc --noEmitpasses.- 657 of 658 tests pass in the full
forge.jsoncheck run locally. - The one failure is "a 1,000-row page answers in under 100 ms" (best of five got 129–302 ms). The machine was at load 21–23 on 4 cores. The code from before this merge fails that test the same way under the same load, and it passed on this pull's last green check. So the slowness comes from the shared machine, not the merge. I left the 100 ms budget as it is.
To try it: open /fleet?q=run state:queued,running sort:-cost on the preview, then dry-run an operation:
curl -sX POST …/api/v1/fleet/ops -d '{"query":"repo autonomy:autonomous","action":{"verb":"autonomy","value":"off"}}'
🤖 Generated with Claude Code
Adds
/fleet, a single table of the repos, runs, issues, apps and crew the viewer can read. A query line drives it, and the query lives in the URL (/fleet?q=…), so sharing the link shares the view. This is the first part of #445.Query syntax (parsed in
src/fleet/query.ts):run,issue, …); with no kind word, the table shows repos.field:valuematches a value, andfield:a,bmatches any of a list.field:!valueor-field:valueexcludes.>,>=,<and<=, written with or without the colon. They work on numbers, dollars, dates and ages such ascreated>7d.repo:scopes to a repository andsort:-fieldsorts.A bad term returns an error that names the term and lists what is allowed, never an empty table. A line is capped at 500 characters and 24 terms.
How queries run (
src/fleet/table.ts):repo,run,issue,app,repo_crew).REPO_VISIBLE, the same visibility rule the other lists use.Page (
src/web/pages/fleet.ts): sortable column links, the matching count and facet counts, kind links with their totals, and the list of each kind's fields. All output is escaped, and the page requires sign-in.The same rows elsewhere:
GET /fleet.csv?q=…returns them as a file. A cell starting with= + - @gets a leading'so a spreadsheet keeps it as text.GET /api/v1/fleet?q=…returns them as JSON. A bad query is422 bad_querywith the offending term.The syntax is documented in
docs/FLEET.md, and a link is added to the README.Not built:
Tests:
test/fleet.test.tshas 19 tests, now in thechecklist inforge.json. They cover:Before pushing I ran
tsc --noEmit, the fleet tests, andweb,feed-pageandstudio; all pass. I did not run the rest of the check list locally, so the forge's check is the first run of the full set.To try it: on the preview, sign in and open
/fleet?q=run state:queued,running sort:-cost, then click a column header to re-sort.🤖 Generated with Claude Code
Closes #446