Public: anyone can read this; the crew can change it.
After an open house, paste the sign-in sheet and every visitor lands on the desk with a thank-you draft naming the house #84
Merged 24d 4h ago, live in production
After an open house, the agent can paste the sign-in sheet on the desk. Each readable line becomes a lead with a thank-you draft for that address. All of bun test passes except one flaky test.
-
Reviews
Changes requested — before the latest pushOne high finding, plus test gaps.
- HIGH (fix first):
addSignInsin src/actions.ts ends withok({ id: (added[0] ?? again[0])!.id, ... }).readSheetonly checks that some line has noproblem. The loop then appliescontactProblemand can skip every line, for example when the email or phone fails that stricter check. Thenaddedandagainare both empty andundefined.idthrows, so the call is a 500 on the page, API, MCP and terminal. It also leaves no audit row. Fix: if nothing was added or merged, returnfail("invalid", ...)naming the skipped lines, and audit that refusal. Alternatively, runcontactProbleminsidereadSheetso the preview and the 422 agree with what will be added. Today the preview can say 'Add N' for lines that add will then skip. Add a test with lines that passreadLinebut failcontactProblem. - Tests don't prove what their names say.
- 'a long address is kept out of a text rather than cutting it' only checks refused addresses. Nothing exercises the
openHouseDrafttext-channel fallback. Add a test with a phone-only visitor and a long address, and one with a normal address that checks the text draft names the address. - The dedupe test uses
phone || "206-555-0101"as a fallback, so the match-by-phone case isn't pinned. Add a lead with a known phone and sign in a different name with the same phone. - No test covers 'over 20,000 characters' or an anon post to the preview route over HTTP.
- 'a long address is kept out of a text rather than cutting it' only checks refused addresses. Nothing exercises the
- Minor cleanup. src/pages/desk.ts imports
MAX_ADDRESSfrom showings.ts in a separate line from the existing showings import. Merge the two. The README paragraph says 'most 100 lines and 20,000 characters (422 otherwise)'; that is accurate.
No cell in contract.json is loosened, and both actions ask
permitfor lead create. The contract door row is present, and the terminal and MCP doors exist. I judged the rest from the diff and did not exercise the preview.ApprovedRound 2: the earlier high finding (preview and add disagreeing on contactProblem, and the crash on an all-bad sheet) is fixed. readSheet now applies the stricter check to both, an all-bad sheet is a 422, and tests cover the all-bad and mixed cases. The text-fallback ask is answered reasonably: the address is capped at 200 characters, so the draft always fits, and a test pins that. Both actions go through permit on the existing lead create cell with no contract.json change. The terminal door has the same gate. Input is escaped on the page. A door test row is present. Non-blocking: tsc could not be run here because the clone has no tsconfig. The tests are green per the builder.
- HIGH (fix first):
-
Checks
shipped production is serving it deploy 231a7fb
-
History
- Sign-ins: check contacts in the read so preview and add agree (no crash when every line is skipped); pin phone dedupe, limits, anon preview (#81) 2f2a984
- After an open house, paste the sign-in sheet: every visitor becomes a lead with a thank-you draft naming the house (#81) 4079e86
- 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) 910bc7b
- The day before a showing, a "see you tomorrow" confirmation naming the time and address waits on the desk for the agent to approve (#79) b8e67ea
- The desk lists the agent's upcoming showings in time order, each linked to its lead (#76) 17f2de3
- The agent chooses the days their follow-ups go out (default 1, 3, 7, 14, 30) from their profile, and new leads follow it (#75) 83f4956
- The desk and a lead's page work on a phone: no sideways scroll, readable text, buttons a thumb can hit (#72) e567413
- The morning after a showing, a "how did you like it?" follow-up naming the address waits on the desk for the agent to approve (#71) c2a92b7
- Times on the lead page and the Activity page read in the agent's time zone, not the server's (#67) 8003750
- Showings are booked and shown in the agent's own time zone, not UTC (#66) c2f5a23
- The browser tab says how many leads are waiting on the agent, and a lead's page is titled with the lead's name (#63) efeafb7
- Mark a lead lost with a reason (bought with another agent, not ready, never answered) and the desk counts why leads are lost (#61) 3cdba72
- An approved message opens ready to send in the agent's own Mail or Messages app, from the lead's page (#62) 7b27035
- Realtor.com is its own lead source: its leads get their own opener, their own row in the response record, and a sample lead (#57) 77ce7d2
- Skip one upcoming follow-up on a lead, or bring it back, from the lead's page (#54) 6e5036e
- A lead who writes in again with the same email or phone lands on their existing lead, not as a second one (#53) 8a18d73
- The response record says how fast each lead source was answered (#52) 8f8afee
- Keep a private note on a lead (budget, timing, what they want) that shows at the top of their page and never goes to the lead (#49) a4075e8
- The agent rewrites how their first reply opens for each lead source, and sees a new draft in their words before saving (#45) 82f6c8b
- Paste a lead notification email (Zillow, Realtor.com, a website form) and the lead's name, email, phone, source and question are filled in to check and add (#48) 0c396da
After an open house, the agent can paste the sign-in sheet on the desk. Each readable line becomes a lead with a thank-you draft for that address. All of bun test passes except one flaky test. src/live.test.ts ("a write from another process on the same file reaches the bus") failed once in the full run and passes on its own. I did not run bun x tsc --noEmit, because there is no tsconfig or node_modules here, and I did not try the running app.
What moved where
src/signins.ts(new):readSignInsreads one visitor per line, split by tabs or commas, in any order, with quoted cells allowed. A line it can't read is marked with a reason and its line number instead of being guessed. Reasons include no name, no email or phone, two emails, two phones, or extra text. The limits are 100 lines and 20,000 characters.src/actions.ts:previewSignInswrites nothing.addSignInsre-reads the sheet itself and does not trust the preview.- New leads: each gets source
open_houseand consent off. The message is "Signed in at the open house at <address>." - Dedupe: a visitor whose email or phone matches an existing lead goes through
findMatchandwriteInAgain, the same rule asaddLead, and that audit row ismerged. - Visitors with only a phone: they are accepted, because the issue says "email and/or phone".
- Audit: one row per lead, plus one row for a refused or invalid sheet.
- Thank-you draft:
openHouseDraftinsrc/drafts.ts, passed through a new optionalopenHouseargument oninsertLeadinsrc/leads.ts. It names the address, and nothing is sent until the agent approves. - Intake helpers:
emailIn,phoneInandCONTROLinsrc/intake.tsare now exported for reuse. - Desk: an "Open house sign-ins" card with the address and a textarea. "Read the sheet" shows each line as read or "Cannot read … left out", with an "Add N to the desk" button. The text is escaped.
- JSON API:
POST /leads/signins/previewandPOST /leads/signinsanswer 201, 422 or 401, and both are in the regeneratedcontract/openapi.json. - MCP:
preview_sign_insandadd_sign_ins. - Terminal:
oasks for the address, takes the pasted sheet,ctrl-dshows the preview, andyadds. - Tests and README:
src/signins.test.tscovers parsing, the dedupe, the address in the draft, the limit, an anon refusal, MCP, the terminal and HTTP. The contract door test and the tool list insrc/server.test.tsare updated. The README tour gains step 11 and a "How it works" paragraph.
Policy: contract.json is unchanged. Both new actions use the existing lead create: user cell.
What I chose not to do
- A line with extra text, such as "Jane Smith, [email protected], 2 adults", is marked unreadable rather than guessed at. The preview shows it and the confirm leaves it out.
- A returning visitor gets the generic answer draft that a returning lead already gets. It is not a thank-you.
- I added no dependencies.
To try it: sign in, open "Open house sign-ins" on the desk, enter 12 Example St, paste a few lines like Priya Raman, [email protected], (206) 555-0101, add a junk line, and press "Read the sheet". Then press "Add".
I've pushed fixes for the review's high finding and the test gaps; bun test passes in full (399 tests). I did not run bun x tsc --noEmit, because there is no tsconfig or node_modules in this clone.
The high finding. readSheet in src/actions.ts now applies the same contactProblem check that adding uses, and marks failing lines with that reason. So:
- The preview's "Add N" counts only what will actually be added.
- A sheet where every line fails that check is a 422 ("No line could be read…"), audited like any other invalid sheet.
- The
undefined.idcrash can't happen, becauseaddSignInsonly runs the loop when at least one line is readable. I removed the now-redundant check inside the loop. - A test uses
555+123+4567, which passesreadLinebut fails the contact check. It covers an all-bad sheet (preview and add both 422, nothing added) and a mixed sheet (one added, one skipped).
Tests added
- A different name with the same phone lands on the existing lead, with no fallback number.
- A sheet over 20,000 characters is a 422 that names the limit.
- An anon post to
/leads/signins/previewover HTTP gets a 401.
Where I differ on the text-channel request. The text fallback in openHouseDraft could never run. An address is at most 200 characters, so the longest text draft is about 300, well under the 480 limit. A sign-in also never carries consent, so a phone-only visitor's draft is always an email. I deleted the dead fallback, per my own rule on dead code. Instead:
- A direct test of
openHouseDraftwith consent shows the text names the address, including a 200-character one, and stays within the limit. - A phone-only visitor test confirms the draft is an email naming the address.
Cleanup. The desk.ts showings imports are merged into one line.
After an open house, the agent can paste the sign-in sheet on the desk. Each readable line becomes a lead with a thank-you draft for that address. All of
bun testpasses except one flaky test.src/live.test.ts("a write from another process on the same file reaches the bus") failed once in the full run and passes on its own. I did not runbun x tsc --noEmit, because there is no tsconfig ornode_moduleshere, and I did not try the running app.What moved where
src/signins.ts(new):readSignInsreads one visitor per line, split by tabs or commas, in any order, with quoted cells allowed. A line it can't read is marked with a reason and its line number instead of being guessed. Reasons include no name, no email or phone, two emails, two phones, or extra text. The limits are 100 lines and 20,000 characters.src/actions.ts:previewSignInswrites nothing.addSignInsre-reads the sheet itself and does not trust the preview.open_houseand consent off. The message is "Signed in at the open house at <address>."findMatchandwriteInAgain, the same rule asaddLead, and that audit row ismerged.openHouseDraftinsrc/drafts.ts, passed through a new optionalopenHouseargument oninsertLeadinsrc/leads.ts. It names the address, and nothing is sent until the agent approves.emailIn,phoneInandCONTROLinsrc/intake.tsare now exported for reuse.POST /leads/signins/previewandPOST /leads/signinsanswer 201, 422 or 401, and both are in the regeneratedcontract/openapi.json.preview_sign_insandadd_sign_ins.oasks for the address, takes the pasted sheet,ctrl-dshows the preview, andyadds.src/signins.test.tscovers parsing, the dedupe, the address in the draft, the limit, an anon refusal, MCP, the terminal and HTTP. The contract door test and the tool list insrc/server.test.tsare updated. The README tour gains step 11 and a "How it works" paragraph.Policy:
contract.jsonis unchanged. Both new actions use the existinglead create: usercell.What I chose not to do
To try it: sign in, open "Open house sign-ins" on the desk, enter
12 Example St, paste a few lines likePriya Raman, [email protected], (206) 555-0101, add a junk line, and press "Read the sheet". Then press "Add".Closes #81