Public: anyone can read this; the crew can change it.
Traces 5a: compare two traces of one issue side by side, with the cost and time difference #18164
Merged 5h 12m ago, live in production
This adds GET /api/v1/traces/compare?a=ID&b=ID, the JSON version of the compare page that already exists on main. Pull #18017 had already shipped src/trace/compare.ts, the compare page at /traces/ /compare/ , the terminal c key, the MCP compare action and the docs section. The API route was the missing piece.
-
Reviews
ApprovedClean. The route checks the read scope, rejects unknown or malformed query parameters with a 422, and reads each run through readTrace, so the run's own gate applies. A run the caller may not read gets the same 404 as an unknown id, and the test shows that. The 422 not_one_issue covers two runs of different issues and the same run named twice. No SQL or shell is built from user text. The OpenAPI route is registered, the route lists are updated, the docs are in docs/features/traces.md rather than the README, and the tests cover the success, 422, 404 and 401 paths. The compare view and compare.ts already exist from #17995, and the terminal and MCP tool already offer the same comparison, so the API is the only new door.
-
Checks
shipped production is serving it deploy a338207
-
History
- openapi-errors: probe traces/compare with and without ids so its 404 and 422 are both answered 1235b16
- Traces 5a: GET /api/v1/traces/compare gives two runs of one issue with the cost and time difference (#18083) dd21c32
- Games survival step 3: quality-of-life mods tried on a copy first (graves, essential-commands, sleep, harvest, vein miner, styled-chat) (#18145) f058287
- Spend 1: a monthly budget per cloud account, one notice at 80% and one at 100% (#18121) 3382c40
- Games: a proxy plugin update can wait until nobody has been on for 30 minutes (#18039) 9a5eb31
- Traces 5: compare two traces, and share one with secrets redacted (#18017) 7a17314
- AWS writes for mail setup are a named allowlist beside the read rule, and nothing else (#18142) 93c7c3d
- Traces 1c: GET /api/v1/traces/:id returns the thread, turns and steps as one tree (#18128) 077bab0
- A box's TPS and tick time show live on its games pane, from spark's health report or `/spark tps` at check-in (#18143) f7e559b
- Access 4c: the grants view as an MCP tool and a terminal screen (#18130) 89afadf
- small: the Absorb findings say they are ready for the owner to send to Ben (#18132) d41ec43
- Games survival step 2a: BlueMap behind login at /games/<box>/<server>/map, no published box port (#18100) 1132c91
- A Mac can take a repository's checks and report them on the pull (#17915) 4c72a1d
- Access 4: one view of every grant, and a page that says who may do what (#18062) 5ba07c8
- Access 2: one `may(principal, action, resource)`, with the repository checks behind it first (#18065) 7d48ce1
- Apps without a login 2: a tiny model in the browser fills the app's spec, and the compiler catches every failure (#18117) 4147a37
- Games: a new pin for the forge's proxy plugin replaces the old jar, in PLUGINS and on disk, and the page says which one loaded (#18111) da9e15f
- Healer: a server still starting, its log moving, is not started again (#18053) d918642
- Game box: refuse a wake or a mod install the box has no memory for (#18057) 7fe508f
- Games survival step 1: a survival performance set (lithium, scalablelux, noisium, chunky) planned as one locked install (#18099) b838dce
GET /api/v1/traces/compare was never wrongly declared. The failing test only called it with no query string, so it only ever saw the 422, never the 404 the route declares. I fixed the test, not the route.
test/openapi-errors.test.ts now has a small PROBE_QUERY table. For this route the test adds a second call with two unknown run ids, which gets the 404. It keeps the call with no ids, which gets the 422.
test/openapi-errors.test.ts passes locally (5 of 5) and tsc --noEmit is clean. I ran scripts/gate.ts --fix but didn't read its output. The pushed commit changes only the test, and the route and its refuses: [401, 404, 422] are unchanged. The forge's full check will run on the push.
To try it, run bun test test/openapi-errors.test.ts.
This adds
GET /api/v1/traces/compare?a=ID&b=ID, the JSON version of the compare page that already exists on main. Pull #18017 had already shippedsrc/trace/compare.ts, the compare page at/traces/<id>/compare/<other>, the terminalckey, the MCPcompareaction and the docs section. The API route was the missing piece.What it does
readTrace, the same gate as the run's log. A run the caller can't read, or an unknown id, is the same 404.not_one_issue. A missing or malformed id, or an unknown parameter, is also a 422.aandb(id, title, outcome), therowsthe page shows,timeDiffMsandcostDiffUsd(both B − A, or null when a side lacks the figure). Cost shows only to those who may see the owner's spend.src/http/api/traces.tsandsrc/http/lazy_lists.ts, with an OpenAPI route insrc/contract/openapi/routes/getApiV1TracesCompare.ts. The existing/api/v1/tracesmark already covers it, sosrc/http/api.tsis untouched.docs/features/traces.mdnames the route.test/traces-api.test.tscompares two runs of one issue and asserts +30 s and +$0.75, and the step row. It also covers a pair from two issues as a 422, the same run twice as a 422, a bad id as a 422, a hidden run as a 404 identical to an unknown id, and no token as a 401.Not done: no new page work, since the compare view and the link from the trace page were already there. "Both doors" is covered by the existing terminal
ckey, stated in the commit asNo door: ….Checks:
bun x tsc --noEmitis clean, and the traces-api, security-floor, route-marks and page-budget tests pass (54). The gate's only remaining note is that my test helperissueInresembles one intest/assigned-etag.test.ts; I left it. I did not run the full suite; the forge's check does.Reused:
compareViews,sameIssueandreadTrace; no new comparison logic.Try it: on the preview, call
GET /api/v1/traces/compare?a=<run id>&b=<run id>with a bearer token, using two runs of one issue.🤖 Generated with Claude Code
Closes #18083