diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index 2c0202d..407c6b4 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -66,6 +66,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 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 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 6a64439..3bc3e95 100644 --- a/ai/context/current.md +++ b/ai/context/current.md @@ -21,8 +21,8 @@ provider. | | | |---|---| -| Latest tag | `baseline-v1` (CM4, [#5](https://github.com/sourceplane/commerce/pull/5)) | -| On `main` since | CM5 — the cirrus standard (no kiox, generated component docs, this context pack) | +| Latest tag | `baseline-v2` (CM5 — the cirrus standard, [#6](https://github.com/sourceplane/commerce/pull/6) and [#7](https://github.com/sourceplane/commerce/pull/7): 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` (CM4, [#5](https://github.com/sourceplane/commerce/pull/5)) | | Proven live | No. Everything short of the platform is proven offline in Baseline CI; the tokens minted, a real R2 apply, a real `wrangler deploy` with the bucket and Durable Object bindings, the probes and a real Shopify store are still to come (risks CM-P, CM-M) | ## Where to read @@ -37,7 +37,6 @@ provider. ## Next -1. Bootstrap one storefront from the next tag against a workspace and record +1. Bootstrap one storefront from `baseline-v2` against a workspace and record its timings; its deploy answers CM-M, and it closes CM-P. Connect a Shopify development store to it once. -2. Cut the next `baseline-vN` with `tag.yml` so the registry can pin CM5. diff --git a/ai/context/decisions.md b/ai/context/decisions.md index 14d960d..3f5e8f8 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`; `checks.yml` runs on pull requests only | A bootstrap cannot set a repository variable (replaced the `ORUN_CI` gate); the convergence watch takes the newest run on the merge sha from any workflow | IMPLEMENTATION-STATUS (CM4) | | 11 | stack-tectonic 0.19.0, not 0.20.0 | 0.20.0's lane-scoped install is refused by Next 16's Turbopack | IMPLEMENTATION-STATUS (CM4), design.md §9 | | 12 | orun is pinned only where it runs (the `orun-action` `version:` in each workflow); no kiox. Component docs are generated from the manifests and checked in CI | `kiox.yaml` pinned a version nothing ran; a hand-written copy of the dependency graph and bindings drifts silently | IMPLEMENTATION-STATUS (CM5), `tooling/catalog/gen-component-docs.py` | +| 13 | `subdomain` is read from the Cloudflare connection (`from: connection.cloudflare.workersSubdomain`), never asked | It belongs to the account like its id and has one right answer; a typed one could only be wrong, and showed up after deploy in the smoke and the probes | `blueprint.yaml`, IMPLEMENTATION-STATUS (CM-7) | diff --git a/blueprint.yaml b/blueprint.yaml index 4eda835..ae4bc74 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -98,6 +98,18 @@ spec: pattern: "^[a-z0-9][a-z0-9-]{0,62}$" help: The workers.dev subdomain of the Cloudflare account the store 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, the phase probes 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. The + # console renders no field for it. 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 0c61575..98cd09f 100644 --- a/docs/phases/README.md +++ b/docs/phases/README.md @@ -57,8 +57,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. +- `subdomain` — the workers.dev subdomain of the Cloudflare account you + deploy into. It is in every URL the phases probe. 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 222ae3f..b785c1f 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -54,7 +54,12 @@ inputs: subdomain: type: string default: "your-workers-subdomain" - description: The workers.dev subdomain of the Cloudflare account the site deploys into — its URLs and the probes. + description: >- + The workers.dev subdomain of the Cloudflare account the site deploys + into — its URLs and 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 18cbc24..4736695 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 | |------|---------|--------|------------| -| [`commerce/`](./commerce/) | **CM** | ✅ Shipped (`baseline-v1`); live bootstrap pending | Vercel's Next.js Commerce, equivalent in code and function, on Cloudflare Workers with the Shopify Storefront API as its backend — and an Orun baseline that instantiates it in one landing, live on a bundled demo catalogue until a store is connected (CM4) | +| [`commerce/`](./commerce/) | **CM** | ✅ Shipped (`baseline-v2`); live bootstrap pending | Vercel's Next.js Commerce, equivalent in code and function, on Cloudflare Workers with the Shopify Storefront API as its backend — and an Orun baseline that instantiates it in one landing, live on a bundled demo catalogue until a store is connected (CM4) | As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`. diff --git a/specs/epics/commerce/IMPLEMENTATION-STATUS.md b/specs/epics/commerce/IMPLEMENTATION-STATUS.md index 8f61596..881c5a5 100644 --- a/specs/epics/commerce/IMPLEMENTATION-STATUS.md +++ b/specs/epics/commerce/IMPLEMENTATION-STATUS.md @@ -10,7 +10,7 @@ the code departed from `design.md` or from the upstream template. | CM2 — the cache infrastructure from Terraform | ✅ Shipped (validated; apply gated on a linked workspace) | [#3](https://github.com/sourceplane/commerce/pull/3) | | CM3 — ready to instantiate | ✅ Shipped | [#4](https://github.com/sourceplane/commerce/pull/4) | | CM4 — a baseline, in one landing | ✅ Shipped (offline-proven; no live bootstrap yet, risk CM-P) | [#5](https://github.com/sourceplane/commerce/pull/5) (CM-5), tagged `baseline-v1` | -| CM5 — the cirrus standard | ✅ Shipped | CM-6 — on `main` after `baseline-v1`, not yet tagged | +| CM5 — the cirrus standard | ✅ Shipped | [#6](https://github.com/sourceplane/commerce/pull/6) (CM-6), [#7](https://github.com/sourceplane/commerce/pull/7) (CM-7), tagged `baseline-v2` | ## Departures from the upstream template @@ -151,6 +151,44 @@ Nothing about the storefront changed. What changed is the baseline around it: | context pack | `operations.md`, `deployment.md` | plus `current.md`, `decisions.md`, `open-risks.md` | cirrus-baseline's shape; the three new pages are this repository's own and no module places them (the leak gate still allows exactly two) | | status | CM4 "this PR, to be tagged"; risk CM-B and design §2/§7 describing CM3's wrangler vars and calling CM-B open; the epic README's gate claiming an offline `plan` | CM4 shipped ([#5](https://github.com/sourceplane/commerce/pull/5)) and tagged `baseline-v1`; CM-B, design §2/§7 and "Around the template" say what CM4 built (no vars, request origin, `.env.example` only); the gate says offline is `validate` only | the documents had not caught up with the tag and with CM4 | +### The subdomain from the Cloudflare connection (CM-7) + +`subdomain` was the one input an operator typed that the platform could +answer itself: it belongs to the Cloudflare account the same way its id does, +and it has exactly one right answer. A typed one could only be wrong, and +wrong showed up after deploy — in the deploy's smoke (its `DEPLOYED_URL`), the +phase probes and the console's verify URLs. `blueprint.yaml` now declares +`from: connection.cloudflare.workersSubdomain`, as cirrus-baseline does since +baseline-v23: the Cloudflare integration reads the subdomain 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 is refused at the door with the fix named. + +- `testing/manifest.test.sh` takes cirrus-baseline's rule verbatim: the source + is accepted, and only when `spec.requires.integrations` lists its provider. +- `repo-blueprint.yaml` keeps the input and its default; it, `BOOTSTRAP.md` + and `docs/phases/README.md` say only a hand-run build passes + `--set subdomain`. +- Nothing a storefront carries changes: the rename writes the value where it + always did (`workersDevSubdomain`, the URLs), and the probes read it as + before. + +Verified: + +- `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer,wire}.test.sh` + green; `gen-component-docs.py --check` green (3 components). +- Mutation: with `cloudflare` dropped from `spec.requires.integrations`, + `manifest.test.sh` fails with exactly one finding, naming + `inputs[subdomain]`; restored, it passes. +- `orun new --status` at v2.58.11: `01-product` pending, 147 files. + `testing/leak.test.sh` at v2.58.11: 147 files derived; 140 shipped sources + name no factory path. `testing/placement.test.sh` at v2.78.4: 147 files + placed, two landings; the product's own plan applies `cloudflare-r2` at + level 0 and deploys `web` at level 1 on stage and prod; the 02-docs merge + plans 0 jobs; `--resume` a no-op. +- `orun task check CM-7` complete. + ## Verified (CM5) - `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer,wire}.test.sh` diff --git a/specs/epics/commerce/README.md b/specs/epics/commerce/README.md index bf9871e..b8bf22e 100644 --- a/specs/epics/commerce/README.md +++ b/specs/epics/commerce/README.md @@ -8,7 +8,7 @@ The upstream code stays the code: `lib/shopify` (queries, mutations, reshaping, | Field | Value | |-------|-------| -| Status | ✅ Shipped — CM0–CM4 landed (#1–#5), tagged `baseline-v1`; CM5 (the cirrus standard, CM-6) on `main`, not yet tagged. R2 apply and live deploy proven only by a live bootstrap (risk CM-P) | +| Status | ✅ Shipped — CM0–CM4 landed (#1–#5), tagged `baseline-v1`; CM5 (the cirrus standard, CM-6 #6 and CM-7 #7) tagged `baseline-v2`. R2 apply and live deploy proven only by a live bootstrap (risk CM-P) | | Cluster | **CM** (CM0–CM5) | | Owner(s) | `apps/web` (the storefront) · `tests/web` (client + webhook tests) · `infra/terraform/cloudflare-r2` (the cache bucket) | | Builds on | `cirrus-baseline` conventions — intent, components, the Checks lane, the gated Orun lane; the factory's `cloudflare-r2` root and `tooling/wire` renderer | @@ -16,7 +16,7 @@ The upstream code stays the code: `lib/shopify` (queries, mutations, reshaping, | Changes | Adds the Workers build, the cache bindings, the monorepo wrapper, tests, the R2 root and the deploy contract; the storefront's code is untouched except where Next 16 or Workers force a change (status file) | | Decisions locked | (1) OpenNext on Workers + Static Assets. (2) Incremental cache in R2, tag cache and queue in Durable Objects — no D1, no KV. (3) `wrangler.jsonc` is rendered per environment from the R2 root's wiring document — and, since CM4, committed as the fixture render, because the deploy lane checks it exists before the build (risk CM-J). (4) The Shopify facts are Worker secrets set once per environment; the deploy lane does not set them — and, since CM4, optional: without them the storefront serves a bundled demo catalogue (risk CM-N). (5) `experimental.useCache`, not `cacheComponents`, until the adapter runs staged renders. (6) CM4: one landing — the plan, not a landing boundary, orders the bucket before the Worker; the R2 root has its own `r2-data` key (risk CM-L). | | Gate | CM1 is the first user-visible rung. CM2 needs a workspace with a Cloudflare connection to plan and apply (the root's plan lists the account's buckets, `adopt.tf`); offline it is held to `terraform validate`. | -| Shipped as | `baseline-v1` ([#5](https://github.com/sourceplane/commerce/pull/5)), then CM5 on `main`; proven offline (Baseline CI), deploy gated until a workspace is linked | +| Shipped as | `baseline-v1` ([#5](https://github.com/sourceplane/commerce/pull/5)), then `baseline-v2` (CM5: [#6](https://github.com/sourceplane/commerce/pull/6), [#7](https://github.com/sourceplane/commerce/pull/7)); proven offline (Baseline CI), deploy gated until a workspace is linked | ## Read order @@ -34,4 +34,4 @@ The upstream code stays the code: `lib/shopify` (queries, mutations, reshaping, | CM2 — the cache infrastructure from Terraform | `infra/terraform/cloudflare-r2`, the app's `secretEnv` and `dependsOn` | the root validates; the wiring keys match the template | | CM3 — ready to instantiate | README, as-built status | a reader can run, test, preview, connect Shopify and deploy it | | CM4 — a baseline, in one landing | card, build document, rename, bootstrap tooling, tests; the demo catalogue, cart page and checkout notice | a new storefront goes from nothing to live in one landing with no third-party key, the R2 bucket applied before the Worker; Baseline CI green | -| CM5 — the cirrus standard | no kiox, generated component docs, the context pack, status that agrees with the tags | Baseline CI green with the docs check | +| CM5 — 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/commerce/epic.yaml b/specs/epics/commerce/epic.yaml index bf887b4..58ba3ed 100644 --- a/specs/epics/commerce/epic.yaml +++ b/specs/epics/commerce/epic.yaml @@ -46,4 +46,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 product" - "every milestone's status row agrees with the tags" - tasks: [CM-6] + - "the console card reads subdomain from the Cloudflare connection (from: connection.cloudflare.workersSubdomain), as cirrus-baseline since baseline-v23" + tasks: [CM-6, CM-7] diff --git a/specs/epics/commerce/implementation-plan.md b/specs/epics/commerce/implementation-plan.md index 018f98a..9994eff 100644 --- a/specs/epics/commerce/implementation-plan.md +++ b/specs/epics/commerce/implementation-plan.md @@ -95,6 +95,11 @@ storefront itself changing. repository's own, so no module places them. - **Status that agrees with the tags.** CM4 is shipped and tagged; CM-B and the design's mapping say what CM4 built. +- **The subdomain from the Cloudflare connection (CM-7).** The card declares + `subdomain` as `from: connection.cloudflare.workersSubdomain`, as + cirrus-baseline does since baseline-v23, so the console asks for nothing the + connection already knows; `testing/manifest.test.sh` requires the source's + provider in `spec.requires.integrations`. **Done when** - `git grep -i kiox` finds nothing outside this milestone's own record diff --git a/tasks/CM-7.TaskContract.yaml b/tasks/CM-7.TaskContract.yaml new file mode 100644 index 0000000..1a6958c --- /dev/null +++ b/tasks/CM-7.TaskContract.yaml @@ -0,0 +1,25 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: CM-7 + title: "The subdomain from the Cloudflare connection" +spec: + goal: "The console card reads the workers.dev subdomain from the workspace's Cloudflare connection (`from: connection.cloudflare.workersSubdomain`) instead of asking for it, as cirrus-baseline does since baseline-v23, and the manifest gate holds that source to a connection the card requires" + 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/epics/README.md + - specs/epics/commerce/** + - tasks/CM-7.TaskContract.yaml + doneWhen: + - "blueprint.yaml declares `from: connection.cloudflare.workersSubdomain` on `subdomain`, so the console renders no field for it" + - testing/manifest.test.sh accepts that source only when spec.requires.integrations lists its provider, and fails naming the input when it does not (mutation-checked) + - BOOTSTRAP.md, docs/phases and repo-blueprint.yaml say only a hand-run build passes `--set subdomain` + - the contract tests, the docs check, the leak gate and the offline bootstrap are green + 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 [])}