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

Every search door takes the same longest query, and no page echoes more of it than fits on a line #13862

Merged opened this

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

Merged

Every search door now takes the same longest query, 200 characters, and no page repeats more than 60 characters of it. The new test/query-limit.test.ts passes and tsc is clean. I ran about 15 of the explore, search, docs and API-reference test files, not the whole suite.

Notes

shipped production is serving it deploy 751373a

opened this

Every search door now takes the same longest query, 200 characters, and no page repeats more than 60 characters of it. The new test/query-limit.test.ts passes and tsc is clean. I ran about 15 of the explore, search, docs and API-reference test files, not the whole suite. scripts/fast.ts named 2,353 test files, too many to run here, and the forge runs the full check on the push. I did not run scripts/design-lint.ts: the one run I started got moved to the background and I never checked its output.

What changed

  • One limit. src/core/query_limit.ts holds MAX_QUERY_CHARS = 200 and the small helpers around it.

- It replaces the per-page numbers: core/search.ts MAX_QUERY, explore's 100, docs_link's 80 and the API reference page's 100. - Those pages and /explore, /search and /docs now use it. - The API reference page quietly goes from 100 to 200.

  • API. GET /api/v1/explore and GET /api/v1/search answer 422 with field: "q" and "q is at most 200 characters" when q is longer. A q of exactly 200 still gets a 200.
  • Pages. /explore, /search and /docs search the first 200 characters and show one line saying so (data-query-trimmed). The search box keeps only the capped query.
  • Echoes. The explore empty-state title, its filter chip's title and label, and the search heading, empty state and <title> show at most 60 characters, then an ellipsis. The docs empty state does the same.
  • Tests. test/query-limit.test.ts covers the 422 on both APIs, the trimmed note on all three pages, and the shortened empty title.
  • Existing test changed. test/search.test.ts had a "hostile queries" case that sent 4,000 characters and expected 200. That is now a 422 by design, so I lowered it to 200 characters.

Left alone

  • MCP search and the TUI still cap q their own way. The issue named the web doors only.
  • The sign-in and sign-up links on a page still carry the whole URL in their next= parameter.

To try it Open /explore?q= followed by 300 letters, or run curl -i '/api/v1/search?q=<201 letters>'.

Closes #13846

4 earlier comments
commented

Every search door now takes the same longest query, 200 characters, and no page repeats more than 60 characters of it. The new test/query-limit.test.ts passes and tsc is clean. I ran about 15 of the explore, search, docs and API-reference test files, not the whole suite. scripts/fast.ts named 2,353 test files, too many to run here, and the forge runs the full check on the push. I did not run scripts/design-lint.ts: the one run I started got moved to the background and I never checked its output.

What changed

  • One limit. src/core/query_limit.ts holds MAX_QUERY_CHARS = 200 and the small helpers around it.

- It replaces the per-page numbers: core/search.ts MAX_QUERY, explore's 100, docs_link's 80 and the API reference page's 100. - Those pages and /explore, /search and /docs now use it. - The API reference page quietly goes from 100 to 200.

  • API. GET /api/v1/explore and GET /api/v1/search answer 422 with field: "q" and "q is at most 200 characters" when q is longer. A q of exactly 200 still gets a 200.
  • Pages. /explore, /search and /docs search the first 200 characters and show one line saying so (data-query-trimmed). The search box keeps only the capped query.
  • Echoes. The explore empty-state title, its filter chip's title and label, and the search heading, empty state and <title> show at most 60 characters, then an ellipsis. The docs empty state does the same.
  • Tests. test/query-limit.test.ts covers the 422 on both APIs, the trimmed note on all three pages, and the shortened empty title.
  • Existing test changed. test/search.test.ts had a "hostile queries" case that sent 4,000 characters and expected 200. That is now a 422 by design, so I lowered it to 200 characters.

Left alone

  • MCP search and the TUI still cap q their own way. The issue named the web doors only.
  • The sign-in and sign-up links on a page still carry the whole URL in their next= parameter.

To try it Open /explore?q= followed by 300 letters, or run curl -i '/api/v1/search?q=<201 letters>'.

commented

<!-- look-pages b9415a35e3ea --> Look pages for b9415a3, from the gate:

  • look pages (inferred): this pull changes src/web/pages/api.ts, src/web/pages/docs_link.ts, src/web/pages/search.ts and 1 more; the forge pictures /docs (src/web/pages/docs_link.ts), /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
commented

The "both doors" gate failed because src/core/query_limit.ts is new but has no terminal screen or how-to. I added a "No door:" line in a new empty commit instead, and pushed it. bun scripts/gate.ts now passes that rule. I did not re-run tsc or the tests, since nothing in the code changed. The forge's check on the push is the real verdict.

query_limit.ts is an internal limit shared by search doors that already exist. A person can't reach it directly, so it needs no screen or how-to of its own.

The look-pages note from the gate on #13862 is informational. It infers /docs and /explore from the changed pages, and I made no "Looks:" or "No look:" override. The change keeps the same query limit and cuts how much of a query a page echoes, so no new page is added.

commented

<!-- look-pages 3ae283bb01a5 --> Look pages for 3ae283b, from the gate:

  • look pages (inferred): this pull changes src/web/pages/api.ts, src/web/pages/docs_link.ts, src/web/pages/search.ts and 1 more; the forge pictures /docs (src/web/pages/docs_link.ts), /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
commented

This feedback is the gate's automatic look-pages note again, now for 3ae283b. It asks for no code change, so I made no commit and pushed nothing.

The gate inferred /docs and /explore from the changed files (src/web/pages/api.ts, docs_link.ts, search.ts and one more). The pull changes how much of a search query those pages echo, capped at one line. It adds no components and changes no layout. The inferred pictures are fine to take as they are.

I did not add a "Looks:" or "No look:" override. The inference names the right pages, and an override would only hide them from the check.

If a person wants different pages pictured, say which and I'll add a "Looks: <path>" line in a commit.

Approved

Clean. One constant (200) in core/query_limit.ts is read by /explore, /search, /docs and both APIs. The preview answers 422 on /api/v1/search with a 201-character q. All three pages show the single data-query-trimmed line. Echoes are capped at 60 characters with an ellipsis. No new dependency, no secrets, output stays escaped, no markup beyond the existing muted small paragraph. Minor, not blocking: the search heading, title and docs empty state have no test of their own for the 60-character echo (only the explore title does), and readExploreLine slices by UTF-16 units while the rest counts code points.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs