Repository navigation
Keep classic-app school subdomains and dash/storefront out of new schools - #927
Merged
Merged
Conversation
New schools can no longer take product or infrastructure hostnames (RESERVED_SUBDOMAINS in code) or subdomains listed in the new reserved_subdomains table, which operators fill from a local file with migrate:reserved-subdomains so customer data stays out of the repository. The availability check reports "reserved" and leaves reserved names out of suggestions; createSchool rejects them with a subdomain_reserved conflict; the setup wizard says the address isn't available. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 37951e026d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…s as taken - Custom domains can't be the platform domain, a name under it (www, product hosts, school subdomains) or a .localhost name: 409 hostname_reserved, shown in domain settings as "This domain isn't available." - createSchool and createSchoolCustomHost map a unique violation on the subdomain or hostname constraints to subdomain_taken / hostname_taken instead of failing; the pre-checks stay - Reserve mcp, webhook(s), internal, platform, prod, production, beta, localhost and courselit, matching FrontLit Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve conflicts with the base's own reserved-subdomain work: the fixed list now lives only in @courselit/api-contract (union of both lists), and the API's reserved_subdomains table adds names reserved in the database. Static names are refused by the contract schema; database-reserved names get a 409 subdomain_reserved from createSchool. The availability check reports both as "reserved". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The table was folded into 0000_baseline.sql but not into the snapshot, so the next `db:generate` would emit a CREATE TABLE that fails on databases built from the baseline. `db:generate` now reports no schema changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…table Replace the reserved_subdomains table and its import script with a live check against the classic app (LEGACY_SCHOOL_CHECK_URL, GET <url>?host=). A subdomain or custom domain a classic school owns is refused; when the classic app can't be asked the address is refused for now (legacy_check_unavailable, or reason "unavailable" from the availability check). Unset skips the check. The fixed product hostname list stays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep only what the shared courselit.app needs: classic-app school subdomains read as taken (availability check, suggestions and POST /v1/schools, via LEGACY_SCHOOL_CHECK_URL, failing closed), and `dash` and `storefront` join the fixed reserved list. Drop the custom-host checks, platform-hostname check, unique-violation mapping, new availability reason, admin copy and README changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tch stub The spyOn(globalThis, "fetch") stub leaked into later test files in the same process, so their fetch calls returned undefined (29 CI failures). Serve the classic app's answers from Bun.serve on a random port instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ic app On QA the classic app serves schools on a different domain from the rewrite, so asking about <label>.<PLATFORM_SITE_DOMAIN> never matched a classic school. LEGACY_SCHOOL_DOMAIN overrides it; prod leaves it unset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Eleven parallel calls took up to 1.5 s against the classic app on QA and hit the timeout, failing the whole availability check. Ask about the first four still-free candidates only; the wizard shows three. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…alid The field already says why inline; the button no longer looks usable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The classic CourseLit app and the rewrite will share
courselit.app. host-router sends a hostname to the classic app when a classic school owns it, and to the rewrite otherwise. So a new rewrite school must not take a classic school's subdomain. It also must not takedashorstorefront, which Caddy serves as fixed hosts and which aren't in the base's reserved list yet.What changes
dashandstorefrontare added toRESERVED_SUBDOMAINSinpackages/api-contract/src/school-subdomain.ts.apps/api/src/legacy-schools.tsasks the classic appGET <LEGACY_SCHOOL_CHECK_URL>?host=<label>.<domain>(codelitdev/courselit-subscriptions#60):<domain>isLEGACY_SCHOOL_DOMAINif set, otherwisePLATFORM_SITE_DOMAIN. Only QA needs it, because there the classic app serves schools onclqa.sitewhile the rewrite usescourselit.cluster.clqa.site. Prod leaves it unset.takenAmong): the name reads astaken, like the base's reserved names. For suggestions, only the first 4 still-free candidates are checked, in one parallel round, and only those can be offered; the wizard shows 3. Checking all 11 at once took up to 1.5 s on QA and timed out.POST /v1/schools: 409subdomain_taken. The check sits in the route, not increateSchool, so staff imports of classic schools still work.Deploying
mainsetsLEGACY_SCHOOL_CHECK_URLfor QA and prod, plusLEGACY_SCHOOL_DOMAIN=clqa.siteon QA./school/exists, before the rewrite uses this. Otherwise every name would read as free.pr-927-c09e68a): a classic school's subdomain shows as taken, with suggestions.Tests
legacy-schools.test.ts, 5 tests through the real routes with a local stand-in classic app: owned, suggestions, create refused, a free name created, theLEGACY_SCHOOL_DOMAINoverride, classic app failing → 500, variable unset → not consulted.onboarding.test.tspasses. The full API suite passed (808 tests) before the latest two commits. Admin onboarding tests: 30 pass. Contract tests: 65 pass.apps/api,apps/adminandpackages/api-contract.🤖 Generated with Claude Code