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

/api/v1/search answers kind=pulls (and kind=issues meaning issues only), so a narrowed search returns N of the kind asked for #17001

Merged opened this

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

Merged

/api/v1/search now takes kind=pulls, and kind=issues now returns issues only. The limit counts whichever kind you asked for. kind=all is unchanged.

Notes

opened this

/api/v1/search now takes kind=pulls, and kind=issues now returns issues only. The limit counts whichever kind you asked for. kind=all is unchanged. The search, CLI and MCP search tests I ran pass and tsc is clean. I did not run the full suite, so the forge's full check on this push is the first full run.

  • Query: searchLocalIssues in src/core/search.ts takes an optional only that adds AND kind = 'issue' or 'pull' inside each per-repository arm. A repository with many issues can no longer crowd the pulls out of the window. The value is a literal chosen from the type, never caller text. Live origin hits are filtered to the same kind.
  • Validation and wording: searchKind accepts pulls, and the invalid_kind message, the MCP message, the OpenAPI refusal text and the blank-q note now list it.
  • CLI: forge search --kind … --limit … goes to the API as given, and narrowConversations and its 100-hit workaround are gone. docs/CLI.md is updated.
  • Web: /search?kind=pulls draws the conversations section, which now holds only pulls. I added no new component.
  • Tests: test/search.test.ts seeds 150 issues and 5 pulls that match one query. kind=pulls&limit=5 returns exactly the 5 pulls, kind=issues&limit=100 returns 100 issues and no pulls, and kind=all still includes pulls. The CLI test now asserts the flags pass straight through. Two tests that asserted the old kind wording (test/mcp-search.test.ts and test/search-note.test.ts) now expect pulls in the list.
  • Left out: the search page's kind chips do not offer "Pulls". The URL works, but there is no button. A client that sent kind=issues and relied on pulls coming back with it now gets issues only, which is what the issue asked for.
  • Reused: I added no new function. I extended searchLocalIssues and the existing searchKind and searchRefusal.

To try it, open /search?q=retry&kind=pulls, or run forge search retry --kind pulls --limit 5.

[{"go":"/search?q=retry&kind=pulls","look":"the results list","expect":"only pulls appear, no issues"},{"go":"/search?q=retry&kind=issues","look":"the results list","expect":"only issues appear, no pulls"}]

Closes #7633

3 earlier comments
commented

/api/v1/search now takes kind=pulls, and kind=issues now returns issues only. The limit counts whichever kind you asked for. kind=all is unchanged. The search, CLI and MCP search tests I ran pass and tsc is clean. I did not run the full suite, so the forge's full check on this push is the first full run.

  • Query: searchLocalIssues in src/core/search.ts takes an optional only that adds AND kind = 'issue' or 'pull' inside each per-repository arm. A repository with many issues can no longer crowd the pulls out of the window. The value is a literal chosen from the type, never caller text. Live origin hits are filtered to the same kind.
  • Validation and wording: searchKind accepts pulls, and the invalid_kind message, the MCP message, the OpenAPI refusal text and the blank-q note now list it.
  • CLI: forge search --kind … --limit … goes to the API as given, and narrowConversations and its 100-hit workaround are gone. docs/CLI.md is updated.
  • Web: /search?kind=pulls draws the conversations section, which now holds only pulls. I added no new component.
  • Tests: test/search.test.ts seeds 150 issues and 5 pulls that match one query. kind=pulls&limit=5 returns exactly the 5 pulls, kind=issues&limit=100 returns 100 issues and no pulls, and kind=all still includes pulls. The CLI test now asserts the flags pass straight through. Two tests that asserted the old kind wording (test/mcp-search.test.ts and test/search-note.test.ts) now expect pulls in the list.
  • Left out: the search page's kind chips do not offer "Pulls". The URL works, but there is no button. A client that sent kind=issues and relied on pulls coming back with it now gets issues only, which is what the issue asked for.
  • Reused: I added no new function. I extended searchLocalIssues and the existing searchKind and searchRefusal.

To try it, open /search?q=retry&kind=pulls, or run forge search retry --kind pulls --limit 5.

[{"go":"/search?q=retry&kind=pulls","look":"the results list","expect":"only pulls appear, no issues"},{"go":"/search?q=retry&kind=issues","look":"the results list","expect":"only issues appear, no pulls"}]
commented

<!-- look-pages a08e5c4e8d73 --> Look pages for a08e5c4, from the gate:

  • look pages (none): this pull changes src/web/pages/search.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

/api/v1/search now answers kind=pulls, and kind=issues returns issues only. A narrowed search therefore returns N results of the kind asked for. The CLI's forge search --kind … --limit … passes both straight through.

The new commit changes no code. It only supplies the lines the gate asked for:

  • Look pages: a No look: line says the src/web/pages/search.ts change is one passed-through query parameter, and the page is /search?q=retry&kind=pulls. The gate's /settings/security/controls trace looks spurious to me. I think the gate mis-traced the route, so I didn't name that page.
  • Name the issue: Direction: … (#7633).
  • Both doors: a No door: line says web, CLI and API already share the kind parameter, and all three were updated in the first commit.

gate --explain reports 0 failing rules.

  • Comment width: the one note is a comment over 100 columns in src/actions/search.ts. gate --fix rewrapped nothing, so I left it for the nightly rewrap.
  • Dead code and as never: the gate's dead-code and test-honesty rules pass. I didn't touch the tests for as never.

bun x tsc --noEmit is clean. test/search.test.ts and test/cli-search.test.ts pass, 29 tests.

To try it, open /search?q=retry&kind=pulls, or run forge search retry --kind pulls --limit 5.

commented

Both of sentinel's points are fixed, and I've pushed the branch. bun x tsc --noEmit, the design lint and the tests that cover search all pass. Those are test/search-page.test.ts, test/search.test.ts and test/search-docs.test.ts. I didn't run the full suite; the forge's check does that on the push.

  • Page: /search now has a Pull requests chip after "Issues & pull requests". It is an <a> to kind=pulls and shows as current there. A new test in test/search-page.test.ts checks the link and the current state. It sits beside the existing "Issues & pull requests" chip and the page still shows pulls in the issues section.
  • Terminal: the palette search (ctrl+k) takes a leading pulls:, so pulls: retry searches pull requests only, the same as kind=pulls. It is wired in forgeSearch in src/tui/forge.ts. A new test in test/search-docs.test.ts checks it.
  • How-to: sentinel named client-search.md, but that file is about searching the forges you sent, not /search. I put a "Narrowing to pull requests" section in docs/features/search-finds-guides.md instead. It covers the chip, the API kind=pulls and kind=issues, the CLI --kind pulls --limit 5 and the pulls: prefix.
  • Commit line: it is "Direction: … (#7633)".

I left two things alone:

  • The pulls: prefix is the only terminal narrowing. I didn't add an issues: prefix.
  • The gate notes an over-long comment in src/actions/search.ts that I didn't touch. It says the nightly rewrap will handle it on main.
Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs