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

A listing deal carries the date the listing agreement expires, and the clock and the deal page flag a closing that would fall after it #188

Merged opened this

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

Merged

A listing or both-sides deal can now carry a "Listing agreement expires" date, and a closing on or after it shows one conflict everywhere the other conflicts show. New and related tests pass, but bun x tsc --noEmit could not run: the repo has no tsconfig.json and no typescript dependency.

Notes

shipped production is serving it deploy d2eada7

opened this

A listing or both-sides deal can now carry a "Listing agreement expires" date, and a closing on or after it shows one conflict everywhere the other conflicts show. New and related tests pass, but bun x tsc --noEmit could not run: the repo has no tsconfig.json and no typescript dependency. There is no scripts/gate.ts either.

What changed

  • Suggestion: src/deadlines.ts adds "Listing agreement expires" with a 30-day lead, for listing and both only. The add-date form uses the new suggestedFor(side), so a buyer-side deal doesn't offer it. It is still stored as custom and matched by its exact label, like leadOfLabel, and no new kind was added.
  • Owner: the issue says "owed by the agent", but no agent role existed, so I added agent to PARTY_ROLES. It is not a role a person can be added in: CONTACT_ROLES and isContactRole now guard the add-party form, MCP, terminal and import. addDeadline sets the owner to agent whenever that exact label is added, whatever owes says.
  • Conflict: conflicts() in src/order.ts flags an open expiry on or before the open closing. The line reads "Closing (Dec 3) falls after the listing agreement expires (Nov 30): extend the listing or move closing." If both fall on the same day it says "falls on the day the listing agreement expires" instead.
  • Clearing and ordinary rule: moving either date or marking the expiry done clears it. The expiry is excluded from the ordinary "due on or after closing" rule, since expiring after closing is the healthy case.
  • Surfaces: the deal page, clock, week sheet, terminal, API and MCP all read the same conflict list. I only reworded the OpenAPI and MCP descriptions, and regenerated contract/openapi.json.
  • Agent only: the date is left out of timelineRows, which feeds the client page, MCP's client_timeline and the terminal timeline, and out of the status-update draft listing. Its notifiedOf list is empty, so no party is drafted a reminder for it.
  • Sample: 9 Orchard Row now has an expiry four days before its closing, so the demo shows the flag.
  • README: one sentence added to the tour.

Tests

  • New src/listing.test.ts covers the checklist's cases.
  • I changed two existing tests because the new sample data contradicts them. "No sample deal is flagged on a fresh boot" is now "only 9 Orchard Row is flagged", and the sample custom-date count goes from 1 to 2.

Chose not to do

  • No reminder goes to the agent themselves. There is no agent-directed reminder mechanism, so "agent only" means no client party is drafted anything. The agent sees the date on the clock and week sheet.
  • No contract cell was touched.

Try it

  • Open 9 Orchard Row in the preview: the clock lane says "1 out of order" and the deal page shows the line. Its timeline page omits the date.

Closes #174

4 earlier comments · 3 events
commented

A listing or both-sides deal can now carry a "Listing agreement expires" date, and a closing on or after it shows one conflict everywhere the other conflicts show. New and related tests pass, but bun x tsc --noEmit could not run: the repo has no tsconfig.json and no typescript dependency. There is no scripts/gate.ts either.

What changed

  • Suggestion: src/deadlines.ts adds "Listing agreement expires" with a 30-day lead, for listing and both only. The add-date form uses the new suggestedFor(side), so a buyer-side deal doesn't offer it. It is still stored as custom and matched by its exact label, like leadOfLabel, and no new kind was added.
  • Owner: the issue says "owed by the agent", but no agent role existed, so I added agent to PARTY_ROLES. It is not a role a person can be added in: CONTACT_ROLES and isContactRole now guard the add-party form, MCP, terminal and import. addDeadline sets the owner to agent whenever that exact label is added, whatever owes says.
  • Conflict: conflicts() in src/order.ts flags an open expiry on or before the open closing. The line reads "Closing (Dec 3) falls after the listing agreement expires (Nov 30): extend the listing or move closing." If both fall on the same day it says "falls on the day the listing agreement expires" instead.
  • Clearing and ordinary rule: moving either date or marking the expiry done clears it. The expiry is excluded from the ordinary "due on or after closing" rule, since expiring after closing is the healthy case.
  • Surfaces: the deal page, clock, week sheet, terminal, API and MCP all read the same conflict list. I only reworded the OpenAPI and MCP descriptions, and regenerated contract/openapi.json.
  • Agent only: the date is left out of timelineRows, which feeds the client page, MCP's client_timeline and the terminal timeline, and out of the status-update draft listing. Its notifiedOf list is empty, so no party is drafted a reminder for it.
  • Sample: 9 Orchard Row now has an expiry four days before its closing, so the demo shows the flag.
  • README: one sentence added to the tour.

Tests

  • New src/listing.test.ts covers the checklist's cases.
  • I changed two existing tests because the new sample data contradicts them. "No sample deal is flagged on a fresh boot" is now "only 9 Orchard Row is flagged", and the sample custom-date count goes from 1 to 2.

Chose not to do

  • No reminder goes to the agent themselves. There is no agent-directed reminder mechanism, so "agent only" means no client party is drafted anything. The agent sees the date on the clock and week sheet.
  • No contract cell was touched.

Try it

  • Open 9 Orchard Row in the preview: the clock lane says "1 out of order" and the deal page shows the line. Its timeline page omits the date.
commented

Fixed one of the two failing tests and pushed. The other I could not reproduce, so I left it alone.

Fixed: "a deal's page offers the suggested dates in a plain datalist" in src/suggested.test.ts expected every suggestion. The first sample deal is buyer-side and correctly doesn't offer "Listing agreement expires". The test now expects suggestedFor("buyer"). The test was wrong, not the code. The listing and both-sides offer is covered in src/listing.test.ts.

Not fixed: "the reminder review answers within budget the first time after a deal changes" in src/speed.test.ts. It took 305 ms in the deploy against the 50 ms budget. It passed all three runs I did here, alongside the fixed test. My change adds only a label comparison to the reminder path, so I read this as load on the deploy machine. I made no change for it. If it fails again on this push, I'll look at the reminder review path.

The change itself is unchanged from the description of this pull above.

commented

I found no cause in my change for this failure, so I changed no code and pushed an empty commit to re-run the deploy check.

The failing test, "the clock answers within budget the first time after a deal changes", is a timing test: a median of five cold requests against a 50 ms budget with 200 deals. The previous run failed on a different test of the same kind (the reminder review, 305 ms). The deploy runs have shown 305 ms and 331 ms.

I ran the same timing probe here on main and on this branch. The clock and the reminder review come in at about 35 ms and 30 ms on both, within a few ms of each other. My change only adds a label comparison to the conflict pass, so it doesn't move those numbers. Both routes sit close to the budget, and a loaded deploy machine can push them over.

I did not raise the 50 ms budget, because that would change what the test guards. If the re-run fails again on a timing test, the cold clock and review paths need speeding up in their own change, or someone has to decide to relax the budget.

The pull's description is unchanged: the listing-expiry feature, the datalist test fix from the last push, and the agent owner role.

Changes requested — before the latest push

Changes needed (the feature works in the preview: 9 Orchard Row shows '1 out of order'), but the following must be fixed in one round:

  1. API contract drift (fix first): ROLE in src/routes.ts:224 is still buyer|seller|lender|title|other_agent, but a deal's deadlines[].owes can now be agent, so /api/deals answers with a value its own schema (and contract/openapi.json, which has no agent anywhere) forbids. Add agent to the owes schemas (not to the party-role schemas), regenerate openapi.json, and add a test that the sample deal's response validates against the schema.
  2. The agent's own date can leak to a client. setOwes (src/deals.ts) lets the expiry be reassigned to buyer/seller; addDeadline forces agent only on create, and import (src/import.ts) never does. Once owed by a client, the move/owes drafts go to that client. Make the label's owner agent on every path (setOwes refuses to change it; import forces it), with tests.
  3. Box 3 says reminders go to the agent only. Currently nobody is reminded at all (recipients() is empty). Either surface it as an agent-directed item on the reminder review/This week (agent-only, not a client draft), or state plainly in the README and pull that it is only shown on the clock, and justify it. The test should assert what the agent does see.
  4. The label rule is by exact string and is ungated by side: a buyer-side deal can still type the label by hand and get a forced agent owner and the flag. Reject or ignore the label when the deal's side is buyer, with a test.
  5. Terminal/MCP: the Owed by prompt, set_owes and add_date still list agent for every date; confirm that is wanted for ordinary dates (the issue only asked for this date) or restrict it, and say which in the pull.
  6. Clean: listing.test.ts has void id; / void expiry; to silence unused variables; drop the unused bindings instead. The sample.test comment and the order.page.test change are fine.

No contract.json cell was loosened.

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

Sentinel's three points are fixed and pushed. Tests pass: 98 across the listing, suggested-dates, import, deals, MCP and terminal suites, plus 26 across the OpenAPI, contract, routes, export and sheet files. I did not run the full suite; the forge does that on push. bun x tsc --noEmit can't run here (the repo has no tsconfig.json or typescript), and there is no scripts/gate.ts or scripts/fast.ts.

What changed

  • Owner can't be handed away. setOwes now refuses to change who owes "Listing agreement expires" (409, "the agent's own date"). The "Owed by" selector on the date sheet shows only the agent for that date. Import forces owes to agent for that date, whatever the file says. agent is no longer offered as a choice anywhere a person picks an owner: addDeadline, setOwes, MCP and the terminal prompt all take CONTACT_ROLES only. This keeps drafts about the agent's own paperwork from reaching a client.
  • Side is checked. addDeadline refuses the date on a buyer-side deal (422, field label), and import refuses it with the same reason.
  • Dead binding removed. The void id; is gone along with the unused binding it was hushing.
  • Contract: the OpenAPI owner enum now includes agent in answers (OWER), while request bodies still take only the party roles. contract/openapi.json is regenerated. No contract cell changed.

Not done: an existing deal that is switched to buyer-side after it already carries the date keeps it. I didn't add a rule for that, since the issue doesn't ask for one.

Try it: on 9 Orchard Row, change the owner of "Listing agreement expires". The selector offers only the agent. Adding the date to a buyer-side deal is refused.

🤖 Generated with Claude Code

Approved

Earlier asks are met. The agent's date can no longer be handed to another party: setOwes refuses it, import forces the owner to agent, and the sheet selector offers only the agent. A buyer-side deal is refused in both addDeadline and import. The dead binding is gone. No contract cell is loosened, and the new tests cover each path. Non-blocking: a deal switched to buyer-side after it carries the date keeps it, as Mason noted. The agent also gets no reminder of their own, only the calendar alarm.

commented

Left #174 open: 1 unticked item remain (When an open deal's Closing is on or after its listing expiry, the deal page, the clock row, the week sheet, the API and MCP show one conflict: "Closing (Dec 3) falls after the listing agreement expires (Nov 30): extend the listing or move closing." It uses the same conflict list and words style as src/order.ts. Moving either date clears it, and so does marking the listing expiry done (extended).).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs