chore(identity): remove the legacy underscore-username tier - #1400
Conversation
Production had exactly one underscore username (debs_obrien); it was renamed by hand on 2026-08-12 (users.username, email_inbox_addresses, saved_packages names -> debs-obrien), so the two-tier validation shipped in #1395/#1396 no longer guards anyone. Username validation is one strict DNS-label rule everywhere again: the lenient recognition pattern, the separate DNS-safe validator, the 409 rename prompt on the package-app entry, and the hosted-URL path-mount fallback for non-DNS-safe usernames are all removed. The shared dnsSafeUsernamePattern stays as the single source of truth (also validating wildcard-routed subdomain labels). Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe change removes legacy underscore-username handling. Username validation now applies strict DNS-label rules, and configured package-app origins consistently use per-user subdomains. ChangesUsername and package-app routing
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/contributing/decisions/0017-per-user-package-app-subdomains.md`:
- Around line 50-55: Update the outdated underscore-account consequence in this
decision document to reflect that the sole legacy account was already renamed
and no rename is required before hosting; replace the statement with a concise
historical migration note or remove it, while preserving the current strict
DNS-label policy.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: b6252b05-1010-4315-bf30-f98fca023373
📒 Files selected for processing (9)
docs/contributing/decisions/0017-per-user-package-app-subdomains.mddocs/contributing/security.mdpackages/shared/src/public-urls.tspackages/worker/src/app/package-app-origin.tspackages/worker/src/app/package-app-origin.workers.test.tspackages/worker/src/identity/platform-account-creation.tspackages/worker/src/identity/username.node.test.tspackages/worker/src/identity/username.tspackages/worker/src/mcp/capabilities/packages/package-app-fetch.ts
💤 Files with no reviewable changes (2)
- packages/worker/src/app/package-app-origin.ts
- packages/worker/src/app/package-app-origin.workers.test.ts
The sole underscore account was already migrated; CodeRabbit caught the stale Consequences bullet still requiring renames before hosting. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Cloudflare now rejects creating key-value backed Durable Object namespaces (error 10099). Every PR preview deploys a fresh kody-pr-<n>-mock-cloudflare script that runs these migrations from scratch, so preview resource deploys started failing repo-wide. Existing long-lived scripts already applied tags v1/v2 and are unaffected. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
|
🔎 Preview deployed: https://kody-pr-1400.kody-a99.workers.dev Worker: Mocks:
|
Intent
Kent's call: no legacy affordances for underscore usernames. The two-tier validation from #1395/#1396 (lenient recognition of stored usernames, strict DNS labels for new ones) existed to protect existing underscore accounts — but production has exactly one, and it has now been migrated, so the lenient tier guards nobody and is pure legacy residue.
Summary
debs_obrien(user 42, 2 stock platform forks, 1 inbox alias, no community listings, nodebs-obriencollision) was renamed by hand via the D1 API:users.username,email_inbox_addresses.address/local_part, and bothsaved_packages.namevalues →debs-obrien. A post-migration sweep confirms zero underscore usernames, package scopes, or inbox locals remain.getUsernameFormatValidationErroris strict (DNS label) again and is the only username format rule;getDnsSafeUsernameValidationErrorand the lenient legacy pattern are removed.resolveHostedPackageAppUrlno longer falls back to the path mount for non-DNS-safe usernames;package_app_fetchmount selection simplifies accordingly.dnsSafeUsernamePattern/isDnsSafeUsernamestay inpackages/shared/src/public-urls.tsas the single source of truth — still needed to validate subdomain labels from wildcard-routed hostnames, which are arbitrary strings.new_classestonew_sqlite_classes. Cloudflare now rejects creating key-value backed DO namespaces (error 10099), and every PR preview deploys a fresh mock script that runs these migrations from scratch — preview resource deploys were failing repo-wide (first seen on this PR's preview). Long-lived scripts already applied tags v1/v2 and are unaffected.Known residual (self-healing): the
package.jsonfiles inside her two Artifacts repos still say@debs_obrien/...; her next publish fails scope validation with a clear message prompting the fix. They are unmodified platform forks. Kent may want to give Debbie a heads-up that her handle is nowdebs-obrien.Testing
npm run validategreen (E2E was an infra flake — workerd webserver crash — and passed on re-run; Nx flagged the task flaky).resolveDisplayNamefallback), removed the legacy-owner workers test; the full subdomain/handoff/host-label workers suite and search-identity/app-base-url/auth/account-profile suites pass unchanged otherwise.Summary by CodeRabbit
Bug Fixes
404response.Documentation