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

When a lead's last follow-up has gone out with no answer, the desk says so and one tap marks them lost (never answered) #88

Merged opened this

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

Merged

A lead whose follow-ups have all gone out with no answer now shows "Follow-ups finished — no answer" on its desk row and its page, with a one-tap "Mark lost — never answered" button. I ran the full suite and 417 tests pass.

Notes

shipped production is serving it deploy aba151a

opened this

A lead whose follow-ups have all gone out with no answer now shows "Follow-ups finished — no answer" on its desk row and its page, with a one-tap "Mark lost — never answered" button. I ran the full suite and 417 tests pass. One fails, live.test.ts ("a write from another process on the same file reaches the bus"), and it fails the same way with my change stashed. bun run lint:design printed no findings. There is no tsconfig.json, scripts/gate.ts or scripts/fast.ts in this repo, so the type check and the gate script were not run.

What changed

  • The flag (src/finished.ts, new): followUpsFinished is a pure function. It flags a lead that is still new or contacted, has had its first reply, and is not put away. The lead must also have no showing and no pasted-in reply or logged call. Every message it has must be sent or skipped, and at least one must be a cadence follow-up. It reads the lead's own messages, not fixed days, so it follows a per-agent cadence. Check-ins, showing notes and answers to replies are not cadence follow-ups, so a lead with one is not flagged.
  • Data (src/leads.ts): LeadDetail.finished and DeskLead.finished carry the flag. The desk works it out for every lead at once in one query.
  • The button: it posts state=lost, reason=never_answered to the existing /leads/:id/state. It is the same action and permit check as marking lost by hand, and it sends nothing to the lead. The desk button is hidden from anyone who cannot update a lead, and the lead page leads its state buttons with the same one. There is no new permission cell.
  • Sample data: Ruth Okafor has had all five follow-ups and never answered. This takes the sample desk from 15 leads to 16, so I changed the counts in actions.test.ts, export.test.ts, search.test.ts and terminal.test.ts.
  • Docs and styling: the README has a "When follow-ups run out" paragraph. There is one new class, .close-out, documented in docs/design/areas/desk.md.
  • Tests (src/finished.test.ts):

- Flagged only once the cadence is exhausted. - A hand-skipped follow-up counts as finished, with a custom cadence. - Not flagged after a reply, a call or a showing. - The desk and page wording, and the button hidden without update rights. - The action records lost / never answered, sends nothing, and appears in Activity. - The sample holds exactly one such lead.

What I chose not to do: a lead that has already had a reply, call or showing is never flagged, even if the cadence later runs out. I read "no reply and no call logged since" as "ever", which is the safer reading of "never flagged". The route still answers with the lead's page rather than the desk, as it does today.

To try it: open the desk and find Ruth Okafor, tap "Mark lost — never answered", then check Activity as an admin.

Closes #69

2 earlier comments · 1 event
commented

A lead whose follow-ups have all gone out with no answer now shows "Follow-ups finished — no answer" on its desk row and its page, with a one-tap "Mark lost — never answered" button. I ran the full suite and 417 tests pass. One fails, live.test.ts ("a write from another process on the same file reaches the bus"), and it fails the same way with my change stashed. bun run lint:design printed no findings. There is no tsconfig.json, scripts/gate.ts or scripts/fast.ts in this repo, so the type check and the gate script were not run.

What changed

  • The flag (src/finished.ts, new): followUpsFinished is a pure function. It flags a lead that is still new or contacted, has had its first reply, and is not put away. The lead must also have no showing and no pasted-in reply or logged call. Every message it has must be sent or skipped, and at least one must be a cadence follow-up. It reads the lead's own messages, not fixed days, so it follows a per-agent cadence. Check-ins, showing notes and answers to replies are not cadence follow-ups, so a lead with one is not flagged.
  • Data (src/leads.ts): LeadDetail.finished and DeskLead.finished carry the flag. The desk works it out for every lead at once in one query.
  • The button: it posts state=lost, reason=never_answered to the existing /leads/:id/state. It is the same action and permit check as marking lost by hand, and it sends nothing to the lead. The desk button is hidden from anyone who cannot update a lead, and the lead page leads its state buttons with the same one. There is no new permission cell.
  • Sample data: Ruth Okafor has had all five follow-ups and never answered. This takes the sample desk from 15 leads to 16, so I changed the counts in actions.test.ts, export.test.ts, search.test.ts and terminal.test.ts.
  • Docs and styling: the README has a "When follow-ups run out" paragraph. There is one new class, .close-out, documented in docs/design/areas/desk.md.
  • Tests (src/finished.test.ts):

- Flagged only once the cadence is exhausted. - A hand-skipped follow-up counts as finished, with a custom cadence. - Not flagged after a reply, a call or a showing. - The desk and page wording, and the button hidden without update rights. - The action records lost / never answered, sends nothing, and appears in Activity. - The sample holds exactly one such lead.

What I chose not to do: a lead that has already had a reply, call or showing is never flagged, even if the cadence later runs out. I read "no reply and no call logged since" as "ever", which is the safer reading of "never flagged". The route still answers with the lead's page rather than the desk, as it does today.

To try it: open the desk and find Ruth Okafor, tap "Mark lost — never answered", then check Activity as an admin.

commented

I merged main into the branch, resolved the conflicts, and pushed. The full suite passes except one test, and bun run lint:design printed no findings. That one test is live.test.ts ("a write from another process on the same file reaches the bus"). It also failed on this branch before I touched it, apparently because of the sandbox.

  • Close-out button: main added a per-row star in src/pages/desk.ts and src/routes.ts. The star and my "Mark lost — never answered" button both need the same permission, lead update. So I dropped my extra mayUpdate flag and the close-out button now uses main's mayStar.
  • Row layout: the form sits inside li.lead-item under the row and spans the full width of that grid. I updated the matching tests (src/finished.test.ts).
  • Design doc: docs/design/areas/desk.md now keeps both sections, the star and the finished-follow-ups one.
Changes requested — before the latest push

The web side looks right: flag logic is pure and follows the lead own cadence, the button posts to the existing /leads/:id/state with never_answered, no permit cell is loosened, output is escaped, sample data and tests cover it.

One miss, which is enough to change: the terminal is not a door for this. src/tty.ts / the terminal desk is untouched, so the terminal desk and lead screen never say "Follow-ups finished — no answer" (they still show the plain done status) and offer no one-key way to mark that lead lost (never answered). The list requires that what a person can do on the page they can do in the terminal too, gated through permit exactly as the page does (hidden/refused for a guest). Fix: show FINISHED_LABEL on the terminal desk row and lead screen when finished is true, add a key on the lead screen that calls setState with state lost and reason never_answered (same permit check, nothing sent, reaching web viewers live like other writes), add terminal tests (label shown; key records lost/never_answered; guest cannot), and mention the key in the README paragraph.

Minor: the new paragraph in docs/design/areas/desk.md has one overlong line; rewrap it.

Boxes 1-6 otherwise met on the web; they stay open until the terminal door lands.

commented

The terminal now handles finished leads too. I ran the full suite and 429 tests pass. The one failure is live.test.ts ("a write from another process on the same file reaches the bus"), which also failed before my first change. bun run lint:design printed no findings.

  • Desk row and lead screen: both show "Follow-ups finished — no answer" when finished is true. On the lead screen this replaces "Every follow-up has gone out."
  • The m key: on the lead screen it calls setState with lost and never_answered, through the same permit check as the page and the existing x key. Nothing is sent to the lead. The hint "m mark lost — never answered" only appears for someone permit would let update the lead. The key does nothing on a lead that isn't finished.
  • Tests (src/terminal.test.ts):

- The label shows on the desk and the lead screen. - m records lost / never answered and the number of sent messages doesn't change. - A guest's m leaves the lead untouched. - A guest's desk doesn't show the label.

  • README and design doc: the README paragraph now mentions the terminal and m, and I rewrapped the overlong paragraph in docs/design/areas/desk.md.

Limit of the guest test: a guest can't open a lead screen in the terminal, so the test checks that m pressed from a guest's desk leaves the lead alone and that the guest sees no label. That the action itself refuses a guest is covered in src/finished.test.ts.

Approved

Approved. The earlier ask, that the terminal be a door like the page, is met: the desk and lead screen show the label, and m goes through setState, so it is the same permit check as the page. Its hint is hidden for anyone permit would refuse. No contract cell is loosened and nothing is sent to the lead. The test for each box is in the diff, and the README and the design doc are updated. The prior head dc73a35d9848 is not in my clone, so I read the whole diff rather than only what changed since. I did not run the suite or the preview.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs