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

A signed-out 404 offers sign-in that comes back to the same address #4114

Parked opened this
Closed without merging

A signed-out visitor who hits a 404 on a GET now sees a "Sign in" button next to "Go home". It leads back to the address they asked for. bun x tsc --noEmit and test/web-ui.test.ts pass (25 tests); I didn't run the rest of the suite.

Notes

stopped parked by the crew

opened this

A signed-out visitor who hits a 404 on a GET now sees a "Sign in" button next to "Go home". It leads back to the address they asked for. bun x tsc --noEmit and test/web-ui.test.ts pass (25 tests); I didn't run the rest of the suite.

What changed

  • notFoundPage (src/web/chrome.ts): The button reuses the existing signInHref(ctx), so the next value is the path plus query, URL-encoded. On a platform edge that same helper sends the visitor to the edge login (or to /signup for an edge-made account) rather than /signin.
  • Signed in or non-GET: A signed-in 404, or a 404 on any non-GET, renders exactly as before.
  • Existence: The button appears whether or not the thing exists. A hidden private repository and a missing one still render the same page, apart from the echoed address.
  • Tests (test/web-ui.test.ts): One test covers a signed-out GET of a private repository's link: the Sign in link carries the right next, and hidden and absent pages are identical once the echoed address is scrubbed. It also checks that a signed-in 404 has no sign-in link. A second test checks that safeNext refuses //evil.example, https://… and backslash paths.
  • Existing test changed: The raw-route "conflates not-found" test compares a hidden and a missing repository byte for byte. Its scrub now also drops the echoed next= value, which differs by path. I changed the test, not the behaviour.

Left out

  • The 404 responses for POST and other mutations get no link, as the issue says "GET requests only".
  • Wherever the visitor comes back to is decided by the existing sign-in flow, which I didn't touch.

Closes #4111

commented

A signed-out visitor who hits a 404 on a GET now sees a "Sign in" button next to "Go home". It leads back to the address they asked for. bun x tsc --noEmit and test/web-ui.test.ts pass (25 tests); I didn't run the rest of the suite.

What changed

  • notFoundPage (src/web/chrome.ts): The button reuses the existing signInHref(ctx), so the next value is the path plus query, URL-encoded. On a platform edge that same helper sends the visitor to the edge login (or to /signup for an edge-made account) rather than /signin.
  • Signed in or non-GET: A signed-in 404, or a 404 on any non-GET, renders exactly as before.
  • Existence: The button appears whether or not the thing exists. A hidden private repository and a missing one still render the same page, apart from the echoed address.
  • Tests (test/web-ui.test.ts): One test covers a signed-out GET of a private repository's link: the Sign in link carries the right next, and hidden and absent pages are identical once the echoed address is scrubbed. It also checks that a signed-in 404 has no sign-in link. A second test checks that safeNext refuses //evil.example, https://… and backslash paths.
  • Existing test changed: The raw-route "conflates not-found" test compares a hidden and a missing repository byte for byte. Its scrub now also drops the echoed next= value, which differs by path. I changed the test, not the behaviour.

Left out

  • The 404 responses for POST and other mutations get no link, as the issue says "GET requests only".
  • Wherever the visitor comes back to is decided by the existing sign-in flow, which I didn't touch.
commented

Parked by the crew: the check failed ("origins on the web > /go/:code redirects a signed-out phone, and dead codes are one 404") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs