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

A People page lists each person on the agent's deals with every open date they owe, across all deals, soonest first, so one call covers them all #49

Merged opened this

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

Merged

/people now lists each person on the agent's deals once, with every open date they owe across deals, soonest first. GET /api/people and the listpeople MCP tool return the same data. I ran the people, server, openapi, contract, design and security tests and bun run lint:design, and all passed.

Notes

shipped production is serving it deploy d2eada7

opened this

/people now lists each person on the agent's deals once, with every open date they owe across deals, soonest first. GET /api/people and the list_people MCP tool return the same data. I ran the people, server, openapi, contract, design and security tests and bun run lint:design, and all passed. I did not run bun x tsc --noEmit, because the repo has no tsconfig.json and the bare invocation only prints help. I also did not run the full suite; the forge runs it on push.

What changed

  • Grouping: src/people.ts is the pure grouping function. Parties with the same contact (trimmed, case-insensitive) become one person under their newest name, with all their roles. With no contact, the name is the key.
  • Ordering: each person's open dates are sorted by due date, then address. People who owe nothing open come last.
  • Page: src/pages/people.ts renders each person as a card with name, roles and contact. Each open date is a link to /deals/:id with the date label, address, due date and overdue/soon/upcoming badge. People with nothing open show "Nothing open". The page sends no script, and its classes are listed in docs/design/areas/people.md.
  • Header: signed-in viewers see Clock and People links in the header.
  • Access: reading goes through listDeals, which asks permit for deal list. contract.json is unchanged. Signed out, the page and the API both answer 401.
  • API description: routes outside a resource's api path had no contract cell. I added an optional cell to Api in src/routes.ts, which src/openapi.ts falls back to. /api/people declares deal/list, and contract/openapi.json is regenerated.
  • Tests: src/people.test.ts covers the matching function. A test in src/server.test.ts covers the page, API, MCP and anon refusal, with Priya Nair's two deals as the shared-lender case. The MCP tool list in that test is updated.
  • Docs: the README walk points at People with Priya Nair, who works both 1418 Alder Lane and 9 Orchard Row. src/sample.ts already had her, so I left it alone. docs/TECHNICAL.md is updated.

What I chose differently or left out

  • Open dates on a closed deal are not listed, matching how the clock and This week treat closed deals. The person still appears.
  • If two parties on one deal share a role, each of them is shown as owing that role's dates.
  • There is no terminal command for People; the issue didn't ask for one.
  • The rebase onto origin/main was a no-op, so there were no conflicts with #13 or #20 at push time.

To try it: sign in, open People in the header, and look at Priya Nair's two dates from different deals.

🤖 Generated with Claude Code

Closes #30

2 earlier comments · 1 event
commented

/people now lists each person on the agent's deals once, with every open date they owe across deals, soonest first. GET /api/people and the list_people MCP tool return the same data. I ran the people, server, openapi, contract, design and security tests and bun run lint:design, and all passed. I did not run bun x tsc --noEmit, because the repo has no tsconfig.json and the bare invocation only prints help. I also did not run the full suite; the forge runs it on push.

What changed

  • Grouping: src/people.ts is the pure grouping function. Parties with the same contact (trimmed, case-insensitive) become one person under their newest name, with all their roles. With no contact, the name is the key.
  • Ordering: each person's open dates are sorted by due date, then address. People who owe nothing open come last.
  • Page: src/pages/people.ts renders each person as a card with name, roles and contact. Each open date is a link to /deals/:id with the date label, address, due date and overdue/soon/upcoming badge. People with nothing open show "Nothing open". The page sends no script, and its classes are listed in docs/design/areas/people.md.
  • Header: signed-in viewers see Clock and People links in the header.
  • Access: reading goes through listDeals, which asks permit for deal list. contract.json is unchanged. Signed out, the page and the API both answer 401.
  • API description: routes outside a resource's api path had no contract cell. I added an optional cell to Api in src/routes.ts, which src/openapi.ts falls back to. /api/people declares deal/list, and contract/openapi.json is regenerated.
  • Tests: src/people.test.ts covers the matching function. A test in src/server.test.ts covers the page, API, MCP and anon refusal, with Priya Nair's two deals as the shared-lender case. The MCP tool list in that test is updated.
  • Docs: the README walk points at People with Priya Nair, who works both 1418 Alder Lane and 9 Orchard Row. src/sample.ts already had her, so I left it alone. docs/TECHNICAL.md is updated.

What I chose differently or left out

  • Open dates on a closed deal are not listed, matching how the clock and This week treat closed deals. The person still appears.
  • If two parties on one deal share a role, each of them is shown as owing that role's dates.
  • There is no terminal command for People; the issue didn't ask for one.
  • The rebase onto origin/main was a no-op, so there were no conflicts with #13 or #20 at push time.

To try it: sign in, open People in the header, and look at Priya Nair's two dates from different deals.

🤖 Generated with Claude Code

Changes requested — before the latest push

Two misses against the list; everything else (permit via listDeals, no loosened cell, escaping, 401 for anon, tests for grouping/order/closed deals) looks right.

  1. Both doors: People is not in src/tty.ts. The page, API and MCP have it, the terminal does not. Add a People view there (e.g. a key from the deal list), gated through the same listDeals/permit path, using people() from src/people.ts, with a test, and say the key in the README next to the existing terminal keys. "The issue did not ask" does not hold: the bar is that anything a person does on the page works in the terminal.
  1. Contract: /api/people is a new door but has no row in src/contract.test.ts. Add the deal/list row for GET /api/people (and list_people over MCP if that table covers tools) so the table audit knocks on it.

Minor cleanups while there: in src/routes.ts the new import type { Verb } from ./can.ts sits above the bun:sqlite/node imports, so put it with the other local imports; and the nav in src/pages/layout.ts shows Clock/People links on every page, so confirm design-lint is still clean and the new .btn markup matches existing nav classes.

commented

I've addressed both misses and the cleanups, and pushed to the same branch. The terminal, contract, openapi and server tests pass (72 tests), and bun run lint:design is clean. I didn't run bun x tsc --noEmit: the repo has no tsconfig.json, so it only prints help. The forge's full check runs on the push.

  • Terminal: P opens a People view, listed on the header line and in the key hints. It calls listDeals (so permit) and then people(), and shows each person with their roles, contact and open dates, or "Nothing open". A test in src/terminal.test.ts has two deals sharing one lender and checks the lender appears once, with dates from both deals. It also checks that a guest sees nobody. The README names the key (P) next to the page, and docs/TECHNICAL.md says the terminal view matches the page.
  • Contract test: a new test in src/contract.test.ts runs every identity through listDeals, which is the call GET /people, GET /api/people and list_people all make. It checks the result against what permit(who, "deal", "list") says.
  • Where I disagree: src/contract.test.ts holds a table of actions per resource and cell, with no row for a route or tool. A "deal/list row for GET /api/people" has nowhere to go there, so I added the separate test instead. src/openapi.test.ts already requires every /api/ route to name its cell, and /api/people names deal/list.
  • Import: the Verb import in src/routes.ts now sits with the local imports.
  • Nav: the Clock and People links in src/pages/layout.ts use the same button button-quiet classes as Sign in. They are hidden when signed out. Design-lint is clean.

I made no change to contract.json.

🤖 Generated with Claude Code

commented

The failing deploy tests are fixed and pushed. A full bun test run here now passes: 157 tests, 0 failures.

Cause: my People server test made an anonymous GET /api/people call. The door limits how many API calls a stranger can make from one address, and every test file in a single run shares that limit. My extra call used up the allowance. The audit tests and the "stranger is refused" test then got 429 instead of 401.

Fix: I removed that one anonymous fetch from src/server.test.ts. Anon is still refused on the page (401 on /people). The contract test I added earlier checks that listDeals refuses anon, and /api/people, list_people and the page all use that call.

Not run here: bun x tsc --noEmit, because the repo has no tsconfig.json.

🤖 Generated with Claude Code

Approved

People page, GET /api/people, list_people and the terminal P view all read through listDeals (permit deal/list); contract.json is untouched, so no cell is loosened. Output is escaped, the page ships no script, and the preview refuses a signed-out caller with 401. Tests cover grouping, ordering, closed deals, the page, API and MCP agreeing, the terminal view and a guest being refused, plus a per-identity contract test. README and TECHNICAL.md are updated. Non-blocking: the anonymous /api/people check was dropped to avoid the shared rate limit, so the API's 401 for strangers is covered only through the page and the listDeals contract test. I could not fetch the earlier review head (55b84af4f3d0) in the clone, so I judged the current change in full; the earlier asks as the builder describes them (terminal door, contract test, import placement, nav) are all present.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs