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

A lead who says "not until spring" can be put away until a date: follow-ups stop, and that morning a check-in draft waits on the desk #80

Merged opened this

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

Merged

An agent can now put an open lead away until a date. The full bun test run passes (383 tests) and the design lint is clean. I did not run tsc because the repo has no tsconfig.json, and there is no scripts/gate.ts or scripts/fast.ts here.

Notes

shipped production is serving it deploy aba151a

opened this

An agent can now put an open lead away until a date. The full bun test run passes (383 tests) and the design lint is clean. I did not run tsc because the repo has no tsconfig.json, and there is no scripts/gate.ts or scripts/fast.ts here. I did not start the app or try the new pages, key and routes in a browser or terminal; they are covered by tests only.

What changed

  • Data: the date is a new lead.back_on column, added by a new migration. It is a field, not a status, so the lost and qualified logic is untouched. src/putaway.ts validates the date in the profile's time zone (not today, at most 365 days out) and works out the 8:00 instant.
  • Putting away: putAway skips every unsent follow-up and writes one check-in message, numbered from CHECK_IN_DAY = 300. Putting a lead away again moves that one message.
  • Check-in draft: it comes due at 8:00 on the date in the agent's zone, and advance ignores a showing's hold for it. It goes by the lead's channel, is signed from the profile, and never uses the private note. Nothing is sent without approval.
  • Desk: a put-away lead is in neither "Needs you" nor "In follow-up" and shows only under All, with a Back on <date> badge. Once the check-in is due it is in "Needs you" with a "Check-in ready" status.
  • Bringing back: "Bring back now" and a lead writing back (recordInbound) clear the date and schedule the set-aside follow-ups again from that moment. Follow-ups the agent skipped by hand stay skipped. The same happens when the check-in is sent, and closing the lead just clears the date.
  • Doors:

- Page: a "Come back on…" card on the lead page, with a "Bring back now" button. - JSON: PATCH /leads/{id} with {"back_on": "YYYY-MM-DD"}, where null clears it. A bad date is a 422 whose message starts with back_on:. - MCP: the put_lead_away tool. - Terminal: a puts the lead away and A brings it back. - All of them go through one action that asks permit for a lead update. contract.json and its cells are unchanged.

  • Activity: shows "put <lead> away until May 1, 2026" and "brought <lead> back".
  • Sample data: Hannah Wright is put away for 60 days.
  • Docs and tests:

- The README tour has a paragraph, there is an "How it works" section, and AGENTS.md has a note. - New src/put-away.test.ts covers validation, skipped follow-ups, the draft appearing on the date and not before, wrote-back clearing, the activity wording and the terminal keys. - server.test.ts covers PATCH and the page forms. - I changed two existing tests: the MCP tool list in server.test.ts, and the desk-views partition test in actions.test.ts. That one now allows a lead to be in none of the three views, because a put-away lead is only under All.

Choices to check

  • Refusals: a lead whose first reply hasn't gone out, or one that is qualified or lost, can't be put away.
  • Waiting answer draft: a lead with an answer draft already waiting stays in "Needs you" after being put away.
  • Skip by hand: the check-in can't be skipped like a follow-up, because that would leave the date set with nothing behind it. The error says to bring the lead back instead.
  • Activity wording: the Activity page says "put … away until …" in lowercase, because it reads as part of a sentence.

I did not touch #69's code.

🤖 Generated with Claude Code

Closes #77

1 earlier comment · 1 event
commented

An agent can now put an open lead away until a date. The full bun test run passes (383 tests) and the design lint is clean. I did not run tsc because the repo has no tsconfig.json, and there is no scripts/gate.ts or scripts/fast.ts here. I did not start the app or try the new pages, key and routes in a browser or terminal; they are covered by tests only.

What changed

  • Data: the date is a new lead.back_on column, added by a new migration. It is a field, not a status, so the lost and qualified logic is untouched. src/putaway.ts validates the date in the profile's time zone (not today, at most 365 days out) and works out the 8:00 instant.
  • Putting away: putAway skips every unsent follow-up and writes one check-in message, numbered from CHECK_IN_DAY = 300. Putting a lead away again moves that one message.
  • Check-in draft: it comes due at 8:00 on the date in the agent's zone, and advance ignores a showing's hold for it. It goes by the lead's channel, is signed from the profile, and never uses the private note. Nothing is sent without approval.
  • Desk: a put-away lead is in neither "Needs you" nor "In follow-up" and shows only under All, with a Back on <date> badge. Once the check-in is due it is in "Needs you" with a "Check-in ready" status.
  • Bringing back: "Bring back now" and a lead writing back (recordInbound) clear the date and schedule the set-aside follow-ups again from that moment. Follow-ups the agent skipped by hand stay skipped. The same happens when the check-in is sent, and closing the lead just clears the date.
  • Doors:

- Page: a "Come back on…" card on the lead page, with a "Bring back now" button. - JSON: PATCH /leads/{id} with {"back_on": "YYYY-MM-DD"}, where null clears it. A bad date is a 422 whose message starts with back_on:. - MCP: the put_lead_away tool. - Terminal: a puts the lead away and A brings it back. - All of them go through one action that asks permit for a lead update. contract.json and its cells are unchanged.

  • Activity: shows "put <lead> away until May 1, 2026" and "brought <lead> back".
  • Sample data: Hannah Wright is put away for 60 days.
  • Docs and tests:

- The README tour has a paragraph, there is an "How it works" section, and AGENTS.md has a note. - New src/put-away.test.ts covers validation, skipped follow-ups, the draft appearing on the date and not before, wrote-back clearing, the activity wording and the terminal keys. - server.test.ts covers PATCH and the page forms. - I changed two existing tests: the MCP tool list in server.test.ts, and the desk-views partition test in actions.test.ts. That one now allows a lead to be in none of the three views, because a put-away lead is only under All.

Choices to check

  • Refusals: a lead whose first reply hasn't gone out, or one that is qualified or lost, can't be put away.
  • Waiting answer draft: a lead with an answer draft already waiting stays in "Needs you" after being put away.
  • Skip by hand: the check-in can't be skipped like a follow-up, because that would leave the date set with nothing behind it. The error says to bring the lead back instead.
  • Activity wording: the Activity page says "put … away until …" in lowercase, because it reads as part of a sentence.

I did not touch #69's code.

🤖 Generated with Claude Code

Changes requested — before the latest push

Behaviour looks right and covered, but one required item is missing: the new door has no row in src/contract.test.ts. The permission matrix there (around the book_showing/cancel_showing line, ~146-174) checks each lead-update door per role. setBackOn (PATCH back_on, POST /leads/:id/back-on and /bring-back, MCP put_lead_away, terminal a/A) needs a row there asserting anon is refused (signin_required) and user may, like the showing door. put-away.test.ts only checks anon vs user on the action, not through the contract table. Fix that first. No contract.json cell is loosened, which is good. I could not see the Back on badge on the preview desk as anon with a bearer token only (no signed identity), so that part rests on the unit test.

commented

The missing contract row is added and pushed; the full bun test run passes (383 tests, 0 failures).

What changed since the first push

  • Contract row: src/contract.test.ts now exercises the put-away door in the lead-update row of the permission matrix, next to bookShowing and cancelShowing. It calls setBackOn with a date, setBackOn with null (bring back), and the MCP put_lead_away tool. Each result must equal the outcome of marking the lead lost, so an anon caller is refused and a user may do it.
  • Routes and terminal: PATCH back_on, POST /leads/:id/back-on, POST /leads/:id/bring-back and the terminal a/A keys all call that same setBackOn action. They are covered by the setBackOn call itself, not by a separate row each.
  • Policy: no contract.json cell is loosened. Putting a lead away is the existing lead update cell, as in the first pull.

Not checked

  • Preview badge: I did not see the Back on badge on the preview desk. It is covered by the desk-page test in src/put-away.test.ts.

🤖 Generated with Claude Code

Approved

Earlier ask (a contract row for the new door) is met: src/contract.test.ts now runs setBackOn (date and null) and the MCP put_lead_away through the lead-update row. No cell in contract.json is loosened. Everything goes through one action that asks permit, the date is validated at the boundary in the agent zone, and the tests cover validation, skipped follow-ups, the draft appearing at 8:00 and not before, wrote-back clearing, activity wording and the terminal keys. Caveat: the clone has no 492329ec4db5, so I read the whole diff, not only the delta. The preview shows a guest desk with no leads, so I could not see the badge there; the desk-page test covers it. Non-blocking: the MCP tool maps a missing back_on to an empty string, which gives a 422 naming back_on; that is fine.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs