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

Put a lead marked qualified or lost back into follow-ups #23

Merged opened this

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

Merged

A closed lead can now be put back in follow-ups from its page, the API, the MCP and the terminal. I ran the actions, terminal, server, audit, openapi, readme and contract tests: 78 pass and the one failure was a stale contract/openapi.json, which I regenerated and re-checked.

Notes

shipped production is serving it deploy aba151a

opened this

A closed lead can now be put back in follow-ups from its page, the API, the MCP and the terminal. I ran the actions, terminal, server, audit, openapi, readme and contract tests: 78 pass and the one failure was a stale contract/openapi.json, which I regenerated and re-checked. I did not run the full suite or a type check: the repository has no tsconfig.json, so tsc printed help, and scripts/gate.ts, scripts/fast.ts and scripts/design-lint.ts don't exist here. scripts/lint-design.ts ran with no output.

What changed

  • Reopen: reopen in src/leads.ts sets the lead to contacted if a first reply was ever sent, otherwise new.
  • Unsent touches: the skipped touches are drafted again with the current profile and the consent rule, so text vs email is decided afresh. Touches already sent stay as history.
  • Schedule: days 1, 3, 7, 14 and 30 are counted from the moment of reopening, so nothing comes due in a burst. The first reply of a never-answered lead goes back to a draft.
  • setState in src/actions.ts: it accepts "open", and only for a qualified or lost lead; an open lead is refused as invalid. Any other state stays invalid.
  • Permission: it goes through the same update lead check as marking a lead closed, so contract.json is unchanged.
  • Audit: the change is recorded through audited with a new reopened act. The Activity page reads it as "put X back in follow-ups".
  • Page: a closed lead's page shows "Put back in follow-ups" when the person may update it. The POST /leads/:id/state and PATCH /leads/:id route docs list open, and contract/openapi.json is regenerated.
  • MCP and terminal: the mark_lead tool accepts state: "open". In the terminal, o on a closed lead puts it back, and the hint line shows it.
  • README: the follow-up section says how to reopen.

Tests added: reopen reschedules only the unsent touches and none comes due on the next tick, a never-answered lead comes back as new with its draft, and anon is refused. The page and API reopen, an unknown state returns 422, and o works in the terminal.

Not done: no new dependency, and no contract cell was loosened.

Closes #5

commented

A closed lead can now be put back in follow-ups from its page, the API, the MCP and the terminal. I ran the actions, terminal, server, audit, openapi, readme and contract tests: 78 pass and the one failure was a stale contract/openapi.json, which I regenerated and re-checked. I did not run the full suite or a type check: the repository has no tsconfig.json, so tsc printed help, and scripts/gate.ts, scripts/fast.ts and scripts/design-lint.ts don't exist here. scripts/lint-design.ts ran with no output.

What changed

  • Reopen: reopen in src/leads.ts sets the lead to contacted if a first reply was ever sent, otherwise new.
  • Unsent touches: the skipped touches are drafted again with the current profile and the consent rule, so text vs email is decided afresh. Touches already sent stay as history.
  • Schedule: days 1, 3, 7, 14 and 30 are counted from the moment of reopening, so nothing comes due in a burst. The first reply of a never-answered lead goes back to a draft.
  • setState in src/actions.ts: it accepts "open", and only for a qualified or lost lead; an open lead is refused as invalid. Any other state stays invalid.
  • Permission: it goes through the same update lead check as marking a lead closed, so contract.json is unchanged.
  • Audit: the change is recorded through audited with a new reopened act. The Activity page reads it as "put X back in follow-ups".
  • Page: a closed lead's page shows "Put back in follow-ups" when the person may update it. The POST /leads/:id/state and PATCH /leads/:id route docs list open, and contract/openapi.json is regenerated.
  • MCP and terminal: the mark_lead tool accepts state: "open". In the terminal, o on a closed lead puts it back, and the hint line shows it.
  • README: the follow-up section says how to reopen.

Tests added: reopen reschedules only the unsent touches and none comes due on the next tick, a never-answered lead comes back as new with its draft, and anon is refused. The page and API reopen, an unknown state returns 422, and o works in the terminal.

Not done: no new dependency, and no contract cell was loosened.

Approved

Reopen goes through the same permit-checked setState as marking a lead closed, so no contract cell is loosened. It is audited with a new act, reachable from the page, API, MCP and terminal, and documented in the README. Only a closed lead can be reopened. The unsent touches are rescheduled from now, so none comes due in a burst. Tests cover the schedule, the never-answered case, anon refusal, the page and API path, and the terminal key. No security findings. This review was read from the diff; I did not run the tests or open the preview.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs