From 79bce1aa6f396ae1fd9c54c8802178cec86cddbb Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 21 Oct 2026 12:13:04 +0000 Subject: [PATCH 1/3] feat: read the workers.dev subdomain from the Cloudflare connection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `subdomain` input was typed by hand, though it belongs to the Cloudflare account the same way its id does and has exactly one right answer. A wrong value surfaced only after deploy, in CORS, OAuth origins, smoke checks and the verify URLs. Ported from cirrus-baseline #30. - blueprint.yaml: `subdomain` declares `from: connection.cloudflare.workersSubdomain`; the bootstrap door fills it from the connection the build is bound to, so the console renders no field - testing/manifest.test.sh: cirrus's block, byte for byte — accepts the source and requires its provider in spec.requires.integrations (mutation-checked) - repo-blueprint.yaml, BOOTSTRAP.md, docs/phases/01-scaffold.md and docs/phases/README.md: a hand-run build still passes --set subdomain - saas-bootstrap-factory IMPLEMENTATION-STATUS: dated record (Lumen has no BE3 note or risk #13 to supersede) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01D8AmgTwmnp4M8mgmnS9aha --- BOOTSTRAP.md | 22 ++++++++++----- blueprint.yaml | 13 +++++++++ docs/phases/01-scaffold.md | 2 +- docs/phases/README.md | 7 ++++- repo-blueprint.yaml | 6 +++- .../IMPLEMENTATION-STATUS.md | 28 +++++++++++++++++++ testing/manifest.test.sh | 15 ++++++++-- 7 files changed, 81 insertions(+), 12 deletions(-) diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index 5dfc898..416df74 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -88,11 +88,16 @@ orun new --blueprint repo-blueprint.yaml \ --set subdomain= ``` -`subdomain` is the Cloudflare **account's** workers.dev subdomain, not the -product name. Every generated URL and the api-edge CORS allowlist derive from -it, so a wrong value ships a product that deploys cleanly and is unreachable -at every address it advertises. Find it under Workers & Pages in the -dashboard. +`subdomain` is the workers.dev subdomain of the Cloudflare account you deploy +into, not the product name. Every generated URL and the api-edge CORS +allowlist derive from it, so a wrong value ships a product that deploys +cleanly and is unreachable at every address it advertises. Find it under +Workers & Pages in the dashboard. + +A build started from the console, or with `orun baseline new --from bst_…`, +never asks for it: the platform reads it from the workspace's Cloudflare +connection, the same one the deploy tokens mint from. Only a hand-run build +like this one passes it. **`--run-hooks` is the difference between placing files and bootstrapping a product.** Without it `orun new` writes the tree and stops: no repo is @@ -255,8 +260,11 @@ tag, which is why it carries none. What that means for a console build: - `reponame` and `githuborg` come from the repository the operator picked; + `subdomain` from the workspace's Cloudflare connection + (`from: connection.cloudflare.workersSubdomain` — the connection the build + is bound to, so it names the account the deploy tokens mint from); `apibaseurl` is derived (`https://api.{productdomain}`); only - `productname`, `productdomain` and `subdomain` are typed. + `productname` and `productdomain` are typed. - `orunWorkspace` is not on the form — it cannot be. The build runs inside the workspace, and `from: workspace` (orun ≥ v2.58.11) fills it from there. - The card collects no `domain`, so a console build skips `07-domain`. Run @@ -342,7 +350,7 @@ purpose, written down so they read as instructions rather than breakage. | api-edge deploy: `Service binding '_WORKER' … not found` | A fleet worker never deployed in phase 04. Resume that convergence, then re-run `05-edge`. | | Convergence run fails, lanes look transient | `orun.run/watch@v1` already resumes it up to 3× (`gh run rerun --failed` is a true resume: exec-id + `--retry`). | | Convergence still red after the resume budget | Re-running the phase lands nothing new, and CI plans `--changed`, so nothing redeploys what the failed run left undeployed. Resume the run itself — `gh run rerun --failed ` — then re-run the phase so its `await` hooks verify. | -| `/health` probes fail against a green deploy | Check `subdomain` first: it must be the Cloudflare account's workers.dev subdomain, and the default is a placeholder. | +| `/health` probes fail against a green deploy | Check `subdomain` first: it must be the Cloudflare account's workers.dev subdomain, and the default is a placeholder. A console build reads it from the Cloudflare connection; a hand-run build passes it with `--set`. | | CLI login dies with 429 `rate_limited` | Fixed ≥ v2.48.1 (redeem honours Retry-After). Upgrade the CLI. | | `unknown flag: --phase`, `cannot unmarshal !!map into []scaffold.Hook`, or an action `has no parameter "githubOwner"` / `"sha"` | The CLI is below the v2.58.11 floor. This blueprint is not readable by an older one. | | A fresh build stops before 01-scaffold: `✕ phase "04-workers" precondition "wiring" is not met: … project "" not found` | The CLI is below v2.58.10, which asks the preflight about the product's project before phase 01 has created it and calls the answer a failure. Upgrade; the probe is then deferred to phase 04. | diff --git a/blueprint.yaml b/blueprint.yaml index 4f7dc30..c8d1394 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -103,6 +103,19 @@ spec: pattern: "^[a-z0-9][a-z0-9-]{0,62}$" help: The workers.dev subdomain on the Cloudflare account this builds into. example: acme + # READ FROM THE CLOUDFLARE CONNECTION, not asked. The subdomain belongs + # to the account the same way its id does, and there is exactly one + # right answer — a typed one could only be wrong, and wrong showed up + # after deploy, in CORS, OAuth origins, smoke checks and the verify URLs + # below. The integration reads it from Cloudflare at connect and on its + # hourly health check; the bootstrap door fills this input from the + # connection the build is BOUND to, the same one CLOUDFLARE_ACCOUNT_ID + # and the deploy tokens mint from, so all three name one account. + # + # No orun action and no `probe:` is needed, because the platform already + # holds the fact. An account with no workers.dev subdomain refuses the + # build at the door, naming the fix, before anything is created. + from: connection.cloudflare.workersSubdomain # ── PREVIEW ONLY. `repo-blueprint.yaml`'s `integrations/reconcile` hooks # mint these, brokered, during phase 03. ──────────────────────────────── diff --git a/docs/phases/01-scaffold.md b/docs/phases/01-scaffold.md index bedb2ba..a342c7f 100644 --- a/docs/phases/01-scaffold.md +++ b/docs/phases/01-scaffold.md @@ -47,7 +47,7 @@ gates the set, so the promise is a test rather than a claim. | `productdomain` | `acme.dev` | REQUIRED. Product domain | | `githuborg` | `sourceplane` | REQUIRED. The org or user the repo is created under | | `orunWorkspace` | `ws_ABCD1234` | workspace id. Unset, the workspace the build runs in (ORUN_WORKSPACE); with none anywhere, the placeholder `ws_SET_ME` | -| `subdomain` | `rahulvarghesepullely` | the Cloudflare account's workers.dev subdomain — every URL derives from it (worker names are brand-prefixed, so keeping the baseline's account is supported) | +| `subdomain` | `rahulvarghesepullely` | workers.dev subdomain of the Cloudflare account you deploy into — every URL derives from it (worker names are brand-prefixed, so keeping the baseline's account is supported). A console or `--from bst_…` build reads it from the Cloudflare connection; pass it only for a hand-run build | | `apibaseurl` | `https://api.acme.dev` | CLI default API base; empty derives from `productdomain` | | `repoPrivate` | `true` (default) | visibility at creation only | | `epicSlug` | `infra-baselining` (default) | the epic every phase files its task under | diff --git a/docs/phases/README.md b/docs/phases/README.md index 6103cc9..558756b 100644 --- a/docs/phases/README.md +++ b/docs/phases/README.md @@ -76,7 +76,7 @@ same words. | `productname` | yes | display name | | `productdomain` | yes | the apex domain the product answers on; it does not need to exist yet | | `githuborg` | yes | the org or user the repo lives under. The console fills it from the chosen repository's owner | -| `subdomain` | — | the Cloudflare **account's** workers.dev subdomain. The default is a placeholder; see below | +| `subdomain` | — | workers.dev subdomain of the Cloudflare **account** you deploy into. A console or `--from bst_…` build reads it from the Cloudflare connection; pass it only for a hand-run build. The default is a placeholder; see below | | `apibaseurl` | — | the CLI/SDK default API base; empty means `https://api.` | | `orunWorkspace` | — | workspace id. Unset, it is the workspace the build runs in (`from: workspace`, ORUN_WORKSPACE, which a console build always has); with none anywhere, 01 writes the placeholder `ws_SET_ME`, which fails loudly rather than silently cross-tenanting | | `epicSlug` | — | default `infra-baselining`; the epic every phase files its task under, found by slug so a fresh run and a resumed run find the same work | @@ -89,6 +89,11 @@ api-edge CORS allowlist derive from it, so a wrong value ships a product that deploys cleanly and is unreachable at every address it advertises — and the `/health` probes of 05, 06 and 08 fail against hosts that were never going to exist. Find it under Workers & Pages in the Cloudflare dashboard. +A build started from the console, or with `orun baseline new --from bst_…`, +never asks for it: `blueprint.yaml` declares +`from: connection.cloudflare.workersSubdomain`, so the platform reads it from +the workspace's Cloudflare connection, the same one the deploy tokens mint +from. Only a hand-run build passes it. `01-scaffold` writes the answers into the product as `.rebrand/values.json`, which is committed. Every later phase's rebrand hook diff --git a/repo-blueprint.yaml b/repo-blueprint.yaml index 523c42b..1f53dca 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -60,7 +60,11 @@ inputs: subdomain: type: string default: "your-workers-subdomain" - description: workers.dev subdomain for app-config seams. + description: >- + workers.dev subdomain for app-config seams. A console or `--from bst_…` + build gets it from the workspace's Cloudflare connection (blueprint.yaml + declares `from: connection.cloudflare.workersSubdomain`); pass it with + --set only for a hand-run build. salesEmail: type: string default: "" diff --git a/specs/epics/saas-bootstrap-factory/IMPLEMENTATION-STATUS.md b/specs/epics/saas-bootstrap-factory/IMPLEMENTATION-STATUS.md index 3c7aa09..12edd02 100644 --- a/specs/epics/saas-bootstrap-factory/IMPLEMENTATION-STATUS.md +++ b/specs/epics/saas-bootstrap-factory/IMPLEMENTATION-STATUS.md @@ -21,3 +21,31 @@ and `README.md` (at-a-glance). One row per shipped milestone, newest first. compiled plan DAG is unchanged and CI produces no component jobs. - Follow-on milestones (BF1+) begin changing `component.yaml` and Stack Tectonic contracts and will produce real plan/verify jobs. + +## The workers.dev subdomain, read from the Cloudflare connection (2026-10-21, `baseline-v30`) + +Ported from cirrus-baseline (its #30). `subdomain` was a typed field on the +console card, though it belongs to the Cloudflare account the same way its id +does and has exactly one right answer: a wrong one surfaced only after deploy, +in CORS, OAuth origins, smoke checks and the verify URLs. + +`blueprint.yaml` now declares `from: connection.cloudflare.workersSubdomain`. +The Cloudflare integration reads the subdomain from the account at connect and +on its hourly health check, and the bootstrap door fills the input from the +connection the build is BOUND to — the same one `CLOUDFLARE_ACCOUNT_ID` and the +deploy tokens mint from. The console renders no field for it, and an account +with no workers.dev subdomain refuses the build at the door, naming the fix. + +- `testing/manifest.test.sh` accepts the source and requires its provider to be + in `spec.requires.integrations` (cirrus's block, byte for byte). The card + already lists `cloudflare`. +- `repo-blueprint.yaml`, `BOOTSTRAP.md`, `docs/phases/01-scaffold.md` and + `docs/phases/README.md` say a hand-run build still passes `--set subdomain`. +- Cirrus also marked a BE3 "not probed" note superseded and answered its risk + #13. Lumen carried neither, so this section is the whole record. + +| check | result | +|---|---| +| manifest, phases, coverage, rebrand | all pass | +| mutation: `cloudflare` removed from the card's `spec.requires.integrations` | `manifest.test.sh` fails (exit 1) naming `inputs[subdomain]` — "there is no connection to read it from"; restored, it passes | +| `orun new --status`, `testing/leak.test.sh`, `testing/placement.test.sh` (orun 2.58.11, the CI pin) | pass — 1103 files derived and placed, unchanged | diff --git a/testing/manifest.test.sh b/testing/manifest.test.sh index cf6dcd2..2d68525 100755 --- a/testing/manifest.test.sh +++ b/testing/manifest.test.sh @@ -218,9 +218,20 @@ for path in manifests: # field for it (saas-bootstrap-console BC-K5). Two ways to get it # wrong, and the platform refuses both — check them here too, so the # mistake is caught in this repo rather than at a live bootstrap. + # + # A `connection..` source is read from the connection + # the build is bound to, so the provider must be one the manifest + # requires — the platform's parser refuses it otherwise. + sources_known = ("repo.name", "repo.owner", "repo.fullName", + "connection.cloudflare.workersSubdomain") src = field.get("from") - if src is not None and src not in ("repo.name", "repo.owner", "repo.fullName"): - B(f"inputs[{key}].from is {src!r} — must be repo.name, repo.owner or repo.fullName") + if src is not None and src not in sources_known: + B(f"inputs[{key}].from is {src!r} — must be one of {', '.join(sources_known)}") + if isinstance(src, str) and src.startswith("connection."): + provider = src.split(".")[1] + if provider not in ((spec.get("requires") or {}).get("integrations") or []): + B(f"inputs[{key}].from is {src!r} but spec.requires.integrations " + f"does not list {provider} — there is no connection to read it from") # ── secrets: BOTH or NEITHER, checked both ways ─────────────────────── declared = {s.get("key"): (s.get("provider"), s.get("template")) for s in (spec.get("secrets") or [])} From 6403a87d4374c7a5b1dc63ad9533943f49be43ed Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 21 Oct 2026 12:17:11 +0000 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20remove=20the=20domain=20input=20?= =?UTF-8?q?=E2=80=94=20the=20custom-domain=20component=20lands=20in=2006-c?= =?UTF-8?q?onsole,=20parked?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `07-domain` was the one conditional phase: off unless `--set domain=true`, landing a single component that ships parked (`subscribe.environments: []`), so its convergence was a green run with nothing in it. The switch turned on a component that is already off. Ported from cirrus-baseline #31; Lumen keeps its landings, so the component folds into 06-console, the last landing that converges a deploy and the one that places web-console-next. - repo-blueprint.yaml: the `domain` input, its values.json key and the 07-domain phase are gone; cloudflare-domain joins 06-console's modules - blueprint.yaml: the programme lists seven milestones - docs/phases/07-domain.md and tasks/07-domain.TaskContract.yaml deleted; what is still true (parked, v5 fence, zone first, restore the subscribe block) is a section of docs/phases/06-console.md and a row in ai/context/operations.md - 06-console's contract leaves cloudflare-domain out of `affects` (parked) - tests: phases.test.sh expects cloudflare-domain in 06-console; leak and placement no longer force `domain` on (1103 files placed, the identical set); the phased sequence places 08-docs after 06-console - tests/fixtures/acme.json drops "domain": false - records: saas-bootstrap-factory IMPLEMENTATION-STATUS section; a "Since then" note in saas-baseline-tracking Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01D8AmgTwmnp4M8mgmnS9aha --- BOOTSTRAP.md | 29 +++-- README.md | 6 +- ai/context/operations.md | 10 +- blueprint.yaml | 12 +- docs/phases/01-scaffold.md | 1 - docs/phases/06-console.md | 54 +++++++- docs/phases/07-domain.md | 120 ------------------ docs/phases/08-docs.md | 8 +- docs/phases/README.md | 27 ++-- docs/phases/TIMINGS.md | 7 +- repo-blueprint.yaml | 87 +++---------- specs/epics/saas-baseline-tracking/README.md | 7 + .../IMPLEMENTATION-STATUS.md | 58 +++++++++ tasks/06-console.TaskContract.yaml | 2 + tasks/07-domain.TaskContract.yaml | 14 -- testing/leak.test.sh | 4 +- testing/manifest.test.sh | 9 +- testing/phases.test.sh | 9 +- testing/placement.test.sh | 11 +- tests/fixtures/acme.json | 3 +- tooling/rebrand/rebrand.mjs | 4 +- 21 files changed, 202 insertions(+), 280 deletions(-) delete mode 100644 docs/phases/07-domain.md delete mode 100644 tasks/07-domain.TaskContract.yaml diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index 416df74..44e4ccb 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -116,8 +116,10 @@ every phase after `01-scaffold` brands the tree — derives as `drifted`, and The phases are `01-scaffold`, `02-foundation`, `03-infrastructure`, `03-infrastructure-database`, `04-workers`, `04-workers-restore`, `05-edge`, -`06-console`, `07-domain` (only when `domain=true`), `08-docs` — ten phases -filed under eight milestones. Each is idempotent, each follows one contract — +`06-console`, `08-docs` — nine phases filed under seven milestones. The gap +at 07 is the optional `07-domain` phase, whose parked custom-domain component +lands in `06-console` since baseline-v30 (the `domain` input that switched it +on is gone). Each is idempotent, each follows one contract — **place its modules → land them as a PR that must go green → watch the convergence → verify the outcome** — and each carries its own narration. Full guide: [docs/phases/README.md](docs/phases/README.md), with a page per @@ -137,8 +139,7 @@ orun new --blueprint repo-blueprint.yaml --out ~/sourceplane/acme --run-hooks \ orun new --blueprint repo-blueprint.yaml --out ~/sourceplane/acme --run-hooks \ --phase 02-foundation --values ~/sourceplane/acme/.rebrand/values.json # … 03-infrastructure, 03-infrastructure-database, 04-workers, -# 04-workers-restore, 05-edge, 06-console, 08-docs; -# 07-domain only with --set domain=true. +# 04-workers-restore, 05-edge, 06-console, 08-docs. ``` The flags that shape a run: @@ -252,7 +253,7 @@ The console renders **`blueprint.yaml`**, the card, and never this file or the blueprint directly. The card owns the build contract: the overview, the three integrations and the admin key role it requires, the inputs the form collects, a read-only preview of the five brokered secrets and of the -programme (the epic and its eight milestones), and `bootstrap.blueprint: +programme (the epic and its seven milestones), and `bootstrap.blueprint: repo-blueprint.yaml` — the document a runner places. The registry row in orun-cloud owns identity and the pinned tag; the card is fetched *at* that tag, which is why it carries none. @@ -267,8 +268,9 @@ What that means for a console build: `productname` and `productdomain` are typed. - `orunWorkspace` is not on the form — it cannot be. The build runs inside the workspace, and `from: workspace` (orun ≥ v2.58.11) fills it from there. -- The card collects no `domain`, so a console build skips `07-domain`. Run - it later from the CLI (and read its page first). +- There is no `domain` input. The custom-domain component lands in + `06-console`, parked, on every build, and an owner wires it later in an + ordinary PR (§4). - The runner hands its refreshed token over through `ORUN_TOKEN_FILE` (`bootstrap.tokenChannel`), so a session that rotates mid-build does not end it. @@ -281,11 +283,14 @@ that mint them, and its programme and inputs to the blueprint's. - **Deployment record**: `08-docs` is the close-out, and safe to re-run any time as a live-state refresh. -- **Custom domain**: `07-domain` needs the product zone to exist in - Cloudflare, and in this baseline the `cloudflare-domain` component ships - parked and mid-migration to provider v5, so the phase lands it without - deploying anything. See [docs/phases/07-domain.md](docs/phases/07-domain.md) - before running it. +- **Custom domain**: the `cloudflare-domain` component is already in the + product, landed by `06-console`: parked (it subscribes to no environment) + and mid-migration to provider v5. Create the product zone in + Cloudflare, finish the v5 resource and restore the component's + commented-out `subscribe` block in an ordinary PR (see + [docs/phases/06-console.md](docs/phases/06-console.md#the-custom-domain--parked)), + and re-run `--phase 08-docs` once it converges so the docs pick up the + domain URLs. - **Runtime secrets** (OAuth client secrets, billing keys, …): seed with `orun secrets set --org --env `; the next deploy pushes them to the workers (`wire-now-seed-later` — nothing blocks on them). diff --git a/README.md b/README.md index ddf8f9c..8e3e165 100644 --- a/README.md +++ b/README.md @@ -42,10 +42,10 @@ _Not yet recorded — run [`08-docs`](docs/phases/08-docs.md) after This baseline births new products from one artifact — `repo-blueprint.yaml`, run by `orun new` (**[BOOTSTRAP.md](BOOTSTRAP.md)** → -[docs/phases/](docs/phases/README.md)). It declares ten idempotent phases — +[docs/phases/](docs/phases/README.md)). It declares nine idempotent phases — scaffold, foundation, infrastructure, database, workers, workers-restore, -edge, console, optional domain, docs — each landing a verified slice, each -selectable with `--phase `. +edge, console (with the custom-domain component, parked), docs — each landing +a verified slice, each selectable with `--phase `. Products receive **product-only content** (source, infra, CI, their own docs); none of this baseline's machinery ships, and a product's docs speak only about the product. diff --git a/ai/context/operations.md b/ai/context/operations.md index c1f6949..439886f 100644 --- a/ai/context/operations.md +++ b/ai/context/operations.md @@ -113,11 +113,11 @@ orun integrations list --org --json && orun cloud check --org | add a runtime secret | `orun secrets set --org --env ` | | resolve workspace identity | `orun workspace ` | | check integrations | `orun integrations list --org --json` | -| custom domain | run the `07-domain` phase once the zone exists, then `08-docs` | +| custom domain | `infra/terraform/cloudflare-domain` ships parked (`subscribe.environments: []`). Once the zone exists in the Cloudflare account, finish the provider-v5 resource and restore the `subscribe` block its `component.yaml` carries commented out, merge, then run the `08-docs` phase | | headless/CI credentials | `ORUN_TOKEN` (workspace-scoped) + `GITHUB_TOKEN` | -The ops phases (docs refresh, custom domain, and the original deployment -sequence) all live in ONE versioned artifact: `repo-blueprint.yaml` in the +The ops phases (docs refresh and the original deployment sequence) all +live in ONE versioned artifact: `repo-blueprint.yaml` in the baseline this product was born from. Clone it at a tag and select the phase — from anywhere, with the two tokens above exported: @@ -126,10 +126,6 @@ git clone --depth 1 https://github.com/OPSFLOWS baseline && cd baseline orun new --blueprint repo-blueprint.yaml --out \ --run-hooks --phase 08-docs --values # docs refresh - -orun new --blueprint repo-blueprint.yaml --out \ - --run-hooks --phase 07-domain --set domain=true \ - --values # custom domain ``` `` carries this product's identity — at minimum `reponame`, diff --git a/blueprint.yaml b/blueprint.yaml index c8d1394..20682b4 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -154,7 +154,7 @@ spec: # these. Idempotent by identity — epic by slug, milestone by name-within-epic # — so a re-run finds what it made before. The console renders the programme # so an operator can see the shape of the work before pressing Build. - # Ten phases, eight milestones: `03-infrastructure-database` and + # Nine phases, seven milestones: `03-infrastructure-database` and # `04-workers-restore` are second landings of 03 and 04, and file under them. programme: epicSlug: infra-baselining # = repo-blueprint.yaml's `epicSlug` default @@ -165,13 +165,11 @@ spec: - name: 03-infrastructure - name: 04-workers - name: 05-edge + # The custom-domain component lands in 06-console, parked (it + # subscribes to no environment until an owner wires a zone), so the + # optional 07-domain milestone and the `domain` input that switched it + # on are gone. The numbering keeps its gaps so 08 keeps its name. - name: 06-console - # 07-domain carries `when: inputs.domain` in repo-blueprint.yaml (it - # needs the Cloudflare zone to already exist), so its milestone is - # ensured only on a run that asks for it. Declared with its condition - # rather than silently listed, so the console can say so. - - name: 07-domain - when: domain - name: 08-docs bootstrap: diff --git a/docs/phases/01-scaffold.md b/docs/phases/01-scaffold.md index a342c7f..c0b2e3f 100644 --- a/docs/phases/01-scaffold.md +++ b/docs/phases/01-scaffold.md @@ -51,7 +51,6 @@ gates the set, so the promise is a test rather than a claim. | `apibaseurl` | `https://api.acme.dev` | CLI default API base; empty derives from `productdomain` | | `repoPrivate` | `true` (default) | visibility at creation only | | `epicSlug` | `infra-baselining` (default) | the epic every phase files its task under | -| `domain` | `false` (default) | `true` also runs `07-domain` | The full set, rebrand overrides included, is in the [phases README](README.md#inputs) and `repo-blueprint.yaml`'s `inputs:` diff --git a/docs/phases/06-console.md b/docs/phases/06-console.md index fc6ba67..bf1dcdb 100644 --- a/docs/phases/06-console.md +++ b/docs/phases/06-console.md @@ -2,7 +2,8 @@ Lands the **web console** (`repo-blueprint.yaml`, phase `06-console`) — the product UI served from Workers static assets — and proves both it and the -edge it talks to live. +edge it talks to live. The custom-domain component lands with it, parked +([below](#the-custom-domain--parked)). ## What it lands @@ -12,6 +13,52 @@ phase 05 edge. Console builds are the heaviest lane in the product, which is why this phase's landing waits up to 45 minutes for its PR and its convergence watch up to 45 minutes too. +`infra/terraform/cloudflare-domain` lands in the same pull request, parked. +`testing/phases.test.sh` holds the set: modules move whole, and nothing else +moves with them. + +## The custom domain — parked + +`infra/terraform/cloudflare-domain` — the zone lookup and, once wired, a +custom domain per environment for the console worker +(`CONSOLE_CUSTOM_DOMAIN` in the product's `intent.yaml`: +`stage.` and `prod.` after rebrand, empty for +`dev`) — lands with the console and **deploys nothing**, for two reasons +that live in the component rather than in the phase: + +1. **It ships parked.** Its `component.yaml` declares + `subscribe.environments: []`, so CI plans no lanes for it. The product + runs on workers.dev URLs until an owner wires it. +2. **The attachment is fenced off.** The component is midway through a + two-step migration to Cloudflare provider v5: the v4 + `cloudflare_workers_domain` resource was dropped from state and its block + is commented out until the v5 `cloudflare_workers_custom_domain` replaces + it. Un-parked as it stands, the root would look up the zone and attach + nothing. + +It used to land on its own as the optional `07-domain` phase, behind a +`domain` input. That landing deployed nothing either — its convergence was a +green run with nothing in it — so the phase and the switch are gone, and +this phase's task contract leaves the component out of `affects`: there is +nothing in it to re-plan. + +Wiring it is a normal pull request in the product, once the zone exists: + +1. **The zone first.** The product zone (e.g. `acme.dev`) must already exist + in the Cloudflare account the product deploys into, created in the + dashboard; zone creation is an account-plan operation the platform does + not broker. The component runs with `zoneMode: existing`: it looks the + zone up by `baseDomain` and manages records and custom domains IN it, not + the zone itself. Without the zone a plan fails with `no zone found` (or + the brokered token's account is not the zone's). +2. **Finish the v5 resource and restore the `subscribe` block** the + component carries commented out — both are described in its own comments, + and its `README.md` says where the migration stands. +3. **Land it.** The convergence on `main` applies it; check the product + resolves on its own domain (DNS propagation applies), then re-run + [`08-docs`](08-docs.md) so the deployment manifest records the + custom-domain URLs. + ## Inputs `--out` is the product repo. The blueprint's required inputs — `reponame`, @@ -79,9 +126,8 @@ nothing new, and the `await` hooks re-probe. ## Next -[Phase 08 — docs](08-docs.md) records what was built. Optional -[phase 07 — domain](07-domain.md) comes first only if you set -`domain=true` — read that page before you do. +[Phase 08 — docs](08-docs.md) records what was built. The custom domain is +wired later, in an ordinary PR ([above](#the-custom-domain--parked)). Post-baseline: seed runtime worker secrets (`orun secrets set --org --env `; wire-now-seed-later, nothing blocks on them) and ship diff --git a/docs/phases/07-domain.md b/docs/phases/07-domain.md deleted file mode 100644 index 206f53b..0000000 --- a/docs/phases/07-domain.md +++ /dev/null @@ -1,120 +0,0 @@ -# Phase 07 — domain (OPTIONAL, and not yet wired end to end) - -Lands the **custom product domain** (`repo-blueprint.yaml`, phase -`07-domain`): the `cloudflare-domain` terraform that is meant to put the -console on `` instead of workers.dev. - -Skip it until you own the domain — the baseline is fully functional on -workers.dev URLs after phase 06. And read the next section before you run it -at all. - -## What this phase does today — read this first - -In this baseline, running `07-domain` lands the component and **deploys -nothing**, for two reasons that live in the component rather than in the -phase: - -1. **`cloudflare-domain` ships parked.** Its `component.yaml` declares - `subscribe.environments: []`, so CI plans no lanes for it. The phase's - convergence is therefore a run with nothing in it, and reads green. This - is the "a green run that deployed nothing" trap every other phase guards - against with a probe; this phase has no probe to catch it. -2. **The custom-domain attachment is fenced off.** The component is midway - through a two-step migration to Cloudflare provider v5: the v4 - `cloudflare_workers_domain` resource was dropped from state and its - block is commented out until the v5 `cloudflare_workers_custom_domain` - replaces it. Un-parked as it stands, the root would look up the zone and - attach nothing. - -So the honest status is: the phase, its task and its PR work; the domain -does not. Wiring it for real means, in the product, finishing the v5 -resource and restoring the `subscribe` block (both are described in the -component's own comments), then landing that as a normal PR once the zone -exists. The phase's narration says as much when it is done: the component -is in the repository, and nothing is attached until it subscribes. - -## Prerequisite (hard) - -The product zone (e.g. `acme.dev`) must **already exist in the Cloudflare -account** — created in the dashboard; zone creation is an account-plan -operation the platform does not broker. The component runs with -`zoneMode: existing`: it looks the zone up by `baseDomain` and manages -records and custom domains IN it, not the zone itself. Without the zone a -plan fails with `no zone found`. - -## What it lands - -`infra/terraform/cloudflare-domain`: the zone lookup and, once the migration -above is finished, a custom domain per environment for the console worker — -`CONSOLE_CUSTOM_DOMAIN` in the product's `intent.yaml`, -`stage.` and `prod.` after rebrand (empty for -`dev`). - -## Inputs - -`--out` is the product repo. The blueprint's required inputs — `reponame`, -`productname`, `productdomain`, `githuborg` — are validated before any phase -runs, so pass them on every invocation; the product's own -`.rebrand/values.json` is a complete values file. See -[the phases README](README.md#inputs). - -The phase carries `when: inputs.domain`, so it is **skipped** unless -`domain=true` — set on the command line or recorded in the values file. A -skipped phase does not block `08-docs`, which requires `06-console` rather -than this one. The console card collects no `domain`, so a console build -always skips this phase. - -## Steps - -1. **requires** — `06-console` placed. -2. **pre** — the phase's task (its milestone is ensured only on a run that - asks for the phase). -3. **place** → **brand** → **lockfile** → **land** — the standard contract - (PR `phase(07-domain): custom domain`). -4. **converge** — `orun.run/watch@v1` on the merged commit. See above for - what that run contains today. - -## Verify / done means - -The convergence run is green. Then — once the component is wired — check the -product resolves on its own domain (DNS propagation applies), and re-run -[phase 08](08-docs.md) so the deployment manifest records the custom-domain -URLs. - -## Troubleshooting - -- **Plan fails: zone not found** — the zone does not exist in this - Cloudflare account yet, or the brokered token's account differs from the - zone's account. Create the zone, re-run. -- **Green convergence, domain does not resolve** — expected today; see - "What this phase does today". - -## Example commands - -From the baseline checkout: - -```bash -orun new --blueprint repo-blueprint.yaml --out $HOME/sourceplane/acme \ - --run-hooks --phase 07-domain --set domain=true \ - --values $HOME/sourceplane/acme/.rebrand/values.json -``` - -Headless (fresh container / no checkout — see BOOTSTRAP.md §2): clone the -baseline at a tag and run the same command, with `ORUN_TOKEN` + -`GITHUB_TOKEN` exported: - -```bash -export ORUN_TOKEN="$(orun auth token | tail -1)" GITHUB_TOKEN=… -git clone --depth 1 --branch https://github.com/sourceplane/lumen -cd lumen -orun new --blueprint repo-blueprint.yaml --out /work/acme \ - --run-hooks --phase 07-domain --set domain=true --values /work/acme.values.yaml -``` - -Preview with zero side effects: drop `--run-hooks` — the phase places files -and stops, with no landing, no convergence watch and no probe. `--status` -derives every phase's state and writes nothing at all. - -## Next - -[Phase 08 — docs](08-docs.md). diff --git a/docs/phases/08-docs.md b/docs/phases/08-docs.md index e5d525a..c84555f 100644 --- a/docs/phases/08-docs.md +++ b/docs/phases/08-docs.md @@ -25,8 +25,7 @@ this credential" rather than a failed render. ## Steps -1. **requires** — `06-console` placed. Not `07-domain`, so a bootstrap that - skips the custom domain still reaches this phase. +1. **requires** — `06-console` placed. 2. **pre** — the phase's task. 3. **render** — a `post` hook runs `hooks/render-deployment-docs.sh . ` from the baseline checkout. It reads identity from @@ -46,8 +45,9 @@ this credential" rather than a failed render. - Right after [phase 06](06-console.md) — the "working baseline" moment — to record it. -- Again after [phase 07](07-domain.md), once the domain actually resolves, - so the manifest picks up the custom-domain URLs. +- Again once the custom domain is wired (see + [06-console](06-console.md#the-custom-domain--parked)) and actually + resolves, so the manifest picks up the custom-domain URLs. - Any time later as a **live-state refresh**: the manifest is regenerated from scratch on every run and carries its own render timestamp. The product's `ai/context/operations.md` carries the same command for its own diff --git a/docs/phases/README.md b/docs/phases/README.md index 558756b..fb1fca8 100644 --- a/docs/phases/README.md +++ b/docs/phases/README.md @@ -1,6 +1,6 @@ -# The phases — one blueprint, ten selections +# The phases — one blueprint, nine selections -`repo-blueprint.yaml` declares ten phases that take a product from +`repo-blueprint.yaml` declares nine phases that take a product from **nothing** to a **live, documented baseline** on Cloudflare and Supabase. Run them one at a time at your own pace with `--phase `, or run the whole sequence unattended with `--resume`. There is no wrapper that runs @@ -41,17 +41,19 @@ deploying is what a merge does and a PR cannot. | [`04-workers`](04-workers.md) | 04-workers | the 12-worker fleet, two feedback bindings stripped | convergence green | | [`04-workers-restore`](04-workers.md#the-second-landing-04-workers-restore) | 04-workers | the two bindings put back (places no files) | convergence green | | [`05-edge`](05-edge.md) | 05-edge | `api-edge` (+ its tests, + `platform-limits-tests`) | `/health` answers on stage and prod | -| [`06-console`](06-console.md) | 06-console | web console | console + edge live on stage and prod | -| [`07-domain`](07-domain.md) | 07-domain | custom domain (OPTIONAL — `when: inputs.domain`) | convergence green | +| [`06-console`](06-console.md) | 06-console | web console, and the custom-domain component (parked until a zone is wired) | console + edge live on stage and prod | | [`08-docs`](08-docs.md) | 08-docs | live-deployment docs (places no files; a hook renders them) | the URLs the manifest claims, re-probed | -Ten phases, eight milestones. `03-infrastructure-database` and +Nine phases, seven milestones. `03-infrastructure-database` and `04-workers-restore` are second landings of the unit before them: each has its own PR and its own task, and each files under its predecessor's milestone. They are documented on their predecessor's page for the same -reason. +reason. The numbering keeps its gap at 07: the custom-domain component that +was the optional `07-domain` phase lands in `06-console`, parked, and an +owner wires it later in an ordinary PR (see +[06-console](06-console.md#the-custom-domain--parked)). -Two requirements look odd and are deliberate: +One requirement looks odd and is deliberate: - **`05-edge` requires `04-workers`, not `04-workers-restore`.** A phase that places no files derives as `unknown` — the product repo cannot be @@ -61,8 +63,6 @@ Two requirements look odd and are deliberate: that catches a phase run against a tree where its predecessor never happened. `testing/phases.test.sh` refuses a requirement on a hook-only phase. -- **`08-docs` requires `06-console`, not `07-domain`**, so a bootstrap that - skips the custom domain still reaches it. ## Inputs @@ -81,7 +81,6 @@ same words. | `orunWorkspace` | — | workspace id. Unset, it is the workspace the build runs in (`from: workspace`, ORUN_WORKSPACE, which a console build always has); with none anywhere, 01 writes the placeholder `ws_SET_ME`, which fails loudly rather than silently cross-tenanting | | `epicSlug` | — | default `infra-baselining`; the epic every phase files its task under, found by slug so a fresh run and a resumed run find the same work | | `repoPrivate` | — | default `true`; applied only when `01-scaffold` creates the repo — an existing repo keeps its visibility | -| `domain` | — | default `false`; `true` runs `07-domain` (read that page first) | | `pascalName`, `brandSlug`, `cliBin`, `salesEmail` | — | rebrand overrides. Empty, the first three derive from the names above (`brandSlug`, the worker prefix, from `reponame`); an empty `salesEmail` keeps the baseline mailbox | **`subdomain` is not the product name.** Every generated URL and the @@ -97,7 +96,7 @@ from. Only a hand-run build passes it. `01-scaffold` writes the answers into the product as `.rebrand/values.json`, which is committed. Every later phase's rebrand hook -reads it, and it carries `githuborg`, `epicSlug` and `domain` too, so a phase +reads it, and it carries `githuborg` and `epicSlug` too, so a phase run months later in a fresh container can recover what the operator answered (orun's own record, `.orun/provenance.lock`, is gitignored and does not survive a container). The blueprint's **required** inputs are still @@ -176,8 +175,7 @@ Why it can run unattended: reverting your product's identity to `lumen`. Re-place one deliberately with `--phase `. - `04-workers-restore` and `08-docs` place no files, so they derive as - `unknown`; `07-domain` derives as `skipped` unless `domain=true`. - `--status` prints all of this without writing anything. + `unknown`. `--status` prints all of this without writing anything. - **Git-level idempotence is not deploy-level idempotence.** The product's CI plans `--changed`: a component deploys only when its files changed in the push. If a convergence is still red after the watch has spent its @@ -269,8 +267,7 @@ never product content. The whole design: `specs/epics/saas-baseline-tracking/`. The console previews the same programme from `blueprint.yaml`'s -`programme:` block — the epic and its eight milestones, with `07-domain` -marked conditional. +`programme:` block — the epic and its seven milestones. ## Why there is one document diff --git a/docs/phases/TIMINGS.md b/docs/phases/TIMINGS.md index f7829ea..2f9d4b6 100644 --- a/docs/phases/TIMINGS.md +++ b/docs/phases/TIMINGS.md @@ -44,13 +44,12 @@ quotes to an operator ("About N minutes"). | `04-workers-restore` | 5 | **estimate** | — as its own phase; its convergence was the 10m54s inside vela's 31m | billing + membership redeploy | | `05-edge` | 5 | measured | 5m22s vela; 5m03s ambient | land → converge → `/health` probes | | `06-console` | 16 | measured | 15m37s vela (all 3 resumes, self-healed); 14m01s ambient (0 resumes) | console builds are heavy | -| `07-domain` | 5 | **estimate, never run** | — | today its convergence plans nothing ([07-domain.md](07-domain.md)) | | `08-docs` | 1 | **estimate** | — (neither run's table records it) | probe + render + land | | tracking (BT) | seconds per landing | **estimate** | — | one task lookup and at most two creates per landing, plus the epic once | **Totals.** Measured: ~73m for 01–06 on vela, ~60m for 02–06 on ambient. The card (`blueprint.yaml`) promises ~60–75 minutes and budgets 75. The -per-phase numbers above sum to 84 without `07-domain` — they overstate, +per-phase numbers above sum to 84 — they overstate, because `04-workers`' 31 is vela's figure for the old phase 04, which already contained the restore landing that `04-workers-restore` budgets again. Budget **60–75 minutes**, and treat the 04 pair as ~20–31 between them. @@ -85,7 +84,9 @@ unchanged is a document nobody checked. over `ORUN_TOKEN`. 5. **A convergence that follows a commit touching NO components** plans zero lanes and reads "green". The phase's verify hook is the real gate; never - trust a green run without one. (`07-domain` is exactly this case today.) + trust a green run without one. (It is why the parked custom-domain + component no longer has a landing of its own: as `07-domain` it was + exactly this case. It lands in `06-console` now.) ## Defect log from the measured runs diff --git a/repo-blueprint.yaml b/repo-blueprint.yaml index 1f53dca..64d4a98 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -84,9 +84,10 @@ inputs: the build runs in; with none anywhere, the scaffold writes a placeholder that fails loudly rather than silently cross-tenanting. # ── The facts the phases below need and the flows used to hold. They were - # workflow inputs (`githuborg`, `epicslug`, `domain` on the flows' per-phase - # workflow.yaml), which made them invisible to anything reading this file — - # including the console that has to render a form. + # workflow inputs (`githuborg`, `epicslug` — and `domain`, gone since the + # custom-domain component lands with the console, parked — on the flows' + # per-phase workflow.yaml), which made them invisible to anything reading + # this file — including the console that has to render a form. githuborg: type: string pattern: "^[A-Za-z0-9][A-Za-z0-9-]*$" @@ -110,14 +111,6 @@ inputs: cannot be un-made retroactively for anything already pushed. `orun.repo/ensure@v1` only sets this at creation: an existing repository keeps whatever visibility it already has. - domain: - type: boolean - default: false - description: >- - Whether to wire the product's custom domain (phase 07). It needs the - Cloudflare zone to already exist, so it is off unless asked for — the - condition the umbrella carried as a shell `[ = "true" ]` test and phase - 07 now carries as its own `when:`. # ── SOURCES ─────────────────────────────────────────────────────────────── # The baseline is this repo itself. Run `orun new` from the Lumen repo root so @@ -633,7 +626,7 @@ modules: # records the non-secret inputs in .orun/provenance.lock, but `.orun/` is # gitignored in the product, so it has never survived a container — this # file is committed, which is why every input a later phase needs must - # appear here. githuborg/epicSlug/domain are here for exactly that: a + # appear here. githuborg/epicSlug are here for exactly that: a # phase run months later in a fresh container reads them back. - name: rebrand-values mode: template @@ -651,8 +644,7 @@ modules: "salesEmail": "{{ .salesEmail }}"{{ end }}, "orunWorkspace": "{{ .orunWorkspace }}", "githuborg": "{{ .githuborg }}", - "epicSlug": "{{ .epicSlug }}", - "domain": {{ if .domain }}true{{ else }}false{{ end }} + "epicSlug": "{{ .epicSlug }}" } # ── PHASES ──────────────────────────────────────────────────────────────── @@ -1320,6 +1312,14 @@ phases: - "https://{{ .inputs.reponame }}-api-edge-stage.{{ .inputs.subdomain }}.workers.dev/health" - "https://{{ .inputs.reponame }}-api-edge-prod.{{ .inputs.subdomain }}.workers.dev/health" + # The custom-domain component lands here too, PARKED: it subscribes to no + # environment until an owner wires a zone (the commented-out `subscribe` + # block in infra/terraform/cloudflare-domain/component.yaml), so a landing of + # its own changed nothing live. It belongs with the last landing that + # converges a deploy because it routes the DEPLOYED console and edge (it + # `dependsOn` web-console-next). It was the optional 07-domain phase, behind + # a `domain` input, until that input was removed; the numbering keeps its + # gap so 08-docs keeps its name. - name: 06-console title: The web console expectedMinutes: 16 @@ -1328,7 +1328,7 @@ phases: await: "The console is building. This is the second-longest wait of the build." done: "The console is live on stage and prod, talking to the edge. {{ .meta.elapsed }}." failed: "The console did not build. The build log above carries the error." - modules: [web-console-next, web-console-next-tests] + modules: [cloudflare-domain, web-console-next, web-console-next-tests] requires: phases: [05-edge] hooks: @@ -1383,63 +1383,6 @@ phases: - "https://{{ .inputs.reponame }}-api-edge-prod.{{ .inputs.subdomain }}.workers.dev/health" - "https://{{ .inputs.reponame }}-web-console-next-prod.{{ .inputs.subdomain }}.workers.dev" - # cloudflare-domain trails the console because it wires the DEPLOYED - # console's custom domain. `when:` is the condition the umbrella carried as - # `[ "{{ inputs.domain }}" = "true" ]` in shell — a phase that declares when - # it runs beats a caller remembering not to ask for it. - - name: 07-domain - title: The custom domain - expectedMinutes: 5 - narrate: - start: "Now placing the custom-domain component for {{ .inputs.productdomain }} — the zone and the console's custom domains." - await: "Waiting for the convergence run that follows the domain PR." - done: "The custom-domain component is in the repository. It subscribes to no environment yet, so nothing is attached until it does — docs/phases/07-domain.md says what to change." - failed: "The domain phase did not land. Check that the zone for {{ .inputs.productdomain }} exists in this Cloudflare account." - modules: [cloudflare-domain] - when: inputs.domain - requires: - phases: [06-console] - hooks: - pre: - - id: task - uses: orun.task/ensure@v1 - with: - kind: task - epic: "{{ .inputs.epicSlug }}" - milestone: "{{ .phase.name }}" - name: "phase({{ .phase.name }}): custom domain" - prefix: BASE - contract: tasks/07-domain.TaskContract.yaml - post: - # Brand what this phase placed before it lands (see 02-foundation). - - id: stage - run: ["git", "add", "-A"] - - id: rebrand - run: ["node", "{{ .baseline.dir }}/tooling/rebrand/rebrand.mjs", "--values", ".rebrand/values.json", "--allow-dirty"] - - id: restage - run: ["git", "add", "-A"] - - id: rebrand-verify - run: ["node", "{{ .baseline.dir }}/tooling/rebrand/rebrand.mjs", "--verify", "--values", ".rebrand/values.json"] - - id: pnpm-lockfile - run: ["pnpm", "install", "--lockfile-only"] - - id: land - uses: orun.pr/land@v1 - narrate: "The domain PR is merged into main." - with: - task: "{{ .phase.hooks.task.outputs.key }}" - epic: "{{ .inputs.epicSlug }}" - branchSlug: "{{ .phase.name }}" - title: "phase({{ .phase.name }}): custom domain" - await: - - id: converge - uses: orun.run/watch@v1 - narrate: "The convergence run after the domain PR came back green." - with: - sha: "{{ .phase.hooks.land.outputs.mergeSha }}" - repo: "{{ .inputs.githuborg }}/{{ .inputs.reponame }}" - resumeBudget: 3 - waitSeconds: 1800 - # Places nothing. It records what the other phases built, from PROBED facts # rather than from what the blueprint intended — which is why it runs last # and why its verify is the same probe 06-console ends on. diff --git a/specs/epics/saas-baseline-tracking/README.md b/specs/epics/saas-baseline-tracking/README.md index a0c6f31..0628b7f 100644 --- a/specs/epics/saas-baseline-tracking/README.md +++ b/specs/epics/saas-baseline-tracking/README.md @@ -53,6 +53,13 @@ folder records what was ported here and where Lumen differs. - **The rehearsal.** One real Lumen bootstrap with `track=true` whose epic rollup reads `8/8 done`, recorded here with the task keys. +> **Since then.** The flows became `repo-blueprint.yaml`, and in +> `baseline-v30` the `domain` input was removed: `07-domain`'s one component +> ships parked, so it lands in `06-console`. A bootstrap today opens seven +> milestones (`01-scaffold` to `06-console`, then `08-docs`), so the rollup to +> look for is `7/7`. The text above is the shape BT shipped, kept as the +> record. + ## Agent brief v2 — one command, four kinds of line Ported from cirrus (its #36). The brief is 65 lines: ask three questions, diff --git a/specs/epics/saas-bootstrap-factory/IMPLEMENTATION-STATUS.md b/specs/epics/saas-bootstrap-factory/IMPLEMENTATION-STATUS.md index 12edd02..277acdd 100644 --- a/specs/epics/saas-bootstrap-factory/IMPLEMENTATION-STATUS.md +++ b/specs/epics/saas-bootstrap-factory/IMPLEMENTATION-STATUS.md @@ -49,3 +49,61 @@ with no workers.dev subdomain refuses the build at the door, naming the fix. | manifest, phases, coverage, rebrand | all pass | | mutation: `cloudflare` removed from the card's `spec.requires.integrations` | `manifest.test.sh` fails (exit 1) naming `inputs[subdomain]` — "there is no connection to read it from"; restored, it passes | | `orun new --status`, `testing/leak.test.sh`, `testing/placement.test.sh` (orun 2.58.11, the CI pin) | pass — 1103 files derived and placed, unchanged | + +## The `domain` input, removed (2026-10-21, `baseline-v30`) + +Ported from cirrus-baseline (its #31). `07-domain` was the one conditional +phase: `when: inputs.domain`, off by default, landing a single component, +`cloudflare-domain`. That component ships PARKED — `subscribe.environments: +[]` — so CI plans no lanes for it and the phase's convergence was a green run +with nothing in it. A landing that deploys nothing, behind a switch that turns +on a component which is already off, was one more question and one more PR for +no effect. Cirrus has one landing and folded the component into `01-product`; +Lumen keeps its landings, so it folds into `06-console`, the last landing that +converges a deploy and the one that places `web-console-next`, which the +component routes and `dependsOn`. + +### What shipped + +- `repo-blueprint.yaml`: the `domain` input is gone, and with it the + `"domain"` key of the `.rebrand/values.json` template; `cloudflare-domain` + joins `06-console`'s modules; the `07-domain` phase is deleted. Nine phases + remain; the numbering keeps its gap so `08-docs` keeps its name. `08-docs` + already required `06-console`. +- `blueprint.yaml`: the programme lists seven milestones; `07-domain` (and its + `when: domain`) is gone. +- `tasks/07-domain.TaskContract.yaml` and `docs/phases/07-domain.md` are + deleted. What the page said that is still true — the component ships parked, + its custom-domain attachment is fenced off mid-migration to provider v5, the + zone must exist in the account first, wiring it is restoring the + commented-out `subscribe` block — is now a section of + `docs/phases/06-console.md`, and `ai/context/operations.md` (which ships) + says the same without naming a factory path. +- `06-console`'s task contract leaves `cloudflare-domain` out of `affects`: + that list is what the convergence deploys, and a parked component deploys + nothing. +- `tests/fixtures/acme.json` loses `"domain": false`. + +### What the tests had to become + +- `testing/phases.test.sh` has no FOLDED map, so its partition records the + move in place: `06-console` expects `cloudflare-domain`, with a comment + saying why, and the gate still proves the component moved whole and nothing + moved with it. +- `testing/leak.test.sh` and `testing/placement.test.sh` no longer force + `domain` on: `06-console` places the component on every build, so the gates + cover it without help. The placement tier's phased sequence now places + `08-docs` after `06-console` — it requires the drifted `06-console`, the + exact case BE-O12 fixed. +- `testing/manifest.test.sh` (comments only) no longer lists `domain` among + the blueprint's build-driving inputs. + +### Verification + +| check | result | +|---|---| +| manifest, phases, coverage, rebrand | all pass — 7 milestones agree; 9 phases, 65 modules | +| `orun new --status` (orun 2.58.11, the CI pin) | parses; nine phases derived | +| `testing/leak.test.sh` (orun 2.58.11) | pass — 1103 files derived, 2 context files, no factory paths | +| `testing/placement.test.sh` (orun 2.58.11) | pass — 1103 product files, the same count as with `domain` forced on before; `01 → 08` place through the rebrand; `--resume` keeps the branding | +| derived file set against `main` with `domain=true` | identical: 1103 files, and `06-console`'s 186 are exactly `main`'s 06-console (176) plus 07-domain (10) | diff --git a/tasks/06-console.TaskContract.yaml b/tasks/06-console.TaskContract.yaml index eb914f8..799e09f 100644 --- a/tasks/06-console.TaskContract.yaml +++ b/tasks/06-console.TaskContract.yaml @@ -9,6 +9,8 @@ spec: goal: The web console is live on stage and prod, talking to the edge affects: - web-console-next + # Not cloudflare-domain, though 06-console lands it: it ships parked + # (subscribe.environments: []), and a parked component deploys nothing. doneWhen: - console and edge live on stage and prod gates: [] diff --git a/tasks/07-domain.TaskContract.yaml b/tasks/07-domain.TaskContract.yaml deleted file mode 100644 index 3a1de97..0000000 --- a/tasks/07-domain.TaskContract.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# Task contract template for the 07-domain landing (saas-baseline-tracking BT1). -# Unbound to a key on purpose: `orun task create --contract` seals and -# attaches it to the key the allocator issues. gates: [] is a DECLARATION — -# merge alone finishes this task; the main convergence is the gate the flow -# watches, not one the plane observes as a PR check. -apiVersion: orun.io/v1 -kind: TaskContract -spec: - goal: The product answers on its custom domain instead of workers.dev - affects: - - cloudflare-domain - doneWhen: - - convergence green on the custom domain - gates: [] diff --git a/testing/leak.test.sh b/testing/leak.test.sh index 6678baf..3ceef5d 100755 --- a/testing/leak.test.sh +++ b/testing/leak.test.sh @@ -27,14 +27,12 @@ trap 'rm -rf "$scratch"' EXIT echo "── deriving what every phase would place" # Inputs come from the fixture, so a new required input fails HERE rather than -# in front of an operator. `domain` is forced on: 07-domain is conditional, and -# a gate that never looks at a phase cannot vouch for it. +# in front of an operator. sets=() while IFS=$'\t' read -r k v; do sets+=( --set "$k=$v" ); done < <( python3 - "$root/tests/fixtures/acme.json" <<'PY' import json, sys vals = json.load(open(sys.argv[1])) -vals["domain"] = True for k, v in vals.items(): if k.startswith("_"): continue diff --git a/testing/manifest.test.sh b/testing/manifest.test.sh index 2d68525..4ae5cab 100755 --- a/testing/manifest.test.sh +++ b/testing/manifest.test.sh @@ -322,7 +322,7 @@ for path in manifests: # refused. # # ONE DIRECTION ONLY. The blueprint declares more than this file does — - # `githuborg`, `epicSlug`, `domain`, `orunWorkspace` and the identity + # `githuborg`, `epicSlug`, `orunWorkspace` and the identity # defaults are how a BUILD is driven, not what a product is configured # with. What must hold is that nothing this file declares arrives at an # engine that cannot take it. @@ -339,7 +339,7 @@ for path in manifests: # ── …AND THE OTHER DIRECTION, for REQUIRED inputs only ─────────────── # # The check above is one-directional on purpose: the blueprint declares - # more than this card does, because `epicSlug`, `domain` and the identity + # more than this card does, because `epicSlug` and the identity # defaults are how a BUILD is driven rather than what a product is # configured with. That tolerance had no floor, and `githuborg` fell # through it — `required: true` in the blueprint, absent from this card, @@ -372,8 +372,9 @@ for path in manifests: # # A milestone is what a phase CLUBS ITS TASK UNDER, which the phase states # as `orun.task/ensure@v1`'s `milestone:`. Reading that is why nine phases - # correctly produce eight milestones: `04-workers-restore` names - # `04-workers`, because it is the second landing of one unit of work. + # correctly produce seven milestones: `03-infrastructure-database` and + # `04-workers-restore` name `03-infrastructure` and `04-workers`, because + # each is the second landing of one unit of work. # # Distinct, in phase order. The old check grepped the umbrella's # `ensure-milestone` lines for the same list. diff --git a/testing/phases.test.sh b/testing/phases.test.sh index 238c8ea..b8027cb 100755 --- a/testing/phases.test.sh +++ b/testing/phases.test.sh @@ -71,8 +71,13 @@ WAS = { "projects-worker", "projects-worker-tests", "webhooks-worker", "webhooks-worker-tests"], "05-edge": ["api-edge", "api-edge-tests"], - "06-console": ["web-console-next", "web-console-next-tests"], - "07-domain": ["cloudflare-domain"], + # `cloudflare-domain` was 07-domain's one module. It folded into 06-console + # when the `domain` input went: the component ships parked (it subscribes + # to no environment until an owner wires a zone), so a landing of its own + # deployed nothing, and an on/off switch for a component that is already + # off was one more question for nothing. It moved whole, and nothing else + # moved with it. + "06-console": ["cloudflare-domain", "web-console-next", "web-console-next-tests"], } # Declared since BE1 and placing nothing: their work is hooks. `discovery-roots` # is likewise new — the empty apps/infra/packages/tests roots orun's repo-scale diff --git a/testing/placement.test.sh b/testing/placement.test.sh index 7c954c0..bcc9483 100755 --- a/testing/placement.test.sh +++ b/testing/placement.test.sh @@ -43,14 +43,12 @@ fails=0 fail() { echo " ✕ $*" >&2; fails=$((fails + 1)); } # The fixture is the source of inputs, so a new required input fails HERE rather -# than in front of an operator. `domain` is forced on: 07-domain is conditional, -# and a tier that never places a phase cannot vouch for it. +# than in front of an operator. sets=() while IFS=$'\t' read -r k v; do sets+=( --set "$k=$v" ); done < <( python3 - "$root/tests/fixtures/acme.json" <<'PY' import json, sys vals = json.load(open(sys.argv[1])) -vals["domain"] = True for k, v in vals.items(): if k.startswith("_"): continue @@ -221,7 +219,10 @@ name_after_brand="$(python3 -c "import json;print(json.load(open('$seq/package.j [ "$name_after_brand" = "acme-cloud" ] \ || fail "after branding, package.json name is $name_after_brand, not the product's" -for ph in 02-foundation 03-infrastructure 03-infrastructure-database 04-workers 05-edge 06-console 07-domain; do +# 08-docs requires 06-console, which the rebrand has drifted: the case BE-O12 +# used to refuse. (The custom-domain component used to land after 06-console as +# 07-domain; it lands in 06-console now, parked.) +for ph in 02-foundation 03-infrastructure 03-infrastructure-database 04-workers 05-edge 06-console 08-docs; do if ! orun new --blueprint "$root/repo-blueprint.yaml" --out "$seq" --phase "$ph" \ "${sets[@]}" > "$scratch/p-$ph.log" 2>&1; then fail "phase $ph refused after the rebrand: $(tail -1 "$scratch/p-$ph.log")" @@ -241,7 +242,7 @@ name_after_resume="$(python3 -c "import json;print(json.load(open('$seq/package. $name_after_resume. A resume between phases must not un-brand a product." [ "$fails" -eq 0 ] && \ - echo " 01 → 07 place through the rebrand; --resume leaves the branding alone" + echo " 01 → 08 place through the rebrand; --resume leaves the branding alone" [ "$fails" -eq 0 ] || { echo "placement.test.sh: $fails failure(s)" >&2; exit 1; } echo "placement.test.sh: ok" diff --git a/tests/fixtures/acme.json b/tests/fixtures/acme.json index 194bdbb..6813d82 100644 --- a/tests/fixtures/acme.json +++ b/tests/fixtures/acme.json @@ -16,6 +16,5 @@ "githuborg": "acme-inc", "subdomain": "acme", "orunWorkspace": "ws_0000000000000000000000000000000f", - "epicSlug": "infra-baselining", - "domain": false + "epicSlug": "infra-baselining" } diff --git a/tooling/rebrand/rebrand.mjs b/tooling/rebrand/rebrand.mjs index 0d349b4..241e290 100644 --- a/tooling/rebrand/rebrand.mjs +++ b/tooling/rebrand/rebrand.mjs @@ -65,8 +65,8 @@ if (valuesPath) { // blueprint renders values.json with those. Every product born before the // blueprint was the bootstrap (from the flows' phase slices) COMMITTED a // values.json with the camelCase keys this file used to read (`repoName`, - // `productName`, …), and a phase run against one later — 07-domain, a docs - // refresh — brands with that file. Both are read, and the manifest's key + // `productName`, …), and a phase run against one later — a docs refresh — + // brands with that file. Both are read, and the manifest's key // wins where both are present. const LEGACY = { reponame: "repoName", From 733038ae721ee816cddf72ae30fe50a50dc94c7b Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 22 Oct 2026 03:49:41 +0000 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20the=20console=20asks=20for=20no=20d?= =?UTF-8?q?omain=20=E2=80=94=20the=20domain=20is=20set=20later?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The product answers on workers.dev from its first deploy and nothing in the build needs a domain, so the console card no longer asks for one. Everything that uses the domain stays where it is, carrying a placeholder until an owner sets it. Ported from turso-starter #9. - blueprint.yaml: no productdomain input, and no apibaseurl (it derived from {productdomain}; a card can only derive from inputs it declares) - repo-blueprint.yaml: productdomain optional, default empty - rebrand.mjs: productdomain no longer required; empty brands the reserved placeholder .example.com where lumen.app stood (intent BASE_DOMAIN/CONSOLE_CUSTOM_DOMAIN, edge and identity origins, mail sender, billing success URLs); with no domain the CLI default is the prod edge, https://-api-edge-prod..workers.dev - ai/context/operations.md: "Setting the domain later" - render-deployment-docs.sh: the placeholder is no domain to probe - tests: fixture carries no domain; placement checks the product's CLI default and placeholder instead of the card's derive; rebrand.test.sh covers no domain, an empty one and a given one; CI reads the blueprint with no domain - docs: BOOTSTRAP.md, docs/phases; record in saas-bootstrap-factory (baseline-v30, with #115) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01D8AmgTwmnp4M8mgmnS9aha --- .github/workflows/baseline.yml | 5 +- BOOTSTRAP.md | 33 +++++-- ai/context/operations.md | 59 +++++++++++- blueprint.yaml | 25 +++-- docs/phases/01-scaffold.md | 5 +- docs/phases/02-foundation.md | 2 +- docs/phases/04-workers.md | 2 +- docs/phases/05-edge.md | 2 +- docs/phases/06-console.md | 14 ++- docs/phases/08-docs.md | 9 +- docs/phases/README.md | 4 +- hooks/render-deployment-docs.sh | 12 ++- repo-blueprint.yaml | 23 ++++- .../IMPLEMENTATION-STATUS.md | 93 +++++++++++++++++++ testing/manifest.test.sh | 7 ++ testing/placement.test.sh | 80 ++++++++++++---- testing/rebrand.test.sh | 43 +++++++++ tests/fixtures/acme.json | 11 ++- tooling/rebrand/rebrand.mjs | 26 +++++- 19 files changed, 379 insertions(+), 76 deletions(-) diff --git a/.github/workflows/baseline.yml b/.github/workflows/baseline.yml index 7956f83..0446365 100644 --- a/.github/workflows/baseline.yml +++ b/.github/workflows/baseline.yml @@ -95,12 +95,13 @@ jobs: set -euo pipefail orun --version # Inputs that are `required: true` must be supplied for the document - # to resolve; the values are arbitrary and nothing is written. + # to resolve; the values are arbitrary and nothing is written. No + # domain: the console asks for none, so the document must resolve + # without one. orun new --blueprint repo-blueprint.yaml --status \ --out "$(mktemp -d)" \ --set reponame=acme-cloud \ --set "productname=Acme Cloud" \ - --set productdomain=acme.dev \ --set githuborg=acme-inc # Tier 1's leak gate. It derives what every phase WOULD place and gates # that set — so it needs orun, which is why it rides this job rather than diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index 44e4ccb..d679114 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -83,7 +83,7 @@ cd lumen orun new --blueprint repo-blueprint.yaml \ --out ~/sourceplane/acme --run-hooks --resume \ --set reponame=acme --set productname="Acme Cloud" \ - --set productdomain=acme.dev --set githuborg=sourceplane \ + --set githuborg=sourceplane \ --set orunWorkspace=ws_XXXXXXXX \ --set subdomain= ``` @@ -99,6 +99,17 @@ never asks for it: the platform reads it from the workspace's Cloudflare connection, the same one the deploy tokens mint from. Only a hand-run build like this one passes it. +**No domain is asked.** The blueprint's required inputs are `reponame`, +`productname` and `githuborg`; 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` wherever the domain goes +(intent's `BASE_DOMAIN` and `CONSOLE_CUSTOM_DOMAIN`, the edge and identity +console origins, the mail sender, the billing return URLs) for an owner to +replace later (§4). With no domain the CLI's default API is the product's own +prod edge, `https://-api-edge-prod..workers.dev`. Pass +`--set productdomain=` only for a product that already has its domain; the +CLI then defaults to `https://api.`. + **`--run-hooks` is the difference between placing files and bootstrapping a product.** Without it `orun new` writes the tree and stops: no repo is created, nothing is landed, no convergence is watched, and no phase probes @@ -130,7 +141,7 @@ phase in that folder. orun new --blueprint repo-blueprint.yaml --out ~/sourceplane/acme --run-hooks \ --phase 01-scaffold \ --set reponame=acme --set productname="Acme Cloud" \ - --set productdomain=acme.dev --set githuborg=sourceplane \ + --set githuborg=sourceplane \ --set orunWorkspace=ws_XXXXXXXX --set subdomain= # 01 committed the answers as .rebrand/values.json, keyed by the blueprint's @@ -263,9 +274,13 @@ What that means for a console build: - `reponame` and `githuborg` come from the repository the operator picked; `subdomain` from the workspace's Cloudflare connection (`from: connection.cloudflare.workersSubdomain` — the connection the build - is bound to, so it names the account the deploy tokens mint from); - `apibaseurl` is derived (`https://api.{productdomain}`); only - `productname` and `productdomain` are typed. + is bound to, so it names the account the deploy tokens mint from); only + `productname` is typed. +- No domain is asked. `productdomain` and `apibaseurl` (which the card + derived from it, and a card can only derive from inputs it declares) left + the card in baseline-v30: the product is born with the placeholder + `.example.com` where the domain goes, and its CLI defaults to its + own prod edge on workers.dev. An owner sets the domain later (§4). - `orunWorkspace` is not on the form — it cannot be. The build runs inside the workspace, and `from: workspace` (orun ≥ v2.58.11) fills it from there. - There is no `domain` input. The custom-domain component lands in @@ -283,7 +298,11 @@ that mint them, and its programme and inputs to the blueprint's. - **Deployment record**: `08-docs` is the close-out, and safe to re-run any time as a live-state refresh. -- **Custom domain**: the `cloudflare-domain` component is already in the +- **Custom domain**: a product built without one carries the placeholder + `.example.com` wherever the domain goes; replacing it + (`git grep -l .example.com`) is the first step, and the + product's `ai/context/operations.md`, "Setting the domain later", lists + every place and step. The `cloudflare-domain` component is already in the product, landed by `06-console`: parked (it subscribes to no environment) and mid-migration to provider v5. Create the product zone in Cloudflare, finish the v5 resource and restore the component's @@ -360,7 +379,7 @@ purpose, written down so they read as instructions rather than breakage. | `unknown flag: --phase`, `cannot unmarshal !!map into []scaffold.Hook`, or an action `has no parameter "githubOwner"` / `"sha"` | The CLI is below the v2.58.11 floor. This blueprint is not readable by an older one. | | A fresh build stops before 01-scaffold: `✕ phase "04-workers" precondition "wiring" is not met: … project "" not found` | The CLI is below v2.58.10, which asks the preflight about the product's project before phase 01 has created it and calls the answer a failure. Upgrade; the probe is then deferred to phase 04. | | The product's `intent.yaml` says `workspace: ws_SET_ME`, or its secret refs name the repository (`secret:///…`) | `orunWorkspace` was empty: set it, or run the build in the workspace (ORUN_WORKSPACE) with a CLI ≥ v2.58.11, which fills it from there. | -| `✕ input "productdomain" is required` | Required inputs are validated before anything else, so this names the key nobody typed. All four — `reponame`, `productname`, `productdomain`, `githuborg` — must be set on every invocation, including single-phase ones. `--values /.rebrand/values.json` carries them. | +| `✕ input "productname" is required` | Required inputs are validated before anything else, so this names the key nobody typed. All three — `reponame`, `productname`, `githuborg` — must be set on every invocation, including single-phase ones. `--values /.rebrand/values.json` carries them. The domain is not required (a baseline before v30 asked for `productdomain` too). | | Console/edge smoke fails right after the FIRST deploy of a worker | workers.dev route propagation race — the deploy lane's smoke retries with backoff (stack-tectonic ≥ 0.18.2); a convergence resume clears older pins. | | Terraform lane: "state already locked" by ITS OWN plan | Backend lock-release race — a convergence resume clears it. | | Lanes fail with NO logs at all | GitHub Actions billing or spending limit. The message lives only in the check-run annotations (`gh api repos///check-runs//annotations`). | diff --git a/ai/context/operations.md b/ai/context/operations.md index 439886f..ab407fe 100644 --- a/ai/context/operations.md +++ b/ai/context/operations.md @@ -113,7 +113,7 @@ orun integrations list --org --json && orun cloud check --org | add a runtime secret | `orun secrets set --org --env ` | | resolve workspace identity | `orun workspace ` | | check integrations | `orun integrations list --org --json` | -| custom domain | `infra/terraform/cloudflare-domain` ships parked (`subscribe.environments: []`). Once the zone exists in the Cloudflare account, finish the provider-v5 resource and restore the `subscribe` block its `component.yaml` carries commented out, merge, then run the `08-docs` phase | +| custom domain | see [Setting the domain later](#setting-the-domain-later): replace the domain string, create the zone, restore `infra/terraform/cloudflare-domain`'s commented-out `subscribe` block (it ships parked, `subscribe.environments: []`, mid-way to provider v5), merge, then run the `08-docs` phase | | headless/CI credentials | `ORUN_TOKEN` (workspace-scoped) + `GITHUB_TOKEN` | The ops phases (docs refresh and the original deployment sequence) all @@ -129,12 +129,65 @@ orun new --blueprint repo-blueprint.yaml --out \ ``` `` carries this product's identity — at minimum `reponame`, -`productname`, `productdomain`, `githuborg` and `orunWorkspace`, which the -blueprint validates before anything runs. `--run-hooks` is what makes a phase +`productname`, `githuborg` and `orunWorkspace`, which the blueprint validates +before anything runs (and `productdomain` once the product has a domain); +`.rebrand/values.json` in this repository is a complete one. `--run-hooks` is what makes a phase land and verify rather than just place files; `--status` previews without writing. Every phase is idempotent — re-running a completed one is a no-op that re-verifies. +## Setting the domain later + +This product answers on workers.dev from its first deploy, and it was built +without a domain. Every place the domain goes carries one string until an +owner sets it — in this repository, `lumen.app` (built without a domain, that +is the reserved placeholder `.example.com`, which can never be +anyone's real domain). Nothing that uses the domain was removed; it waits: + +| where | what it is | +|---|---| +| `intent.yaml` | `BASE_DOMAIN` (every environment) and `CONSOLE_CUSTOM_DOMAIN` (`stage.lumen.app`, `prod.lumen.app`) — the parameters of the parked `infra/terraform/cloudflare-domain` | +| `infra/terraform/cloudflare-domain` | `baseDomain` in its `component.yaml`, the Terraform variable's default, its README | +| `apps/api-edge/wrangler.template.jsonc` | `CONSOLE_CUSTOM_DOMAIN`, the console origin CORS allows besides the workers.dev one | +| `apps/identity-worker/wrangler.template.jsonc` | `OAUTH_ALLOWED_CONSOLE_ORIGINS`, which lists the workers.dev console too, so sign-in works without a domain | +| `apps/notifications-worker/wrangler.template.jsonc` | `EMAIL_FROM_ADDRESS`, `no-reply@mail.lumen.app` | +| `apps/billing-worker/wrangler.template.jsonc` | `POLAR_SUCCESS_URL`, the fallback return after checkout | +| `tests/api-edge` | the CORS fixtures, which follow the edge's config | + +To set it, in one PR: + +1. **Replace the string everywhere**, and record the domain as + `productdomain` in `.rebrand/values.json`, where the docs refresh reads + it: + + ```bash + git grep -lF 'lumen.app' # every file that names it + git grep -lzF 'lumen.app' | xargs -0 perl -pi -e 's/\Qlumen.app\E/acme.dev/g' # acme.dev: yours + ``` + +2. **Create the zone** in the Cloudflare account the product deploys into + (dashboard; the platform does not create zones), then restore the + `subscribe` block `infra/terraform/cloudflare-domain/component.yaml` + carries commented out, and finish the provider-v5 custom-domain resource + its comments describe. Until then the console has no custom domain and + keeps its workers.dev URL. +3. **Verify the mail domain** — `mail.` in Cloudflare Email + Service (DKIM/SPF). The notifications worker sends from + `no-reply@mail.`; until it is verified, sends surface as + `notification.failed` events and nothing else breaks. +4. **Supabase auth URLs.** This product sets none: sign-in is the identity + worker's, and `infra/terraform/supabase` names no domain. If you have + since set Supabase Auth's site URL or redirect URLs in its dashboard, + point them at the domain too. +5. **The CLI default, if you want it on the domain.** Built without a + domain, `DEFAULT_API_URL` in `packages/cli/src/brand.ts` is the prod edge + on workers.dev, `https://lumen-api-edge-prod..workers.dev`; + replacing the domain string does not move it. Re-point it once a host on + your domain routes to the edge. +6. **Merge, then run the docs flow** (the `08-docs` phase, above) once the + convergence is green and DNS resolves, so `deployment.md` records the + domain. + ## Evolution Structural changes (new workers, infra components, packages) follow the diff --git a/blueprint.yaml b/blueprint.yaml index 20682b4..678080c 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -61,6 +61,18 @@ spec: # The cost lands here. An `askedBy: agent` input was exempt from `pattern`, # because prose asked for it and prose does not validate. Every input now # carries the rule its value is checked against before Continue. + # + # THE DOMAIN IS NOT ASKED. The product goes live on workers.dev, and a + # domain is an owner's step after the bootstrap: `productdomain` defaults + # to empty in repo-blueprint.yaml, and the rebrand writes the reserved + # placeholder `.example.com` wherever the domain goes (intent's + # BASE_DOMAIN and CONSOLE_CUSTOM_DOMAIN, the edge and identity origins, the + # mail sender, the billing return URLs) for the product's + # ai/context/operations.md, "Setting the domain later", to replace. Nothing + # that needs a domain is removed — it waits for one. `apibaseurl` went with + # it: it was derived from `{productdomain}`, and a card can only derive + # from inputs it declares. With no domain, the CLI's default API is the + # product's own prod edge on workers.dev (rebrand.mjs). - key: reponame label: Repo name pattern: "^[a-z][a-z0-9-]{1,38}$" @@ -75,19 +87,6 @@ spec: pattern: "^[A-Za-z0-9][A-Za-z0-9 .,'&-]{1,48}$" help: The name people will see — in the console header, the emails, the docs. 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 apex domain the product answers on. It does not need to exist yet. - example: acme.dev - - key: apibaseurl - label: API base URL - pattern: "^https://[a-z0-9.-]+$" - help: Where the CLI and SDK point by default. - # Derived rather than asked: it is the product domain with a prefix, and - # a field for it is a field an operator can get subtly wrong (http, a - # trailing slash, api. on the wrong half) for no gain. - derive: "https://api.{productdomain}" - key: githuborg label: GitHub organisation pattern: "^[A-Za-z0-9][A-Za-z0-9-]*$" diff --git a/docs/phases/01-scaffold.md b/docs/phases/01-scaffold.md index c0b2e3f..f036864 100644 --- a/docs/phases/01-scaffold.md +++ b/docs/phases/01-scaffold.md @@ -44,11 +44,11 @@ gates the set, so the promise is a test rather than a claim. | `--out` | `$HOME/sourceplane/acme` | a flag, not an input; created if absent | | `reponame` | `acme` | REQUIRED. Lowercase slug (`^[a-z][a-z0-9-]*$`); repo becomes `/` | | `productname` | `Acme Cloud` | REQUIRED. Display name | -| `productdomain` | `acme.dev` | REQUIRED. Product domain | +| `productdomain` | — (default empty) | NOT ASKED. Empty brands the placeholder `.example.com` where the domain goes, for an owner to replace later; pass it only for a product that already has its domain | | `githuborg` | `sourceplane` | REQUIRED. The org or user the repo is created under | | `orunWorkspace` | `ws_ABCD1234` | workspace id. Unset, the workspace the build runs in (ORUN_WORKSPACE); with none anywhere, the placeholder `ws_SET_ME` | | `subdomain` | `rahulvarghesepullely` | workers.dev subdomain of the Cloudflare account you deploy into — every URL derives from it (worker names are brand-prefixed, so keeping the baseline's account is supported). A console or `--from bst_…` build reads it from the Cloudflare connection; pass it only for a hand-run build | -| `apibaseurl` | `https://api.acme.dev` | CLI default API base; empty derives from `productdomain` | +| `apibaseurl` | — (default empty) | CLI default API base; empty derives `https://api.`, or with no domain the prod edge, `https://-api-edge-prod..workers.dev` | | `repoPrivate` | `true` (default) | visibility at creation only | | `epicSlug` | `infra-baselining` (default) | the epic every phase files its task under | @@ -149,7 +149,6 @@ orun new --blueprint repo-blueprint.yaml \ --out $HOME/sourceplane/acme --run-hooks --phase 01-scaffold \ --set reponame=acme \ --set productname="Acme Cloud" \ - --set productdomain=acme.dev \ --set githuborg=sourceplane \ --set orunWorkspace=ws_ABCD1234 \ --set subdomain=rahulvarghesepullely diff --git a/docs/phases/02-foundation.md b/docs/phases/02-foundation.md index 63ee054..7c4c3e8 100644 --- a/docs/phases/02-foundation.md +++ b/docs/phases/02-foundation.md @@ -20,7 +20,7 @@ applies them yet: the migration runner (`infra/db-migrate`) lands in ## Inputs `--out` is the product repo. The blueprint's required inputs — `reponame`, -`productname`, `productdomain`, `githuborg` — are validated before any phase +`productname`, `githuborg` — are validated before any phase runs, so pass them on every invocation; the product's own `.rebrand/values.json` is a complete values file. See [the phases README](README.md#inputs). diff --git a/docs/phases/04-workers.md b/docs/phases/04-workers.md index da903f8..97ccc1c 100644 --- a/docs/phases/04-workers.md +++ b/docs/phases/04-workers.md @@ -64,7 +64,7 @@ PRs and two task contracts, are two phases here. ## Inputs `--out` is the product repo. The blueprint's required inputs — `reponame`, -`productname`, `productdomain`, `githuborg` — are validated before any phase +`productname`, `githuborg` — are validated before any phase runs, so pass them on every invocation; the product's own `.rebrand/values.json` is a complete values file. See [the phases README](README.md#inputs). diff --git a/docs/phases/05-edge.md b/docs/phases/05-edge.md index db422d5..c602cd5 100644 --- a/docs/phases/05-edge.md +++ b/docs/phases/05-edge.md @@ -28,7 +28,7 @@ own deploy lane in phase 04 is the evidence for it. ## Inputs `--out` is the product repo. The blueprint's required inputs — `reponame`, -`productname`, `productdomain`, `githuborg` — are validated before any phase +`productname`, `githuborg` — are validated before any phase runs, so pass them on every invocation; the product's own `.rebrand/values.json` is a complete values file. See [the phases README](README.md#inputs). diff --git a/docs/phases/06-console.md b/docs/phases/06-console.md index bf1dcdb..c2570b1 100644 --- a/docs/phases/06-console.md +++ b/docs/phases/06-console.md @@ -23,8 +23,10 @@ moves with them. custom domain per environment for the console worker (`CONSOLE_CUSTOM_DOMAIN` in the product's `intent.yaml`: `stage.` and `prod.` after rebrand, empty for -`dev`) — lands with the console and **deploys nothing**, for two reasons -that live in the component rather than in the phase: +`dev` — and, since the console asks for no domain, `` is the +placeholder `.example.com` until an owner sets one) — lands with +the console and **deploys nothing**, for two reasons that live in the +component rather than in the phase: 1. **It ships parked.** Its `component.yaml` declares `subscribe.environments: []`, so CI plans no lanes for it. The product @@ -42,7 +44,11 @@ green run with nothing in it — so the phase and the switch are gone, and this phase's task contract leaves the component out of `affects`: there is nothing in it to re-plan. -Wiring it is a normal pull request in the product, once the zone exists: +Wiring it is a normal pull request in the product, once the zone exists. +The product's `ai/context/operations.md` ("Setting the domain later") carries +the whole list for its owner: replace the placeholder everywhere it stands +(`git grep -l .example.com` — intent, the edge and identity console +origins, the mail sender, the billing return URLs), then: 1. **The zone first.** The product zone (e.g. `acme.dev`) must already exist in the Cloudflare account the product deploys into, created in the @@ -62,7 +68,7 @@ Wiring it is a normal pull request in the product, once the zone exists: ## Inputs `--out` is the product repo. The blueprint's required inputs — `reponame`, -`productname`, `productdomain`, `githuborg` — are validated before any phase +`productname`, `githuborg` — are validated before any phase runs, so pass them on every invocation; the product's own `.rebrand/values.json` is a complete values file. See [the phases README](README.md#inputs). diff --git a/docs/phases/08-docs.md b/docs/phases/08-docs.md index c84555f..4e28d5b 100644 --- a/docs/phases/08-docs.md +++ b/docs/phases/08-docs.md @@ -29,9 +29,10 @@ this credential" rather than a failed render. 2. **pre** — the phase's task. 3. **render** — a `post` hook runs `hooks/render-deployment-docs.sh . ` from the baseline checkout. It reads identity from - `.rebrand/values.json`, probes the four public URLs (and - `api./health` and `app.`, reported as - pending when they do not answer), lists secrets and integrations by name + `.rebrand/values.json`, probes the four public URLs (and, when that file + records a domain, `api./health` and `app.`, + reported as pending when they do not answer — a product built without a + domain records none, so they are skipped), lists secrets and integrations by name with `orun secrets list` / `orun integrations list`, and renders the files above. It refuses to finish if a `TBD_08DOCS` placeholder survives. 4. **land** — `orun.pr/land@v1`: PR `docs(deployment): record live @@ -56,7 +57,7 @@ this credential" rather than a failed render. ## Inputs `--out` is the product repo. The blueprint's required inputs — `reponame`, -`productname`, `productdomain`, `githuborg` — are validated before any phase +`productname`, `githuborg` — are validated before any phase runs, so pass them on every invocation; the product's own `.rebrand/values.json` is a complete values file. The renderer also takes `orunWorkspace`, which that file records. See diff --git a/docs/phases/README.md b/docs/phases/README.md index fb1fca8..b12ef4d 100644 --- a/docs/phases/README.md +++ b/docs/phases/README.md @@ -74,10 +74,10 @@ same words. |---|---|---| | `reponame` | yes | lowercase slug (`^[a-z][a-z0-9-]*$`); the repo becomes `/`, and it prefixes the Supabase projects and every worker. The console fills it from the chosen repository | | `productname` | yes | display name | -| `productdomain` | yes | the apex domain the product answers on; it does not need to exist yet | +| `productdomain` | — | NOT ASKED, default empty. The product goes live on workers.dev; empty brands the reserved placeholder `.example.com` wherever the domain goes (intent's `BASE_DOMAIN` / `CONSOLE_CUSTOM_DOMAIN`, the edge and identity console origins, the mail sender, the billing return URLs), for an owner to replace later (the product's `ai/context/operations.md`, "Setting the domain later"). Pass it only for a product that already has its domain | | `githuborg` | yes | the org or user the repo lives under. The console fills it from the chosen repository's owner | | `subdomain` | — | workers.dev subdomain of the Cloudflare **account** you deploy into. A console or `--from bst_…` build reads it from the Cloudflare connection; pass it only for a hand-run build. The default is a placeholder; see below | -| `apibaseurl` | — | the CLI/SDK default API base; empty means `https://api.` | +| `apibaseurl` | — | the CLI default API base. Empty, it is `https://api.` when a domain is given, and otherwise the product's own prod edge on workers.dev, `https://-api-edge-prod..workers.dev`. Not on the card: it was derived from the domain | | `orunWorkspace` | — | workspace id. Unset, it is the workspace the build runs in (`from: workspace`, ORUN_WORKSPACE, which a console build always has); with none anywhere, 01 writes the placeholder `ws_SET_ME`, which fails loudly rather than silently cross-tenanting | | `epicSlug` | — | default `infra-baselining`; the epic every phase files its task under, found by slug so a fresh run and a resumed run find the same work | | `repoPrivate` | — | default `true`; applied only when `01-scaffold` creates the repo — an existing repo keeps its visibility | diff --git a/hooks/render-deployment-docs.sh b/hooks/render-deployment-docs.sh index 491689d..cc6feb4 100755 --- a/hooks/render-deployment-docs.sh +++ b/hooks/render-deployment-docs.sh @@ -3,7 +3,7 @@ # Called by phase 08-docs as a `run:` hook (and safe to run by hand). # Idempotent: the # generated files and the README section are fully re-rendered on every run, -# so re-running after phase 07 (custom domain) or any redeploy refreshes them. +# so re-running after the custom domain is wired or any redeploy refreshes them. # # hooks/render-deployment-docs.sh # @@ -31,6 +31,10 @@ vals=".rebrand/values.json" repo="$(python3 -c "import json;print(json.load(open('$vals'))['reponame'])")" sub="$(python3 -c "import json;print(json.load(open('$vals'))['subdomain'])")" domain="$(python3 -c "import json;print(json.load(open('$vals')).get('productdomain',''))")" +# A product is built with no domain (the console asks for none): values.json +# records "" and the tree carries the reserved placeholder .example.com +# until an owner sets one. Neither is a domain to probe. +case "$domain" in *.example.com) domain="" ;; esac # Workspace slug via the direct backend read (works for user sessions AND # workspace-scoped ORUN_TOKENs); tolerate failure — slug then shows as "?". @@ -54,14 +58,14 @@ con_prod="https://${repo}-web-console-next-prod.${sub}.workers.dev" p_es="$(probe "$edge_stage/health")"; p_ep="$(probe "$edge_prod/health")" p_cs="$(probe "$con_stage")"; p_cp="$(probe "$con_prod")" -# Custom domain (phase 07, optional): probe only if a domain is declared; +# Custom domain (set later, by an owner): probe only if a domain is recorded; # an unreachable domain is reported as pending, never a failure. dom_rows="" if [ -n "$domain" ]; then p_da="$(probe "https://api.${domain}/health")" p_dc="$(probe "https://app.${domain}")" - dom_rows="| edge (custom domain) | https://api.${domain}/health | $( [ "$p_da" = 000 ] && echo 'pending (phase 07 not run, or DNS propagating)' || badge "$p_da" ) | -| console (custom domain) | https://app.${domain} | $( [ "$p_dc" = 000 ] && echo 'pending (phase 07 not run, or DNS propagating)' || badge "$p_dc" ) |" + dom_rows="| edge (custom domain) | https://api.${domain}/health | $( [ "$p_da" = 000 ] && echo 'pending (not wired yet, or DNS propagating)' || badge "$p_da" ) | +| console (custom domain) | https://app.${domain} | $( [ "$p_dc" = 000 ] && echo 'pending (not wired yet, or DNS propagating)' || badge "$p_dc" ) |" fi # Inventories — NAMES/status only, never values. Tolerant: a token that diff --git a/repo-blueprint.yaml b/repo-blueprint.yaml index 64d4a98..ff6d733 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -39,8 +39,20 @@ inputs: description: Human display name (e.g. "Acme Cloud"). productdomain: type: string - required: true - description: Product domain (e.g. acme.dev) — BASE_DOMAIN, console custom domains, OAuth origins. + default: "" + description: >- + The product's own domain, once it has one (e.g. acme.dev). NOT ASKED: + the product answers on workers.dev from its first deploy, and a domain + is an owner's step after it. Empty, the rebrand writes the reserved + placeholder `.example.com` wherever the domain goes — + intent.yaml's BASE_DOMAIN and CONSOLE_CUSTOM_DOMAIN (the parked + cloudflare-domain's parameters), the api-edge CORS and identity-worker + OAuth console origins (both also allow the workers.dev console, so + sign-in works without it), the notifications sender and the billing + success URLs — so setting it later is replacing that one string; the + product's ai/context/operations.md, "Setting the domain later", says + how. Pass it with --set only to brand a hand-run build with a domain it + already has. pascalName: type: string default: "" @@ -56,7 +68,12 @@ inputs: apibaseurl: type: string default: "" - description: CLI default API base (default https://api.). + description: >- + CLI default API base. Empty, the rebrand derives it: with a + `productdomain`, https://api.; with none (the console + asks for none), the product's own prod edge on workers.dev, + https://-api-edge-prod..workers.dev, which is + live from the first deploy. subdomain: type: string default: "your-workers-subdomain" diff --git a/specs/epics/saas-bootstrap-factory/IMPLEMENTATION-STATUS.md b/specs/epics/saas-bootstrap-factory/IMPLEMENTATION-STATUS.md index 277acdd..5899a67 100644 --- a/specs/epics/saas-bootstrap-factory/IMPLEMENTATION-STATUS.md +++ b/specs/epics/saas-bootstrap-factory/IMPLEMENTATION-STATUS.md @@ -107,3 +107,96 @@ component routes and `dependsOn`. | `testing/leak.test.sh` (orun 2.58.11) | pass — 1103 files derived, 2 context files, no factory paths | | `testing/placement.test.sh` (orun 2.58.11) | pass — 1103 product files, the same count as with `domain` forced on before; `01 → 08` place through the rebrand; `--resume` keeps the branding | | derived file set against `main` with `domain=true` | identical: 1103 files, and `06-console`'s 186 are exactly `main`'s 06-console (176) plus 07-domain (10) | + +## The domain is set later (2026-10-22, `baseline-v30`) + +Ported from turso-starter (its #9). The console card 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 product answers on workers.dev from its first +deploy, every phase probes workers.dev, and the one component that attaches +a domain, `cloudflare-domain`, ships parked. The owner asked for the domain +to stop being an input at bootstrap, with the logic that uses it kept where +it is so it can be set later. Ships in `baseline-v30` with #115: the tag was +never pushed, and the owner pushes it at this PR's merge commit, so the one +release carries the subdomain source, the removed `domain` switch and this. + +### What shipped + +- `blueprint.yaml` declares no `productdomain` and no `apibaseurl`. The card + derived `apibaseurl` as `https://api.{productdomain}`, and a card can only + derive from inputs it declares, so it left with the domain. The console's + Product step asks for the display name alone. +- `repo-blueprint.yaml`: `productdomain` is optional, default `""`, and its + description names where the domain goes and how it is set later; + `apibaseurl`'s description states the CLI rule below. The values template + still writes `"productdomain": ""`. A hand-run build may pass + `--set productdomain=` for a product that already has its domain. +- `tooling/rebrand/rebrand.mjs` no longer requires `productdomain`. Empty, it + brands the reserved placeholder `.example.com` (RFC 2606) where + `lumen.app` stood — intent's `BASE_DOMAIN` and `CONSOLE_CUSTOM_DOMAIN` (the + parked `cloudflare-domain`'s parameters, and the component's own + `baseDomain`), api-edge's `CONSOLE_CUSTOM_DOMAIN` (CORS), identity-worker's + `OAUTH_ALLOWED_CONSOLE_ORIGINS` (which also lists the workers.dev console, + so sign-in works without a domain), the notifications sender + `no-reply@mail.`, billing's `POLAR_SUCCESS_URL`, and the edge's + CORS test fixtures. No component logic changed. Lumen's Supabase root + configures no auth URLs, so nothing there names the domain. +- The CLI's default API. `apibaseurl` fell back to `https://api.`, + which with the placeholder is a host that can never answer. With no domain + it is now the product's own prod edge on workers.dev, + `https://-api-edge-prod..workers.dev` — the worker + rule's name for `lumen-api-edge` deployed `--env prod`, live from the first + deploy. With a domain it stays `https://api.`; an explicit + `apibaseurl` still wins. +- `hooks/render-deployment-docs.sh` already probed the custom domain only + when `.rebrand/values.json` records one, so the empty value skips it; it + now also treats the `*.example.com` placeholder as no domain, and its + narration no longer names the removed `07-domain`. +- The shipped `ai/context/operations.md` gains "Setting the domain later": + every place the domain goes, then replace the placeholder + (`git grep -lF`), create the zone and restore `cloudflare-domain`'s + commented-out `subscribe` block, verify the mail domain, Supabase auth URLs + (none configured), re-point the CLI default if wanted, merge, run the docs + flow. It names the baseline's `lumen.app`, which the rebrand turns into + the product's own placeholder, and no factory path. +- `BOOTSTRAP.md`, `docs/phases/README.md`, `docs/phases/01-scaffold.md` and + the required-inputs sentence of five phase pages: three required inputs + (`reponame`, `productname`, `githuborg`); `productdomain` NOT ASKED; + `06-console.md` and `08-docs.md` say the custom domain is the placeholder + until set. The troubleshooting row for a missing input names + `productname`. + +### What the tests had to become + +- `tests/fixtures/acme.json` carries no domain, so the leak gate and the + placement tier exercise exactly what a console build supplies. +- `testing/placement.test.sh` read the card's `derive` and exited "gone + blind" without it. It now checks the value a no-domain product gets: its + `DEFAULT_API_URL` must be the PLACED, BRANDED api-edge's wrangler name plus + `-prod` on the fixture's subdomain (with `--env prod` read from its + `component.yaml`), and every `BASE_DOMAIN` / non-empty + `CONSOLE_CUSTOM_DOMAIN` in its `intent.yaml` must be the placeholder. It + refuses to pass on nothing: a fixture with a domain or an `apibaseurl`, a + missing worker name, deploy env, `DEFAULT_API_URL` or `BASE_DOMAIN` each + fail it. +- `testing/rebrand.test.sh` gains nine checks: no domain and an empty domain + brand the placeholder; the OAuth origins keep the workers.dev console; the + no-domain CLI default is the prod edge, follows `brandSlug`, and survives + three passes; a given domain brands itself and `https://api.`; an + explicit `apibaseurl` wins. +- `testing/manifest.test.sh` (comment only): the derive-agreement check has + nothing to hold today and stays for the next derived input. +- `baseline.yml`'s blueprint read sets no domain, so CI proves the document + resolves without one. + +### Verification + +| check | result | +|---|---| +| manifest, phases, coverage, rebrand | all pass — 7 milestones agree; 9 phases, 65 modules; 45 of 45 components; rebrand 23 checks (14 before) | +| `orun new --status` with no `productdomain` (orun 2.58.11, the CI pin) | parses; nine phases derived | +| `testing/leak.test.sh` (orun 2.58.11) | pass — 1103 files derived, unchanged; 2 context files, no factory paths | +| `testing/placement.test.sh` (orun 2.58.11) | pass — 1103 product files, unchanged; `DEFAULT_API_URL` is `https://acme-cloud-api-edge-prod.acme.workers.dev`; the placeholder `acme-cloud.example.com` in `BASE_DOMAIN` ×3 and `CONSOLE_CUSTOM_DOMAIN` ×2, 10 files carry it; `01 → 08` place through the rebrand | +| mutation: the old CLI rule (`https://api.` always) | `rebrand.test.sh` fails 3 checks, `placement.test.sh` fails naming `https://api.acme-cloud.example.com`; restored, both pass | +| mutation: no placeholder (empty domain stays empty) | `rebrand.test.sh` fails 3 checks, `placement.test.sh` fails on `BASE_DOMAIN ''`; restored, both pass | +| the documented replacement, on a placed product | `git grep -lF acme-cloud.example.com` lists 10 files; the `perl` one-liner leaves 0, and `BASE_DOMAIN` reads `acme.dev` | diff --git a/testing/manifest.test.sh b/testing/manifest.test.sh index 4ae5cab..a6ac6ef 100755 --- a/testing/manifest.test.sh +++ b/testing/manifest.test.sh @@ -193,6 +193,13 @@ for path in manifests: # run by hand passes nothing and rebrand's fallback wins. One rule, two # implementations — which is the thing this file's header warns about, # unless something holds them equal. This does. + # + # Since the console stopped asking for the domain, the card derives + # nothing: `apibaseurl` left it with `productdomain` (a card can only + # derive from inputs it declares), and rebrand's fallback alone picks + # the value — `https://api.`, or with no domain the product's + # prod edge on workers.dev, which placement.test.sh checks in a placed + # product. This stays for the next input that derives. if derive is not None and (root / REBRAND).exists(): js = (root / REBRAND).read_text(errors="replace") for m in re.finditer(r"const (\w+) = values\.\w+ \?\? `([^`]+)`", js): diff --git a/testing/placement.test.sh b/testing/placement.test.sh index bcc9483..a4b4721 100755 --- a/testing/placement.test.sh +++ b/testing/placement.test.sh @@ -20,9 +20,9 @@ # because that already happened once with a version pin; # 3. brand it as `01-scaffold`'s hook chain does, then `rebrand.mjs --verify`; # 4. run the leak rules over the REAL FILES rather than the derivation; -# 5. check the API base the product ends up with against the rule -# `blueprint.yaml` states as its `derive` — the last mile of BE3's gate, -# in the product; +# 5. check the API base and the domain the product ends up with: built with +# no domain, as a console build is, its CLI defaults to its own prod edge +# on workers.dev and the domain's places carry `.example.com`; # 6. THE PHASED SEQUENCE THROUGH A REBRAND: place 01, brand, then place the # phases that follow. This is the step no test in this repository has ever # taken, and it is where BE-O12's two defects lived. @@ -164,30 +164,74 @@ print(f" {len(placed)} product files; ai/context is exactly " f"{len(ALLOWED_AI)}; no factory, no provenance prose") PY -# ── the derived API base, in the product ─────────────────────────────────── -# BE3 states `derive: "https://api.{productdomain}"` in blueprint.yaml and holds -# it equal to rebrand.mjs's fallback. Both of those are checks on the RULES. -# This checks the value a product ends up with. -echo "── the API base the product ends up with" +# ── the API base and the domain, in the product ──────────────────────────── +# The console asks for no domain, so the fixture carries none, and BE3's +# `derive: "https://api.{productdomain}"` left the card with it (a card can +# only derive from inputs it declares). What a product built that way must +# end up with, checked in the product rather than as a rule: +# +# - its CLI's DEFAULT_API_URL is its own prod edge on workers.dev. The name +# is read from the PLACED, BRANDED api-edge — its wrangler `name` plus the +# `--env prod` its component.yaml deploys — so the CLI and the worker it +# points at are held to one rule. `https://api.` could never +# answer; +# - every place the domain goes carries the reserved placeholder +# `.example.com`, for an owner to replace later. +# +# Neither half can pass on nothing: a fixture that gains a domain, a brand.ts +# without DEFAULT_API_URL, an api-edge that stops deploying `--env prod`, or an +# intent without BASE_DOMAIN fails here instead of going blind. +echo "── the API base and the domain the product ends up with" python3 - "$tree" "$root" <<'PY' import json, pathlib, re, sys -import yaml tree, root = pathlib.Path(sys.argv[1]), pathlib.Path(sys.argv[2]) -man = yaml.safe_load((root / "blueprint.yaml").read_text())["spec"] -derive = next((f.get("derive") for f in man["inputs"] if f["key"] == "apibaseurl"), None) -if not derive: - sys.exit("blueprint.yaml no longer derives apibaseurl — this check has gone blind") vals = json.loads((root / "tests/fixtures/acme.json").read_text()) -want = re.sub(r"\{([a-z]+)\}", - lambda m: {"productdomain": vals["productdomain"]}[m.group(1)], derive) +if (vals.get("productdomain") or "").strip(): + sys.exit("tests/fixtures/acme.json carries a productdomain — a console build " + "supplies none, so this would no longer check what one produces") +if (vals.get("apibaseurl") or "").strip(): + sys.exit("tests/fixtures/acme.json carries an apibaseurl — the CLI default " + "would be that, and the no-domain rule would go unchecked") + +wr = (tree / "apps/api-edge/wrangler.template.jsonc").read_text() +name = re.search(r'"name":\s*"([a-z0-9-]+)"', wr) +if not name: + sys.exit("apps/api-edge/wrangler.template.jsonc has no worker name — gone blind") +if not name.group(1).startswith(vals["reponame"] + "-"): + sys.exit(f"FAIL: the placed api-edge is named {name.group(1)!r}, not branded " + f"with {vals['reponame']!r}") +comp = (tree / "apps/api-edge/component.yaml").read_text() +if not re.search(r"^\s*deployCommand:.*--env prod\s*$", comp, re.M): + sys.exit("apps/api-edge/component.yaml no longer deploys `--env prod` — gone blind") +want = f"https://{name.group(1)}-prod.{vals['subdomain']}.workers.dev" brand = (tree / "packages/cli/src/brand.ts").read_text() m = re.search(r'DEFAULT_API_URL = "([^"]+)"', brand) if not m: sys.exit("packages/cli/src/brand.ts no longer declares DEFAULT_API_URL — gone blind") if m.group(1) != want: - sys.exit(f"FAIL: the product's DEFAULT_API_URL is {m.group(1)!r}; " - f"blueprint.yaml's derive over this fixture says {want!r}") -print(f" DEFAULT_API_URL is {want} — the rule blueprint.yaml declares") + sys.exit(f"FAIL: the product's DEFAULT_API_URL is {m.group(1)!r}; built with no " + f"domain it must be its own prod edge, {want!r}") +print(f" DEFAULT_API_URL is {want} — api-edge's prod worker") + +placeholder = f"{vals['reponame']}.example.com" +intent = (tree / "intent.yaml").read_text() +bases = re.findall(r"^[ \t]*BASE_DOMAIN:[ \t]*(.*?)[ \t]*$", intent, re.M) +consoles = [c for c in re.findall(r"^[ \t]*CONSOLE_CUSTOM_DOMAIN:[ \t]*(.*?)[ \t]*$", intent, re.M) + if c not in ('""', "''")] +if not bases or not consoles: + sys.exit("intent.yaml carries no BASE_DOMAIN or CONSOLE_CUSTOM_DOMAIN — gone blind") +for b in bases: + if b != placeholder: + sys.exit(f"FAIL: intent.yaml's BASE_DOMAIN is {b!r}, not the placeholder {placeholder!r}") +for c in consoles: + if not c.endswith("." + placeholder): + sys.exit(f"FAIL: intent.yaml's CONSOLE_CUSTOM_DOMAIN is {c!r}, not under {placeholder!r}") +carrying = sorted( + str(p.relative_to(tree)) for p in tree.rglob("*") + if p.is_file() and ".git" not in p.parts and ".orun" not in p.parts + and placeholder in p.read_text(errors="replace")) +print(f" the domain is the placeholder {placeholder}: BASE_DOMAIN x{len(bases)}, " + f"CONSOLE_CUSTOM_DOMAIN x{len(consoles)}; {len(carrying)} files carry it") PY # ── THE PHASED SEQUENCE THROUGH A REBRAND ────────────────────────────────── diff --git a/testing/rebrand.test.sh b/testing/rebrand.test.sh index 01a8251..ada2d01 100755 --- a/testing/rebrand.test.sh +++ b/testing/rebrand.test.sh @@ -104,6 +104,49 @@ check "a token keeps the word boundaries its value had" \ "{$base}" apps/w/notes.yaml 'id: lumen.applumen' \ 'id: altocumulus.devlumen' +# THE DOMAIN IS SET LATER. The console asks for none, so the values file a +# console build writes has an empty `productdomain`, and the rebrand writes the +# reserved placeholder `.example.com` wherever the domain goes. The +# CLI's default API cannot be `https://api.`, which never answers: +# it is the product's own prod edge on workers.dev, named by the worker rule +# (`-api-edge-prod`). A hand-run build that passes a domain keeps +# `https://api.`. +echo "── rebrand: no domain given, and a domain given" +nodomain='{"reponame":"acme-cloud","productname":"Acme Cloud","githuborg":"acme-inc","subdomain":"acme"}' +check "no domain given: the reserved placeholder, for an owner to replace later" \ + "$nodomain" intent.yaml ' BASE_DOMAIN: lumen.app' \ + ' BASE_DOMAIN: acme-cloud.example.com' +check "an empty domain is no domain" \ + '{"reponame":"acme-cloud","productname":"Acme Cloud","productdomain":""}' \ + intent.yaml ' BASE_DOMAIN: lumen.app' \ + ' BASE_DOMAIN: acme-cloud.example.com' +check "no domain: the OAuth console origins keep the workers.dev console" \ + "$nodomain" apps/identity-worker/wrangler.template.jsonc \ + ' "OAUTH_ALLOWED_CONSOLE_ORIGINS": "https://prod.lumen.app,https://lumen-web-console-next-prod.rahulvarghesepullely.workers.dev",' \ + ' "OAUTH_ALLOWED_CONSOLE_ORIGINS": "https://prod.acme-cloud.example.com,https://acme-cloud-web-console-next-prod.acme.workers.dev",' +check "no domain: the CLI defaults to the product's prod edge on workers.dev" \ + "$nodomain" packages/cli/src/brand.ts 'export const DEFAULT_API_URL = "https://api.lumen.app";' \ + 'export const DEFAULT_API_URL = "https://acme-cloud-api-edge-prod.acme.workers.dev";' +check "…named by the worker rule, so a brandSlug renames it too" \ + '{"reponame":"acme-cloud","productname":"Acme Cloud","brandSlug":"acme","subdomain":"acme"}' \ + packages/cli/src/brand.ts 'export const DEFAULT_API_URL = "https://api.lumen.app";' \ + 'export const DEFAULT_API_URL = "https://acme-api-edge-prod.acme.workers.dev";' +check "…and survives every later phase's pass" \ + "$nodomain" packages/cli/src/brand.ts 'export const DEFAULT_API_URL = "https://api.lumen.app";' \ + 'export const DEFAULT_API_URL = "https://acme-cloud-api-edge-prod.acme.workers.dev";' 3 +check "a domain given: the domain where the domain goes" \ + '{"reponame":"acme-cloud","productname":"Acme Cloud","productdomain":"acme.dev","subdomain":"acme"}' \ + intent.yaml ' BASE_DOMAIN: lumen.app' \ + ' BASE_DOMAIN: acme.dev' +check "a domain given: the CLI defaults to api." \ + '{"reponame":"acme-cloud","productname":"Acme Cloud","productdomain":"acme.dev","subdomain":"acme"}' \ + packages/cli/src/brand.ts 'export const DEFAULT_API_URL = "https://api.lumen.app";' \ + 'export const DEFAULT_API_URL = "https://api.acme.dev";' +check "an explicit apibaseurl wins either way" \ + '{"reponame":"acme-cloud","productname":"Acme Cloud","apibaseurl":"https://edge.acme.dev"}' \ + packages/cli/src/brand.ts 'export const DEFAULT_API_URL = "https://api.lumen.app";' \ + 'export const DEFAULT_API_URL = "https://edge.acme.dev";' + # --verify runs in every phase of a bootstrap. Without the product's values it # cannot tell the product's own identity from a baseline leftover, and a product # whose domain contains `lumen` failed it in every phase; with them it passes. diff --git a/tests/fixtures/acme.json b/tests/fixtures/acme.json index 6813d82..38c21a3 100644 --- a/tests/fixtures/acme.json +++ b/tests/fixtures/acme.json @@ -3,16 +3,17 @@ "The inputs a Tier 1 dry instantiation renders with (saas-bootstrap-engine BE5).", "Acme is not a real product and never becomes one: this tree is placed into a", "temp directory, asserted against, and deleted. The values are chosen to be", - "AWKWARD rather than tidy — a two-word product name, a hyphenated repo slug, 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.", + "AWKWARD rather than tidy — a two-word product name, a hyphenated repo slug,", + "and NO domain: a console build asks for none, so the placeholder", + ".example.com is what a product is born with, and the CLI defaults", + "to the product's own prod edge on workers.dev — 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-cloud", "productname": "Acme Cloud", - "productdomain": "acme.dev", "githuborg": "acme-inc", "subdomain": "acme", "orunWorkspace": "ws_0000000000000000000000000000000f", diff --git a/tooling/rebrand/rebrand.mjs b/tooling/rebrand/rebrand.mjs index 241e290..50ffdd3 100644 --- a/tooling/rebrand/rebrand.mjs +++ b/tooling/rebrand/rebrand.mjs @@ -20,11 +20,12 @@ // { // "reponame": "acme-cloud", // required — repo slug // "productname": "Acme Cloud", // required — display name -// "productdomain": "acme.dev", // required — product domain +// "productdomain": "acme.dev", // optional — default .example.com (set later) // "pascalName": "AcmeCloud", // default: productname, non-alnum stripped // "brandSlug": "acme", // default: reponame // "cliBin": "acme", // default: reponame -// "apibaseurl": "https://api.acme.dev",// default: https://api. +// "apibaseurl": "https://api.acme.dev",// default: https://api., or with no +// // domain https://-api-edge-prod..workers.dev // "subdomain": "my-subdomain", // default: "your-workers-subdomain" // "salesEmail": "sales@acme.dev" // optional: keeps baseline mailbox if absent // } @@ -78,7 +79,7 @@ if (valuesPath) { for (const [key, old] of Object.entries(LEGACY)) { if (values[key] === undefined && values[old] !== undefined) values[key] = values[old]; } - 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); @@ -89,12 +90,27 @@ if (valuesPath) { // 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 pascalName = values.pascalName ?? productname.replace(/[^A-Za-z0-9]/g, ""); const brandSlug = values.brandSlug ?? reponame; const cliBin = values.cliBin ?? reponame; -const apibaseurl = values.apibaseurl ?? `https://api.${productdomain}`; const subdomain = values.subdomain ?? "your-workers-subdomain"; +// The CLI's default API. With a domain it is `https://api.`. With none, +// `api.` would point every CLI at a host that can never answer, so +// it is the product's own prod edge on workers.dev, live from the first deploy: +// api-edge deploys `--env prod` (apps/api-edge/component.yaml) as the wrangler +// name `lumen-api-edge` + `-prod`, which the worker rule below re-prefixes to +// `-api-edge-prod`. Re-pointing it at a domain later is an edit to +// packages/cli/src/brand.ts. +const apibaseurl = + (values.apibaseurl ?? "").trim() || + ((values.productdomain ?? "").trim() + ? `https://api.${productdomain}` + : `https://${brandSlug}-api-edge-prod.${subdomain}.workers.dev`); const salesEmail = values.salesEmail; // optional // A `secret://///` ref names the WORKSPACE // first and the project (repo) second. In the baseline the two happen to be