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

opened this

Merged 32d 5h ago, live in production

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

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 · 1 event
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.

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

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs