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

The client list can be searched by name or email with a plain GET box that survives a reload #14656

Merged opened this

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

Merged

/forges now has a search box. ?q= narrows the client list by forge name, the person it was sent for, or the claimant's email, ignoring case. It's a plain GET form with no script, so it survives a reload.

Notes

shipped production is serving it deploy 4ec2c16

opened this

/forges now has a search box. ?q= narrows the client list by forge name, the person it was sent for, or the claimant's email, ignoring case. It's a plain GET form with no script, so it survives a reload. The new tests and the existing client-filter tests pass, and tsc, the gate and design-lint are clean. I didn't run the full suite.

  • Search: it works on the in-memory rows, so it's a substring match in src/spawn/client_search.ts. There is no SQL or LIKE pattern, and %, _ and \ are ordinary characters. That covers the issue's risk about binding q as a parameter and escaping wildcards. It also means the issue's src/spawn/clients.ts is untouched.
  • Input: q is trimmed, control characters are dropped, and it's capped at 80 characters. An empty q shows everyone.
  • Page: the page change is in src/web/pages/forges.ts. The box keeps your text and works together with the state and sort links, which now carry q. When nothing matches, it says No forges match "…" with a "Clear the search" link.
  • Tests: test/client-search.test.ts covers a match, no match, a hostile q, wildcards, and the cap.
  • Left out: no live-as-you-type filtering and no highlighting of the match. I also didn't search app names or the terminal screen's client list.

Try it: open /forges, type part of a name or email, and press Enter.

[{"go":"/forges?q=mar","look":"the search box and the list","expect":"the box holds 'mar' and only matching forges show"},{"go":"/forges?q=zzz","look":"the empty message","expect":"No forges match \"zzz\" with a Clear the search link back to /forges"}]

🤖 Generated with Claude Code

Closes #14641

5 earlier comments · 1 event
commented

/forges now has a search box. ?q= narrows the client list by forge name, the person it was sent for, or the claimant's email, ignoring case. It's a plain GET form with no script, so it survives a reload. The new tests and the existing client-filter tests pass, and tsc, the gate and design-lint are clean. I didn't run the full suite.

  • Search: it works on the in-memory rows, so it's a substring match in src/spawn/client_search.ts. There is no SQL or LIKE pattern, and %, _ and \ are ordinary characters. That covers the issue's risk about binding q as a parameter and escaping wildcards. It also means the issue's src/spawn/clients.ts is untouched.
  • Input: q is trimmed, control characters are dropped, and it's capped at 80 characters. An empty q shows everyone.
  • Page: the page change is in src/web/pages/forges.ts. The box keeps your text and works together with the state and sort links, which now carry q. When nothing matches, it says No forges match "…" with a "Clear the search" link.
  • Tests: test/client-search.test.ts covers a match, no match, a hostile q, wildcards, and the cap.
  • Left out: no live-as-you-type filtering and no highlighting of the match. I also didn't search app names or the terminal screen's client list.

Try it: open /forges, type part of a name or email, and press Enter.

[{"go":"/forges?q=mar","look":"the search box and the list","expect":"the box holds 'mar' and only matching forges show"},{"go":"/forges?q=zzz","look":"the empty message","expect":"No forges match \"zzz\" with a Clear the search link back to /forges"}]

🤖 Generated with Claude Code

commented

<!-- look-pages 3914927091c1 --> Look pages for 3914927, from the gate:

  • look pages (none): this pull changes src/web/pages/forges.ts but the forge could not trace the route of /settings/security/controls (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

I pushed a fix for the three gate messages. Only the "pipeline first" one was a hard failure. I ran bun scripts/gate.ts after the commit, but I haven't seen the forge's check pass.

  • Both doors: I added docs/features/client-search.md. The commit message also carries a No door: line explaining that the terminal client list has no search, so the web page and the how-to are the door for now.
  • Pipeline first: the commit message now has a Direction: line naming #14641. This is a justification for putting the feature ahead of pipeline work, not a pipeline change.
  • Look pages: the gate message about /settings/security/controls is advisory and still appears. My Looks: /forges line was rejected locally because /forges isn't a page listed under app.looks in forge.json. A No look: <why> line in a later commit would clear it if the reviewer wants it gone.

The search code is unchanged, so its tests still stand from the first push.

🤖 Generated with Claude Code

commented

<!-- look-pages 596ff838fd80 --> Look pages for 596ff83, from the gate:

  • look pages (none): "Looks: /forges" is not a page of app.looks in forge.json; this pull changes src/web/pages/forges.ts but the forge could not trace the route of /settings/security/controls (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

I pushed a commit that adds a No look: line, in answer to the look-pages note. The code is unchanged, and I haven't seen the forge's check run on it.

/forges can't be a Looks: page. It isn't in forge.json app.looks, and it needs a signed-in owner with forges already sent. Adding it to the capture list would mean changing how looks are captured, which is outside this issue. The new line says that, and test/client-search.test.ts covers the route instead.

If you'd rather have a captured look, say so and I'll add /forges to looksAsOwner with a seeded client.

🤖 Generated with Claude Code

Changes requested — before the latest push

Search itself is sound: in-memory substring match, no SQL, q capped and escaped, tests for match, no match and hostile q. One miss against the list: the terminal door.

Fix first: add the client search to the terminal's client list screen in src/tui/ (entry where AGENTS.md says), reusing parseClientQuery/searchClients, gated exactly as the page is, with a test. The commit's "No door:" line is not a reason the list lets pass; the list says what a person does on the page they can do in the terminal. Then update docs/features/client-search.md to describe both doors.

Also: the state counts (All (N), Active (N)) ignore q, so with a search active the counts disagree with the rows shown. Count over the searched rows, or say so. Direction is pipeline first; this feature is ahead of the pipeline items, so keep it to this one small pull.

commented

Both points are fixed and pushed. tsc, the gate and the three affected test files pass locally (33 tests); I haven't seen the forge's check run on this push.

  • Terminal door: Forges you sent now has a / key that opens a search box. It reuses parseClientQuery and searchClients, and the screen is still offered to admins only, as the page is. It combines with f (state). No match reads No forges match "…" · / to change the search, and an empty query shows everyone again. The change is in src/tui/screens/forges.ts.
  • Counts: All (N) and the state counts on the page are now computed over the searched rows, so they agree with the list. A new page test checks this.
  • Tests:
    • test/tui-forges.test.ts covers the search lines and the / flow through the real screen.
    • I changed one existing assertion there, the header line, because it now also names / to search. The old assertion was wrong only for the new wording.
  • Docs: docs/features/client-search.md now describes the web page and the terminal, and the counts.
  • Commit message: the earlier No door: line is superseded by the terminal door, so I didn't repeat it.

🤖 Generated with Claude Code

Approved

Approved. The search is an in-memory substring match, so there is no SQL and no LIKE pattern. q is trimmed, stripped of control characters, capped at 80, and escaped on output. It is a plain GET form, so it works with JavaScript off and survives a reload. The sort and state links carry q, and the counts are taken over the searched rows. The terminal has the same search on / through the shared parseClientQuery and searchClients, and docs/features/client-search.md covers both doors, with nothing added to README. Tests cover match, no match, a hostile q, wildcards, the cap, the counts, and the terminal flow.

I did not sign in to the preview, so I did not use /forges there; this rests on the diff and its tests.

Two things I would do next:

  1. Give the search input a visible label, or at least check it on a 360px screen. At present only the placeholder and aria-label name it, and the placeholder disappears once someone types.
  2. Keep the Clear link from dropping the state filter. When a state is active, it could return to /forges?state=…&sort=… instead of /forges?sort=….

Direction note: this is a feature ahead of the pipeline-first list. It is small and single-purpose, so I am not blocking on it.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs