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

A deal whose closing is marked done leaves the clock for a Closed list, and can be reopened #28

Merged opened this

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

Merged

A deal whose Closing date is marked done now steps off the clock into a Closed card. Reopening the Closing date brings it back, and no contract.json cell changed. The tests for this change pass, but I ran no full-suite pass that was green and could not type-check, as noted below.

Notes

shipped production is serving it deploy d2eada7

opened this

A deal whose Closing date is marked done now steps off the clock into a Closed card. Reopening the Closing date brings it back, and no contract.json cell changed. The tests for this change pass, but I ran no full-suite pass that was green and could not type-check, as noted below.

What moved where

  • Closed flag: a pure isClosed(deadlines) in src/deadlines.ts: closed when the closing date has done_at. It is derived, with no new column. DealView gets closed: boolean, set once in view() in src/deals.ts.
  • Reminders: drafts() in src/reminders.ts returns nothing for a closed deal. That one rule stops /tick, reminders_today over MCP, the terminal's r list and the clock's Reminders for today.
  • Clock (src/pages/clock.ts): / draws only open deals as lanes. The axis span and the summary counts ignore closed ones. A compact Closed card below the clock lists them newest first (address and closing date, linked to /deals/:id). It is absent when there are none. If every deal is closed, the clock says so.
  • Deal page (src/pages/deal.ts): a closed deal says "Closed on …" in the heading summary. Its dates and sheets still open. Reopening the Closing date there uses the existing markDone, so the clock updates live over deal.changed.
  • Terminal (src/terminal.ts): the date list skips a closed deal's dates, and h shows them as it does done dates.
  • API and docs: GET /api/deals and list_deals include closed. contract/openapi.json is re-emitted. The README walk-through has a new step "Close a deal" (the calendar step is now 12), and docs/TECHNICAL.md has a paragraph on it.
  • Sample-deal shift (#4): I made no change. A sample deal whose Closing is marked done already counts as touched, because its done_at no longer matches the sample marker.

Tests added

  • Pure test (src/deals.test.ts): Closing done closes a deal and reopening it opens it again; another date done does not close it; a closed deal has no drafts and nothing in dueOn.
  • Server test (src/server.test.ts): marking a deal's Closing done removes its lane and lists it under Closed; its page says "Closed on"; the API says closed: true; /tick leaves it out; reopening restores the lane.
  • Terminal test (src/terminal.test.ts): a closed deal's dates leave the date list and the r list, and h shows them again.

What I ran

  • src/server.test.ts, deals.test.ts, terminal.test.ts, openapi.test.ts and sample.test.ts pass together (67 tests). lint:design is clean.
  • Running all of src in one process made two audit.test.ts tests fail with a 429 from the write rationing. That file passes on its own, both with my change and on the base, so I did not chase it. I left the forge's full check to confirm.
  • I could not run tsc: the repository has no tsconfig.json, so bun x tsc --noEmit only printed its help.
  • There is no scripts/gate.ts or scripts/fast.ts here, and I did not try the running app.

What I left alone

  • #13's This week card is not here. When it lands, it should read the same deal.closed filter that the clock already applies.

Closes #20

3 earlier comments · 3 events
commented

A deal whose Closing date is marked done now steps off the clock into a Closed card. Reopening the Closing date brings it back, and no contract.json cell changed. The tests for this change pass, but I ran no full-suite pass that was green and could not type-check, as noted below.

What moved where

  • Closed flag: a pure isClosed(deadlines) in src/deadlines.ts: closed when the closing date has done_at. It is derived, with no new column. DealView gets closed: boolean, set once in view() in src/deals.ts.
  • Reminders: drafts() in src/reminders.ts returns nothing for a closed deal. That one rule stops /tick, reminders_today over MCP, the terminal's r list and the clock's Reminders for today.
  • Clock (src/pages/clock.ts): / draws only open deals as lanes. The axis span and the summary counts ignore closed ones. A compact Closed card below the clock lists them newest first (address and closing date, linked to /deals/:id). It is absent when there are none. If every deal is closed, the clock says so.
  • Deal page (src/pages/deal.ts): a closed deal says "Closed on …" in the heading summary. Its dates and sheets still open. Reopening the Closing date there uses the existing markDone, so the clock updates live over deal.changed.
  • Terminal (src/terminal.ts): the date list skips a closed deal's dates, and h shows them as it does done dates.
  • API and docs: GET /api/deals and list_deals include closed. contract/openapi.json is re-emitted. The README walk-through has a new step "Close a deal" (the calendar step is now 12), and docs/TECHNICAL.md has a paragraph on it.
  • Sample-deal shift (#4): I made no change. A sample deal whose Closing is marked done already counts as touched, because its done_at no longer matches the sample marker.

Tests added

  • Pure test (src/deals.test.ts): Closing done closes a deal and reopening it opens it again; another date done does not close it; a closed deal has no drafts and nothing in dueOn.
  • Server test (src/server.test.ts): marking a deal's Closing done removes its lane and lists it under Closed; its page says "Closed on"; the API says closed: true; /tick leaves it out; reopening restores the lane.
  • Terminal test (src/terminal.test.ts): a closed deal's dates leave the date list and the r list, and h shows them again.

What I ran

  • src/server.test.ts, deals.test.ts, terminal.test.ts, openapi.test.ts and sample.test.ts pass together (67 tests). lint:design is clean.
  • Running all of src in one process made two audit.test.ts tests fail with a 429 from the write rationing. That file passes on its own, both with my change and on the base, so I did not chase it. I left the forge's full check to confirm.
  • I could not run tsc: the repository has no tsconfig.json, so bun x tsc --noEmit only printed its help.
  • There is no scripts/gate.ts or scripts/fast.ts here, and I did not try the running app.

What I left alone

  • #13's This week card is not here. When it lands, it should read the same deal.closed filter that the clock already applies.
commented

The failing deploy was caused by my new server test, and I've fixed it. The full bun test src now passes (100 tests, 0 fail), and the fix is pushed.

Cause: My test marked a deal's Closing done and reopened it as alice (u1). That user already shares a per-person write allowance with the other test files in one run. My writes used it up, so the 429 hit the next file's alice requests, in audit.test.ts. Those two audit tests only failed when the whole suite ran together. I wrongly dismissed them earlier as unrelated.

Fix: The closing test in src/server.test.ts now acts as its own person, closer (u20). I changed only the test; app code is untouched.

I still can't run tsc: the repository has no tsconfig.json.

commented

I merged main into the branch and pushed it. After the merge, bun test src passes (104 tests, 0 fail), and lint:design is clean. The OpenAPI file was re-emitted and came out unchanged.

Two files conflicted, and I kept both sides in each:

  • src/pages/deal.ts: I kept my closedOn helper and main's new messages() function (the record of sent reminders).
  • src/terminal.test.ts: I kept my closed-deal terminal test and main's new test for s on a deal (messages sent). The import line now brings in both markDone and sendReminder.

I didn't run tsc, since the repository has no tsconfig.json.

Changes requested — before the latest push

Core design is sound: closed is derived, no contract cell is loosened, writes still go through markDone/permit, output is escaped. Two things to fix in one round:

  1. Both doors. The page has a Closed card; the terminal has no way to see which deals are closed. A closed deal just vanishes from the date list until h is pressed, and then it shows as ordinary dates with no marker. Add a Closed line or section to the terminal (e.g. a closed list or a Closed marker on the deal, gated like the other reads), and say in the README step 11 how to find and reopen a closed deal in the terminal.
  1. Tests. The terminal test asserts that the r list does not contain 88 Shut Ave after closing, but never shows it contained it before. Its closing is 20 days out, so the assertion is probably vacuous and would pass without the change. Set the dates so a reminder is due today, assert it is in r before closing, then assert it is gone after. The same applies to the /tick assertion in server.test.ts: first show the deal appears in the tick before closing. The Closing-done check can also be repeated once for the Closed on <date> text on the deal page, which is derived from the UTC slice of done_at; check it names the day it was marked.
Approved — before the latest push

Approved. Closed is derived from the Closing date being done (no column, no contract.json change). Reminders stop through the one drafts() rule, covering /tick, MCP and the terminal r list. The clock shows a Closed card and the deal page says Closed on. The terminal hides a closed deal dates and h reveals them. Reopening goes through the existing markDone, which checks permit. Tests cover the pure rule, the server flow and the terminal. The OpenAPI file and README are updated. The earlier test-rationing failure was fixed by giving the test its own user. I could not diff against 83161af (not in my clone) and the preview needs a sign-in I do not have, so I judged from the change as shown. Non-blocking: closedOn slices the UTC done_at, so a late-evening close could show the next day.

the crew's run was interrupted: restart, resumes on the next pass — cancelled
commented

A deal whose Closing date is marked done now steps off the clock into a Closed card, sends no reminders, and comes back when the Closing date is reopened. bun test src passes (113 tests, 0 fail) on the merged branch. I changed no contract.json cell.

Review feedback (sentinel): the terminal test was vacuous.

  • Fixed: the terminal test now creates a deal with an inspection ending in three days, so a reminder is due today. It asserts the deal is in r before markDone and absent after.
  • Same fix on the server side: the /tick check now asserts the deal's reminder is present before the Closing is marked done and absent after.
  • New terminal assertions: the date list shows a Closed (1) section with the address and close date, h marks the dates (closed), and u on the Closing date reopens the deal.
  • Deal page and terminal: both now name the day the Closing was marked done ("Closed on …"). It is the app's calendar day of done_at, via a shared closedOn, and a test pins it.

Main had moved on (#27 This week), so the branch conflicted.

  • Merge: I merged main and kept both sides in clock.ts, server.test.ts, terminal.test.ts and terminal.ts.
  • Week list: thisWeek in src/week.ts now skips closed deals. That one rule covers the clock card, the terminal w view and MCP this_week, and src/week.test.ts has a test for it. This is the follow-up the first description said #13's card should make.

What I didn't do:

  • bun x tsc --noEmit only installs and prints help, because the repo has no tsconfig.json, so there is no type check.
  • scripts/design-lint.ts, scripts/gate.ts and scripts/fast.ts don't exist here, so none of them ran.
  • I didn't start the app.

Closes #20

🤖 Generated with Claude Code

Approved

Earlier asks met: the terminal and /tick tests now assert the reminder is present before Closing is marked done and absent after, and "Closed on …" now names the day Closing was marked done (closedOn, pinned by a test). Closed is derived from the Closing date, with no new write path and no contract.json cell changed. Reminders, This week and the terminal all follow one deal.closed rule. The terminal has the Closed list, h and u, and the README and openapi are updated. I could not diff against 83161af7e4f6 here (commit not in the clone), so I judged the full change. Non-blocking: the repo has no tsconfig, so nothing type-checks; worth a follow-up issue.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs