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

Right after approving from the desk, the desk's confirmation offers "Undo send" for the minute it lasts #101

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

After you press "Send the ticked ones" on the Due follow-ups page, the confirmation now names each lead sent to and gives each an Undo send button for the minute it lasts. The earlier decline was right that the desk (/) has no approve control, so no "desk confirmation" exists to extend.

Notes

shipped production is serving it deploy aba151a

opened this

After you press "Send the ticked ones" on the Due follow-ups page, the confirmation now names each lead sent to and gives each an Undo send button for the minute it lasts.

The earlier decline was right that the desk (/) has no approve control, so no "desk confirmation" exists to extend. The only desk-like approval whose confirmation lacked Undo was the Due page. The lead page's own "Sent." already shows Undo, including in the next-lead flow, so I left it alone.

What changed

  • Redirect: POST /leads/send-due now redirects to /due?sent=<lead ids>. The ids are plain numbers; no HTML travels in the redirect or the cookie notice.
  • Rendering: GET /due reads those ids (digits only, capped at the batch limit) and asks undoable and permit(lead, update) about each. The names are escaped. Each button posts to the existing /leads/:id/undo with the same "For a minute after sending." hint. It is server-rendered, so there is no layout shift.
  • Undo landing: The undo route sends you back to /due when the form carries ?from=due; any other undo still lands on the lead. The undone follow-up shows up as due again. No new route and no contract change.
  • Where: src/routes.ts, src/pages/due.ts, a README line, and a new src/due-undo.test.ts.

Tests

  • Passing: src/due-undo.test.ts and the neighbouring suites (due, undo, contract, openapi, design, readme, server, security) pass, and scripts/lint-design.ts is clean.
  • Not run: tsc has no tsconfig.json in this clone, so I did not type-check. scripts/gate.ts, scripts/fast.ts and scripts/design-lint.ts don't exist here either.
  • Expiry and permission: The test covers the button within the minute, none after an undo, none for unknown or junk ids, and escaping of names. I did not test an expired minute directly, because it would need a 60-second wait. Both the expired case and the user-who-may-not-update case rely on undoable and permit, which I reused as-is.

What I chose not to do

  • I did not add an approve control to the desk.
  • I did not add Undo to the "Nothing else needs you" or next-lead links.

To try it: Tick a due follow-up on /due and press "Send the ticked ones". Undo send appears under the heading, and pressing it returns you to /due.

🤖 Generated with Claude Code

Closes #93

2 earlier comments · 2 events
commented

After you press "Send the ticked ones" on the Due follow-ups page, the confirmation now names each lead sent to and gives each an Undo send button for the minute it lasts.

The earlier decline was right that the desk (/) has no approve control, so no "desk confirmation" exists to extend. The only desk-like approval whose confirmation lacked Undo was the Due page. The lead page's own "Sent." already shows Undo, including in the next-lead flow, so I left it alone.

What changed

  • Redirect: POST /leads/send-due now redirects to /due?sent=<lead ids>. The ids are plain numbers; no HTML travels in the redirect or the cookie notice.
  • Rendering: GET /due reads those ids (digits only, capped at the batch limit) and asks undoable and permit(lead, update) about each. The names are escaped. Each button posts to the existing /leads/:id/undo with the same "For a minute after sending." hint. It is server-rendered, so there is no layout shift.
  • Undo landing: The undo route sends you back to /due when the form carries ?from=due; any other undo still lands on the lead. The undone follow-up shows up as due again. No new route and no contract change.
  • Where: src/routes.ts, src/pages/due.ts, a README line, and a new src/due-undo.test.ts.

Tests

  • Passing: src/due-undo.test.ts and the neighbouring suites (due, undo, contract, openapi, design, readme, server, security) pass, and scripts/lint-design.ts is clean.
  • Not run: tsc has no tsconfig.json in this clone, so I did not type-check. scripts/gate.ts, scripts/fast.ts and scripts/design-lint.ts don't exist here either.
  • Expiry and permission: The test covers the button within the minute, none after an undo, none for unknown or junk ids, and escaping of names. I did not test an expired minute directly, because it would need a 60-second wait. Both the expired case and the user-who-may-not-update case rely on undoable and permit, which I reused as-is.

What I chose not to do

  • I did not add an approve control to the desk.
  • I did not add Undo to the "Nothing else needs you" or next-lead links.

To try it: Tick a due follow-up on /due and press "Send the ticked ones". Undo send appears under the heading, and pressing it returns you to /due.

🤖 Generated with Claude Code

Changes requested — before the latest push

Security reads clean: ids are digit-only and capped, each re-asked of undoable and permit, names escaped, no route or contract change. Changes needed, in one round:

  1. Box 5 tests are missing. Add a test that the confirmation has no Undo send once the minute has passed (call undoable/the route with a now past 60s, or backdate the send row) and a test that a role permit denies for lead update sees none. The builder said these were skipped; the issue requires them, and a reused helper is not a test.
  2. Merge the new import { findLead } from "./leads.ts" into the existing ./leads.ts import line.
  3. The issue asked for the desk (incl. next-lead flow) confirmation; the pull moved it to /due. If the desk has no approve control, say so on issue #93 so a person can reshape the boxes, rather than ticking them silently. Also wrap the long README line.
  4. Run the design lint that exists in this clone and report it.
commented

All four points are handled on the branch and pushed.

  1. Box 5 tests. src/due-undo.test.ts has a new test.

- It checks that /due?sent=<id> shows Undo send right after a send. - It then backdates the undo_send row by 61 seconds and checks the button is gone. - For the role permit denies, I used anon, the only identity below user. The same page shows it no button. - The anon case passes by showing no button, but I did not check that this is because the page refuses anon.

  1. Import. findLead is folded into the existing ./leads.ts import in src/routes.ts, and the duplicate line is removed.
  2. Issue and README. I commented on #93. It says the desk has no approve control, that the lead page already offers Undo (including the next-lead flow), and that the pull puts the button on /due. The boxes as written are therefore met only for /due, and a person may want to reshape them. The README line is wrapped.
  3. Design lint. This clone has scripts/lint-design.ts and no design-lint.ts. It exits 0 with no findings, and src/design.test.ts and src/readme.test.ts pass.

I ran src/due-undo.test.ts, src/design.test.ts and src/readme.test.ts, and all pass. The suites I ran before the review (due, undo, contract, openapi, server, security) were not re-run after this round, and I did not run tsc or the full suite. There is no tsconfig.json in this clone, and there is no scripts/gate.ts or scripts/fast.ts either.

Approved

All earlier asks are met: the expiry and no-permission cases now have tests (backdated undo_send row, anon), the findLead import is merged, the README line is wrapped, and design lint is clean. The ?from=due flag only chooses between two fixed local paths, so there is no open redirect. The sent ids are digits only, capped, and each is re-checked through undoable and permit. Names are escaped, no route or contract cell changed. Non-blocking: the desk has no approve control, so the confirmation lives on /due; a person may want to reshape box 1 of #93.

commented

Left #93 open: 1 unticked item remain (After approving from the desk (including the "next lead" flow), the desk's confirmation names the lead and carries an "Undo send" button that posts to the existing /leads/:id/undo (same-origin checked, as today), with the same "For a minute after sending." hint as the lead page.).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs