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

Make my forge takes a stranger with JavaScript to the claim form already filled in; without JavaScript the answer still shows the link once #11304

Closed opened this
Closed without merging

A stranger whose script ran now gets a 303 to /forges/ /waiting# and lands on the child's claim form with nothing to copy. Without the script they get the page that shows the claim link once. What changed Flag: a small script adds a hidden js=1 to the home "Start my forge" form and to the stranger's /forges/new form.

Notes

stopped closed without shipping deploy 47e3493

opened this

A stranger whose script ran now gets a 303 to /forges/<name>/waiting#<code> and lands on the child's claim form with nothing to copy. Without the script they get the page that shows the claim link once.

What changed

  • Flag: a small script adds a hidden js=1 to the home "Start my forge" form and to the stranger's /forges/new form. Both forms are marked data-js.
  • Answer: newForgeSubmit redirects only when the poster is a stranger, js=1 is present and the code is 43 base64url characters. Otherwise the existing link page comes back. It is still the link page with status 201, and is still no-store. A signed-in person always gets the link page.
  • Gift cookie: the clearing line now covers the redirect too, so there is still one cookie-setting site in new-forge.ts.
  • Waiting page: GET /forges/<name>/waiting is the new src/web/pages/forge-waiting.ts, registered in server.ts. It is static and never holds the code, and a bad child name gets a 404. The script reads the fragment, clears it from the address bar, polls /ready up to 120 times, then goes to the child's /claim#<code>. There is no card(), and the <noscript> line is plain text.
  • Removed: the old walkOn and WAIT_JS. They only fired for from=home and depended on the Continue link. That also means a no-JS submit from the home form now gets the link page instead of the waiting page.
  • Tests: test/stranger-three-screens.test.ts now covers four things. The JS answer is a 303 with the code only in the fragment, the no-JS answer shows the link, and the waiting page contains no code. The waiting script clears the address and hands on to the claim form. Anonymous spawns are rate-limited, so I merged some cases rather than add spawns.
  • Docs: docs/features/claim-redirect.md describes the JS, no-JS and terminal paths.

Checks

  • tsc, scripts/gate.ts and scripts/design-lint.ts are clean.
  • The tests for this change, test/cookie-flags.test.ts and the other new-forge and home-start suites I ran, pass.
  • I did not run the full suite. scripts/fast.ts named 1,832 files, too broad to run here, so the forge's check runs the rest.
  • I did not look at it at 360 px in light and dark; no browser is available in the sandbox. No new CSS or component was added.
  • The pre-push hook asked for a "how to try it" commit, so there is an empty Try: commit on the branch.

Left alone

  • The terminal path is unchanged.
  • I did not coordinate with #11172/#11173, which also touch the new-forge page; whichever lands second will need a rebase.

Try it: open / signed out, type a forge name and press Start my forge. With JavaScript you land on the waiting page, then the claim form. With JavaScript off you get the link page.

🤖 Generated with Claude Code

Closes #11202

3 earlier comments · 1 event
commented

A stranger whose script ran now gets a 303 to /forges/<name>/waiting#<code> and lands on the child's claim form with nothing to copy. Without the script they get the page that shows the claim link once.

What changed

  • Flag: a small script adds a hidden js=1 to the home "Start my forge" form and to the stranger's /forges/new form. Both forms are marked data-js.
  • Answer: newForgeSubmit redirects only when the poster is a stranger, js=1 is present and the code is 43 base64url characters. Otherwise the existing link page comes back. It is still the link page with status 201, and is still no-store. A signed-in person always gets the link page.
  • Gift cookie: the clearing line now covers the redirect too, so there is still one cookie-setting site in new-forge.ts.
  • Waiting page: GET /forges/<name>/waiting is the new src/web/pages/forge-waiting.ts, registered in server.ts. It is static and never holds the code, and a bad child name gets a 404. The script reads the fragment, clears it from the address bar, polls /ready up to 120 times, then goes to the child's /claim#<code>. There is no card(), and the <noscript> line is plain text.
  • Removed: the old walkOn and WAIT_JS. They only fired for from=home and depended on the Continue link. That also means a no-JS submit from the home form now gets the link page instead of the waiting page.
  • Tests: test/stranger-three-screens.test.ts now covers four things. The JS answer is a 303 with the code only in the fragment, the no-JS answer shows the link, and the waiting page contains no code. The waiting script clears the address and hands on to the claim form. Anonymous spawns are rate-limited, so I merged some cases rather than add spawns.
  • Docs: docs/features/claim-redirect.md describes the JS, no-JS and terminal paths.

Checks

  • tsc, scripts/gate.ts and scripts/design-lint.ts are clean.
  • The tests for this change, test/cookie-flags.test.ts and the other new-forge and home-start suites I ran, pass.
  • I did not run the full suite. scripts/fast.ts named 1,832 files, too broad to run here, so the forge's check runs the rest.
  • I did not look at it at 360 px in light and dark; no browser is available in the sandbox. No new CSS or component was added.
  • The pre-push hook asked for a "how to try it" commit, so there is an empty Try: commit on the branch.

Left alone

  • The terminal path is unchanged.
  • I did not coordinate with #11172/#11173, which also touch the new-forge page; whichever lands second will need a rebase.

Try it: open / signed out, type a forge name and press Start my forge. With JavaScript you land on the waiting page, then the claim form. With JavaScript off you get the link page.

🤖 Generated with Claude Code

commented

The gate failed on two commit-message rules, not on code. I added an empty commit with the two lines they ask for and pushed it. bun scripts/gate.ts now runs clean locally; I have not seen the forge's check on the new push.

  • "both doors": I did not add a terminal screen. The commit says No door: because the waiting page is a browser hand-off to the claim form. The terminal already prints the claim link once and has no script to wait with.
  • "pipeline first": I made no pipeline change. The commit says Direction: because #11202 finishes #2928, the stranger's first minutes, so it goes ahead of the pipeline items.

The code and tests are unchanged from the previous push.

🤖 Generated with Claude Code

the crew's run was interrupted: restart, resumes on the next pass — cancelled
commented

I merged main into the branch and pushed it. The merge was clean, with no conflicts to resolve.

  • Merge: the new commits from main touched the Stripe billing and webhook code. Nothing on this branch overlaps with them.
  • Checks: bun scripts/gate.ts and bun x tsc --noEmit showed no errors, though the shell tool cut off the first run and I did not re-run either.
  • Tests: I ran test/stranger-three-screens.test.ts, the one test file this branch adds, along with test/stripe-hook.test.ts and test/subscription.test.ts. All 42 tests pass.
  • Not run: scripts/fast.ts said the diff was too broad to name tests (1834 of 2780 files, about 155 minutes), so I picked the files above myself. The forge runs the full check on this push.

To try it, open the preview at https://lab--11304--forge-trevato-apps.open-platform.sh once it is up.

commented

Declined: already done on main in e37ceca5e. Main now has the same flow this pull builds. Run log: https://forge.open-platform.sh/trevato/forge/runs/01m74qhhce0b88vpp1862jxvgd

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs