Public: anyone can read this; the crew can change it.
/explore filters live in the URL: minimum forks, updated within, kind, with the same words in the explorer MCP tool #14133
Check · Review · Land · Live done — Landed and live in production.
Most of this was already on main, so this pull adds only minforks. What was already there: URL filters: /explore already takes kind, since (the same window as updated) and forks as GET parameters. Commits acec0d9bf and e1c236f17 did that.
shipped production is serving it deploy 6521495
5 earlier comments · 2 events
Most of this was already on main, so this pull adds only min_forks.
What was already there:
- URL filters:
/explorealready takeskind,since(the same window asupdated) andforksas GET parameters. Commitsacec0d9bfande1c236f17did that. - Form and chips: the plain GET form and the removable chips were already in place, and each active filter shows as a chip.
- MCP tool: the explorer MCP tool already takes the same fields as its own arguments, with no new tool.
What changed:
min_forksis now the floor thatforkssets. It works on the page, the API and the MCP tool, andforkswins if both are given. The change is insrc/actions/explore.ts, plus one schema property insrc/http/mcp/tools/explore.ts.test/explorer-filters.test.tsis new. It covers each of the three filters, bad values, andforkswinning overmin_forks.bun teston the new file,test/mcp-size.test.tsand the two existing explore-url test files passes (27 tests). The type check andscripts/gate.ts --fixcame back clean.
What I left out:
- No 400 on the page for a bad value. The page deliberately answers 200 with a note that names the bad value and shows the unfiltered list. An existing test (#11819) requires that. The API already answers 422 with the field name. I did not overturn that decision. If you want 400, it is a small follow-up that also changes that test.
- No new chip UI. The existing chips already cover this.
Try it: open /explore?min_forks=2&since=7d&kind=app.
🤖 Generated with Claude Code
Pushed a fix for the stale tool table. It should clear one of the four red tests, and I can't confirm the other three from here.
Cause: my edit to the explore tool's doc string changed its row in the generated table in docs/MCP.md, and I hadn't regenerated it. I ran bun scripts/mcp-table.ts and committed the result. test/mcp-table.test.ts, test/mcp-size.test.ts and test/explorer-filters.test.ts now pass (21 tests).
The other three failures:
- Terminal variants and client list:
test/tui-variants.test.tsandtest/client-list.test.tspass in my sandbox, and they never touch the explore tool. They could be flakes or be caused by the table row. I made no change for them, so I'm waiting on the next check for those. - Crew concurrency: I didn't run this test locally. It hit a 30-second timeout and has nothing to do with explore filters, so I expect it to be a timing flake.
If any of them fail again, send me the log and I'll look.
/explore now accepts min_forks=N as the forks floor, the same as forks:N in the filter line. It works on the page, the explore API and the explorer MCP tool's new min_forks argument. For example, /explore?min_forks=2&since=7d&kind=app opens the filtered view.
The check failed on the "both doors" rule because the change touches src/actions/explore.ts and the MCP explore tool but nothing under src/tui/. I added no terminal code. The terminal's explorer line already takes forks:N through parseExploreQuery, and min_forks is only another name for it in URLs and arguments. I recorded that as a No door: line in a new empty commit, and the gate passes locally with it.
I only re-ran scripts/gate.ts here; I did not re-run tsc or the tests this turn. The tests from the earlier commit are in test/explorer-filters.test.ts. The forge will run the full check on this push.
The preview works for good values: /explore?min_forks=2&since=7d&kind=app narrows the list and shows a removable chip. Two things are missing.
- (Fix first) Box 1 asks for a 400 naming the parameter on a bad value. /explore?min_forks=abc answers 200 with a note and the unfiltered list. Return 400 naming the parameter, and update the #11819 test that pins 200, saying so in the pull. Alternatively get the owner to relax the box; I cannot.
- docs/features/explore.md does not mention min_forks (or since). Add a line there; it is the how-to home, not README.
Also, the new tests only exercise the line parser. Add one that requests the page or API with min_forks and checks the result.
The No door note is acceptable because the TUI already takes forks:N.
/explore and GET /api/v1/explore now answer 400 naming min_forks when it isn't a whole number from 0 to 1000. abc, -1 and 1001 all get it. The page still renders, with the note "min_forks is not a count — use a whole number from 0 to 1000". The API returns {error:"invalid", field:"min_forks"}.
The explore, filter, parity and numbers tests pass, 62 across four files. I ran no wider set here: scripts/fast.ts named 2393 test files for this diff, so I stopped that run and ran only those four. tsc --noEmit was clean, and bun scripts/gate.ts --fix was run but its output was cut off by the same timeout, so I did not see the result. Nothing was re-run after the push.
What changed:
- Parameter: it is validated in
badMinForks(src/actions/explore.ts), used by the page and the API. Ifforksis also given,forkswins andmin_forksis not checked. - Docs:
docs/features/explore.mdhas amin_forksrow in its parameter table, sayingforks=wins when both are given and that a bad value is a 400 namingmin_forks. I added no row or line forsince; it is not in the table or the prose. - Test:
test/explore-url.test.tsnow fetches the page and the API over HTTP. A goodmin_forksnarrows the list, andabc,-1and1001give a 400 namingmin_forkson both.min_forks=0is accepted on the API only; the page is not requested with0.
Not changed, and a point of disagreement: since and kind still answer a noted 200 with the unfiltered list on the page, as the #11819 test pins. I did not edit that test because min_forks was never in it, and making every bad filter a 400 would change the page for all existing links. If you want that too, say so and I will do it with the test change. The new 400 applies to min_forks only.
The earlier "No door" note still applies. The terminal takes forks:N already, and this is only the URL parameter's refusal, so I added no src/tui/ code.
<!-- look-pages c8f9f6f0b7a8 --> Look pages for c8f9f6f, from the gate:
look pages (inferred): this pull changes src/web/studio/explore.ts; the forge pictures /explore (src/web/studio/explore.ts), the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
One thing left, and it is the issue's first box: a bad value is a 400 naming the parameter. On the preview that holds for min_forks only (page and API both 400). /explore?since=9y and ?kind=nope still answer 200 on the page with the unfiltered list, and the API answers 400 unknown_filter for since and 422 for kind, none with field naming since/kind. Fix first: make the page 400 for a bad since/updated/kind the same way badMinForks does (naming the parameter), give the API the same field, and update the #11819 test that pins the noted 200, saying so in the pull. Everything else from the earlier round is met: min_forks is validated at the boundary, documented in docs/features/explore.md, accepted by the MCP tool, mcp-table regenerated, and tested. Non-blocking: the 400 page is built by cloning the drawn Response; fine, but a short comment on why the page still renders would help.
/explore filters can now be set in the URL with min_forks, since (or updated) and kind. The page, GET /api/v1/explore and the explorer MCP tool all take the same names. A bad value for any of these four parameters is a 400 that names the parameter, on the page and the API.
What changed in this round
- One check for all four.
badMinForksis nowbadExploreParaminsrc/actions/explore.ts. It returns{ field, message }, for examplesince is not a window — use 1d, 7d, 30d. The message names the parameter and never repeats the value, so there is nothing to escape. Like the one-line form,sinceis only checked whenupdatedis absent, andmin_forksonly whenforksis absent. - Page. A bad value gets a 400, and the page still draws the note over the unfiltered list. A good filter next to the bad one still applies. A comment now explains why the page still draws and why the response is copied: to keep its headers, security floor included.
- API. The response is
400 { error: "invalid", field, message }. A badkindused to get a422; it now gets this same 400, so all four answer the same way. A badsortkeeps its 422. A bad word typed intoqkeeps its 400unknown_filter. - MCP tool. No change: it already rejected every unknown value.
Tests changed because the behaviour changed on purpose (they were not wrong before):
test/explore-url.test.ts: the #11819 test (a badkind/updated/sincewas a 200 with a note) now expects 400. A badsortstays 200. The #11232sincetest now expects 400.test/explore-url-filters.test.tsandtest/explore-since.test.ts: the noted 200 for a badsince/kindis now 400.test/explore-api-paging.test.ts: a badkindis now 400 withfield: "kind".- New test: each of
since,updatedandkind(and a badsincenext to a goodkind) gets a 400 naming the parameter on both the page and the API. Good values still get a 200, uppercasekind=APPincluded.
docs/features/explore.md describes the new refusal.
Left as they were: sort, mine, archived and live given as separate parameters still get a 200 with a note on the page. They are outside this issue's three filters.
Checks: bun x tsc --noEmit and bun scripts/design-lint.ts pass, and bun scripts/gate.ts --fix raised nothing to fix. scripts/fast.ts named 2,393 test files, too many to run here, so I ran the explore and MCP-explore suites (38 files, 301 pass, 0 fail) and left the full suite to the forge's check.
To try it: on the preview, /explore?since=9y and /explore?kind=nope show the page with the note, and /api/v1/explore?since=9y returns {"error":"invalid","field":"since",…}, all with status 400. /explore?since=7d&kind=app&min_forks=1 narrows the list.
🤖 Generated with Claude Code
Earlier asks are met: a bad min_forks, since, updated or kind is a 400 naming the parameter on the page and the API. The preview confirms it: /explore?since=9y, ?kind=nope and ?min_forks=abc all answer 400, and so do the matching /api/v1/explore calls with the field named. A good combination (min_forks=2&since=7d&kind=app) answers 200. The MCP tool takes min_forks through its existing action and the tools table is regenerated. Tests cover each filter and each bad value, and the old 200 expectations were changed on purpose. The docs are in docs/features/explore.md, not the README. The terminal already reads forks: in its line, so the No door note stands. Non-blocking: the for (const field of ["sort"] as const) loop in src/http/api.ts now has one entry and could be a plain block.
Most of this was already on main, so this pull adds only
min_forks.What was already there:
/explorealready takeskind,since(the same window asupdated) andforksas GET parameters. Commitsacec0d9bfande1c236f17did that.What changed:
min_forksis now the floor thatforkssets. It works on the page, the API and the MCP tool, andforkswins if both are given. The change is insrc/actions/explore.ts, plus one schema property insrc/http/mcp/tools/explore.ts.test/explorer-filters.test.tsis new. It covers each of the three filters, bad values, andforkswinning overmin_forks.bun teston the new file,test/mcp-size.test.tsand the two existing explore-url test files passes (27 tests). The type check andscripts/gate.ts --fixcame back clean.What I left out:
Try it: open
/explore?min_forks=2&since=7d&kind=app.🤖 Generated with Claude Code
Closes #14046