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

A date that falls on or after closing is flagged on the clock, its sheet, the deal page, the API and MCP, so a slipped contingency is seen before the closing table #61

Merged opened this

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

Merged

Open dates due on or after closing are now flagged on the clock, the sheets, the deal page, the API, MCP and the terminal. I ran nine test files that cover the change and they pass.

Notes

shipped production is serving it deploy d2eada7

opened this

Open dates due on or after closing are now flagged on the clock, the sheets, the deal page, the API, MCP and the terminal. I ran nine test files that cover the change and they pass. I did not run the full suite, bun scripts/gate.ts (the file doesn't exist in this repo), or bun x tsc --noEmit (there is no tsconfig, so it prints help). bun run lint:design passes.

What changed

  • src/order.ts (new): conflicts(deadlines) returns {deadline_id, label, due, closing} for each open, non-closing date due on or after the open closing date. Done dates, closed deals and deals with no closing date give none. conflictLine words it as "Financing contingency ends (Nov 24) now falls after closing (Nov 20): move one or the other." A date due on closing itself reads "falls on closing".
  • src/deals.ts: DealView.conflicts is set once when a deal is assembled, in one pass over its dates. Every door reads it from there, so there is no extra query.
  • Pages:

- A flagged date's sheet shows its own line, and the closing sheet shows all of them. - The deal page shows one line per flagged date above Dates. - On the clock, a flagged marker carries a "!" in its corner and an aria-label ending "falls on or after closing". The lane head shows "N out of order". - The new .conflict and .marker[data-conflict] rules in static/app.css use existing tokens. The marker is absolutely positioned, so nothing shifts.

  • Move and add-date notices: the move or the new date still succeeds, and the form notice appends the conflict lines.
  • API, MCP and terminal: conflicts is in GET /api/deals/:id, the deal list and get_deal, and is documented in src/openapi.ts (contract/openapi.json is re-emitted). The terminal deal view lists the lines with a "!" prefix.
  • Docs: one sentence in README step 5, and a note in docs/TECHNICAL.md.

Tests

  • src/order.test.ts covers before, on and after closing, a done date, a closed deal and the line text.
  • src/order.page.test.ts asserts that no sample deal is flagged on a fresh boot and that the clock has no marker. It then moves Alder Lane's financing past closing and checks the notice, the API, the rendered sheets, the deal page and the clock marker.
  • src/terminal.test.ts has one new test for the terminal view.

Left out

  • No cell of contract.json changed.
  • A move made in the terminal or over MCP does not append the conflict to its status line or result. The terminal deal view and get_deal show it afterwards.
  • No new design-area doc: .conflict is the only new class and is described here.

Try it In the preview, open 1418 Alder Lane's Financing marker, move it a few days past closing, and look for the "!" on the marker and the notice after the move.

🤖 Generated with Claude Code

Closes #58

4 earlier comments · 2 events
commented

Open dates due on or after closing are now flagged on the clock, the sheets, the deal page, the API, MCP and the terminal. I ran nine test files that cover the change and they pass. I did not run the full suite, bun scripts/gate.ts (the file doesn't exist in this repo), or bun x tsc --noEmit (there is no tsconfig, so it prints help). bun run lint:design passes.

What changed

  • src/order.ts (new): conflicts(deadlines) returns {deadline_id, label, due, closing} for each open, non-closing date due on or after the open closing date. Done dates, closed deals and deals with no closing date give none. conflictLine words it as "Financing contingency ends (Nov 24) now falls after closing (Nov 20): move one or the other." A date due on closing itself reads "falls on closing".
  • src/deals.ts: DealView.conflicts is set once when a deal is assembled, in one pass over its dates. Every door reads it from there, so there is no extra query.
  • Pages:

- A flagged date's sheet shows its own line, and the closing sheet shows all of them. - The deal page shows one line per flagged date above Dates. - On the clock, a flagged marker carries a "!" in its corner and an aria-label ending "falls on or after closing". The lane head shows "N out of order". - The new .conflict and .marker[data-conflict] rules in static/app.css use existing tokens. The marker is absolutely positioned, so nothing shifts.

  • Move and add-date notices: the move or the new date still succeeds, and the form notice appends the conflict lines.
  • API, MCP and terminal: conflicts is in GET /api/deals/:id, the deal list and get_deal, and is documented in src/openapi.ts (contract/openapi.json is re-emitted). The terminal deal view lists the lines with a "!" prefix.
  • Docs: one sentence in README step 5, and a note in docs/TECHNICAL.md.

Tests

  • src/order.test.ts covers before, on and after closing, a done date, a closed deal and the line text.
  • src/order.page.test.ts asserts that no sample deal is flagged on a fresh boot and that the clock has no marker. It then moves Alder Lane's financing past closing and checks the notice, the API, the rendered sheets, the deal page and the clock marker.
  • src/terminal.test.ts has one new test for the terminal view.

Left out

  • No cell of contract.json changed.
  • A move made in the terminal or over MCP does not append the conflict to its status line or result. The terminal deal view and get_deal show it afterwards.
  • No new design-area doc: .conflict is the only new class and is described here.

Try it In the preview, open 1418 Alder Lane's Financing marker, move it a few days past closing, and look for the "!" on the marker and the notice after the move.

🤖 Generated with Claude Code

commented

Of the two deploy failures, one was my mistake and is fixed. The other looks like a timing flake that also hits main's code.

  • Print-rules test (my mistake): I had added the .conflict and .marker[data-conflict] CSS rules after the @media print block in static/app.css. The timeline test requires every rule from that point on to be scoped to .timeline-page. I moved the new rules above the print block. src/timeline.test.ts, src/design.test.ts and src/order.page.test.ts now pass.
  • Clock budget test (flake, not changed): "the clock answers within budget the first time after a deal changes" failed with a median of 53–65 ms against the 50 ms budget. It does the same without my change, once in two runs on the base code. Run alone, it passed 3 of 3 times with my change, and src/speed.test.ts passed 4 of 4 runs with it. The earlier failures came when it ran alongside other test files. I changed nothing for it; if the forge check still trips on it, that is machine load, not the flag code.

The fix is pushed as 256c59b.

Changes requested — before the latest push

The web side is solid: conflicts are computed once in assemble, permit is untouched, no contract cell loosened, output escaped, openapi updated. One miss against the list: the two doors are not equal. Fix first: when a date is moved or added in the terminal (and over MCP move_deadline/add_deadline), the status/result must also carry the conflict lines, as the web notice does through withConflicts. The builder left this out on purpose; the list says a person can do on the page what they can do in the terminal, and a slipped contingency should be seen at the moment of the move. Add a test in src/terminal.test.ts that moves a date past closing through the keys and asserts the status line says so (the current test only adds via the db and reads the deal view). Smaller: (1) static/app.css has a doubled blank line after the new rules; (2) src/order.page.test.ts uses as never to dodge the label type, assert the label properly; (3) in sheet.ts the order.ts import sits after who.ts, keep imports in the file existing order; (4) no test covers the on-closing wording on a page, only in order.test.ts, fine, but add the add-date notice path (withConflicts via POST /deals/:id/deadlines) since that route changed and has no test.

commented

I've made the terminal and MCP name a conflict at the moment of a move or add, as the web notice does, and pushed it as 52ed6fb. The terminal, order-page, server, OpenAPI, timeline, design and contract tests pass, and bun run lint:design passes. I didn't run the full suite.

  • One helper: withConflicts(db, who, dealId, said) now lives in src/deals.ts, next to a small conflictsOf. The web routes call it in place of the private copy that was in src/routes.ts, so all three doors build the notice the same way.
  • Terminal: m and a now end their status line with the conflict lines (e.g. "Moved Financing contingency ends to … Financing contingency ends (Nov 24) now falls after closing (Nov 20): move one or the other."). The move still goes through.
  • MCP: move_date and add_date answer with {...date, conflicts: [...]}. I updated the move_date description to say so.
  • Smaller points: all four are done.

- Removed the doubled blank line in static/app.css. - The as never is gone: the page test now asserts the real label. - Reordered the order.ts import in src/pages/sheet.ts to match the file's existing order. - Added a test for the add-date notice, POST /deals/:id/deadlines, including the "falls on closing" wording on the rendered sheet.

  • New tests:

- A terminal test presses m past closing and asserts the status line says so, then adds a date with a and checks the deal view shows it. - An MCP test adds a date on closing day and asserts conflicts in the answer.

I added conflicts to the add_date answer too, which the request didn't name, so the two MCP tools match.

commented

I merged main into the branch and pushed it as b825930. The terminal, order-page, deals, OpenAPI and design tests pass (67), but one server test fails on main itself.

Conflicts

  • README.md: step 5 keeps main's Date changed notice text, then my sentence about the closing flag.
  • src/deals.ts: the imports keep both conflictLine/conflicts from order.ts and moveKey from reminders.ts.
  • src/terminal.test.ts: my two tests and main's new tests are all kept. My first resolution left a test unclosed, which fda20d0 carried. b825930 fixes it.

Failing test on main src/server.test.ts "a moved date's Date changed notice is sent, declined and undone…" fails the same way on a clean checkout of origin/main (42 pass, 1 fail). It moves a date to the hardcoded 2026-12-01 and expects "Date changed" on the clock, and that isn't due today (2026-11-02), so the date-dependent test looks like the cause. I didn't change it; it needs its own fix.

Speed test The clock speed test ("the clock answers within budget the first time after a deal changes") failed once when run alongside other files, as before. Run alone it passed both times.

Approved — before the latest push

Earlier asks are met. The terminal m and a and the MCP move_date and add_date now name the conflict through the shared withConflicts and conflictsOf helpers. Both go through getDeal, so permit still gates them. The notice test, the doubled blank line, the as never and the import order are all fixed. No contract.json cell is loosened, and there is no new dependency. Non-blocking: the MCP test only exercises add_date, so add a move_date assertion. Non-blocking: the terminal a test only checks the deal view, not the status line. Non-blocking: the README step 5 sentence is on one very long line, and import { ok } in src/mcp.ts is out of order.

commented

I fixed the "Date changed" server test and pushed it as 5ad0772. I haven't fixed the clock speed-budget test, which failed again in the deploy. src/server.test.ts now passes (43 tests).

Server test: the test was wrong, not the code. The failing test, "a moved date's Date changed notice is sent, declined and undone…", asserted that the clock page contains "Date changed". Since #59 the clock no longer carries date sheets; they load from /deals/:id/sheets. The notice only appears under Reminders on the moved date's sheet. This was already failing on a clean origin/main, and my branch's clock and sheet code matches main there. I changed the test to read that sheet fragment and left the rest of it alone.

Speed test: not changed. "The clock answers within budget the first time after a deal changes" went over the 50 ms budget again in the deploy (339 ms for the test). Run alone here it passed on every run, and src/speed.test.ts passed 4 of 4 times. It failed 1 of 4 on main's code, so it is borderline under load whoever's change is running. My flag adds one pass over each deal's dates plus a small conflicts array on each deal. I didn't measure that cost directly. If the forge check still trips on this test, someone should look at the budget on main rather than at this pull.

Approved

Earlier asks are met: the terminal and MCP now name the conflict on move and add, through one shared withConflicts helper, and have tests. The only change since my last review is the server test, which now reads the date sheet fragment instead of the clock. That is correct since #59, because the clock no longer carries sheets. The flag is computed once per assembled deal, reads go through permit, and no contract cell is loosened. Non-blocking: src/mcp.ts imports ok and conflictsOf out of order. The clock speed-budget flake is main-wide and not caused by this pull.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs