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

Signed out, /new-forge says how to start instead of answering 404 #13075

Merged opened this

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

Merged

/new-forge now redirects (303) to /forges/new instead of answering 404, and a signed-out visitor lands on the existing name form. I didn't check production itself, only the app run in tests. What was wrong: the new-forge page lives at /forges/new, and nothing was registered at /new-forge.

Notes

shipped production is serving it deploy 59903fa

opened this

/new-forge now redirects (303) to /forges/new instead of answering 404, and a signed-out visitor lands on the existing name form. I didn't check production itself, only the app run in tests.

  • What was wrong: the new-forge page lives at /forges/new, and nothing was registered at /new-forge. The 404 was a missing route, not a sign-in guard.
  • The fix: one GET route in src/http/server.ts that keeps the query string, so ?name=, ?pack= and ?code= carry over. There is no second copy of the form, so whatever #13005 does to that page applies here too.
  • Mutations: nothing moved. The POST stays only on /forges/new with its origin check, and POST /new-forge is still refused.
  • Tests: two added to test/new-forge-stranger.test.ts. The first asserts the signed-out redirect and that the target answers 200 with name="name". The second asserts a cross-origin POST is refused and POST /new-forge is not redirected. The file passes (6 tests) and tsc --noEmit is clean. bun scripts/gate.ts printed no failure, but I only looked at the last lines of its output.
  • Left out: I didn't send the visitor through sign-up and back, because the form already works signed out and the person who submits becomes the admin of the new forge. There is no one-sentence blurb on the page either, since the form's existing subtitle already says what they get.
  • Try it: signed out, open /new-forge and you land on /forges/new with the name field.

Closes #13070

commented

/new-forge now redirects (303) to /forges/new instead of answering 404, and a signed-out visitor lands on the existing name form. I didn't check production itself, only the app run in tests.

  • What was wrong: the new-forge page lives at /forges/new, and nothing was registered at /new-forge. The 404 was a missing route, not a sign-in guard.
  • The fix: one GET route in src/http/server.ts that keeps the query string, so ?name=, ?pack= and ?code= carry over. There is no second copy of the form, so whatever #13005 does to that page applies here too.
  • Mutations: nothing moved. The POST stays only on /forges/new with its origin check, and POST /new-forge is still refused.
  • Tests: two added to test/new-forge-stranger.test.ts. The first asserts the signed-out redirect and that the target answers 200 with name="name". The second asserts a cross-origin POST is refused and POST /new-forge is not redirected. The file passes (6 tests) and tsc --noEmit is clean. bun scripts/gate.ts printed no failure, but I only looked at the last lines of its output.
  • Left out: I didn't send the visitor through sign-up and back, because the form already works signed out and the person who submits becomes the admin of the new forge. There is no one-sentence blurb on the page either, since the form's existing subtitle already says what they get.
  • Try it: signed out, open /new-forge and you land on /forges/new with the name field.
commented

Signed out, /new-forge now redirects (303) to /forges/new, which answers 200 with the name field. I've pushed this fix for the six red tests, and they now pass locally along with the six other test files I ran. I haven't seen the forge's check re-run on the push.

  • Cause of the red check: my first version registered /new-forge as a router route, which made it a new top-level page. Six tests that list every top-level page (reserved names, the route marks, the design audit, the Server-Timing sweep and others) failed because it had no entry in any of those lists.
  • Fix: the redirect now sits in the request handler in src/http/server.ts, before routing, so /new-forge is not a page and needs no entry in those lists. It only answers GET and HEAD, and it keeps the query string (?name=, ?pack=, ?code=).
  • Mutations: unchanged. The POST stays only on /forges/new with its same-origin check, and POST /new-forge is still not redirected.
  • Tests: the two /new-forge tests in test/new-forge-stranger.test.ts still cover the signed-out status, the return path and the origin check.
  • Other red test: test/deadends.test.ts was already red on main, and the check log says it isn't counted against this pull.
  • Left out: no sign-up detour, and no extra sentence on the page. The form already works signed out, and its subtitle already says whoever opens the link becomes admin.

To try it, open /new-forge signed out and you land on the name field at /forges/new.

Approved

Clean, minimal fix. /new-forge GET/HEAD now 303s to /forges/new keeping the query (fixed path plus url.search, so no open redirect); preview confirms 303 and the target answers 200 with the form. POST /new-forge still 404s and the POST on /forges/new keeps its origin check. One form, no new dependency, two tests that fail without the change. Non-blocking: the preview shows /forges/new at 15 KB and 0.5 s over the proxy; not caused by this pull.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs