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

The 404 page offers a search for what was asked, and a stranger Create an account beside Sign in #8582

Merged opened this

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

Merged

A 404 now offers a search for what was asked, and a signed-out visitor gets Create an account beside Sign in.

shipped production is serving it deploy eb43263

opened this

A 404 now offers a search for what was asked, and a signed-out visitor gets Create an account beside Sign in.

  • Search button: a GET 404 that isn't plain shows "Search for ‘<segment>’", linking to /search?q=<segment>. The segment is the last path segment, URL-decoded, trimmed to 100 characters and escaped. It is omitted when the segment is empty, the path is /, or the segment can't be decoded. Signed-in visitors get it too.
  • Create an account: signed out, it links to /signup beside Sign in. Signed in, neither button shows.
  • plain 404s: a dead /go/:code is unchanged, with neither new button.
  • Where: notFoundPage and a small askedFor helper in src/web/chrome.ts.
  • Tests: a new case in test/web-ui.test.ts covers both buttons, a %3Cx%3E segment rendering as &lt;x&gt;, the 100-character trim, and the signed-in case. test/web-origins.test.ts now asserts the dead /go/ page has no search link and no signup link.
  • Existing test changed: the "hidden and absent 404 are byte-identical" check now also scrubs the echoed search label and q=. The new button repeats the visitor's own path, so the two pages differ only in what the visitor typed. I changed it for that reason; the check itself still holds.

bun test on test/web-ui.test.ts and test/web-origins.test.ts passes (64 tests), and the design lint is clean. I didn't see the tsc output or scripts/gate.ts results, so I can't say they passed. To try it, open /nope signed out, then signed in, and /nope/%3Cx%3E.

Closes #8483

commented

A 404 now offers a search for what was asked, and a signed-out visitor gets Create an account beside Sign in.

  • Search button: a GET 404 that isn't plain shows "Search for ‘<segment>’", linking to /search?q=<segment>. The segment is the last path segment, URL-decoded, trimmed to 100 characters and escaped. It is omitted when the segment is empty, the path is /, or the segment can't be decoded. Signed-in visitors get it too.
  • Create an account: signed out, it links to /signup beside Sign in. Signed in, neither button shows.
  • plain 404s: a dead /go/:code is unchanged, with neither new button.
  • Where: notFoundPage and a small askedFor helper in src/web/chrome.ts.
  • Tests: a new case in test/web-ui.test.ts covers both buttons, a %3Cx%3E segment rendering as &lt;x&gt;, the 100-character trim, and the signed-in case. test/web-origins.test.ts now asserts the dead /go/ page has no search link and no signup link.
  • Existing test changed: the "hidden and absent 404 are byte-identical" check now also scrubs the echoed search label and q=. The new button repeats the visitor's own path, so the two pages differ only in what the visitor typed. I changed it for that reason; the check itself still holds.

bun test on test/web-ui.test.ts and test/web-origins.test.ts passes (64 tests), and the design lint is clean. I didn't see the tsc output or scripts/gate.ts results, so I can't say they passed. To try it, open /nope signed out, then signed in, and /nope/%3Cx%3E.

commented

The failure doesn't come from my change, and I haven't pushed anything new.

The log shows SQLiteError: database or disk is full in test/migrate-token-reach.test.ts on shard 57. The other failures on that shard look like fallout from it: servers.stop and status.mockRestore are undefined because the setup crashed before it assigned them. That points to the check machine's disk filling up, not to the 404 page.

I re-ran the files named in the log here: mcp-backups-test, feed-interact, forks-ranking, hardening, number-retired and never-lost. All 38 tests pass. Earlier I also ran web-ui.test.ts and web-origins.test.ts, the two files I touched, and those pass too (64 tests).

The check needs a re-run on a machine with free disk. I'd rather not push an empty commit just to trigger it. If the failure repeats with a different cause, send me the log and I'll look at it.

Approved

Reads right: the search button is a real link that works with JavaScript off, the echoed segment is escaped and capped, plain 404s stay bare, and the tests cover each branch. The pull is a small change with one purpose. I could not see the buttons on the preview because it sits behind the edge login, so this is judged from the source and tests. Two things I would do next: (1) behind a platform edge signInHref already returns /signup for a stranger, so Sign in and Create an account would point at the same place; drop one in that case. (2) A trailing slash (/kim/nothing/) yields an empty segment and so no search button; take the last non-empty segment.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs