Public: anyone can read this; the crew can change it.
A person saves a /traces search by name and reopens it from the list and the palette #18381
Merged 4h 5m ago, live in production
Saved /traces searches are in: a person names a search, then reopens it from the list, the palette, the API, MCP or the terminal. The tests I ran pass (traces, MCP size, OpenAPI, page budgets, account purge, schema and the repo-wide rule tests, 995 pass).
-
Reviews
Changes requested — before the latest pushAdversarial read: I tried cross-person ids (404 and keyed by user id, good), a hostile name (escaped in HTML, and
<is escaped in the palette JSON), a 51st save, an empty query, a stale facet, and a guest in the terminal (the screen is only offered to signed-in people). No high finding. Three things to fix in one round:- At 50 saved searches the page hides the Save form (
mine.length < MAX_SAVED), so a person never sees the 'remove one to save another' sentence the issue asks for, and cannot even re-save an existing name to replace its query. Keep the form and let the POST answer withlimit_reached's words (a replace of an existing name is still allowed). - Tests are missing for behaviour this pull adds: the palette rows on
/traces(category 'Saved trace searches', none for another person), the page's dropped-facet sentence (data-dropped), the API cross-origin 403 for a session caller on POST/DELETE, and the MCP 51st refusal. Each should fail without the code. - Names are unique per exact string (
UNIQUE(user_id, name)), but listedCOLLATE NOCASE, so 'Failures' and 'failures' are two rows and the terminal's prefix open picks one silently. Treat names case-insensitively (compare lowercased insaveSearch, orname COLLATE NOCASEin the unique key) so 'the same name again replaces' is true.
Boxes 1-4 and 6 are otherwise met; box 5 is left until the tests above exist.
ApprovedRound 2 asks are met: the Save form stays at 50 and a refusal says why, an existing name replaces its query, and names are one name whatever their case (NOCASE lookup, newer spelling kept). The new tests cover the dropped-facet sentence, palette privacy, cross-origin session POST/DELETE (403) and the MCP 51st refusal. I tried a 51st save, another person's id on the page, API and MCP, a cross-site form, an HTML name, a stale facet, and an empty or cursor-only query. Each is refused or escaped, and every row is keyed by the user id.
- At 50 saved searches the page hides the Save form (
-
Checks
shipped production is serving it deploy 55693b7
-
History
- Saved searches: keep the Save form at the limit, one name whatever its case, and the tests the review asked for 193a5cc
- GET /api/v1/traces/saved notes its session phase like its sibling routes 031bf92
- Index the saved-search API routes in the OpenAPI roster 6ad4743
- Saved searches are reached from the terminal's Traces screen and its how-to 2e1b198
- Saved /traces searches: rewrap comments, stamp the migration at its own time 198a01f
- Saved /traces searches: keep, list, open and remove by name on the page, API, MCP and terminal (#18369) b9a0168
- /traces narrows by the tool a run used and the file it touched, on the page, the API and the terminal (#18373) ee241ef
- An imported session's steps carry their tokens and the page shows them, where the file holds them (#18372) 5739158
- An imported session opens at /traces/<id> as the same tree and time strip a crew run has (#18366) 90fb1bc
- /traces lists Talk and imported traces with a kind facet, and the terminal's kind key is tested (#18365) c5e780a
- Issues: a route to assign an issue to a person or an agent (#18285) 69ce311
- The loopback-only look test stops failing checks: the missing prerequisite is named and provided, or the check skips by name (#18362) be7c1a3
- A Codex rollout file imports as a trace, beside Claude Code sessions (#18360) 8900ff3
- Every bare "No …" empty state is drawn from src/core/empty_words.ts, and the OWN_WORDS count table is deleted (#18355) e036110
- A map file over 600 KB is served in parts instead of failing the whole 3D view (#18350) b6d2692
- The terminal and the Apple app's API offer no captain (#18353) 9a9ebf0
- The lane-stopped card carries a Merge action for each green pull waiting on a person (#18348) 67ae93f
- Talk no longer lists, selects or routes to the captain on the web (#18346) 7406da3
- Publishing an app from the tab forge mints the visitor principal, and only then (#18243) 64017fd
- A server's page shows whether its map answers, with the reason, before anyone opens the 3D view (#18349) bca1c31
2 earlier comments
Saved /traces searches are in: a person names a search, then reopens it from the list, the palette, the API, MCP or the terminal. The tests I ran pass (traces, MCP size, OpenAPI, page budgets, account purge, schema and the repo-wide rule tests, 995 pass). I did not run the whole suite; the forge's check does that on push.
What changed
- Storage: a
trace_savedtable (migration20261206075300, pinned) holds a name and the/tracesquery string for each person. It is capped at 50, and every read and write is keyed by the person's id. Saving a name again replaces its query. It goes with the person on account purge. - Reused code: the logic is in
src/trace/saved.tsand goes through the list's ownreadFilterandfilterQuery, not a second parser. A saved query is read again on every open, and a facet that no longer exists is dropped and named (droppedin the API; the page and terminal say it in words). - Page: with a filter set,
/tracesshows a "Name this search" form. Saved searches are links above the results and rows in the palette on that page. "Remove a saved search" is a disclosure of small buttons, and it says it deletes the saved search only and no trace.POST /traces/savedandPOST /traces/saved/<id>/removeare same-origin, so a cross-site post is a 403. A name is escaped on the page. - API:
GET,POSTandDELETE /api/v1/traces/saved[/<id>], with OpenAPI routes. The 51st search is a 422limit_reachedthat says why. Another person's id is a 404. - MCP:
tracetakesaction: "saved", which lists, keeps withnameandquery, or ends withremove. I maderepooptional on that tool for it.test/mcp-size.test.tspasses without raising any ceiling. - Terminal:
btypes the start of a saved name and Enter opens it.wnames and keeps the filters on screen.xremoves the search last opened. - Docs: a "Saved searches" section in
docs/features/traces.md. - Tests:
test/traces-saved.test.tscovers save, list, open, remove, privacy between two people, the 51st refused, cross-site 403, the dropped-facet re-validation, MCP and the terminal.
What I chose not to do
- No typed-name confirm on remove: it deletes a saved query only, and the control says so.
- No
GET /traces/saved/<id>route: each link carries the re-validated query itself. - Palette: saved searches appear only on
/traces, not on every page's palette, to keep other pages' first paint unchanged.
Try it
- Sign in and open
/traces?outcome=failedon the preview. - Name the search and press Save search.
- Reopen it from the "Saved:" links or Ctrl-K.
- In the terminal, open Traces, press
b, type the first letters of the name and press Enter.
The gate's similar-function notes (removeSaved vs cancelTimer, and the test helpers call and press) are false positives. The commits carry No door: and No look: lines explaining where the terminal side and the look-page decision sit.
The check failed because GET /api/v1/traces/saved answered 200 without recording a session phase. It now records that phase, the same way the other /api/v1/traces handlers do. I added one line to listSaved in src/http/api/traces.ts. I didn't add the route to the timing test's UNTIMED allowlist, because that list is meant to shrink.
test/route-timing-coverage.test.ts and the traces tests pass locally (61 tests), and bun x tsc --noEmit reports no errors. I did not run the gate script or the full suite. The fix is pushed.
The rest of the pull is as before: saved /traces searches can be kept, listed, opened and removed by name on the page, in the API, in MCP and in the terminal.
🤖 Generated with Claude Code
All three review points are fixed and pushed. bun x tsc --noEmit is clean and test/traces-saved.test.ts passes (13 tests). I didn't run the full suite or the four tests you listed (dead code, duplicate import, first-view budget, process-wide state). The forge's check runs those on this push.
- Save form at the limit.
/tracesnow shows the Save form whenever a search is active. At 50 saved searches a new name is refused with thelimit_reachedwords ("remove one to save another"), and an existing name still replaces its query. - Case-insensitive names.
saveSearchnow finds an existing name withCOLLATE NOCASE. Saving "failures" over "Failures" updates the one row and keeps the newer spelling. I left theUNIQUE(user_id, name)key as it was, so the migration is unchanged. The lookup is what makes it one name. - New tests. Each one asserts behaviour the pull added.
- The Save form is still on the page at 50, and an existing name replaces its query.
- "Failures" and "failures" are one row.
- The page's
data-droppedsentence shows for a stale facet. - The palette rows are in category "Saved trace searches" for their owner and absent for another person.
- A browser session's cross-origin POST and DELETE on
/api/v1/traces/savedget 403 and change nothing. - The MCP tool refuses the 51st save with the shared words.
I haven't run them against the old code to check that they fail without the fix.
The gate lists some similarity notes in my files (for example press in the new test file is identical to the one in test/traces-touch-tui.test.ts). They are notes, not failures, and I left them alone.
🤖 Generated with Claude Code
Saved
/tracessearches are in: a person names a search, then reopens it from the list, the palette, the API, MCP or the terminal. The tests I ran pass (traces, MCP size, OpenAPI, page budgets, account purge, schema and the repo-wide rule tests, 995 pass). I did not run the whole suite; the forge's check does that on push.What changed
trace_savedtable (migration20261206075300, pinned) holds a name and the/tracesquery string for each person. It is capped at 50, and every read and write is keyed by the person's id. Saving a name again replaces its query. It goes with the person on account purge.src/trace/saved.tsand goes through the list's ownreadFilterandfilterQuery, not a second parser. A saved query is read again on every open, and a facet that no longer exists is dropped and named (droppedin the API; the page and terminal say it in words)./tracesshows a "Name this search" form. Saved searches are links above the results and rows in the palette on that page. "Remove a saved search" is a disclosure of small buttons, and it says it deletes the saved search only and no trace.POST /traces/savedandPOST /traces/saved/<id>/removeare same-origin, so a cross-site post is a 403. A name is escaped on the page.GET,POSTandDELETE /api/v1/traces/saved[/<id>], with OpenAPI routes. The 51st search is a 422limit_reachedthat says why. Another person's id is a 404.tracetakesaction: "saved", which lists, keeps withnameandquery, or ends withremove. I maderepooptional on that tool for it.test/mcp-size.test.tspasses without raising any ceiling.btypes the start of a saved name and Enter opens it.wnames and keeps the filters on screen.xremoves the search last opened.docs/features/traces.md.test/traces-saved.test.tscovers save, list, open, remove, privacy between two people, the 51st refused, cross-site 403, the dropped-facet re-validation, MCP and the terminal.What I chose not to do
GET /traces/saved/<id>route: each link carries the re-validated query itself./traces, not on every page's palette, to keep other pages' first paint unchanged.Try it
/traces?outcome=failedon the preview.b, type the first letters of the name and press Enter.The gate's similar-function notes (
removeSavedvscancelTimer, and the test helperscallandpress) are false positives. The commits carryNo door:andNo look:lines explaining where the terminal side and the look-page decision sit.Closes #18369