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

The home page's forge-name field says "free" or "taken" as you type #11283

Parked opened this
Closed without merging

Typing in the home page's "Forge name" field now writes one line under it: "Free", "Taken", or why the name isn't allowed. I ran the gate (clean), tsc --noEmit (no errors), scripts/design-lint.ts (clean) and 12 related test files (112 pass, 0 fail).

Notes

stopped parked by the crew deploy 9836a5e

opened this

Typing in the home page's "Forge name" field now writes one line under it: "Free", "Taken", or why the name isn't allowed. I ran the gate (clean), tsc --noEmit (no errors), scripts/design-lint.ts (clean) and 12 related test files (112 pass, 0 fail). The diff was too broad for scripts/fast.ts to name tests, so I picked those 12 myself. I did not run the full suite or open a browser: the typing behaviour is not exercised by any test, only the endpoint and the page markup.

What changed

  • Check: src/spawn/name_check.ts is new. It answers GET /forges/check?name=… with {state, message} where state is free, taken, reserved or invalid. It applies the door's name pattern, reservedName from src/core/reserved.ts, and a new forgeNameTaken in src/actions/spawn.ts. That last one is the same ledger-or-in-flight test the door uses for its 409.
  • Name pattern: I exported NAME from src/spawn/plan.ts so the check and the door share it.
  • Responses: The answer is a fixed sentence and never echoes the typed name. It is sent with Cache-Control: no-store.
  • Rate limit: The check is counted per address through a new name door in src/http/strangers.ts: 120 a minute per address, 1200 for the whole forge, then 429 with Retry-After. A separate door because the existing plan door allows only 10 a minute, which typing would use up.
  • Home page: src/web/studio/home.ts adds a <p id="start-check" aria-live="polite"> under the field. A script of about 10 lines waits 250 ms after typing, then asks the endpoint. It drops answers that arrive out of order, and it only runs where fetch exists.
  • Layout shift: .start-check has a fixed min-height in src/web/style/content.ts, so the line never moves the page. It is listed in docs/design/areas/front.md.
  • No JavaScript: the form still posts to /forges/new, and the door still makes the final decision.
  • Docs and tests: docs/features/start-my-forge.md has a new "The name check" section. test/forge-name-check.test.ts covers free, taken, reserved and invalid, the no-echo and no-store headers, the 429 after the limit, and the new line in the form.

Not done

  • The door itself doesn't call reservedName for forge names; that rule is made for account names. The live check does apply it, so a name could show "not allowed" while the door would still accept it. I didn't change the door, since behaviour was to stay as it is. If you want the two to agree, that's a separate change.
  • The layout-shift test only checks that the line is in the markup. It doesn't measure rendering.
  • No new dependencies.

To try it: open / signed out and type admin (not allowed), Bad Name (not allowed), an existing forge's name (Taken), then a fresh name (Free). Or run curl '/forges/check?name=admin'.

Closes #11239

5 earlier comments
commented

Typing in the home page's "Forge name" field now writes one line under it: "Free", "Taken", or why the name isn't allowed. I ran the gate (clean), tsc --noEmit (no errors), scripts/design-lint.ts (clean) and 12 related test files (112 pass, 0 fail). The diff was too broad for scripts/fast.ts to name tests, so I picked those 12 myself. I did not run the full suite or open a browser: the typing behaviour is not exercised by any test, only the endpoint and the page markup.

What changed

  • Check: src/spawn/name_check.ts is new. It answers GET /forges/check?name=… with {state, message} where state is free, taken, reserved or invalid. It applies the door's name pattern, reservedName from src/core/reserved.ts, and a new forgeNameTaken in src/actions/spawn.ts. That last one is the same ledger-or-in-flight test the door uses for its 409.
  • Name pattern: I exported NAME from src/spawn/plan.ts so the check and the door share it.
  • Responses: The answer is a fixed sentence and never echoes the typed name. It is sent with Cache-Control: no-store.
  • Rate limit: The check is counted per address through a new name door in src/http/strangers.ts: 120 a minute per address, 1200 for the whole forge, then 429 with Retry-After. A separate door because the existing plan door allows only 10 a minute, which typing would use up.
  • Home page: src/web/studio/home.ts adds a <p id="start-check" aria-live="polite"> under the field. A script of about 10 lines waits 250 ms after typing, then asks the endpoint. It drops answers that arrive out of order, and it only runs where fetch exists.
  • Layout shift: .start-check has a fixed min-height in src/web/style/content.ts, so the line never moves the page. It is listed in docs/design/areas/front.md.
  • No JavaScript: the form still posts to /forges/new, and the door still makes the final decision.
  • Docs and tests: docs/features/start-my-forge.md has a new "The name check" section. test/forge-name-check.test.ts covers free, taken, reserved and invalid, the no-echo and no-store headers, the 429 after the limit, and the new line in the form.

Not done

  • The door itself doesn't call reservedName for forge names; that rule is made for account names. The live check does apply it, so a name could show "not allowed" while the door would still accept it. I didn't change the door, since behaviour was to stay as it is. If you want the two to agree, that's a separate change.
  • The layout-shift test only checks that the line is in the markup. It doesn't measure rendering.
  • No new dependencies.

To try it: open / signed out and type admin (not allowed), Bad Name (not allowed), an existing forge's name (Taken), then a fresh name (Free). Or run curl '/forges/check?name=admin'.

commented

I merged main into this branch and pushed it. The one conflict, in docs/features/start-my-forge.md, is resolved by keeping both sections. They are this pull's "The name check" and main's "Three screens, no link to copy". src/http/server.ts merged automatically.

The gate and the type check ran clean. test/forge-name-check.test.ts and test/stranger-three-screens.test.ts pass (9 tests). I did not run the full suite; the forge runs it on the push.

How to try it: open / signed out and type a name in the Forge name field. A line under it says Free, Taken or why not.

commented

One of the two failing tests was caused by this pull and is fixed; the other looks like a timeout under shard load and I changed nothing for it. The fix is pushed.

  • "every top-level page has an entry in the audit": the new GET /forges/check route returns a small JSON answer for the name field, not a page. test/design-audit.test.ts counted it as a page with no audit entry. I added forges/check to the list of non-page routes in that test. The test was wrong here, not the code. test/design-audit.test.ts now passes (4 tests).
  • "a sleeping preview woken at the limit > stays asleep…": the check log shows it failing after 120 s in shard 13. Run alone, test/quotas-running.test.ts passes all 7 tests in 18 s. This pull doesn't touch that area, so I changed nothing for it. If it fails again on the next check, it needs a person to look at the shard.
commented

Nothing to change or push this time: I couldn't reproduce the failure, and I believe it is load noise rather than something this pull caused.

budgets > /map and / answer under their p95 and statement budgets in test/snappy.test.ts passed on all three isolated runs here. It is a wall-clock p95 test, and in the check it ran in shard 49 beside many other test files, where timing varies. It is the only failure in the log, and the log says it was not re-run alone.

This pull's only effect on / is a small inline name-check script for signed-out visitors. It adds no database statements, so the statement budgets are unchanged. The route it adds, GET /forges/check, is not one of the routes this test times.

If the next check fails on this test again, someone should look at that shard's load or loosen the p95 margin.

commented

I merged main into the branch and pushed it. Four files conflicted, and one of them needed more than a textual fix. main had added its own live name check on the home page, which only asks whether a forge exists and so can't say why a name is refused. I kept this pull's check, which uses the door's rules, and made it write into main's markup.

  • Home page markup: main's form, ids and .door-says line are kept, including the new /forges/start action and the aria-describedby wiring. The check script now writes into #start-name-says.
  • main's script and test: I removed main's startNameJs script, which asked /forges/<name>/ready. In test/home-start-forge.test.ts I rewrote its live-check test to run this pull's script instead. nameCheckJs is now the home page's only name script. The ok flag I added to that test file's fake fetch response is how the script reads its answer.
  • src/http/server.ts: both imports and both routes are kept, /forges/check and /forges/start.
  • docs/design/areas/front.md, src/web/style/content.ts: main's .door-says replaces my .start-check. docs/features/start-my-forge.md and test/forge-name-check.test.ts now use the new id and action.

The gate, tsc and the design lint are clean. test/forge-name-check.test.ts, test/home-start-forge.test.ts, test/design-audit.test.ts and test/stranger-three-screens.test.ts pass. I did not run the full suite; the forge runs it on the push.

One sandbox denial showed up in the test run (an outbound connection to sunny-day--localhost:80), and it did not fail anything.

To try it, open / signed out and type a name. The line under the field says Free, Taken, or why not.

commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs