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

Merged opened this

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

Merged

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.

Notes

shipped production is serving it deploy d2eada7

opened this

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_reason and fell_by to deal. closed still means "Closing marked done". Deals now also carry fell_through, so GET /api/deals and list_deals say which deals fell through. openDealAt no longer counts a fell-through deal as open.
  • Action: markFellThrough in src/deals.ts is 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.md has the details.

Choices to check

  • No cell of contract.json changed. In src/security.ts, doorOf now classes POST /api/deals/:id/fell and /reopen as deal update, next to amend, 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

Closes #97

1 earlier comment · 1 event
commented

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_reason and fell_by to deal. closed still means "Closing marked done". Deals now also carry fell_through, so GET /api/deals and list_deals say which deals fell through. openDealAt no longer counts a fell-through deal as open.
  • Action: markFellThrough in src/deals.ts is 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.md has the details.

Choices to check

  • No cell of contract.json changed. In src/security.ts, doorOf now classes POST /api/deals/:id/fell and /reopen as deal update, next to amend, 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

Changes requested — before the latest push

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).

  1. 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/fell and /reopen, and the MCP fell_through tool, 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.
  1. Minor cleanup in the same round: the API test's unauthenticated call passes { origin: base } as never as 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.
commented

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 runs markFellThrough (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 as permit(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.fell and deal.reopen now sit next to deal.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

Approved

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.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs