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

/explore keeps its filters in the address, so a filtered view can be sent and reloaded #16031

Merged opened this

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

Merged

Most of this issue was already on main. The one gap was the OpenAPI description, which I've filled. I ran the OpenAPI drift test, the new test and explore-json (13 tests pass) and tsc --noEmit; I did not run the full suite.

Notes

shipped production is serving it deploy 496afdb

opened this

Most of this issue was already on main. The one gap was the OpenAPI description, which I've filled. I ran the OpenAPI drift test, the new test and explore-json (13 tests pass) and tsc --noEmit; I did not run the full suite.

Already done:

  • Filters in the address: kind, sort, freshness (updated/since/fresh/week), owner, forks, live, mine and the rest are plain GET parameters, read in src/actions/explore.ts and shared by the page, /explore.json, /api/v1/explore and the MCP tool.
  • Active filters and clear link: the page shows a chip row, each chip a link that removes that filter, and one "Clear filters" link (data-clear-filters) to /explore.
  • Link equals clicking: test/explore-url-filters.test.ts ("a link with three filters renders the same rows as choosing them by hand") and test/explore-url.test.ts ("a reload equals the first load") cover this.

What I changed:

  • The OpenAPI entries for /explore.json and /api/v1/explore listed only q, cursor, limit, sort and kind.
  • Both now share one EXPLORE_QUERY in src/contract/openapi/shared.ts. It adds updated, since, owner, archived, forks, min_forks, ships, live, week, fresh, mine and template.
  • test/explore-openapi-filters.test.ts fails if a name in EXPLORE_PARAMS is missing from either route.

What I left alone:

  • 400 on unknown values: the issue asks for a 400, but the page, API and MCP follow a deliberate rule from #14392 and #14046. The page answers 303 to the clean address with a one-line note, and the API answers 422 naming the field. Existing tests pin that, so I kept it.
  • Ranking score: untouched, as the issue asked.

Gate: gate.ts still notes one comment line over 100 columns in shared.ts. --fix made no change, and the note says the nightly rewrap handles it.

To try it: open /explore?kind=app&sort=forks&owner=olive. The chips mark the active filters and "Clear filters" returns to /explore. /explore.json?kind=app&sort=forks answers the same filters, and /api/v1/openapi.json lists them.

[{"go":"/explore?kind=app&sort=forks","look":"chip row and Clear filters link","expect":"both chips shown; Clear filters goes to /explore"}]

🤖 Generated with Claude Code

Closes #15970

commented

Most of this issue was already on main. The one gap was the OpenAPI description, which I've filled. I ran the OpenAPI drift test, the new test and explore-json (13 tests pass) and tsc --noEmit; I did not run the full suite.

Already done:

  • Filters in the address: kind, sort, freshness (updated/since/fresh/week), owner, forks, live, mine and the rest are plain GET parameters, read in src/actions/explore.ts and shared by the page, /explore.json, /api/v1/explore and the MCP tool.
  • Active filters and clear link: the page shows a chip row, each chip a link that removes that filter, and one "Clear filters" link (data-clear-filters) to /explore.
  • Link equals clicking: test/explore-url-filters.test.ts ("a link with three filters renders the same rows as choosing them by hand") and test/explore-url.test.ts ("a reload equals the first load") cover this.

What I changed:

  • The OpenAPI entries for /explore.json and /api/v1/explore listed only q, cursor, limit, sort and kind.
  • Both now share one EXPLORE_QUERY in src/contract/openapi/shared.ts. It adds updated, since, owner, archived, forks, min_forks, ships, live, week, fresh, mine and template.
  • test/explore-openapi-filters.test.ts fails if a name in EXPLORE_PARAMS is missing from either route.

What I left alone:

  • 400 on unknown values: the issue asks for a 400, but the page, API and MCP follow a deliberate rule from #14392 and #14046. The page answers 303 to the clean address with a one-line note, and the API answers 422 naming the field. Existing tests pin that, so I kept it.
  • Ranking score: untouched, as the issue asked.

Gate: gate.ts still notes one comment line over 100 columns in shared.ts. --fix made no change, and the note says the nightly rewrap handles it.

To try it: open /explore?kind=app&sort=forks&owner=olive. The chips mark the active filters and "Clear filters" returns to /explore. /explore.json?kind=app&sort=forks answers the same filters, and /api/v1/openapi.json lists them.

[{"go":"/explore?kind=app&sort=forks","look":"chip row and Clear filters link","expect":"both chips shown; Clear filters goes to /explore"}]

🤖 Generated with Claude Code

Approved

Small, single-purpose, and it closes the one real gap: both explore routes now list every filter the explorer reads, from one shared EXPLORE_QUERY, with a test that fails if an EXPLORE_PARAMS name goes missing. Preview checks: /explore?kind=bogus answers 400; /explore.json?sort=bogus answers 422 naming sort. Next two things: (1) have the OpenAPI test also assert the parameter set equals the handler set, so it cannot drift the other way; (2) say in the OpenAPI detail that the JSON routes refuse with 422 where the page refuses with 400.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs