Public: anyone can read this; the crew can change it.
A deal that falls through is marked Fell through with a reason, leaves the clock for the Closed list labelled so, and can be reopened #106
Check · Review · Land · Live done — Landed and live in production.
A deal can now be marked Fell through with a reason, and Reopen puts it back on the clock with its dates as they were. The full bun test run is green (352 tests, 0 fail), including a new src/fell.test.ts. bun run lint:design printed no findings.
shipped production is serving it deploy d2eada7
1 earlier comment · 1 event
A deal can now be marked Fell through with a reason, and Reopen puts it back on the clock with its dates as they were. The full bun test run is green (352 tests, 0 fail), including a new src/fell.test.ts. bun run lint:design printed no findings.
Not run: the type check. The clone has no tsconfig.json, so bun x tsc --noEmit only prints help. scripts/gate.ts, scripts/fast.ts and scripts/design-lint.ts don't exist in this clone either, so I ran the whole suite once and used lint:design.
What changed
- Storage: a migration adds
fell_at,fell_reasonandfell_bytodeal.closedstill means "Closing marked done". Deals now also carryfell_through, soGET /api/dealsandlist_dealssay which deals fell through.openDealAtno longer counts a fell-through deal as open. - Action:
markFellThroughinsrc/deals.tsis the one action every door calls.
- It asks permit for deal update and takes a reason of 1 to 200 characters, checked like a decline reason (REASON_MAX).
- It refuses a deal that already fell through, one that closed, and a reopen of a deal that hasn't fallen through.
- It is audited as deal.fell and deal.reopen, and Activity words both.
- Off the clock: a fell-through deal is skipped in the clock, This week, People, Reminders for today and the header's waiting count. It drafts no reminders or status updates, so nothing is left waiting for approval. It is left out of the calendar file and the default spreadsheet.
- Closed list: fell-through deals appear in the Closed card marked "Fell through", with the date and reason, after the deals that closed.
- Deal page: a Fell through… control asks once and takes the reason. The page header shows the day, reason and who marked it, and Reopen is one tap.
- API, MCP, terminal:
- API: POST /api/deals/:id/fell with { reason }, and POST /api/deals/:id/reopen, both in the OpenAPI document.
- MCP: fell_through and reopen_deal.
- Terminal: F on a deal asks for the reason, or asks "yes" to reopen.
- Docs: README says in one sentence how to mark a deal and bring it back, and
docs/TECHNICAL.mdhas the details.
Choices to check
- No cell of
contract.jsonchanged. Insrc/security.ts,doorOfnow classesPOST /api/deals/:id/felland/reopenas deal update, next toamend, so the door checks the same cell the action does. - A closed deal can't be marked fell through.
- I did not block other edits to a fell-through deal. Its dates stay editable, which keeps Reopen honest.
To try it: open any deal's page, tap Fell through…, give a reason, and it moves to Closed; tap Reopen to bring it back.
🤖 Generated with Claude Code
One change to make; the rest reads clean (permit via dealFor, no cell loosened, reason validated and escaped, every door wired, OpenAPI/MCP/terminal/README present).
- Box 8 asks for a test of 'a user who may not update the deal'. src/fell.test.ts only tries anon (and bad reasons). Add a case where a different signed-in user (not the deal's author, or whatever dealFor refuses) calls markFellThrough,
POST /api/deals/:id/felland/reopen, and the MCPfell_throughtool, and assert the refusal (403/not_found as dealFor answers) and that the deal is unchanged. Also add the new /api/deals/:id/fell and /reopen doors to src/contract.test.ts if that file lists doors by hand.
- Minor cleanup in the same round: the API test's unauthenticated call passes
{ origin: base } as neveras headers, which is a cast hiding a sloppy case; send it with no identity headers and assert the exact status (401). Also place the 'deal.fell'/'deal.reopen' entries in src/activity.ts next to the other deal.* words rather than between date.* ones.
I made the cleanup changes and added the refusal tests, except for the "different signed-in user" case. Under contract.json a signed-in user can't be refused for someone else's deal. The full suite passes (353 tests, 0 fail), and the push is up.
Where I disagree: deal update is user, not author, so any signed-in user may mark any deal fell through. A user who may not update a deal does not exist under the table. Forcing that case would mean narrowing the cell, and the issue says no cell changes. So there is no dealFor refusal to assert for a second signed-in user.
What I added instead:
src/contract.test.ts: a new test runsmarkFellThrough(mark and reopen) as every identity the contract declares, on a deal that names them and on one that names someone else. Each must succeed or fail exactly aspermit(who, "deal", "update", row)says. If the cell is ever narrowed to author, this test covers a signed-in user who may not update the deal.src/fell.test.ts:
- API: a request with no identity headers gets exactly 401 on both POST /api/deals/:id/fell and /reopen. The as never cast is gone.
- MCP: the same request through the fell_through tool is refused.
- Unchanged: after those refusals the deal still reads fell_through: false.
src/activity.ts:deal.fellanddeal.reopennow sit next todeal.amend.
The /api/deals/:id/fell and /reopen doors were already classed as deal update in src/security.ts. contract.test.ts calls actions rather than listing routes by hand, so the new test is the only door entry it needed.
🤖 Generated with Claude Code
Earlier asks (refusal tests, anonymous 401 on API and MCP, no as never, Activity wording next to deal.amend) are met. The permit-driven test over every identity covers the user-may-not-update case, since the contract cell is user. No contract cell is loosened. Every door (page, API, MCP, terminal) calls markFellThrough, which asks permit; the deal is off the clock, This week, People, reminders and the calendar; drafts return empty so nothing waits; Reopen restores the dates. Non-blocking: the preview was not re-fetched in this round.
A deal can now be marked Fell through with a reason, and Reopen puts it back on the clock with its dates as they were. The full
bun testrun is green (352 tests, 0 fail), including a newsrc/fell.test.ts.bun run lint:designprinted no findings.Not run: the type check. The clone has no
tsconfig.json, sobun x tsc --noEmitonly prints help.scripts/gate.ts,scripts/fast.tsandscripts/design-lint.tsdon't exist in this clone either, so I ran the whole suite once and usedlint:design.What changed
fell_at,fell_reasonandfell_bytodeal.closedstill means "Closing marked done". Deals now also carryfell_through, soGET /api/dealsandlist_dealssay which deals fell through.openDealAtno longer counts a fell-through deal as open.markFellThroughinsrc/deals.tsis the one action every door calls.- It asks
permitfor deal update and takes a reason of 1 to 200 characters, checked like a decline reason (REASON_MAX). - It refuses a deal that already fell through, one that closed, and a reopen of a deal that hasn't fallen through. - It is audited asdeal.fellanddeal.reopen, and Activity words both.- API:
POST /api/deals/:id/fellwith{ reason }, andPOST /api/deals/:id/reopen, both in the OpenAPI document. - MCP:fell_throughandreopen_deal. - Terminal:Fon a deal asks for the reason, or asks "yes" to reopen.docs/TECHNICAL.mdhas the details.Choices to check
contract.jsonchanged. Insrc/security.ts,doorOfnow classesPOST /api/deals/:id/felland/reopenas deal update, next toamend, so the door checks the same cell the action does.To try it: open any deal's page, tap Fell through…, give a reason, and it moves to Closed; tap Reopen to bring it back.
🤖 Generated with Claude Code
Closes #97