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

A test fails when a new danger button posts straight from a page instead of through the confirm page #7984

shipped production is serving it opened this has it
opened this

Intent: every new destructive button asks first, without a person checking by eye; today a btn(..., { variant: "danger" }) inside a plain <form method="post"> slips through review (several do: board delete, team member remove, app Stop).

Done looks like:

  • [ ] A new test/danger-buttons.test.ts reads every .ts under src/web/ and finds each variant: "danger" button whose enclosing template is a <form method="post" (a plain text scan of the template is enough; no parser).
  • [ ] Allowed without a confirm: buttons made by confirmAction, buttons whose href is set (they are links), and pages that are the confirmation (confirmBody in search.ts, and any form carrying a name="confirm" field or a typed-phrase field).
  • [ ] Today's other cases are an explicit list in the test, one file — reason per line (for example the board panel Remove, whose index is in the body). The test fails on a danger POST button not covered above and not on the list, naming file:line and saying "use confirmAction from src/web/ui.ts".
  • [ ] A listed case that no longer exists is printed as a hint and does not fail, so the sibling confirm issues can land in any order without editing this file.
  • [ ] Adding <form method="post" action="/x">${btn("Wipe", { variant: "danger" })}</form> to any page makes the test fail; the test runs in well under a second.

Files: test/danger-buttons.test.ts Risks: a text scan can misread a template; keep the rule narrow (danger variant inside a post form within the same template literal) so it never fails on correct code. Brief: a builder who writes tests.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs