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

A Find box on the clock narrows it to the deals whose address, client or party name matches what the agent types, and works without JavaScript #43

Merged opened this

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

Merged

The clock now has a Find box that narrows the deals, This week and today's reminders to the deals matching what you type, and it works without JavaScript. The route tests, the new find tests and the design and timeline tests pass.

Notes

shipped production is serving it deploy d2eada7

opened this

The clock now has a Find box that narrows the deals, This week and today's reminders to the deals matching what you type, and it works without JavaScript. The route tests, the new find tests and the design and timeline tests pass. I did not run the full suite, bun x tsc --noEmit or scripts/gate.ts, because the repo has no tsconfig.json and no scripts/gate.ts. bun scripts/design-lint.ts doesn't exist either; the repo's scripts/lint-design.ts ran with no output.

  • Matching: src/find.ts does the work. find(deals, q) takes plain deals and returns plain deals. It matches on address and on every party's name and contact, trimmed and case-insensitive. query(value) is the boundary check: at most 100 characters, no control characters, otherwise it returns undefined. src/find.test.ts covers address, party name, contact, case, empty and no-match.
  • The form: src/pages/clock.ts adds a <form method=get role=search> above the clock, with one q field labelled "Find a deal". The echoed value is escaped, and a Clear link appears once something is typed.
  • Narrowing: the clock, Closed, This week and today's drafts all use the filtered list. Header untouched.
  • No match: the page shows "No deal matches “…”" with a Clear link, and the This week and reminders cards are hidden so it stays one line. An empty q is the whole clock.
  • Bad input: src/routes.ts returns a 400 in the app's refused style, with no stack trace.
  • Live refresh: static/live.js already refetches location.href, so /events refreshes keep ?q= with no change to the script.
  • Docs and styling: the README's sample-deals walk now says how to find a deal. The new .find class is in static/app.css, placed before the print rules that timeline.test.ts guards, and named in docs/design/areas/find.md.
  • Route test: the new test in src/server.test.ts covers narrowing by address fragment, escaping, the no-match line and the 400s. It checks that a harbor search leaves exactly one lane, not that a specific other deal is absent, because deal ids in that suite aren't fixed.

The issue says to match "client name", but a deal has no client field. The client is the buyer or seller party, so party names already cover it.

I did not touch the contract table, the API, MCP or the terminal. Find is a page filter only; the other doors are unchanged.

To try it, open /?q=harbor on the preview.

🤖 Generated with Claude Code

Closes #38

1 earlier comment · 1 event
commented

The clock now has a Find box that narrows the deals, This week and today's reminders to the deals matching what you type, and it works without JavaScript. The route tests, the new find tests and the design and timeline tests pass. I did not run the full suite, bun x tsc --noEmit or scripts/gate.ts, because the repo has no tsconfig.json and no scripts/gate.ts. bun scripts/design-lint.ts doesn't exist either; the repo's scripts/lint-design.ts ran with no output.

  • Matching: src/find.ts does the work. find(deals, q) takes plain deals and returns plain deals. It matches on address and on every party's name and contact, trimmed and case-insensitive. query(value) is the boundary check: at most 100 characters, no control characters, otherwise it returns undefined. src/find.test.ts covers address, party name, contact, case, empty and no-match.
  • The form: src/pages/clock.ts adds a <form method=get role=search> above the clock, with one q field labelled "Find a deal". The echoed value is escaped, and a Clear link appears once something is typed.
  • Narrowing: the clock, Closed, This week and today's drafts all use the filtered list. Header untouched.
  • No match: the page shows "No deal matches “…”" with a Clear link, and the This week and reminders cards are hidden so it stays one line. An empty q is the whole clock.
  • Bad input: src/routes.ts returns a 400 in the app's refused style, with no stack trace.
  • Live refresh: static/live.js already refetches location.href, so /events refreshes keep ?q= with no change to the script.
  • Docs and styling: the README's sample-deals walk now says how to find a deal. The new .find class is in static/app.css, placed before the print rules that timeline.test.ts guards, and named in docs/design/areas/find.md.
  • Route test: the new test in src/server.test.ts covers narrowing by address fragment, escaping, the no-match line and the 400s. It checks that a harbor search leaves exactly one lane, not that a specific other deal is absent, because deal ids in that suite aren't fixed.

The issue says to match "client name", but a deal has no client field. The client is the buyer or seller party, so party names already cover it.

I did not touch the contract table, the API, MCP or the terminal. Find is a page filter only; the other doors are unchanged.

To try it, open /?q=harbor on the preview.

🤖 Generated with Claude Code

Changes requested — before the latest push

The web side is sound: the query is bounded and control characters are refused at the boundary, the echo is escaped, GET only, no contract cell touched. Two changes are needed.

  1. (Fix first) The terminal has no Find. The review rule is that what a person does on the page they can do in src/tty.ts. src/terminal.ts has dates, week and reminders views, and none of them can be narrowed. Add a find key, for example /, that takes a query. It must go through query() and find() and narrow all three views, with a way to clear it. It also needs a test in src/terminal.test.ts, and the README must say how to use it in the terminal. The pull said it left the terminal alone; the direction asks for both doors.
  1. Tests. The README promises that This week and today's reminders narrow, but no test checks that. Add a server test that a search for one deal leaves the other deal out of This week and out of the reminders. Add one for the no-match page hiding the #today card. The Closed card is also untested.

Smaller points are in the line comments.

commented

The Find box now has a terminal door too, and the untested claims have tests. The find, server, terminal, timeline and design tests pass (68 tests). I did not run the full suite or a type check, because the repo has no tsconfig.json or scripts/gate.ts. scripts/lint-design.ts ran with no output.

  • Terminal:

- / in the dates, week or reminders view opens a "Find a deal" prompt. It goes through query() and find(), the same two functions the page uses. - All three views narrow to the match. Pressing / and then enter with nothing typed clears it. - While a find is active, a "Finding “…”" line shows above the view. A miss says "No deal matches “…”". - The prompt stops accepting text at 100 characters, so an over-long query is truncated and not refused with a message. Control characters are refused by query(). - The key hints list / find, and src/terminal.ts carries a header note about it. - The test in src/terminal.test.ts covers narrowing, the miss, the 100-character cap and clearing. The README now says how to use it in the terminal.

  • Server tests:

- A new test searches for one sample deal and checks the other is gone from This week and from today's reminders. - A miss hides the #today and #week cards. - A deal I closed in the test shows in the Closed card when searched for, and is absent when another deal is searched.

  • Code tidy: the nested ternary in src/pages/clock.ts is now a separate nothing const, and .find sits above the "On paper" comment in static/app.css.

I did not add the terminal command to docs/TECHNICAL.md; the README covers it.

🤖 Generated with Claude Code

Approved

Approved. The earlier asks are met: the terminal door exists (/ prompt, uses the same query()/find() as the page, reads still go through listDeals for the caller so a guest sees nothing private), the server tests cover week, reminders, Closed and the miss, the README covers page and terminal, and the nested ternary is gone. Input is bounded and control characters refused at the boundary, the echo is escaped (tested), the filter is read-only, and contract.json is untouched. I could not diff against 207754eca37e (commit not in the clone), so I judged the full change. Non-blocking: docs/TECHNICAL.md does not mention the terminal key.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs