diff --git a/.baseline/product/README.md b/.baseline/product/README.md index 4f48e72..7bdb89f 100644 --- a/.baseline/product/README.md +++ b/.baseline/product/README.md @@ -162,7 +162,10 @@ own domain, attach the domain to the Worker in Cloudflare (Workers & Pages → `NEXT_PUBLIC_SITE_URL` in `apps/web/wrangler.template.jsonc` and the Auth origin (`app_origin`) in `infra/terraform/supabase/terraform/main.tf` to it, run `pnpm run wire:fixture`, merge, and point Stripe's webhook at the new -origin. +origin. In the same change, replace the reserved placeholder +`subscription-payments.example.com` the product was born with in +`intent.yaml`'s `BASE_DOMAIN` (one line per environment) — the one place the +repository names the domain itself. ## CI diff --git a/.github/workflows/baseline.yml b/.github/workflows/baseline.yml index e2c051b..4f04bf7 100644 --- a/.github/workflows/baseline.yml +++ b/.github/workflows/baseline.yml @@ -95,7 +95,6 @@ jobs: --out "$(mktemp -d)" \ --set reponame=acme-pay \ --set "productname=Acme Cloud" \ - --set productdomain=acme.dev \ --set githuborg=acme-inc - name: the leak gate — what a product carries run: bash testing/leak.test.sh diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index bcfd572..c56089d 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -62,7 +62,7 @@ cd subscription-payments orun new --blueprint repo-blueprint.yaml \ --out ~/products/acme-pay --run-hooks --resume \ --set reponame=acme-pay --set productname="Acme Cloud" \ - --set productdomain=acme.dev --set githuborg=acme-inc \ + --set githuborg=acme-inc \ --set orunWorkspace=ws_XXXXXXXX \ --set subdomain= ``` @@ -99,9 +99,13 @@ orun new --blueprint repo-blueprint.yaml --out ~/products/acme-pay --run-hooks \ `02-docs` reads the identity back from `.rebrand/values.json` in the placed tree, but the blueprint's **required** inputs — `reponame`, `productname`, -`productdomain`, `githuborg` — are validated before anything runs, so pass -them every time (a `--values` file is easier). The full guide, one page per -phase: [docs/phases/README.md](docs/phases/README.md). +`githuborg` — are validated before anything runs, so pass them every time (a +`--values` file is easier). The domain is not one of them: the product goes live +on workers.dev, and `productdomain` defaults to empty, which brands the +reserved placeholder `.example.com` into `BASE_DOMAIN` for an owner +to replace when they attach a domain (README, "Custom domain"). Pass +`--set productdomain=` only for a product that already has its domain. +The full guide, one page per phase: [docs/phases/README.md](docs/phases/README.md). | flag | what it does | |---|---| @@ -253,5 +257,5 @@ at the tag and refuses the whole catalogue if it 404s. | The convergence reported green, then `verify` got 404 | a second workflow ran on the push to main and the watch took its run. Only `ci.yml` may run on a push to main; `checks.yml` runs on pull requests only | | The product's `intent.yaml` says `workspace: ws_SET_ME` | `orunWorkspace` was empty and the build ran outside a workspace; set it and re-run `01-product` | | A bootstrap stopped before `02-docs`; prod no longer waits on stage | the gate is deferred, not dropped: run `02-docs`, or `node tooling/bootstrap/promotion.mjs --restore --file /intent.yaml` | -| `✕ input "productdomain" is required` | all four required inputs must be set on every invocation, single-phase ones included | +| `✕ input "productname" is required` | all three required inputs (`reponame`, `productname`, `githuborg`) must be set on every invocation, single-phase ones included | | `unknown flag: --phase` or a parse error in the blueprint | the CLI is below the v2.58.11 floor | diff --git a/README.md b/README.md index 12b8c50..3d2481c 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ departure. git clone --depth 1 --branch https://github.com/sourceplane/subscription-payments cd subscription-payments orun new --blueprint repo-blueprint.yaml --out ~/products/acme-pay --run-hooks --resume \ - --set reponame=acme-pay --set productname="Acme Cloud" --set productdomain=acme.dev \ + --set reponame=acme-pay --set productname="Acme Cloud" \ --set githuborg=acme-inc --set subdomain= ``` diff --git a/ai/context/current.md b/ai/context/current.md index e77b56e..7218889 100644 --- a/ai/context/current.md +++ b/ai/context/current.md @@ -22,8 +22,9 @@ afterwards; the app deploys and serves without it. | | | |---|---| -| Latest tag | `baseline-v2` (SP6 — the cirrus standard, [#7](https://github.com/sourceplane/subscription-payments/pull/7) and [#8](https://github.com/sourceplane/subscription-payments/pull/8): no kiox, generated component docs, this context pack, and the workers.dev subdomain read from the Cloudflare connection instead of asked) | -| Before it | `baseline-v1` (SP5, [#6](https://github.com/sourceplane/subscription-payments/pull/6)) | +| Latest tag | `baseline-v3` (SP7 — the domain is set later, [#9](https://github.com/sourceplane/subscription-payments/pull/9): the console asks for no domain, and a product is born with the placeholder `.example.com` for an owner to replace) | +| Before it | `baseline-v2` (SP6 — the cirrus standard, [#7](https://github.com/sourceplane/subscription-payments/pull/7) and [#8](https://github.com/sourceplane/subscription-payments/pull/8): no kiox, generated component docs, this context pack, and the workers.dev subdomain read from the Cloudflare connection instead of asked) | +| Before that | `baseline-v1` (SP5, [#6](https://github.com/sourceplane/subscription-payments/pull/6)) | | Proven live | No. Everything short of the platform is proven offline in Baseline CI: the e2e tier migrates a local Postgres under the real Supabase Auth and Data API with the product's own runner, builds in orun's staged job tree, and signs a user up and in with no Stripe key. No bootstrap from a tag has run against a workspace: the Supabase root's apply through the brokered token (SP-M), db-migrate against a real project, the service-role push, a real deploy and the card's twenty minutes (SP-N) are unproven | ## Where to read @@ -38,6 +39,6 @@ afterwards; the app deploys and serves without it. ## Next -1. Bootstrap one product from `baseline-v2` against a workspace with +1. Bootstrap one product from `baseline-v3` against a workspace with Cloudflare and Supabase connected, and record its timings (closes SP-M and SP-N). diff --git a/ai/context/decisions.md b/ai/context/decisions.md index f0192df..6080444 100644 --- a/ai/context/decisions.md +++ b/ai/context/decisions.md @@ -19,3 +19,4 @@ reads in order. | 11 | orun is pinned only where it runs (the `orun-action` `version:` in each workflow); no kiox | `kiox.yaml` pinned a version (v2.15.0) nothing ran | IMPLEMENTATION-STATUS (SP6) | | 12 | Component docs are generated from the manifests and checked in CI | A hand-written copy of the dependency graph and bindings drifts silently | `tooling/catalog/gen-component-docs.py` | | 13 | `subdomain` is read from the Cloudflare connection (`from: connection.cloudflare.workersSubdomain`), never asked | It belongs to the account like its id and has one right answer; a typed one could only be wrong, and showed up after deploy in the origin Stripe and Supabase Auth return to, the smoke and the probes | `blueprint.yaml`, IMPLEMENTATION-STATUS (SP-8) | +| 14 | The console asks for no domain; an empty `productdomain` brands the placeholder `.example.com` | The product goes live on workers.dev and nothing in the build needs a domain; attaching one is an owner's step, and the placeholder keeps every place the domain goes in the repository, ready to replace | `repo-blueprint.yaml`, `tooling/rebrand/rebrand.mjs`, IMPLEMENTATION-STATUS (SP-9) | diff --git a/ai/context/operations.md b/ai/context/operations.md index 59f5492..0299478 100644 --- a/ai/context/operations.md +++ b/ai/context/operations.md @@ -192,7 +192,7 @@ orun integrations list --org --json && orun cloud check --org | connect Stripe | above | | turn on email confirmation | above, "Supabase Auth email" | | rotate the service-role key | rotate it in the Supabase dashboard (API keys), then re-run the supabase apply (a merge touching `infra/terraform/supabase`): it republishes `WIRING_SUPABASE`, and the next web deploy pushes the new key | -| serve a custom domain | attach it to the Worker in Cloudflare; change `NEXT_PUBLIC_SITE_URL` in `apps/web/wrangler.template.jsonc` and the Auth origin in the supabase root; add the new webhook URL in Stripe | +| serve a custom domain | attach it to the Worker in Cloudflare; change `NEXT_PUBLIC_SITE_URL` in `apps/web/wrangler.template.jsonc` and the Auth origin in the supabase root; add the new webhook URL in Stripe; replace the placeholder `subscription-payments.example.com` in `intent.yaml`'s `BASE_DOMAIN` with it | | headless credentials | `ORUN_TOKEN` (workspace-scoped) + `GITHUB_TOKEN` | The deployment record is the bootstrap's `02-docs` phase. Re-running it (the diff --git a/blueprint.yaml b/blueprint.yaml index 3765ff0..6d945cf 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -66,6 +66,12 @@ spec: # already holds says so with `from`. repo-blueprint.yaml declares the same # names; `repoPrivate`, `orunWorkspace` and `epicSlug` are build inputs with # defaults (or filled from the build's workspace) and are not asked. + # + # NOR IS THE DOMAIN. The product goes live on workers.dev, and a domain is an + # owner's step after the bootstrap: `productdomain` defaults to empty, the + # rebrand writes the reserved placeholder `.example.com` where + # the domain goes, and the product's README ("Custom domain") says how to set + # it. Nothing that needs a domain is removed — it waits for one. inputs: - key: reponame label: Repo name @@ -77,11 +83,6 @@ spec: pattern: "^[A-Za-z0-9][A-Za-z0-9 .,'&-]{1,48}$" help: The name people see — beside the logo and in every page title. example: Acme Cloud - - key: productdomain - label: Product domain - pattern: "^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$" - help: The domain the product will answer on. It does not need to exist — the app goes live on workers.dev first. - example: acme.dev - key: githuborg label: GitHub organisation pattern: "^[A-Za-z0-9][A-Za-z0-9-]*$" diff --git a/docs/phases/README.md b/docs/phases/README.md index 443a5d8..378c518 100644 --- a/docs/phases/README.md +++ b/docs/phases/README.md @@ -57,9 +57,15 @@ carry, so it is an owner's step after the bootstrap (the product's README, `01-product` takes the product's identity once and writes it into the repo (`.rebrand/values.json`); `02-docs` reads it back from the placed tree. But the blueprint's **required** inputs — `reponame`, `productname`, -`productdomain`, `githuborg` — are validated before any phase runs, so they -must be supplied on every invocation, single-phase ones included. A -`--values` file is easier than repeating `--set`. +`githuborg` — are validated before any phase runs, so they must be supplied +on every invocation, single-phase ones included. A `--values` file is easier +than repeating `--set`. + +- `productdomain` — NOT ASKED, default empty. The product goes live on + workers.dev; empty brands the reserved placeholder `.example.com` + into `BASE_DOMAIN`, for an owner to replace when they attach a domain (the + product's README, "Custom domain"). Pass it only for a product that already + has its domain. - `subdomain` — the workers.dev subdomain of the Cloudflare account you deploy into. It is in every URL the phases probe, in the origin Stripe diff --git a/repo-blueprint.yaml b/repo-blueprint.yaml index 2c6e821..df72473 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -37,11 +37,18 @@ inputs: description: The product's display name (e.g. "Acme Cloud") — beside the logo and in every page title. productdomain: type: string - required: true + default: "" description: >- - The domain the product will answer on (e.g. acme.dev) — BASE_DOMAIN and - the custom-domain guidance. It does not need to exist: the app answers - on workers.dev from its first deploy. + The product's own domain, once it has one (e.g. acme.dev). NOT ASKED: + the app answers on workers.dev from its first deploy — its site URL, + the Supabase Auth origin and the Stripe return and webhook URLs are all + the workers.dev origin — and a domain is an owner's step after it. + Empty, the rebrand writes the reserved placeholder + `.example.com` where the domain goes (BASE_DOMAIN in + intent.yaml, for every environment), so setting it later is replacing + that one string — the product's README, "Custom domain", says how. Pass + it with --set only to brand a hand-run build with a domain it already + has. githuborg: type: string pattern: "^[A-Za-z0-9][A-Za-z0-9-]*$" diff --git a/specs/epics/README.md b/specs/epics/README.md index aa17c6a..23639a7 100644 --- a/specs/epics/README.md +++ b/specs/epics/README.md @@ -7,6 +7,6 @@ folder is the adoption; the merge creates the epic in the workspace. | Epic | Cluster | Status | What it is | |------|---------|--------|------------| -| [`subscription-payments/`](./subscription-payments/) | **SP** | ✅ Shipped (`baseline-v2`); live bootstrap pending | Vercel's Next.js Subscription Payments Starter, equivalent in code and function, on Cloudflare Workers with Supabase provisioned and migrated through Orun — and an Orun baseline that instantiates it in one landing (SP5) | +| [`subscription-payments/`](./subscription-payments/) | **SP** | ✅ Shipped (`baseline-v3`); live bootstrap pending | Vercel's Next.js Subscription Payments Starter, equivalent in code and function, on Cloudflare Workers with Supabase provisioned and migrated through Orun — and an Orun baseline that instantiates it in one landing (SP5) | As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`. diff --git a/specs/epics/subscription-payments/IMPLEMENTATION-STATUS.md b/specs/epics/subscription-payments/IMPLEMENTATION-STATUS.md index dac3619..e307184 100644 --- a/specs/epics/subscription-payments/IMPLEMENTATION-STATUS.md +++ b/specs/epics/subscription-payments/IMPLEMENTATION-STATUS.md @@ -12,6 +12,7 @@ the code departed from `design.md` or from the upstream template. | SP4 — ready to instantiate | ✅ Shipped | [#5](https://github.com/sourceplane/subscription-payments/pull/5) | | SP5 — a baseline | ✅ Shipped | [#6](https://github.com/sourceplane/subscription-payments/pull/6) (SP-6), tagged `baseline-v1` | | SP6 — the cirrus standard | ✅ Shipped | [#7](https://github.com/sourceplane/subscription-payments/pull/7) (SP-7), [#8](https://github.com/sourceplane/subscription-payments/pull/8) (SP-8), tagged `baseline-v2` | +| SP7 — the domain is set later | ✅ Shipped | [#9](https://github.com/sourceplane/subscription-payments/pull/9) (SP-9), tagged `baseline-v3` | ## Departures from the upstream template @@ -378,6 +379,55 @@ Verified: changes nothing. - `orun task check SP-8` complete. +## The domain is set later (SP7, SP-9) + +The console asked for the product's domain, with help text that said it did +not need to exist — and nothing in the build needed one: the app answers on +workers.dev from its first deploy, and every URL it builds is that origin — +`NEXT_PUBLIC_SITE_URL` (the metadata base, the Supabase Auth callbacks and +Stripe's checkout and portal return URLs, through `getURL()`), the Supabase +root's `app_origin` (Auth's Site URL and allow-list) and the Stripe webhook +the owner registers. The one place the repository names the domain is +`BASE_DOMAIN` in `intent.yaml` (one line per environment: dev, stage, prod). +A domain is an owner's step after the bootstrap (README, "Custom domain"), so +the form no longer asks for it. + +- `blueprint.yaml` declares no `productdomain` input; the console asks for + the product's name alone. +- `repo-blueprint.yaml`'s `productdomain` is optional, default empty. Nothing + else in the build reads it — no hook, probe or `when:` — so an empty value + is harmless; `.rebrand/values.json` records `""`. A hand-run build may still + pass `--set productdomain=` for a product that already has its domain. +- `rebrand.mjs` no longer requires it. Empty, it brands the reserved + placeholder `.example.com` (RFC 2606 — never someone else's + domain) where the domain goes, so setting it later is replacing one + string; the product README ("Custom domain", beside the site URL, the Auth + origin and the Stripe webhook it already listed) and + `ai/context/operations.md` say so. +- `testing/fixtures/acme.json` carries no domain, so the leak gate, the + offline bootstrap and the e2e tier exercise exactly what a console build + supplies; `testing/rebrand.test.sh` pins the placeholder for an absent and + an empty domain; `baseline.yml`'s blueprint read sets no domain. + +Nothing that needs a domain was removed — it waits for one. + +Verified: + +- `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer}.test.sh` + green; `gen-component-docs.py --check` green (6 components). +- At v2.58.11 (the blueprint job's pin): `orun new --status` with no + `productdomain` reads the document (`01-product` pending, 181 files); + `testing/leak.test.sh` 181 files derived, 174 text files read; + `testing/placement.test.sh` 181 files placed, both landings, the product's + own plan orders supabase → db-migrate → web on stage and prod; `--resume` + changes nothing. +- The offline bootstrap of the fixture leaves `.rebrand/values.json` + `productdomain` empty and `BASE_DOMAIN: acme-pay.example.com` in all three + environments of the product's `intent.yaml` (and the same string in its + README and `operations.md`); no line names + `subscription-payments.example.com`. +- `orun task check SP-9` complete. + ## Verified (SP6) - `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer}.test.sh` diff --git a/specs/epics/subscription-payments/README.md b/specs/epics/subscription-payments/README.md index 590424a..a832ca1 100644 --- a/specs/epics/subscription-payments/README.md +++ b/specs/epics/subscription-payments/README.md @@ -8,15 +8,15 @@ The upstream code stays the code: the `@supabase/ssr` clients and the session-re | Field | Value | |-------|-------| -| Status | ✅ SP0–SP5 shipped (#1–#6), tagged `baseline-v1`; SP6 (the cirrus standard, SP-7 #7 and SP-8 #8) tagged `baseline-v2`. Not yet proven by a live bootstrap: the Supabase and migration applies and a live deploy (risks SP-M, SP-N); Stripe keys are the product owner's | -| Cluster | **SP** (SP0–SP6) | +| Status | ✅ SP0–SP7 shipped (#1–#9): SP0–SP5 tagged `baseline-v1`; SP6 (the cirrus standard, SP-7 #7 and SP-8 #8) tagged `baseline-v2`; SP7 (the domain is set later, SP-9 #9) tagged `baseline-v3`. Not yet proven by a live bootstrap: the Supabase and migration applies and a live deploy (risks SP-M, SP-N); Stripe keys are the product owner's | +| Cluster | **SP** (SP0–SP7) | | Owner(s) | `apps/web` (the app) · `tests/web` (helper and webhook tests) · `packages/db` + `infra/db-migrate` + `tests/db` (the schema) · `infra/terraform/supabase` (the project) | | Builds on | `lumen` conventions — the `supabase` Terraform root, the `@saas/db` runner and `db-migrate` component, the orun-secrets wiring; `supabase-starter` for the app-on-Workers shape; `cirrus-baseline` conventions for the repository shape | | Upstream | [vercel/nextjs-subscription-payments](https://github.com/vercel/nextjs-subscription-payments) (sunset upstream in favour of `nextjs/saas-starter`; ported as it stands) | | Changes | Adds the Workers build, the monorepo wrapper, tests, the migrations package, the db-migrate component, the Supabase root and the deploy contract; the template's code changes only where Next 16 / Workers force it (every change is in `IMPLEMENTATION-STATUS.md`) | | Decisions locked | (1) OpenNext on Workers + Static Assets. (2) The anon key is a wrangler var, not a secret: RLS protects the data; the service-role key and the Stripe secrets are Worker secrets — the service-role key pushed by every deploy from `WIRING_SUPABASE` (SP5), the Stripe keys added by the owner when ready, the app deploying and serving without them (SP5). (3) `wrangler.jsonc` rendered from the template: committed as the fixture render (the composition checks it exists before the build), re-rendered per environment from the wiring document by the deploy lanes, which the build inlines (SP5; it was never committed before). (4) The schema is applied by the `@saas/db` runner through Supabase's Management API, from the template's `init.sql` verbatim — not by `supabase db push` in CI — then RLS checked on every table (`020`, SP5). (5) No Hyperdrive: the app speaks PostgREST over HTTPS, never a Postgres socket. (6) `stripe` stays on v14: it already has the fetch client and async webhook verification. (7) Infra before app on main: supabase → db-migrate → web, enforced; advisory on pull requests (SP5). | | Gate | SP1 is the first user-visible rung. SP2 and SP3 need a workspace with a Supabase connection to apply; they are verified by `plan` / `terraform validate`. Checkout and the webhook need the product's Stripe keys as Worker secrets (the one manual step, see `design.md` §3). | -| Shipped as | `baseline-v1` ([#6](https://github.com/sourceplane/subscription-payments/pull/6)), then `baseline-v2` (SP6: [#7](https://github.com/sourceplane/subscription-payments/pull/7), [#8](https://github.com/sourceplane/subscription-payments/pull/8)); proven offline (Baseline CI: contract, leak, placement and the e2e tier over a local Supabase Auth and Data API), deploy gated until a workspace is linked | +| Shipped as | `baseline-v3` ([#9](https://github.com/sourceplane/subscription-payments/pull/9), SP7: no domain asked), `baseline-v2` (SP6: [#7](https://github.com/sourceplane/subscription-payments/pull/7), [#8](https://github.com/sourceplane/subscription-payments/pull/8)), `baseline-v1` ([#6](https://github.com/sourceplane/subscription-payments/pull/6)); proven offline (Baseline CI: contract, leak, placement and the e2e tier over a local Supabase Auth and Data API), deploy gated until a workspace is linked | ## Read order @@ -36,3 +36,4 @@ The upstream code stays the code: the `@supabase/ssr` clients and the session-re | SP4 — ready to instantiate | README, as-built status | a reader can run, test, preview, configure Stripe and deploy it | | SP5 — a baseline | card, build document, rename, bootstrap tooling, the product's README and context pack, tests | a new product goes from nothing to live on stage and prod in one landing, with no Stripe key, every table behind RLS; Baseline CI green | | SP6 — the cirrus standard | no kiox, generated component docs, the context pack, status that agrees with the tags; the subdomain read from the Cloudflare connection | Baseline CI green with the docs check; the card asks for no subdomain | +| SP7 — the domain is set later | the console asks for no domain; an empty `productdomain` brands the placeholder `.example.com` for an owner to replace | Baseline CI green on a fixture with no domain | diff --git a/specs/epics/subscription-payments/epic.yaml b/specs/epics/subscription-payments/epic.yaml index b54425a..07b5e2b 100644 --- a/specs/epics/subscription-payments/epic.yaml +++ b/specs/epics/subscription-payments/epic.yaml @@ -55,3 +55,9 @@ spec: - "every milestone's status row agrees with the tags" - "the console card reads subdomain from the Cloudflare connection (from: connection.cloudflare.workersSubdomain), as cirrus-baseline since baseline-v23" tasks: [SP-7, SP-8] + - name: "SP7 — the domain is set later" + exitCriteria: + - "the console card asks for no domain: a product goes live on workers.dev, and productdomain is an optional build input that defaults to empty" + - "a product built without a domain is branded with the reserved placeholder .example.com wherever the domain goes (BASE_DOMAIN), and its README says how an owner sets the real one" + - "Baseline CI places, leak-checks and plans a product built with no domain" + tasks: [SP-9] diff --git a/specs/epics/subscription-payments/implementation-plan.md b/specs/epics/subscription-payments/implementation-plan.md index 7001638..cf8228a 100644 --- a/specs/epics/subscription-payments/implementation-plan.md +++ b/specs/epics/subscription-payments/implementation-plan.md @@ -130,6 +130,15 @@ itself changing. - the docs check is green in Baseline CI - this file, the status file and `epic.yaml` agree +## SP7 — the domain is set later (SP-9) ✅ + +**Done when** the console card asks for no domain; `productdomain` is an +optional build input, empty by default; a product built without one is branded +with the reserved placeholder `.example.com` where the domain goes +(`BASE_DOMAIN` in `intent.yaml`) and its README says how an owner sets the real one; +Baseline CI places, leak-checks and plans a product built with no domain. +Shipped in `baseline-v3`. + ## Sequencing note SP1's component already names the root's secrets and the db-migrate diff --git a/tasks/SP-9.TaskContract.yaml b/tasks/SP-9.TaskContract.yaml new file mode 100644 index 0000000..0b7b8a8 --- /dev/null +++ b/tasks/SP-9.TaskContract.yaml @@ -0,0 +1,30 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: SP-9 + title: "The domain is set later" +spec: + goal: "The console no longer asks for the product's domain. A product goes live on workers.dev; productdomain is an optional build input (default empty), the rebrand writes the reserved placeholder .example.com where the domain goes (BASE_DOMAIN), and the product's README says how an owner replaces it once a domain is attached" + affects: + - blueprint.yaml + - repo-blueprint.yaml + - tooling/rebrand/rebrand.mjs + - testing/rebrand.test.sh + - testing/fixtures/acme.json + - .github/workflows/baseline.yml + - .baseline/product/README.md + - BOOTSTRAP.md + - README.md + - docs/phases/README.md + - ai/context/operations.md + - ai/context/current.md + - ai/context/decisions.md + - specs/** + - tasks/** + doneWhen: + - blueprint.yaml declares no productdomain input, and repo-blueprint.yaml's productdomain is optional with an empty default + - "rebrand.mjs no longer requires productdomain and brands .example.com when it is empty (testing/rebrand.test.sh)" + - testing/fixtures/acme.json carries no domain, so the leak gate and the offline bootstrap exercise what a console build supplies + - the contract tests, the docs check, the leak gate and the offline bootstrap are green + gates: + - checks diff --git a/testing/fixtures/acme.json b/testing/fixtures/acme.json index 3b39a36..70e872c 100644 --- a/testing/fixtures/acme.json +++ b/testing/fixtures/acme.json @@ -6,16 +6,16 @@ "AWKWARD rather than tidy — a product name with an apostrophe and an", "ampersand (both legal in the card's pattern, both special in TypeScript", "strings, HTML and a PR title), a hyphenated repo slug that CONTAINS the", - "word `pay`, an owner other than the baseline's, and a multi-label domain", - "— because a fixture that only uses values the templates were written", - "against proves the templates work on the values they were written", - "against.", + "word `pay`, an owner other than the baseline's, and NO domain — a", + "console build asks for none, so the placeholder .example.com", + "is what a product is born with — because a fixture that only uses values", + "the templates were written against proves the templates work on the", + "values they were written against.", "Every key here is an input repo-blueprint.yaml declares. A key it does not", "declare is a fixture that has drifted, and orun refuses it." ], "reponame": "acme-pay", "productname": "Sam's Seats & Billing", - "productdomain": "seats.acme.dev", "githuborg": "acme-inc", "subdomain": "acme", "orunWorkspace": "ws_0000000000000000000000000000000f", diff --git a/testing/rebrand.test.sh b/testing/rebrand.test.sh index 6d08694..2607506 100755 --- a/testing/rebrand.test.sh +++ b/testing/rebrand.test.sh @@ -80,6 +80,14 @@ check "the Worker's own origin (NEXT_PUBLIC_SITE_URL): worker name and subdomain check "the placeholder domain is the product's domain, not a renamed slug" \ "$acme" intent.yaml ' BASE_DOMAIN: subscription-payments.example.com' \ ' BASE_DOMAIN: acme.dev' +check "no domain given: the reserved placeholder, for an owner to replace later" \ + '{"reponame":"acme-pay","productname":"Acme Cloud","githuborg":"acme-inc","subdomain":"acme"}' \ + intent.yaml ' BASE_DOMAIN: subscription-payments.example.com' \ + ' BASE_DOMAIN: acme-pay.example.com' +check "an empty domain is no domain" \ + '{"reponame":"acme-pay","productname":"Acme Cloud","productdomain":""}' \ + intent.yaml ' BASE_DOMAIN: subscription-payments.example.com' \ + ' BASE_DOMAIN: acme-pay.example.com' check "the repo slug" \ "$acme" package.json ' "name": "subscription-payments",' \ ' "name": "acme-pay",' diff --git a/tooling/rebrand/rebrand.mjs b/tooling/rebrand/rebrand.mjs index c39dd49..998f927 100644 --- a/tooling/rebrand/rebrand.mjs +++ b/tooling/rebrand/rebrand.mjs @@ -28,7 +28,7 @@ // { // "reponame": "acme-pay", // required — repo slug // "productname": "Acme Cloud", // required — the product's display name -// "productdomain": "acme.dev", // required — the product domain +// "productdomain": "acme.dev", // optional — default .example.com (set later) // "githuborg": "acme-inc", // owner of the product repo (source link in docs) // "brandSlug": "acme", // default: reponame — worker name prefix // "subdomain": "acme", // default: your-workers-subdomain @@ -69,7 +69,7 @@ if (!verifyOnly && !valuesPath) { } if (valuesPath) { values = JSON.parse(fs.readFileSync(valuesPath, "utf8")); - for (const required of ["reponame", "productname", "productdomain"]) { + for (const required of ["reponame", "productname"]) { if (typeof values[required] !== "string" || values[required].length === 0) { console.error(`rebrand: values file is missing required field "${required}"`); process.exit(2); @@ -133,7 +133,11 @@ const rx = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // All fields are unused under --verify; the fallbacks keep derivation total. const reponame = values.reponame ?? ""; const productname = values.productname ?? ""; -const productdomain = values.productdomain ?? ""; +// The domain is NOT ASKED at bootstrap: a product goes live on workers.dev and an +// owner sets a domain later. Until then the reserved placeholder +// `.example.com` (RFC 2606 — it can never be someone else's) stands +// wherever the domain goes, so setting it is replacing one string. +const productdomain = (values.productdomain ?? "").trim() || (reponame ? `${reponame}.example.com` : ""); const githuborg = (values.githuborg ?? "").trim() || baseline.githubOwner; const brandSlug = (values.brandSlug ?? "").trim() || reponame; const subdomain = (values.subdomain ?? "").trim() || "your-workers-subdomain";