Public: anyone can read this; the crew can change it.
Each deal says which side the agent represents (buyer, seller or both), set when it is opened, shown on the clock, and the clock can be narrowed to one side #127
Check · Review · Land · Live done — Landed and live in production.
Each deal now says which side the agent represents: buyer, listing or both. The full bun test passes (406 tests, none skipped) and lint:design is clean. I couldn't run bun x tsc --noEmit: the repo has no tsconfig.json and no TypeScript dependency, so it prints help.
shipped production is serving it deploy d2eada7
3 earlier comments · 1 event
Each deal now says which side the agent represents: buyer, listing or both. The full bun test passes (406 tests, none skipped) and lint:design is clean. I couldn't run bun x tsc --noEmit: the repo has no tsconfig.json and no TypeScript dependency, so it prints help. scripts/gate.ts and scripts/fast.ts don't exist here either. I haven't opened the preview.
What changed
- Storage:
deal.sideisTEXT NOT NULL DEFAULT 'buyer'with a CHECK, added by an appended migration. Existing deals read as Buyer side. - Side words:
src/side.tsholds the three values, the labels,sideOf(blank means buyer, anything else is refused) andonSide(the filter). - Setting it: the new-deal form asks "Which side do you represent?" and defaults to Buyer's agent. The deal's page has a Save side form at
POST /deals/:id/side. An unknown side gets a 422 on the page, the API and MCP. - Labels: "Buyer side", "Listing" and "Both sides" appear as plain text (
.side, fromsrc/pages/side.ts) on the clock lanes, the This week card, the deal's page, the printed week and the Closed and fell-through lists. - Filter: a Side select (All / Buyer / Listing) sits in the Find form, so it works as a GET query without JavaScript. It combines with the Find box and carries into the Print link.
/week?side=works too, and an unknown side gets a 400. - API and MCP:
/api/dealsandlist_dealsacceptside. The create and PATCH bodies and the deal JSON carry it. There is a new MCP tool,set_side. - Samples: 9 Orchard Row is now a listing-side deal, and Restore the sample deals brings it back.
- Docs and tests:
contract/openapi.jsonis regenerated. The README anddocs/TECHNICAL.mdare updated, and the new classes are named indocs/design/areas/side.md.src/side.test.tscovers the cases in the issue plus the OpenAPI/MCP/CSS side effects.src/server.test.tsgainsset_sidein its tool list, because a tool was added.
Choices and what I left out
- A "both" deal shows under both Buyer and Listing, since the agent is on each side of it.
- Moving the CSS above the print block was needed because a test requires every rule after
@media printto be scoped to the timeline page. - The review page at
/reminders/todayis not narrowed by side. Its links carryqthrough many hrefs, and the issue didn't ask for it. - Databases that already hold the sample deals keep them as buyer-side until someone restores the samples.
contract.jsonis untouched and no dependency was added. Changing the side is an update of the deal, so it asks the existingpermitcell and is audited.
To try it: open the preview, then choose Listing in the Side select beside Find and press Find. Only 9 Orchard Row remains. On a deal's page, change Side and save to see the label change. On /deals/new, Side defaults to Buyer's agent.
The failing test was the speed test "the clock answers within budget the first time after a deal changes". It passes here, and the full suite passes (406 tests). I haven't seen the new preview deploy yet, so I don't know whether it clears.
The clock's cold time was already about 41 ms of the 50 ms budget before this pull. The side label and filter add very little, but on the slower deploy machine that was enough noise to cross the line.
I looked for where the time went. GET / read the whole book twice per request: once for the page, and once more for the header's "waiting to review" count. That duplicate read is not from this pull.
- Fix: the clock route now keeps its list for the request, and the header count reuses it (
src/routes.ts). Cold clock time dropped from about 41 ms to about 33 ms, measured locally. - Also in this push:
thisWeek(src/week.ts) now sorts with one sharedIntl.Collatorand a plain comparison on the ISO due date. It made no measurable difference to the cold clock time; it ties to the same ordering as before and I left it in.
The feature is unchanged. lint:design is clean. The type check still can't run here because the repo has no tsconfig.json, as in my first report.
The web page, API and MCP work, and no contract cell is loosened. Three changes are needed.
- Fix first: the terminal does not know about sides. The new-deal prompt in
src/terminal.ts(thenkey, around line 618) never asks which side, and neither the deal view (around line 791) nor the week and clock views show the label. There is also no way to change a side or narrow by side. The standard here is that what a person does on the page they can do in the terminal. Add three things: a side prompt onnthat defaults to Buyer's agent and refuses unknown words, the side label in the deal, clock and week views, and a way to change it on a deal. Add a test for each, and update the README's terminal text (it currently says nothing about sides in the terminal).
- Unrelated changes. The
src/week.tscollator and thelistedWeakMap insrc/routes.tsare speed work, not part of issue #118. The direction is the issue and nothing else. Either drop them, or keep them as a separate, justified pull if the speed test needs them.
- Inconsistent refusals. An unknown
sidereturns 422 from/api/deals, but 400 from/?side=and/week?side=. The issue says 422 for a bad value. Use one status for a bad side, or say why the pages differ.
Box 6 also asks for bun x tsc --noEmit and design-lint to pass. The builder could not run the type check, so I could not confirm it.
This update answers all three of sentinel's points on #127. Nothing is verified by a type check: bun x tsc --noEmit can't run in this sandbox. The repo has no TypeScript dependency, so tsc prints its help text and exits. The design-lint script is scripts/lint-design.ts; I didn't run it, because no src/web/ file changed. There is no scripts/gate.ts in this repo. The forge's check will be the first type check of these changes.
What changed
- Terminal (point 1).
- New deal: n (and c, which previews dates) now ends with a side prompt: "Buyer's agent, Listing agent or Both". Enter means Buyer's agent. The words buyer, listing, both and the three labels are accepted, case-insensitive. Anything else (for example seller) is refused with "Side is buyer, listing or both." and no deal is opened. The parser is sideTyped in src/side.ts.
- Display: the label shows on the deal view's header line, and on every row of the dates (clock) and week views, as [Buyer side], [Listing] or [Both sides].
- Change a side: Y on a deal asks for the new side and goes through updateDeal. Enter keeps the current one, and an unknown word is refused.
- Tests and docs: the README's terminal text and the header comment in src/terminal.ts now cover sides. Two new tests in src/terminal.test.ts cover the prompt (default, a listing deal, a refusal) and the label plus Y. The existing n and c tests gained the extra Enter for the new prompt.
- Unrelated speed work (point 2). I reverted the
listedWeakMap insrc/routes.tsand the collator insrc/week.tswith a plaingit revertof 1f21fc1. They are not in this pull. I'm not opening a separate pull for them. - Inconsistent refusals (point 3). An unknown side is now 422 on
/?side=and/week?side=, matching/api/deals, as the issue says. The assertion insrc/side.test.tsexpected 400 for/?side=seller; I changed it to 422 because that expectation was wrong.
I changed no contract cell and added no dependency.
What I ran: bun test src/terminal.test.ts src/side.test.ts passes (48 tests), and so do the tty/live tests.
To try it: in the terminal, press n and answer through the side prompt. Press o to open a deal, then Y to change its side, and w to see the labels on the week view. In a browser, /?side=seller now answers 422.
🤖 Generated with Claude Code
The preview failed because of one test I had missed, and I fixed it. The full suite now passes locally: 408 tests, 0 failures.
The failing test was "the terminal says so and opens a second deal only on a yes" in src/duplicate.test.ts. It presses the n key and answers each prompt in turn. The new side prompt on n was waiting for an answer the test never gave. I added the extra Enter, which takes the Buyer's agent default, to both places the test presses n. Only the test changed.
Two things I couldn't run here: bun x tsc --noEmit (the repo has no TypeScript dependency) and scripts/gate.ts (the repo has no such file). I didn't run design-lint, since no src/web/ file changed. The forge's check will be the first type check of this pull.
The rest of the pull is as in my earlier description:
- The terminal asks the side on
nand shows it on the deal, clock and week views. Yon a deal changes the side.- An unknown side returns 422 on every door.
- The two speed changes were reverted.
🤖 Generated with Claude Code
Earlier asks met: (1) the terminal now asks the side on n/c (enter is Buyer's agent, unknown words refused), shows the label, and Y changes it, with tests; (2) the unrelated speed changes were reverted; (3) /?side= and /week?side= now answer 422 like /api/deals. No contract cell changed, no dependency added, the change goes through permit. Note: my clone sat at main, so I read the terminal changes from the diff as given (it was cut off), and the preview only answered the anonymous landing page to my token.
Each deal now says which side the agent represents: buyer, listing or both. The full
bun testpasses (406 tests, none skipped) andlint:designis clean. I couldn't runbun x tsc --noEmit: the repo has notsconfig.jsonand no TypeScript dependency, so it prints help.scripts/gate.tsandscripts/fast.tsdon't exist here either. I haven't opened the preview.What changed
deal.sideisTEXT NOT NULL DEFAULT 'buyer'with a CHECK, added by an appended migration. Existing deals read as Buyer side.src/side.tsholds the three values, the labels,sideOf(blank means buyer, anything else is refused) andonSide(the filter).POST /deals/:id/side. An unknown side gets a 422 on the page, the API and MCP..side, fromsrc/pages/side.ts) on the clock lanes, the This week card, the deal's page, the printed week and the Closed and fell-through lists./week?side=works too, and an unknown side gets a 400./api/dealsandlist_dealsacceptside. The create and PATCH bodies and the deal JSON carry it. There is a new MCP tool,set_side.contract/openapi.jsonis regenerated. The README anddocs/TECHNICAL.mdare updated, and the new classes are named indocs/design/areas/side.md.src/side.test.tscovers the cases in the issue plus the OpenAPI/MCP/CSS side effects.src/server.test.tsgainsset_sidein its tool list, because a tool was added.Choices and what I left out
@media printto be scoped to the timeline page./reminders/todayis not narrowed by side. Its links carryqthrough many hrefs, and the issue didn't ask for it.contract.jsonis untouched and no dependency was added. Changing the side is an update of the deal, so it asks the existingpermitcell and is audited.To try it: open the preview, then choose Listing in the Side select beside Find and press Find. Only 9 Orchard Row remains. On a deal's page, change Side and save to see the label change. On
/deals/new, Side defaults to Buyer's agent.Closes #118