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 #18423

opened this

Merged 1h 8m ago, live in production

An imported session's page now has a red Delete that opens from a closed details, tells the owner what is lost, and stays inert until the title matches. The delete route and form were already on main (#18371). This pull reshapes the form and adds the missing pieces.

Notes

opened this

An imported session's page now has a red Delete that opens from a closed details, tells the owner what is lost, and stays inert until the title matches. The delete route and form were already on main (#18371). This pull reshapes the form and adds the missing pieces.

I ran the delete tests, tsc, the design lint, the gate and the dup-imports and page-budget tests, all green. The full fast-tier test run timed out in my sandbox, so I didn't see it finish. I never started the app, so none of this has been tried in a browser.

What changed (src/web/pages/trace_imported.ts, test/trace-delete.test.ts, docs/features/traces.md, docs/design/areas/traces.md):

  • Control: it is a details closed on first paint, so nothing shifts and no script is needed. It shows only for the importer of an imported trace.
  • Warning: the text says the file and its rows go for good and can only be re-imported from the original. It also says a live share link must be stopped first, and says so explicitly when one is live.
  • Inert button: the input carries a pattern made from the escaped title. A small :has(:not(:valid)) CSS rule also dims the button until it matches.
  • Server side: it still checks the title again with the API's remover, deleteImported. A wrong title redirects back with the reason, and a right one lands on /traces with the "Removed … (N bytes freed)" receipt.
  • Test: a new test covers a title full of regex characters, the warning text, no control on a crew run's page, and the right name removing it. The earlier tests already cover a wrong title, a cross-site post (403) and the list dropping the session.

Left out:

  • No undo.
  • No terminal change, because the Traces list's X already deletes (#18371). The commit says No door: for that.
  • No Looks: page, because the page needs a login and an import. The commit says No look: for that.

Reused: deleteImported, deletedWords, SHARED_WORDS, readForm and flashTo. I added no new function except the small titlePattern.

To try it: on the preview, import a session, open /traces/<id>, and open "Delete this session". Type a wrong title and the button is dimmed and does nothing. Type the exact title and it removes the session and lands on /traces with the receipt.

[
 {"go":"/traces/<id> of an imported session you imported","look":"A small red 'Delete this session' summary under the facts; the page does not jump when it opens","expect":"Opening it shows what is lost, the shared-link note, the title in bold and a dimmed Delete"},
 {"go":"type a wrong title, then press Delete","look":"The button","expect":"It does nothing; nothing is removed"},
 {"go":"type the exact title and press Delete","look":"/traces","expect":"A receipt line naming the session and its bytes; the list no longer shows it"},
 {"go":"/traces/<id> of a crew run","look":"Under the facts","expect":"No Delete control"}
]

Closes #18389

commented

An imported session's page now has a red Delete that opens from a closed details, tells the owner what is lost, and stays inert until the title matches. The delete route and form were already on main (#18371). This pull reshapes the form and adds the missing pieces.

I ran the delete tests, tsc, the design lint, the gate and the dup-imports and page-budget tests, all green. The full fast-tier test run timed out in my sandbox, so I didn't see it finish. I never started the app, so none of this has been tried in a browser.

What changed (src/web/pages/trace_imported.ts, test/trace-delete.test.ts, docs/features/traces.md, docs/design/areas/traces.md):

  • Control: it is a details closed on first paint, so nothing shifts and no script is needed. It shows only for the importer of an imported trace.
  • Warning: the text says the file and its rows go for good and can only be re-imported from the original. It also says a live share link must be stopped first, and says so explicitly when one is live.
  • Inert button: the input carries a pattern made from the escaped title. A small :has(:not(:valid)) CSS rule also dims the button until it matches.
  • Server side: it still checks the title again with the API's remover, deleteImported. A wrong title redirects back with the reason, and a right one lands on /traces with the "Removed … (N bytes freed)" receipt.
  • Test: a new test covers a title full of regex characters, the warning text, no control on a crew run's page, and the right name removing it. The earlier tests already cover a wrong title, a cross-site post (403) and the list dropping the session.

Left out:

  • No undo.
  • No terminal change, because the Traces list's X already deletes (#18371). The commit says No door: for that.
  • No Looks: page, because the page needs a login and an import. The commit says No look: for that.

Reused: deleteImported, deletedWords, SHARED_WORDS, readForm and flashTo. I added no new function except the small titlePattern.

To try it: on the preview, import a session, open /traces/<id>, and open "Delete this session". Type a wrong title and the button is dimmed and does nothing. Type the exact title and it removes the session and lands on /traces with the receipt.

[
 {"go":"/traces/<id> of an imported session you imported","look":"A small red 'Delete this session' summary under the facts; the page does not jump when it opens","expect":"Opening it shows what is lost, the shared-link note, the title in bold and a dimmed Delete"},
 {"go":"type a wrong title, then press Delete","look":"The button","expect":"It does nothing; nothing is removed"},
 {"go":"type the exact title and press Delete","look":"/traces","expect":"A receipt line naming the session and its bytes; the list no longer shows it"},
 {"go":"/traces/<id> of a crew run","look":"Under the facts","expect":"No Delete control"}
]
commented

I took all four review points, with two departures from what juniper asked (points 2 and 4). I pushed to the same branch. tsc, the design lint, the gate, and the page-budget, dup-imports and delete tests all pass. I didn't re-run the whole fast tier, and I haven't tried the page on a preview.

  1. Warning text: it is now two short sentences. The first says the file and steps are removed for good and only re-importing the original brings them back. The second says a live share link must be stopped first. There is one share sentence, not one per case.
  2. CSS, differently from asked: I deleted DELETE_CSS entirely instead of switching it to tokens. The design system has no space tokens, so there was nothing to swap in. The form now uses the shared .stack class. I also dropped the dimmed look. The only existing disabled look, .btn[aria-disabled], needs a script to set it. A CSS-only copy would repeat the literal opacity you flagged and put pointer-events: none on the button, which you asked to keep reachable by keyboard. The input's pattern is what stops the submit, and the browser says why through its title. This also drops the "stays dimmed" part of the issue's wording.
  3. Test: a new test posts to this page's own form (/traces/<id>/delete). A wrong name returns a 303 back to the page, the session stays, and the page shows "That is not the session's title: nothing was removed." A cross-origin post is a 403 and the session stays.
  4. Docs, differently from asked: docs/features/traces.md now says the browser won't submit until the pattern matches the title, that this holds without CSS or script, and that the server checks again. I removed the "inert button" claim from both docs/features/traces.md and docs/design/areas/traces.md instead of qualifying it. The design doc now says the form adds no new class.

I made no terminal change. The Traces list's X already deletes (#18371), and the commit carries No door: for it.

[
 {"go":"/traces/<id> of an imported session you imported","look":"A closed 'Delete this session' summary; the page does not jump","expect":"Opening it shows two short sentences, the title in bold and a Delete button"},
 {"go":"type a wrong title, press Delete","look":"The input","expect":"The browser refuses to submit and says the title must match exactly"},
 {"go":"type the exact title, press Delete","look":"/traces","expect":"A receipt naming the session and its bytes; the list no longer shows it"}
]
Sign in to join this conversation.

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

Keyboard shortcuts

Docs