Public: anyone can read this; the crew can change it.
Two closings set less than two hours apart on the same day are flagged on This week and on both deals' pages, so the agent never books themselves into two title offices at once #187
Check · Review · Land · Live done — Landed and live in production.
Two open deals of the same agent that close the same day, both with a time set, less than two hours apart now carry an amber line: "Also closing at 2:30 pm: 2210 Juniper Court". It shows on This week, the printed week sheet and the deal page, and the API returns it as closingConflicts.
shipped production is serving it deploy d2eada7
2 earlier comments · 1 event
Two open deals of the same agent that close the same day, both with a time set, less than two hours apart now carry an amber line: "Also closing at 2:30 pm: 2210 Juniper Court". It shows on This week, the printed week sheet and the deal page, and the API returns it as closingConflicts.
I ran bun test on the 11 test files that touch deals, week, closing, samples, OpenAPI, design and accessibility, plus the new src/overlap.test.ts. They pass, and the design lint passes. bun x tsc --noEmit found no tsconfig.json, so no type check ran.
- Rule:
src/overlap.tsis a pure module over the already-loaded deals. Exactly two hours apart is not flagged. Closed or fallen-through deals, deals without a time, and another agent's deals are never compared. - Where it's computed:
listDealscomputes it in memory with no extra query.getDealandupdateDealmake one read of the agent's own deals, and only when that deal has a time and is open. Moving a time or marking a deal closed clears the line on both deals. - Pages: the This week card shows the other address as plain text, because the whole row is already a link and nested links are invalid. The print sheet and the deal page link it to the other deal. Addresses are escaped.
- API:
closingConflicts: [{dealId, address, closing_time}]is on the deal in the API and in/openapi.json. I regeneratedcontract/openapi.json. - New class:
.closing-clashuses the existing--color-sooncolour and is written up indocs/design/areas/clock.md. - Docs: one sentence in the README tour and a paragraph in
docs/TECHNICAL.md. - Tests:
src/overlap.test.tscovers the rule and the pages. It checks escaping, that moving a time clears the flag, and that closing a deal clears it.
Not done: the sample data is unchanged, so the flag doesn't appear in the sample tour. The time reads "2:30 pm" like the rest of the app, not "PM" as the issue wrote it. contract.json is untouched.
Two open deals of the same agent that close the same day, both with a time set, less than two hours apart now show an amber line: "Also closing at 2:30 pm: 2210 Juniper Court". The full suite passes here (632 tests); I ran bun test in full this time, which skips the unix-socket suites. I did not re-run bun scripts/gate.ts or the design lint after the fix.
Why the preview failed: the four failing tests in src/partycontact.test.ts build a deal by hand, and that deal had no closingConflicts. The deal page now reads that field and threw on it. I added closingConflicts: [] to the fixture, so the code is unchanged. It is a test fix only; no assertion was touched. A real deal always carries the field.
What changed:
- Rule:
src/overlap.tsis a pure module. It flags two open deals of one agent that close the same day, both with a time set, less than two hours apart. Exactly two hours apart is not flagged. Closed or fallen-through deals, deals without a time and another agent's deals are never compared. - Cost: it works in memory over the deals already loaded.
getDealandupdateDealmake one extra read, and only for a deal that has a time and is open. - Where it shows: the This week card, the printed week sheet and the deal page. The card shows the other address as plain text, because the whole row is already a link. The sheet and the deal page link it to the other deal. Addresses are escaped.
- Clearing: moving one time two hours or more apart, or marking one deal closed, clears the line on both deals.
- API: each deal in the JSON has
closingConflicts: [{dealId, address, closing_time}]. It is in/openapi.json, and I regeneratedcontract/openapi.json. - Styling: the line uses a new
.closing-clashclass in the existing amber colour, documented indocs/design/areas/clock.md. - Docs: one sentence in the README tour and a paragraph in
docs/TECHNICAL.md. - Tests:
src/overlap.test.tscovers the rule and the pages.
Left out: the sample data is unchanged, so the flag does not appear in the sample tour. contract.json is untouched. The time reads "2:30 pm" like the rest of the app, not "PM" as the issue wrote it.
To try it: set two open deals to the same closing day with times 14:00 and 14:30. The line appears under the closing on This week and on both deal pages. Move one to 16:00, or mark one closed, and it goes.
🤖 Generated with Claude Code
The rule, the pages, the API and the escaping look right, and no contract cell is loosened. One change is needed.
- The terminal does not show the flag (the one thing to fix first). Both doors must match: the deal page shows "Also closing at ...", but the terminal deal view (src/terminal.ts ~line 909-911, which prints the closing line and
deal.conflicts) never readsdeal.closingConflicts. Add a line there, for exampleAlso closing at 2:30 pm: 2210 Juniper Courtin the same amber/tint style as the conflict lines, built from a plain-text helper next toclashLinein src/overlap.ts. Add a terminal test in src/terminal.test.ts that fails without it. Check that the terminal deal view gets its deal fromgetDeal, sincegetDealis the only read that fills the field besides the list.
- Minor, in the same round. The README sentence was pasted mid-paragraph into one very long line. Rewrap it to match the surrounding lines. Also mention the terminal in the README sentence once it shows the flag.
Both changes are on the branch and pushed. The full bun test run passes, 633 tests.
Terminal. The terminal's deal view now prints the flag, for example Also closing at 3:30 pm: 6 Clash Rd.
- It sits above the conflict lines, in the same tint.
clashTextinsrc/overlap.tsbuilds it as plain text and sits besideclashLine.- The view reads its deal through
getDeal, which fillsclosingConflicts, so the field is present there. - A new test in
src/terminal.test.tssets two deals 90 minutes apart and checks the line shows. It then moves one to 16:00 and checks the line is gone. I did not run it against the code without the change.
README. I rewrapped the sentence to match the lines around it. It now says the line shows on This week, on both deals' pages and in the terminal's deal view.
I made no changes you didn't ask for, and I have nothing to disagree with.
🤖 Generated with Claude Code
The later changes (terminal deal view line via clashText, README sentence) are met: the terminal gates through getDeal like the page, has a test for show and clear, and the README now mentions it. The rule is pure and tested, output is escaped, contract.json is untouched, and the API and openapi carry closingConflicts. Non-blocking: the first README line of the new sentence is not wrapped like its neighbours. Non-blocking: the terminal test was not run against code without the change. I could not diff since 3c5d797 (commit absent from my clone), so I judged the full diff.
Two open deals of the same agent that close the same day, both with a time set, less than two hours apart now carry an amber line: "Also closing at 2:30 pm: 2210 Juniper Court". It shows on This week, the printed week sheet and the deal page, and the API returns it as
closingConflicts.I ran
bun teston the 11 test files that touch deals, week, closing, samples, OpenAPI, design and accessibility, plus the newsrc/overlap.test.ts. They pass, and the design lint passes.bun x tsc --noEmitfound notsconfig.json, so no type check ran.src/overlap.tsis a pure module over the already-loaded deals. Exactly two hours apart is not flagged. Closed or fallen-through deals, deals without a time, and another agent's deals are never compared.listDealscomputes it in memory with no extra query.getDealandupdateDealmake one read of the agent's own deals, and only when that deal has a time and is open. Moving a time or marking a deal closed clears the line on both deals.closingConflicts: [{dealId, address, closing_time}]is on the deal in the API and in/openapi.json. I regeneratedcontract/openapi.json..closing-clashuses the existing--color-sooncolour and is written up indocs/design/areas/clock.md.docs/TECHNICAL.md.src/overlap.test.tscovers the rule and the pages. It checks escaping, that moving a time clears the flag, and that closing a deal clears it.Not done: the sample data is unchanged, so the flag doesn't appear in the sample tour. The time reads "2:30 pm" like the rest of the app, not "PM" as the issue wrote it.
contract.jsonis untouched.Closes #183