diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index c1538fb..9077a66 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -62,6 +62,12 @@ orun new --blueprint repo-blueprint.yaml \ --set subdomain= ``` +`subdomain` is the workers.dev subdomain of the Cloudflare account you deploy +into (Workers & Pages → your subdomain). 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 token +is minted from. Only a hand-run build like this one passes it. + **`--run-hooks` is the difference between placing files and bootstrapping a blog.** Without it `orun new` writes the tree and stops: no repository, no landing, no convergence watch, no probe. That is deliberate — it is what diff --git a/ai/context/current.md b/ai/context/current.md index 4d699e2..918d536 100644 --- a/ai/context/current.md +++ b/ai/context/current.md @@ -21,8 +21,8 @@ component; Sanity stays the owner's SaaS. | | | |---|---| -| Latest tag | `baseline-v1` (CS3) | -| On `main` since | CS4 — the cirrus standard (no kiox, generated component docs, this context pack) | +| Latest tag | `baseline-v2` (CS4 — the cirrus standard: no kiox, generated component docs, this context pack, and the workers.dev subdomain read from the Cloudflare connection instead of asked) | +| Before it | `baseline-v1` (CS3 — the baseline, one landing) | | Proven live | No. Everything short of the platform is proven offline in Baseline CI, unconnected; a live bootstrap (risk CS-M) and a connected blog reading a real dataset, its Presentation preview included (risk CS-H), are still to come | ## Where to read @@ -37,8 +37,7 @@ component; Sanity stays the owner's SaaS. ## Next -1. Bootstrap one blog from the next tag against a workspace, and record its +1. Bootstrap one blog from `baseline-v2` against a workspace, and record its timings (closes CS-M). 2. Connect a Sanity project to it, see the samples give way, and open the Presentation tool once to confirm the preview loads (closes CS-H). -3. Cut the next `baseline-vN` with `tag.yml` so the registry can pin CS4. diff --git a/ai/context/decisions.md b/ai/context/decisions.md index ce7a8c3..ef11983 100644 --- a/ai/context/decisions.md +++ b/ai/context/decisions.md @@ -18,3 +18,4 @@ reads in order. | 10 | `ci.yml` plans nothing while `intent.yaml` names `ws_CHANGE_ME` (replaced the `ORUN_CI` gate); stack-tectonic 0.19.0, not 0.20.0 | A bootstrap cannot set a repository variable; Turbopack refuses 0.20.0's out-of-tree `node_modules` | IMPLEMENTATION-STATUS (CS3) | | 11 | orun is pinned only where it runs (the `orun-action` `version:` in each workflow); no kiox | `kiox.yaml` pinned a version nothing ran | IMPLEMENTATION-STATUS (CS4) | | 12 | Component docs are generated from the manifests and checked in CI | A hand-written copy of the dependency graph and bindings drifts silently | `tooling/catalog/gen-component-docs.py` | +| 13 | The workers.dev subdomain is read from the Cloudflare connection (`from: connection.cloudflare.workersSubdomain`), not asked; only a hand-run build passes `--set subdomain` | It belongs to the account like its id and has one right answer; a typed one could only be wrong, and wrong showed up after deploy in the smoke and the probes (cirrus-baseline since baseline-v23) | IMPLEMENTATION-STATUS (CS-6) | diff --git a/blueprint.yaml b/blueprint.yaml index d828162..630cbca 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -94,6 +94,18 @@ spec: pattern: "^[a-z0-9][a-z0-9-]{0,62}$" help: The workers.dev subdomain of the Cloudflare account the blog deploys 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 the deploy's smoke, 01-product's probes and the + # verify URL 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 token mint from, so all three + # name one account. The console renders no field for it, and 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 `orun.integrations/reconcile@v1` # hooks mint these, brokered, during 01-product. ────────────────────────── diff --git a/docs/phases/README.md b/docs/phases/README.md index 92091bd..50fdf8b 100644 --- a/docs/phases/README.md +++ b/docs/phases/README.md @@ -71,8 +71,10 @@ the blueprint's **required** inputs — `reponame`, `productname`, must be supplied on every invocation, single-phase ones included. A `--values` file is easier than repeating `--set`. -- `subdomain` — the workers.dev subdomain of the Cloudflare account. It is - in every URL the phases probe and in the URL the deploy's smoke reads. +- `subdomain` — the workers.dev subdomain of the Cloudflare account you + deploy into. It is in every URL the phases probe and in the URL the + deploy's smoke reads. A console or `--from bst_…` build reads it from the + Cloudflare connection; pass it only for a hand-run build. - `orunWorkspace` — workspace id (`ws_…`). Unset, it is the workspace the build runs in (`from: workspace`); with none anywhere, a placeholder that fails loudly rather than silently claiming another tenant's workspace. diff --git a/repo-blueprint.yaml b/repo-blueprint.yaml index 3c463d2..86da4bc 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -51,7 +51,12 @@ inputs: subdomain: type: string default: "your-workers-subdomain" - description: The workers.dev subdomain of the Cloudflare account the blog deploys into — its URLs, the deploy's smoke, the probes. + description: >- + The workers.dev subdomain of the Cloudflare account the blog deploys + into — its URLs, the deploy's smoke, the probes. 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. repoPrivate: type: boolean default: true diff --git a/specs/epics/README.md b/specs/epics/README.md index b2eb6b0..b43cdc1 100644 --- a/specs/epics/README.md +++ b/specs/epics/README.md @@ -7,6 +7,6 @@ folder is the adoption; the merge creates the epic in the workspace. | Epic | Cluster | Status | What it is | |------|---------|--------|------------| -| [`cms-sanity/`](./cms-sanity/) | **CS** | ✅ Shipped (`baseline-v1`); live bootstrap pending | Vercel's Sanity CMS blog, equivalent in code and function, running on Cloudflare Workers + Static Assets via OpenNext — and an Orun baseline that instantiates it in one landing, deployable before a Sanity project exists (CS3) | +| [`cms-sanity/`](./cms-sanity/) | **CS** | ✅ Shipped (`baseline-v2`); live bootstrap pending | Vercel's Sanity CMS blog, equivalent in code and function, running on Cloudflare Workers + Static Assets via OpenNext — and an Orun baseline that instantiates it in one landing, deployable before a Sanity project exists (CS3) | As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`. diff --git a/specs/epics/cms-sanity/IMPLEMENTATION-STATUS.md b/specs/epics/cms-sanity/IMPLEMENTATION-STATUS.md index d22fc64..566e367 100644 --- a/specs/epics/cms-sanity/IMPLEMENTATION-STATUS.md +++ b/specs/epics/cms-sanity/IMPLEMENTATION-STATUS.md @@ -9,7 +9,7 @@ the code departed from `design.md` or from the upstream template. | CS1 — the blog on Workers | ✅ Shipped | [#2](https://github.com/sourceplane/cms-sanity/pull/2) | | CS2 — ready to instantiate | ✅ Shipped | [#3](https://github.com/sourceplane/cms-sanity/pull/3) | | CS3 — a baseline | ✅ Shipped | [#4](https://github.com/sourceplane/cms-sanity/pull/4) (CS-4), tagged `baseline-v1` | -| CS4 — the cirrus standard | ✅ Shipped | CS-5 — on `main` after `baseline-v1`, not yet tagged | +| CS4 — the cirrus standard | ✅ Shipped | [#5](https://github.com/sourceplane/cms-sanity/pull/5) (CS-5), [#6](https://github.com/sourceplane/cms-sanity/pull/6) (CS-6), tagged `baseline-v2` | ## Departures from the upstream template @@ -158,6 +158,45 @@ Nothing about the blog changed. What changed is the baseline around it: | the Presentation preview in the READMEs and `design.md` | "Unchanged" (the root README's opening line and mapping table) | unchanged in code, not yet exercised in a browser (risk CS-H); the blog's README asks its owner to open the Presentation tool once after adding the token | CS-H is open: the draft-mode route is tested with a mocked client only | | status | CS3 "in review … to be tagged `baseline-v1`" | CS3 shipped and tagged `baseline-v1` | the tag existed; the documents had not caught up | +### The subdomain from the Cloudflare connection (CS-6) + +The card's `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 the deploy's smoke and +`01-product`'s probes. It now declares `from: +connection.cloudflare.workersSubdomain`, as cirrus-baseline's card does since +baseline-v23: the Cloudflare integration reads the subdomain at connect and on +its hourly health check, the bootstrap door fills the input from the +connection the build is bound to (the one `CLOUDFLARE_ACCOUNT_ID` and the +deploy token come from), the console renders no field for it, and an account +with no workers.dev subdomain is refused at the door. Nothing a blog runs +changes. + +- `blueprint.yaml`: the `from:` source and the reason, at the input; key, + label, pattern, help and example unchanged. +- `testing/manifest.test.sh`: cirrus-baseline's rule, byte for byte — the + source is accepted, and a `connection..…` source whose provider + `spec.requires.integrations` does not list fails (the card lists + `cloudflare`). +- `repo-blueprint.yaml`, `BOOTSTRAP.md`, `docs/phases/README.md`: a console or + `--from bst_…` build reads it from the connection; only a hand-run build + passes `--set subdomain`. The default is unchanged. + +Verified: + +- `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer}.test.sh` + green; `gen-component-docs.py --check` green (2 components). +- Mutation: `cloudflare` removed from `spec.requires.integrations` → + `manifest.test.sh` fails with exactly one finding, `inputs[subdomain].from + is 'connection.cloudflare.workersSubdomain' but spec.requires.integrations + does not list cloudflare`; restored, green. +- `orun new --status` (v2.58.11) reads the blueprint: `01-product` pending + (97 files). `testing/leak.test.sh` (v2.58.11): 97 files derived, every one + read, no factory path named. +- `testing/placement.test.sh` (v2.78.4): 97 files placed, both landings, + `--resume` changes nothing. +- `orun task check CS-6` complete. + ## Verified (CS4) - `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer}.test.sh` diff --git a/specs/epics/cms-sanity/README.md b/specs/epics/cms-sanity/README.md index 5d3359e..4e61399 100644 --- a/specs/epics/cms-sanity/README.md +++ b/specs/epics/cms-sanity/README.md @@ -8,7 +8,7 @@ The upstream code stays the code: the GROQ queries, the schemas, the Portable Te | Field | Value | |-------|-------| -| Status | ✅ CS0–CS3 shipped (#1–#4), CS3 tagged `baseline-v1`; CS4 (the cirrus standard, CS-5) on `main`, not yet tagged. Not yet proven by a live bootstrap (risk CS-M) | +| Status | ✅ CS0–CS4 shipped (#1–#6), CS3 tagged `baseline-v1`; CS4 (the cirrus standard, CS-5, and the subdomain read from the Cloudflare connection, CS-6) tagged `baseline-v2`. Not yet proven by a live bootstrap (risk CS-M) | | Cluster | **CS** (CS0–CS4) | | Owner(s) | `apps/web` (the blog and the Studio) · `tests/web` (image URLs, the date component, the draft-mode route, the unconnected blog) · the baseline (`blueprint.yaml`, `repo-blueprint.yaml`, `.baseline/`, `testing/`) | | Builds on | `cirrus-baseline` conventions; the `portfolio-starter-kit` port's build shape (static-assets incremental cache + `populateCache`) and its analytics beacon; the `turso-starter` port's `force-dynamic` answer to a read-only cache | @@ -16,7 +16,7 @@ The upstream code stays the code: the GROQ queries, the schemas, the Portable Te | Changes | Adds the Workers build, the monorepo wrapper, tests and the deploy contract; makes the blog routes dynamic; mounts the Studio client-side; swaps Speed Insights for one Cloudflare beacon; moves next-sanity/sanity to their Next 16 lines and Tailwind to 4 | | Decisions locked | (1) OpenNext on Workers + Static Assets, the static-assets incremental cache. (2) Blog routes `force-dynamic` + `fetchCache = "force-no-store"`; Sanity's API CDN is the cache; no R2/DO cache. (3) The Studio loads through `next/dynamic` with `ssr: false`; the Studio layout's metadata is written out, not re-exported. (4) Project id and dataset are build-time values the Orun build reads from the product's secrets — best-effort since CS3 (`optionalSecretEnv`): with none, the blog renders bundled sample posts under a "connect your Sanity project" notice; the read token is an optional Worker secret. (5) Tailwind 4, CSS-first. (6) CS3: two phases, one landing (cirrus-baseline v22). | | Gate | CS1 is the first user-visible rung. | -| Shipped as | `baseline-v1` ([#4](https://github.com/sourceplane/cms-sanity/pull/4)), then CS4 on `main`; proven offline (Baseline CI, with no Sanity project), deploy gated until a workspace is linked | +| Shipped as | `baseline-v1` ([#4](https://github.com/sourceplane/cms-sanity/pull/4)), then `baseline-v2` (CS4: [#5](https://github.com/sourceplane/cms-sanity/pull/5), [#6](https://github.com/sourceplane/cms-sanity/pull/6)); proven offline (Baseline CI, with no Sanity project), deploy gated until a workspace is linked | ## Read order @@ -33,4 +33,4 @@ The upstream code stays the code: the GROQ queries, the schemas, the Portable Te | CS1 — the blog on Workers | `apps/web` built by OpenNext, `tests/web`, green checks | `wrangler dev` serves the Studio shell, its chunks, a 401 and a 404; the Worker bundle holds no Studio code; Checks green | | CS2 — ready to instantiate | README, as-built status | a reader can run, test, preview and deploy it against their own Sanity project | | CS3 — a baseline | card, build document, rename, bootstrap tooling, tests; the unconnected blog | a new blog goes from nothing to live in one landing with no Sanity project; Baseline CI green | -| CS4 — the cirrus standard | no kiox, generated component docs, the context pack, status that agrees with the tags | Baseline CI green with the docs check | +| CS4 — the cirrus standard | no kiox, generated component docs, the context pack, status that agrees with the tags; the subdomain read from the Cloudflare connection | Baseline CI green with the docs check; the card asks for no subdomain | diff --git a/specs/epics/cms-sanity/epic.yaml b/specs/epics/cms-sanity/epic.yaml index 6d48cb1..60ff95c 100644 --- a/specs/epics/cms-sanity/epic.yaml +++ b/specs/epics/cms-sanity/epic.yaml @@ -39,4 +39,5 @@ spec: - "every component carries generated docs/{overview,architecture,runbook}.md, and Baseline CI fails a pull request whose manifests and pages disagree" - "ai/context carries this repository's current.md, decisions.md and open-risks.md, and none of them ships to a blog" - "every milestone's status row agrees with the tags" - tasks: [CS-5] + - "the console card reads subdomain from the Cloudflare connection (from: connection.cloudflare.workersSubdomain), as cirrus-baseline since baseline-v23" + tasks: [CS-5, CS-6] diff --git a/specs/epics/cms-sanity/implementation-plan.md b/specs/epics/cms-sanity/implementation-plan.md index 159022d..70e2f4a 100644 --- a/specs/epics/cms-sanity/implementation-plan.md +++ b/specs/epics/cms-sanity/implementation-plan.md @@ -72,6 +72,12 @@ blog itself changing. - **Status that agrees with the tags.** CS3 is shipped and tagged `baseline-v1`; the READMEs no longer call the Presentation preview simply "unchanged" while CS-H is open. +- **The subdomain from the Cloudflare connection (CS-6).** The card's + `subdomain` input declares `from: connection.cloudflare.workersSubdomain`, + as cirrus-baseline's does since baseline-v23: the bootstrap door fills it + from the connection the build is bound to, so the console asks for nothing + a typo could get wrong. `testing/manifest.test.sh` takes cirrus-baseline's + rule, which requires the provider in `spec.requires.integrations`. **Done when** - nothing outside this milestone's own record names kiox (`git grep -i diff --git a/tasks/CS-6.TaskContract.yaml b/tasks/CS-6.TaskContract.yaml new file mode 100644 index 0000000..f5f6866 --- /dev/null +++ b/tasks/CS-6.TaskContract.yaml @@ -0,0 +1,24 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: CS-6 + title: "The subdomain from the Cloudflare connection" +spec: + goal: "The console card stops asking for the workers.dev subdomain and reads it from the Cloudflare connection the build is bound to (`from: connection.cloudflare.workersSubdomain`), as cirrus-baseline does since baseline-v23 — the same account CLOUDFLARE_ACCOUNT_ID and the deploy token come from, so a wrong typed value can no longer surface after deploy in the smoke and the probes" + affects: + - blueprint.yaml + - repo-blueprint.yaml + - testing/manifest.test.sh + - BOOTSTRAP.md + - docs/phases/README.md + - ai/context/current.md + - ai/context/decisions.md + - specs/** + - tasks/** + doneWhen: + - "blueprint.yaml's `subdomain` input declares `from: connection.cloudflare.workersSubdomain`, and its comment says why" + - testing/manifest.test.sh accepts that source and fails a card whose `spec.requires.integrations` does not list the provider (mutation-checked) + - repo-blueprint.yaml, BOOTSTRAP.md and docs/phases/README.md say a console or `--from bst_…` build reads it from the connection and only a hand-run build passes `--set subdomain` + - every milestone's status row agrees with the tags + gates: + - checks diff --git a/testing/manifest.test.sh b/testing/manifest.test.sh index 3fd6af8..5374cb5 100755 --- a/testing/manifest.test.sh +++ b/testing/manifest.test.sh @@ -217,9 +217,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 [])}