Public: anyone can read this; the crew can change it.

An imported session's page has a red Delete that asks for its title typed #18421

opened this

Closed 3h 6m ago

An imported session's page now has a red Delete this session control for its importer, and the terminal has a D key for the same thing. The new tests, the neighbouring trace tests and the page and terminal budget tests pass, tsc --noEmit is clean, and bun scripts/design-lint.ts is clean.

Notes

opened this

An imported session's page now has a red Delete this session control for its importer, and the terminal has a D key for the same thing. The new tests, the neighbouring trace tests and the page and terminal budget tests pass, tsc --noEmit is clean, and bun scripts/design-lint.ts is clean. I did not run the full suite: bun scripts/fast.ts named 2,951 tests (exit 0, over the 5-minute budget), so I ran the ones that cover this change.

What changed

  • Page control:
    • src/web/pages/trace_delete_form.ts draws a closed <details> on /traces/<id>: no script, nothing shifts when it opens.
    • It says what is lost and that a live share link must be stopped first.
    • It asks for the title typed exactly. The field's pattern is that title, so a browser keeps the button from submitting until it matches.
  • Handler: src/web/pages/trace_delete.ts handles POST /traces/:id/delete. It is same-origin and rw-scoped (readForm), and registered in routes/operations.ts and lazy_lists.ts.
    • A right title redirects to /traces with a receipt line ("Deleted “…”: … bytes freed").
    • A wrong title, or a live share link, redraws the page with 422, the reason beside the field, and the disclosure open.
    • A crew run, a Talk turn, another person's session and an unknown id all get the same not-found.
  • Shared code: src/actions/trace_delete.ts holds deleteImportedSession, which reads the row with seenTraceRow and removes it with the API's deleteImported, so there is no second copy. The page and the terminal both use it.
  • Terminal: D in the trace list opens a prompt for the title, and deletes only on the exact one.
  • Docs: docs/features/traces.md and docs/design/areas/traces.md name the control. test/tui-asks-first.test.ts also lists deleteImportedSession as a destructive action.

Tests are in test/trace-imported-delete.test.ts:

  • The control is present for the owner and absent for a crew run.
  • A wrong title keeps the session and redraws the page with why.
  • A live share link refuses the delete.
  • A cross-site post is 403.
  • The right title removes it and the list drops it.
  • The terminal prompt refuses a wrong title and deletes on the right one.

What I did not do

  • No JavaScript to disable the button. The pattern attribute does that job without script, and the server checks the title again.
  • No new CSS: .trace-delete is only a hook. It reuses the shared danger button and field.
  • Nothing is reused from scripts/similar.ts beyond what is above. The check notes that the test's press helper is identical to one in test/traces-saved.test.ts; I left it.
  • The commits carry a No door: line, because the terminal door and the how-to are edits to existing files rather than new ones. They also carry Looks:, Try: and Replaces: lines.
[
  {"go": "/traces", "look": "Import a session file, then open it from the list", "expect": "Its page shows a red 'Delete this session' button below the totals, closed"},
  {"go": "/traces/<imported id>", "look": "Open 'Delete this session'", "expect": "It says the file is removed for good and a live share link must be stopped first, and asks for the title typed; the page does not jump"},
  {"go": "/traces/<imported id>", "look": "Type a wrong title and submit (a browser holds the button back; with script off the server answers)", "expect": "The page is drawn again with the form open and 'That is not the session's exact title: nothing was deleted.'; the session is still listed", "ask": "Does the wrong-title message read clearly beside the field?"},
  {"go": "/traces/<imported id>", "look": "Type the exact title and submit", "expect": "You land on /traces with a receipt line naming the title and the bytes freed, and the session is gone from the list"},
  {"go": "/traces/<a crew run id>", "look": "Look for any Delete control", "expect": "None"}
]

Closes #18389

5 earlier comments · 1 event
commented

An imported session's page now has a red Delete this session control for its importer, and the terminal has a D key for the same thing. The new tests, the neighbouring trace tests and the page and terminal budget tests pass, tsc --noEmit is clean, and bun scripts/design-lint.ts is clean. I did not run the full suite: bun scripts/fast.ts named 2,951 tests (exit 0, over the 5-minute budget), so I ran the ones that cover this change.

What changed

  • Page control:
    • src/web/pages/trace_delete_form.ts draws a closed <details> on /traces/<id>: no script, nothing shifts when it opens.
    • It says what is lost and that a live share link must be stopped first.
    • It asks for the title typed exactly. The field's pattern is that title, so a browser keeps the button from submitting until it matches.
  • Handler: src/web/pages/trace_delete.ts handles POST /traces/:id/delete. It is same-origin and rw-scoped (readForm), and registered in routes/operations.ts and lazy_lists.ts.
    • A right title redirects to /traces with a receipt line ("Deleted “…”: … bytes freed").
    • A wrong title, or a live share link, redraws the page with 422, the reason beside the field, and the disclosure open.
    • A crew run, a Talk turn, another person's session and an unknown id all get the same not-found.
  • Shared code: src/actions/trace_delete.ts holds deleteImportedSession, which reads the row with seenTraceRow and removes it with the API's deleteImported, so there is no second copy. The page and the terminal both use it.
  • Terminal: D in the trace list opens a prompt for the title, and deletes only on the exact one.
  • Docs: docs/features/traces.md and docs/design/areas/traces.md name the control. test/tui-asks-first.test.ts also lists deleteImportedSession as a destructive action.

Tests are in test/trace-imported-delete.test.ts:

  • The control is present for the owner and absent for a crew run.
  • A wrong title keeps the session and redraws the page with why.
  • A live share link refuses the delete.
  • A cross-site post is 403.
  • The right title removes it and the list drops it.
  • The terminal prompt refuses a wrong title and deletes on the right one.

What I did not do

  • No JavaScript to disable the button. The pattern attribute does that job without script, and the server checks the title again.
  • No new CSS: .trace-delete is only a hook. It reuses the shared danger button and field.
  • Nothing is reused from scripts/similar.ts beyond what is above. The check notes that the test's press helper is identical to one in test/traces-saved.test.ts; I left it.
  • The commits carry a No door: line, because the terminal door and the how-to are edits to existing files rather than new ones. They also carry Looks:, Try: and Replaces: lines.
[
  {"go": "/traces", "look": "Import a session file, then open it from the list", "expect": "Its page shows a red 'Delete this session' button below the totals, closed"},
  {"go": "/traces/<imported id>", "look": "Open 'Delete this session'", "expect": "It says the file is removed for good and a live share link must be stopped first, and asks for the title typed; the page does not jump"},
  {"go": "/traces/<imported id>", "look": "Type a wrong title and submit (a browser holds the button back; with script off the server answers)", "expect": "The page is drawn again with the form open and 'That is not the session's exact title: nothing was deleted.'; the session is still listed", "ask": "Does the wrong-title message read clearly beside the field?"},
  {"go": "/traces/<imported id>", "look": "Type the exact title and submit", "expect": "You land on /traces with a receipt line naming the title and the bytes freed, and the session is gone from the list"},
  {"go": "/traces/<a crew run id>", "look": "Look for any Delete control", "expect": "None"}
]
the crew's run was interrupted: restart, resumes on the next pass — cancelled
commented

<!-- look-pages ac5545bf82f4 --> Look pages for ac5545b, from the gate:

  • look pages (named): this pull changes src/web/pages/trace_delete.ts, src/web/pages/trace_delete_form.ts, src/web/pages/trace_imported.ts; a commit names /explore
commented

Main already did this in #18371 (web page, post route, and terminal door).

DECLINED: already done on main in 3d2fa7b89. That commit adds the red Delete on an imported session's page, which asks for the exact title and posts to traceDelete in src/web/pages/trace_imported.ts. It also adds the terminal's X key, and it sits on top of the API from 2c0a8b821 (#18390). My branch builds the same feature a second way: trace_delete.ts, trace_delete_form.ts and a D key. The merge conflicts in docs/features/traces.md, src/http/routes/operations.ts, src/tui/screens/traces.ts and src/web/pages/trace_imported.ts. The conflict comes from that overlap, not from a small drift. Keeping both would leave two delete routes and two terminal keys, so I aborted the merge and pushed nothing. A person should close the issue and the pull.

commented

Declined: already done on main in 3d2fa7b89. The red Delete on an imported session's page, which asks for the exact title, the POST /traces/<id>/delete route and the terminal X key were all added there (#18371), on top of the API from 2c0a8b821 (#18390). My branch builds the same feature a second way, and it conflicts with main in four files. I didn't resolve those conflicts, because keeping both would leave two delete routes and two terminal keys. I changed nothing for this feedback and pushed nothing. Run log: https://forge.open-platform.sh/trevato/forge/runs/01m95f556k616kvezqstyrwsx6 Left open: someone has spoken on this pull.

commented

Closed by the crew: superseded, its change is already on main in 3d2fa7b8 2c0a8b82.

commented

Left #18389 open: 5 unticked items remain (On /traces/<id> of an imported trace, for its owner only, a red Delete control opens a form asking for the session's title typed exactly; the button stays inert until it matches, and a plain click removes nothing. It is a same-origin POST form that works without script (server checks the title again, using the API's reader and remover from the first issue, not a second copy).; On success the person lands on /traces with a receipt line (what was removed, how many bytes); a wrong name draws the page again with why. Crew runs and Talk turns show no control.; The control says what is lost and that a shared link, if one is live, must be stopped first.; …).

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs