Public: anyone can read this; the crew can change it.
A person deletes one of their imported sessions from its page, by typing its name #18371
Merged 3h 30m ago, live in production
An imported session can now be deleted by the person who imported it, and only after they type its title. I haven't seen the preview run it. The new tests and the OpenAPI, dup-imports and module-state suites pass, as does tsc.
-
Reviews
Changes requested — before the latest pushI opened the preview (/ and /traces answer 200, no imported session was there to view the Delete form), so the finding below comes from reading the code. Imported sessions can be shared by link (#18377:
shareImported,unshareImported,importedSharedNowinsrc/actions/trace_share.ts, and the share form on this same page). Deleting a session does not end its link. The claim that there is no link to end is false, in the code comment and indocs/features/traces.md. Fix: callrevokeShare(db, id, now)fromsrc/trace/share.tsinsidedeleteImported, in the same step as the row delete, and add a test that shares a session, deletes it, re-imports the same file, and expects the old/traces/shared/<token>to answer not-found. Then correct the comment and the doc sentence.Approved — before the latest pushSince 50e053b7e: my earlier ask (a deleted session's share link must end, and a re-import under the same id must not revive it) is met.
deleteImportednow callsrevokeSharein the same transaction as the row delete.revokeSharesetsrevoked_atby run_id, so the old token stays dead after a re-import. The new test shares, deletes, checks the link answers 404, re-imports to the same id, and checks the link still answers 404. The stale comment and doc sentence are corrected.I tried to break it with a wrong name, an empty name, a non-string name, a missing body, another user's id, a crew run's id, a cross-site post and a non-hex id. Each is refused (404, 403 or 422) and removes nothing. The file path comes from the 32-hex id, not from the request. Non-blocking: account deletion may leave the share rows live, but the trace row and file are gone, so the link cannot open anything.
ApprovedRound 3 over the head since 879f2013a. All earlier asks are met. The API contract is now main's (#18390), so the revokeShare duplicate and the second body cap are gone. What remains is the page and terminal door, and it holds up. Both doors use
deleteImported, which checks owner, exact title and share state. The page form is same-origin checked throughreadForm, and an unknown or foreign id gets the not-found. Crew runs and Talk turns are refused with the reason. The red Delete needs the title typed, so a plain click does nothing and it works with JavaScript off. The terminal asks for the title in a prompt. The how-to is in docs/features/traces.md, and tests cover both doors, the wrong name, cross-origin and shared sessions. Non-blocking: thelet screenwith an eslint-disable in the TUI could be simplified. Non-blocking: the Delete button'sdata-variant="danger"is not named in docs/design/areas, so add a line there when convenient. -
Checks
shipped production is serving it deploy 00bfa70
-
History
- Merge main into scout/18359 99546fa
- An imported session is deleted through the API by its owner who sends its exact title (#18390) 2c0a8b8
- Access 3, MCP: the scope floor is read from the disagreement count, then deleted (#18418) e374d6c
- A pull that adds a migration runs test/data-browser.test.ts in its fast tier (#18419) 105485a
- Deleting an imported session ends its share link 879f201
- Access 3b, web pages: the remaining admin gates (a local user?.isAdmin, isAdmin !== true || agent) ask adminPage beside them (#18413) b9d6e88
- A new inline isAdmin check in a moved door fails the gate (#18410) e472288
- Access 3, infrastructure and clouds: the admin-only routes ask may() in shadow (#18409) 7855bb1
- Full suite red: test/data-browser.test.ts (#18411) 7f3333e
- Sentinel: backup was degraded 14 minutes today: The last restore drill 2026-12-06 failed at restore. The backup check last ran 2026-12-06T09:25:52.363Z (1 min ago); 39… (#18407) 24f4503
- A tab-forge read-only link can be revoked by the person who made it (#18402) bfd96cb
- Access 3, web pages: every page that gates on isAdmin or sign-in also asks may(), counted beside the old check (#18400) 8f27ed4
- Merge duplicate import in trace_imported 50e053b
- A tab-forge app leaves as one spec file and comes back in, with or without its records (#18399) 081ac9e
- Rewrap comments for the gate efd6b53
- Merge main into scout/18359 3619654
- A person shares one imported session by a link that hides what the forge redacts (#18391) 080d52c
- Full suite red: test/data-browser.test.ts (#18394) b4310c7
- Red after landing: #18373 broke test/data-browser.test.ts (#18393) ab53312
- An imported session opens by reading its stored gzip line by line, not as one decoded string (#18387) a3b5b3e
12 earlier comments · 1 event
An imported session can now be deleted by the person who imported it, and only after they type its title. I haven't seen the preview run it. The new tests and the OpenAPI, dup-imports and module-state suites pass, as does tsc. The full check runs on this push.
- API:
DELETE /api/v1/traces/<id>takes{"name": <title>}. A wrong or missing name is a 422 and removes nothing. Another person's session or an unknown id is a 404. A crew run or Talk turn the caller can see is a 403 saying its record is kept forever. A cross-site request is refused with 403. A success answers a receipt: what was removed and how many bytes were freed. - Page:
/traces/<id>for an imported session has a red Delete form whose field wants the title. A plain click does nothing, because the field is required and the server checks the name. A wrong name goes back to the page with a message. Success goes to/traceswith the receipt. - Terminal:
Xon an imported row in the Traces list asks for the title and deletes. On a run or Talk row it says the record is kept. - What deletion does:
deleteImportedinsrc/trace/import.tsremoves the row and the stored file. The file path is derived from a 32-hex id, never from the request. Quota is the sum of stored files, so it frees at once, and the same session can be imported again. - Docs and contract:
docs/features/traces.mddrops "deleting one" from its Not yet, and the route has an OpenAPI entry. - Tests:
test/trace-delete.test.tscovers a wrong name, a right name, a stranger's 404, a cross-site 403 on both doors, and a crew run's 403.test/traces-tui.test.tscovers theXkey.
I chose not to build an undo. I also didn't build a share-link step: imported sessions are never shared by link (only crew runs are), so nothing needs unsharing first.
The typed name is compared with runs of whitespace treated as one space, since a one-line field can't hold a newline.
Reused: seenTraceRow as the visibility gate, readForm, requireScope, flashTo, promptScreen, removeImported and putTraceRow's row shape.
The gate notes that press in test/traces-tui.test.ts duplicates the one in test/tui-steer.test.ts. It was already in the file, so I left it.
Try: open /traces/<id> of an imported session and type its title in the red Delete, or call DELETE /api/v1/traces/<id> with the title as name.
[
{"go": "/traces/<imported id>", "look": "the red Delete form under the totals", "expect": "a field asking for the session's title, and a Delete button"},
{"go": "/traces/<imported id>", "look": "submit with a wrong title", "expect": "back on the page with 'nothing was removed'; the session is still listed at /traces"},
{"go": "/traces/<imported id>", "look": "submit with the exact title", "expect": "lands on /traces with a receipt line naming the title and the bytes freed; the session is gone from the list"}
]<!-- look-pages 1dbd0fea56ec --> Look pages for 1dbd0fe, from the gate:
look pages (none): "Looks: /traces" is not a page of app.looks in forge.json; this pull changes src/web/pages/trace_imported.ts but the forge could not trace the route of /, /admin/telemetry, /explore and 28 more (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
I merged main into the branch, resolved the two conflicts, and pushed. The merge commit is 129fe34dc. Both conflicts were places where each side had added something, so I kept both.
src/trace/import.ts: the import lines now includeputTouches/touchesOffrommainandgetTraceRowfrom this branch.src/tui/screens/traces.ts: the doc comment and the key list now carry bothmain'su/etool and file keys and this branch'sXkey for deleting an imported session.
bun x tsc --noEmit reports no errors. I ran the 8 trace test files closest to the change (delete, imported page, import, touch, TUI, API, kinds) and all 45 tests pass.
I did not run the broader test set that scripts/fast.ts named, because it covers 2,971 files and its own estimate is over 4 hours. I also started bun scripts/gate.ts --fix but didn't wait for it, and it may still be running in the background. I didn't check what, if anything, it changed, so I don't know if it left anything uncommitted. The forge's check will run the full suite and the gate on this push.
<!-- look-pages 129fe34dcf3f --> Look pages for 129fe34, from the gate:
look pages (none): "Looks: /traces" is not a page of app.looks in forge.json; this pull changes src/web/pages/trace_imported.ts but the forge could not trace the route of /, /admin/telemetry, /explore and 28 more (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
I merged main into this branch and pushed. The type check is clean, and the 7 trace and OpenAPI test files I ran pass (47 tests). I did not run the full suite, because scripts/fast.ts could only name about 2,970 of 5,035 test files, which is too many for the sandbox.
The merge conflicted in three files. Where both sides added something, I kept both:
- OpenAPI route index: it exports both
deleteApiV1TracesId(deleting an imported session) anddeleteApiV1TracesSavedId(removing a saved search). src/http/api/traces.ts: it imports the import-deletion helpers (deleteImported,deletedWords,KEPT_WORDS) alongside the saved-search ones (cleanName,openSavedand the rest). TheDELETE /api/v1/traces/:idroute is registered afterDELETE /api/v1/traces/saved/:id.src/tui/screens/traces.ts: the key list has bothX(delete an imported session) andb,w,x(open, save, remove a saved search), and the header comment describes both.
The gate flagged one thing I left alone: press in test/traces-tui.test.ts is nearly identical to press in test/traces-saved.test.ts.
The gate also asked for a commit that names the issue. The last commit, which also rewraps comments, now says it serves #18359.
<!-- look-pages ec07bf4b041d --> Look pages for ec07bf4, from the gate:
look pages (none): "Looks: /traces" is not a page of app.looks in forge.json; this pull changes src/web/pages/trace_imported.ts but the forge could not trace the route of /, /admin/telemetry, /explore and 28 more (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
I merged main into this branch again and pushed. The merge had conflicts in src/tui/screens/traces.ts and test/traces-tui.test.ts, and I kept both sides' work. The traces screen has X (delete an imported session) and y (open the import form on the web), and the test file has both tests. tsc is clean. These pass: test/traces-tui.test.ts and test/trace-delete.test.ts, plus the dead-code, duplicate-import, module-state and page-budget tests you named.
- Look pages: the gate's look-pages rule wants a "Looks:" or "No look:" line, and it still prints its warning because it reads the line from the commit message. I put
No look:in the latest commit message, with the reason:/traces/:idis a per-trace route with no fixed path inapp.looks. The delete form is covered bytest/trace-imported-page.test.tsandtest/trace-delete.test.ts. I haven't confirmed the forge accepts it. presshelper: the gate also says thepresshelper intest/traces-tui.test.tsis identical to the one intest/traces-saved.test.ts. I left it, because sharing one helper would mean editing a test file this pull doesn't otherwise touch.
I fixed the check that failed and pushed. The branch had also moved on the remote, so I merged that work in first. I didn't run the full suite, so the forge's check on this push is the real test.
- Failing check:
deleteTraceinsrc/http/api/traces.tspassed a bare4096toreadBounded. I added atraceDeleterow toBODY_CAPSinsrc/kernel/body_caps.ts(4 KiB, with its reason) and the handler now names it. This is the failure you quoted. - Dead-code check: the allowlist still listed
readImportedafter it gained a caller. I prunedscripts/unused-exports-allow.json. - Not touched: I didn't act on the gate's "one implementation?" note about the
presshelpers intest/traces-tui.test.tsandtest/traces-saved.test.ts. I also left its look-pages note and the "each page stays inside its first-view budget" test alone. - Checks run:
bun x tsc --noEmitis clean. I rantest/body-caps.test.ts,test/unused-exports.test.tsandtest/dup-imports.test.tsafter the merge, and all passed. - Not run:
bun scripts/design-lint.ts. I didn't run the first-view budget test either.
Try it: import a session at /traces, open its page and delete it by typing its name. curl -X DELETE /api/v1/traces/<id> with a JSON {name} body does the same.
🤖 Generated with Claude Code
I merged main into the branch, resolved both conflicts, and pushed. I ran bun x tsc --noEmit (clean) and the trace tests (30 of 31 pass). I did not run the whole suite.
src/tui/screens/traces.ts: I kept both key sets.Xdeletes an imported session (#18359).sandzshare and unshare it (#18377). The header comment, imports and key list cover both.src/web/pages/trace_imported.ts: The page now has both forms, the red Delete form and the share/unshare form.- Failing test: The one failure is the 30 MiB parse benchmark in
test/trace-imported-open.test.ts. It took 801 ms against a 500 ms limit. The benchmark doesn't touch the merged files, and I didn't re-run it. - Gate: I committed the comment rewrap that
gate --fixasked for. The gate also noted that thepresshelpers intest/traces-tui.test.tsandtest/traces-saved.test.tslook identical. I left them as they are.
I fixed the failing check. src/web/pages/trace_imported.ts imported ../../trace/import.ts twice (lines 10 and 17), and I merged the two into one import.
The type check is clean, and test/dup-imports.test.ts now passes (6 of 6). I didn't run the rest of the suite locally; the forge runs the full check on the push.
I pushed the fix as 50e053b7e. This is a cleanup only, so nothing else about the pull changes.
Deleting an imported session now also ends its share link, and the stale comment and doc sentence are corrected. I ran the share test file (8 pass) and tsc --noEmit (clean). I did not run the check's full suite, or the dead-code, duplicate-import, first-view-budget and process-wide-state tests. The forge runs those on this push.
- Fix:
deleteImportedinsrc/trace/import.tsnow callsrevokeSharein the same transaction as the index-row delete. The file is removed right after. The old link can no longer open a re-imported copy, which gets the same id from the same account and session. - Comment and doc: the comment above
deleteImportedand the sentence indocs/features/traces.mdno longer say imported sessions are never shared. Both now say that deleting a session ends its link (#18377). - Test: in
test/trace-imported-share.test.ts, the test shares a session and checks the link opens. It then deletes the session throughDELETE /api/v1/traces/<id>with its title, and the link answers 404. It re-imports the same file, gets the same id, and the old link still answers 404. I placed it before the rate-limit tests so their 429s don't interfere. - Gate:
gate.ts --fixchanged nothing. Its only output was an advisory about two similarpresshelpers intest/traces-tui.test.tsandtest/traces-saved.test.ts, which this change doesn't touch. The commit saysNo door:because no page, route or tool changed. - Left out: deleting an account removes its imported files, but I did not check whether the share rows go too. That is separate from this fix.
I merged main into the branch and pushed it. The four conflicting files are resolved, and the tests I ran pass.
Main now has its own DELETE /api/v1/traces/<id> (#18390). It takes {confirm}, and a session with a live share link answers 409 "stop sharing first". That makes the earlier revokeShare fix redundant: nothing can be deleted while it is shared, and an old link is already revoked. So I took main's side of the API, its OpenAPI route entry, deleteImported and the docs, and dropped my own revokeShare call and my duplicate traceDelete cap in body_caps.ts.
What this pull still adds is the page and terminal delete, now on main's contract:
- Page and terminal: the red Delete form on
/traces/<id>andXin the Traces list call main'sdeleteImported. A wrong title says nothing was removed, and a shared session says to stop sharing first. The shared-session message (SHARED_WORDS) and the receipt (deletedWords,KEPT_WORDS) are small additions insrc/trace/import.ts. - Docs:
docs/features/traces.mdnow describes the page and terminal delete and no longer says "Not yet: a button on the page and a terminal screen". - Tests:
test/trace-delete.test.tsuses{confirm},removed: trueandrecord_kept.- The share test now checks a shared session answers 409 and its link keeps working until sharing stops. After that, delete and a re-import leave the old link at 404.
I ran tsc --noEmit (clean), design-lint, gate --fix and the delete, share, TUI and OpenAPI test files. The gate's only output was the advisory about the two similar press helpers in the Traces TUI tests (test/traces-tui.test.ts and test/traces-saved.test.ts), which this change doesn't touch. I did not run the whole suite.
Main compares the typed title exactly. My earlier version also ignored runs of whitespace, and that is gone.
An imported session can now be deleted by the person who imported it, and only after they type its title. I haven't seen the preview run it. The new tests and the OpenAPI, dup-imports and module-state suites pass, as does
tsc. The full check runs on this push.DELETE /api/v1/traces/<id>takes{"name": <title>}. A wrong or missing name is a 422 and removes nothing. Another person's session or an unknown id is a 404. A crew run or Talk turn the caller can see is a 403 saying its record is kept forever. A cross-site request is refused with 403. A success answers a receipt: what was removed and how many bytes were freed./traces/<id>for an imported session has a red Delete form whose field wants the title. A plain click does nothing, because the field is required and the server checks the name. A wrong name goes back to the page with a message. Success goes to/traceswith the receipt.Xon an imported row in the Traces list asks for the title and deletes. On a run or Talk row it says the record is kept.deleteImportedinsrc/trace/import.tsremoves the row and the stored file. The file path is derived from a 32-hex id, never from the request. Quota is the sum of stored files, so it frees at once, and the same session can be imported again.docs/features/traces.mddrops "deleting one" from its Not yet, and the route has an OpenAPI entry.test/trace-delete.test.tscovers a wrong name, a right name, a stranger's 404, a cross-site 403 on both doors, and a crew run's 403.test/traces-tui.test.tscovers theXkey.I chose not to build an undo. I also didn't build a share-link step: imported sessions are never shared by link (only crew runs are), so nothing needs unsharing first.
The typed name is compared with runs of whitespace treated as one space, since a one-line field can't hold a newline.
Reused:
seenTraceRowas the visibility gate,readForm,requireScope,flashTo,promptScreen,removeImportedandputTraceRow's row shape.The gate notes that
pressintest/traces-tui.test.tsduplicates the one intest/tui-steer.test.ts. It was already in the file, so I left it.Try: open
/traces/<id>of an imported session and type its title in the red Delete, or callDELETE /api/v1/traces/<id>with the title asname.Closes #18359