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

The /search page keeps to the repository repo:owner/name names in q, as /api/… #17932

opened this in answer to

Merged 21h 20m ago, live in production

/search now keeps to a repo:owner/name written in q, as /api/v1/search and the MCP tool do, so /search?q=repo%3Atrevato%2Fforge+Modrinth searches only that repository. test/mcp-search.test.ts (with the new test) and test/mcp-size.test.ts pass, and tsc --noEmit and design-lint are clean.

Notes

opened this

/search now keeps to a repo:owner/name written in q, as /api/v1/search and the MCP tool do, so /search?q=repo%3Atrevato%2Fforge+Modrinth searches only that repository. test/mcp-search.test.ts (with the new test) and test/mcp-size.test.ts pass, and tsc --noEmit and design-lint are clean. I did not run the full suite or the dead-code test. The check will run the rest on this push.

What changed: The page takes the repo: qualifier out of the query before searching. The remaining words are what gets searched and what code hits are highlighted against, and the repository is passed to search() as the scope. Links, the form value and the title keep the full query, so chips stay scoped. A query without repo: behaves as before. All of it is in src/web/pages/search.ts, as the issue specified.

Unreadable or unknown repositories: A malformed, missing or unreadable repo: shows the same "No repository you can read is called…" note, so a private repository is never confirmed to exist.

Test: The new test sits in test/mcp-search.test.ts after the API scope test. It covers the scoped query, a capitalised REPO:, an unreadable repository reading the same as a missing one, and a bare repo:pebble. I did not confirm that it fails on main.

Not done:

  • The TUI palette has the same gap. I left it, as the issue says, so the commit carries "No door:".
  • The gate flagged readableRepo as 0.70 similar to searchScope in src/http/api.ts. I kept it as the issue's patch wrote it and did not fold the two together. Say if you want them merged.

Try it: open /search?q=repo%3Atrevato%2Fforge+Modrinth on the preview; it should list #17865 and #17867. Then open /search?q=repo%3Anope%2Fnone+x and expect the "No repository you can read" note.

[
  {"go": "/search?q=repo%3Atrevato%2Fforge+Modrinth", "look": "issue results", "expect": "only trevato/forge issues, including #17865 and #17867"},
  {"go": "/search?q=repo%3Anope%2Fnone+x", "look": "the status line under the search box", "expect": "No repository you can read is called “nope/none”; repo: takes owner/name."}
]

🤖 Generated with Claude Code

Closes #17931

8 earlier comments
commented

/search now keeps to a repo:owner/name written in q, as /api/v1/search and the MCP tool do, so /search?q=repo%3Atrevato%2Fforge+Modrinth searches only that repository. test/mcp-search.test.ts (with the new test) and test/mcp-size.test.ts pass, and tsc --noEmit and design-lint are clean. I did not run the full suite or the dead-code test. The check will run the rest on this push.

What changed: The page takes the repo: qualifier out of the query before searching. The remaining words are what gets searched and what code hits are highlighted against, and the repository is passed to search() as the scope. Links, the form value and the title keep the full query, so chips stay scoped. A query without repo: behaves as before. All of it is in src/web/pages/search.ts, as the issue specified.

Unreadable or unknown repositories: A malformed, missing or unreadable repo: shows the same "No repository you can read is called…" note, so a private repository is never confirmed to exist.

Test: The new test sits in test/mcp-search.test.ts after the API scope test. It covers the scoped query, a capitalised REPO:, an unreadable repository reading the same as a missing one, and a bare repo:pebble. I did not confirm that it fails on main.

Not done:

  • The TUI palette has the same gap. I left it, as the issue says, so the commit carries "No door:".
  • The gate flagged readableRepo as 0.70 similar to searchScope in src/http/api.ts. I kept it as the issue's patch wrote it and did not fold the two together. Say if you want them merged.

Try it: open /search?q=repo%3Atrevato%2Fforge+Modrinth on the preview; it should list #17865 and #17867. Then open /search?q=repo%3Anope%2Fnone+x and expect the "No repository you can read" note.

[
  {"go": "/search?q=repo%3Atrevato%2Fforge+Modrinth", "look": "issue results", "expect": "only trevato/forge issues, including #17865 and #17867"},
  {"go": "/search?q=repo%3Anope%2Fnone+x", "look": "the status line under the search box", "expect": "No repository you can read is called “nope/none”; repo: takes owner/name."}
]

🤖 Generated with Claude Code

commented

<!-- look-pages dd73b84d280c --> Look pages for dd73b84, from the gate:

  • look pages (none): this pull changes src/web/pages/search.ts but the forge could not trace the route of /, /docs, /explore and 29 more (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 added the look-pages line the gate asked for and pushed. The gate re-run on the push has not reported back yet.

The earlier commit spelled it Look:, which the gate does not read. The new commit says Looks: src/web/pages/search.ts, with a Try: line. It is an empty commit and changes no code.

The other three refusals the feedback lists don't apply. The change adds no test that uses as never, and the commits already name #17931. I did not run the dead-code test. readableRepo has a caller, so I expect it to pass.

The terminal side is still open. The TUI palette has the same gap, and the "No door:" line in the first commit says it is left for its own change. I kept that, since the issue puts it out of scope.

commented

<!-- look-pages 766722fe8efb --> Look pages for 766722f, from the gate:

  • look pages (none): this pull changes src/web/pages/search.ts but the forge could not trace the route of /, /docs, /explore and 29 more (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

The /search page, /api/v1/search, the MCP search tool and the terminal palette now resolve a repo:owner/name through one core function and give the same answers. The touched tests, the dead-code test and tsc pass. I did not run the whole suite.

One lookup. readableRepoNamed(db, user, named) in src/core/search.ts returns the repo only if the viewer can read it, and undefined for malformed, missing or unreadable names. A small ownerAndName next to it keeps the API's 422 for a malformed name. The page's own copy is deleted. searchScope in api.ts and repoArg in mcp/shared.ts now call the core function. repoArg keeps its bare-name and "did you mean" handling.

Terminal door. The palette in src/tui/forge_parts.ts strips repo: and scopes the search through the same function. An unreadable repo gives one row, "No repository you can read is called “x”", with the hint "repo: takes owner/name". It is the same row whether the repo is private or does not exist. A new test in test/mcp-search.test.ts covers the scoped result, a capitalised REPO:, and private versus missing. It fails without the src/ changes.

Docs. The how-to is a short "Keeping to one repository" section in docs/features/search-finds-guides.md.

On main. I did not run the new page test or the terminal test against main itself. The terminal test fails with the src/ changes stashed.

Not done. The unknown-repo page still has no kind chips. I read your note as "keep the form, which you do" and left the chips alone; say if you want them added.

The gate still flags a 0.57 similarity between readableRepoNamed and rejoinableParent in sever_undo.ts. That is a different lookup, so I left it. The look-pages note repeats because the forge cannot trace the /search route. The latest commit carries Looks: src/web/pages/search.ts, and a reviewer needs to judge that one.

[
  {"go": "/search?q=repo%3Atrevato%2Fforge+Modrinth", "look": "issue results", "expect": "only trevato/forge issues, including #17865 and #17867"},
  {"go": "/search?q=repo%3Anope%2Fnone+x", "look": "status line under the form", "expect": "No repository you can read is called “nope/none”; repo: takes owner/name."}
]

🤖 Generated with Claude Code

commented

<!-- look-pages e74ecbb16c21 --> Look pages for e74ecbb, from the gate:

  • look pages (none): this pull changes src/web/pages/search.ts but the forge could not trace the route of /, /docs, /explore and 29 more (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

<!-- look-pages f95c53edd0f2 --> Look pages for f95c53e, from the gate:

  • look pages (none): "Looks: /search" is not a page of app.looks in forge.json; this pull changes src/web/pages/search.ts but the forge could not trace the route of /, /docs, /explore and 29 more (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

That note is about f95c53e, where Looks: /search named a path that isn't in app.looks. I pushed 03a36e8 after it, with a No look: line giving the reason. Running the gate locally on that commit prints no look-pages warning. I have not seen the forge's own check on it yet.

I picked No look: because /search isn't a declared look page, so no Looks: path would pass. A reviewer should open /search?q=repo%3Atrevato%2Fforge+Modrinth on the preview. The two review steps in the earlier description still apply.

No code changed in this round. The pull is otherwise as described in my last message: one core lookup for repo:, shared by the page, the API, the MCP tool and the terminal palette, with the docs section and tests.

commented

/search keeps to the repository a repo:owner/name in q names, the same as GET /api/v1/search, the MCP search tool and now the terminal palette (ctrl+p). The four doors look the repository up through one function in core.

What moved where

  • One lookup. readableRepoNamed(db, user, named) in src/core/search.ts returns the repository only if the viewer can read it. For a malformed, missing or unreadable name it returns undefined, so a private repository answers exactly like one that does not exist. ownerAndName beside it keeps the API's 422 for a malformed name.
  • Callers. The page, searchScope in src/http/api.ts, repoArg in src/http/mcp/shared.ts and the palette in src/tui/forge_parts.ts all call it. repoArg keeps its bare-name and "did you mean" handling. The page's own copy is deleted.
  • Page (src/web/pages/search.ts):
    • The search runs on the words without repo: and passes the repository to search() as its scope.
    • Code highlighting and the guides-first test use those words too.
    • Links, the form value and the title keep the whole query.
    • A query without repo: behaves as before.
  • Unknown repository. The page shows the form, the kind chips (their links keep the whole query, so a typo can still reach every kind) and one sentence: No repository you can read is called “X”. Use owner/name after repo:. The palette shows the same sentence as one row.
  • Docs. A "Keeping to one repository" section in docs/features/search-finds-guides.md.

Tests (test/mcp-search.test.ts)

  • The page test covers: scoped results, a capitalised REPO:, private and missing repositories giving the same note, a malformed repo:pebble, the chips keeping the whole query, and the wording of the note.
  • The palette test covers the same scoping and the same refusal.
  • Run against main's src/ (e16b19a), the page test fails at toContain("alice/pebble #1") and the palette test at toContain("issue:alice/pebble#1").
  • On this branch, test/mcp-search.test.ts, test/mcp-size.test.ts, test/search-docs.test.ts and test/unused-exports.test.ts pass. tsc --noEmit and design-lint are clean.

Left as is

  • The gate says readableRepoNamed is 0.57 like rejoinableParent in src/actions/sever_undo.ts. That function finds a fork's former parent, a different lookup, so I left them apart.
  • /search is not a page in app.looks in forge.json, so the commits carry No look: with that reason.

Try it on the preview

[
  {"go": "/search?q=repo%3Atrevato%2Fforge+Modrinth", "look": "issue results", "expect": "only trevato/forge issues, including #17865 and #17867"},
  {"go": "/search?q=repo%3Anope%2Fnone+x", "look": "under the search form", "expect": "the five kind chips (All, Apps & repos, Issues & pull requests, Pull requests, Code), then: No repository you can read is called “nope/none”. Use owner/name after repo:."},
  {"go": "/search?q=repo%3Anope%2Fnone+x", "look": "the Code chip's link", "expect": "it keeps repo:nope/none in q", "ask": "Does following a chip after a typo keep the whole query, so fixing the repo name is one edit?"}
]

🤖 Generated with Claude Code

Sign in to join this conversation.

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

Keyboard shortcuts

Docs