diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index 025e612..73c7fcc 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -59,6 +59,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 3d58281..ae3a878 100644 --- a/ai/context/current.md +++ b/ai/context/current.md @@ -19,8 +19,7 @@ records what went live (`02-docs`). | | | |---|---| -| Latest tag | `baseline-v1` (KR4, [#5](https://github.com/sourceplane/kv-redis-starter/pull/5)) | -| On `main` since | KR5 — the cirrus standard (no kiox, generated component docs, this context pack) | +| Latest tag | `baseline-v2` (KR5 — the cirrus standard, [#6](https://github.com/sourceplane/kv-redis-starter/pull/6) and [#7](https://github.com/sourceplane/kv-redis-starter/pull/7): no kiox, generated component docs, this context pack, and the console card reading `subdomain` from the Cloudflare connection); `baseline-v1` is KR4 ([#5](https://github.com/sourceplane/kv-redis-starter/pull/5)) | | Proven live | No. Everything short of the platform is proven offline in Baseline CI: the product built in orun's staged job tree, dry-deployed with the stage document's namespace id, served by `wrangler dev` and smoke-tested. No bootstrap from a tag has run against a workspace: the repository link, a real `terraform apply`, a real `wrangler deploy` and the probes are unproven (risk KR-G) | ## Where to read @@ -35,6 +34,5 @@ records what went live (`02-docs`). ## Next -1. Bootstrap one product from a tag against a workspace, and record its - timings (closes KR-G); then the registry row can go public. -2. Cut the next `baseline-vN` with `tag.yml` so the registry can pin KR5. +1. Bootstrap one product from `baseline-v2` against a workspace, and record + its timings (closes KR-G); then the registry row can go public. diff --git a/ai/context/decisions.md b/ai/context/decisions.md index 7ad8ab4..5895a62 100644 --- a/ai/context/decisions.md +++ b/ai/context/decisions.md @@ -17,3 +17,4 @@ reads in order. | 9 | 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 (KR4), `intent.yaml` | | 10 | orun is pinned only where it runs (the `orun-action` `version:` in each workflow); no kiox | `kiox.yaml` pinned a version (v2.15.0) nothing ran | IMPLEMENTATION-STATUS (KR5) | | 11 | 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` | +| 12 | The console card reads `subdomain` from the Cloudflare connection (`from: connection.cloudflare.workersSubdomain`); only a hand-run build passes it | 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 (cirrus-baseline since baseline-v23) | `blueprint.yaml`, IMPLEMENTATION-STATUS (KR-7) | diff --git a/blueprint.yaml b/blueprint.yaml index 6e57499..480a39f 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -91,6 +91,18 @@ spec: pattern: "^[a-z0-9][a-z0-9-]{0,62}$" help: The workers.dev subdomain of the Cloudflare account the site 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 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. 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 fd2ba4c..d71ec6d 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 1ea6047..21d3863 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -53,7 +53,13 @@ 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 fcd6526..155cc39 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 | |------|---------|--------|------------| -| [`kv-redis-starter/`](./kv-redis-starter/) | **KR** | ✅ Shipped (`baseline-v1`); live bootstrap pending | Vercel's Redis Next.js Starter, equivalent in code and function, on Cloudflare Workers with the counter in Workers KV — and an Orun baseline that instantiates it in one landing (KR4) | +| [`kv-redis-starter/`](./kv-redis-starter/) | **KR** | ✅ Shipped (`baseline-v2`); live bootstrap pending | Vercel's Redis Next.js Starter, equivalent in code and function, on Cloudflare Workers with the counter in Workers KV — and an Orun baseline that instantiates it in one landing (KR4) | As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`. diff --git a/specs/epics/kv-redis-starter/IMPLEMENTATION-STATUS.md b/specs/epics/kv-redis-starter/IMPLEMENTATION-STATUS.md index 8faf41d..95c9ed6 100644 --- a/specs/epics/kv-redis-starter/IMPLEMENTATION-STATUS.md +++ b/specs/epics/kv-redis-starter/IMPLEMENTATION-STATUS.md @@ -10,7 +10,7 @@ the code departed from `design.md` or from the upstream template. | KR2 — the KV namespace from Terraform | ✅ Shipped (validated; apply gated on a linked workspace) | [#3](https://github.com/sourceplane/kv-redis-starter/pull/3) | | KR3 — ready to instantiate | ✅ Shipped | [#4](https://github.com/sourceplane/kv-redis-starter/pull/4) | | KR4 — a baseline, in one landing | ✅ Shipped (offline-proven; no live bootstrap yet, risk KR-G) | [#5](https://github.com/sourceplane/kv-redis-starter/pull/5) (KR-5), tagged `baseline-v1` | -| KR5 — the cirrus standard | ✅ Shipped | KR-6 — on `main` after `baseline-v1`, not yet tagged | +| KR5 — the cirrus standard | ✅ Shipped | [#6](https://github.com/sourceplane/kv-redis-starter/pull/6) (KR-6), [#7](https://github.com/sourceplane/kv-redis-starter/pull/7) (KR-7), tagged `baseline-v2` | ## Departures from the upstream template @@ -95,6 +95,40 @@ Nothing about the counter 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 | KR4 "this PR (KR-5), to be tagged" | KR4 shipped and tagged `baseline-v1` | the tag existed; the documents had not caught up | +### The subdomain from the Cloudflare connection (KR-7) + +The console 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 smoke checks and the +verify URLs. `blueprint.yaml` now declares +`from: connection.cloudflare.workersSubdomain`, as cirrus-baseline does since +`baseline-v23`: 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 is refused at +the door, naming the fix. + +- `testing/manifest.test.sh` takes cirrus-baseline's check: a + `connection..` source is accepted, and only when the card's + `spec.requires.integrations` lists the provider (this card lists + `[github, cloudflare]`). +- `repo-blueprint.yaml` keeps the input and its default; its description, + `BOOTSTRAP.md` and `docs/phases/README.md` say a hand-run `orun new` still + passes `--set subdomain`. +- Nothing a product runs changed: no app, Terraform, test or tooling file. + +Verified: `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer,wire}.test.sh` +green; `gen-component-docs.py --check` green (3 components); at v2.58.11, +`orun new --status` on `repo-blueprint.yaml` (`01-product` 73 files) and +`testing/leak.test.sh` (73 files derived; 66 shipped sources name no factory +path); at v2.78.4, `testing/placement.test.sh` (73 tracked files; +cloudflare-kv → web; `--resume` changes nothing); `orun task check KR-7` +complete. Mutation check: with `cloudflare` removed from +`spec.requires.integrations`, `manifest.test.sh` fails with the one finding +`inputs[subdomain].from is 'connection.cloudflare.workersSubdomain' but +spec.requires.integrations does not list cloudflare`; restored, it passes. + ## Verified (KR5) - `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer,wire}.test.sh` diff --git a/specs/epics/kv-redis-starter/README.md b/specs/epics/kv-redis-starter/README.md index 0b361c9..e04758a 100644 --- a/specs/epics/kv-redis-starter/README.md +++ b/specs/epics/kv-redis-starter/README.md @@ -8,7 +8,7 @@ The port keeps the template's page, layout, styles and components. It replaces t | Field | Value | |-------|-------| -| Status | ✅ KR0–KR4 shipped (#1–#5), tagged `baseline-v1`; KR5 (the cirrus standard, KR-6) on `main`, not yet tagged. The KV apply and a live deploy are not yet proven by a live bootstrap (risk KR-G) | +| Status | ✅ KR0–KR5 shipped (#1–#7; KR4 tagged `baseline-v1`, KR5 — the cirrus standard, KR-6 and KR-7 — tagged `baseline-v2`). The KV apply and a live deploy are not yet proven by a live bootstrap (risk KR-G) | | Cluster | **KR** (KR0–KR5) | | Owner(s) | `apps/web` (the page and the counter) · `tests/web` · `infra/terraform/cloudflare-kv` | | Builds on | `cirrus-baseline` conventions: the `cloudflare-kv` root and the `@@wiring(...)@@` deploy-time render | @@ -16,7 +16,7 @@ The port keeps the template's page, layout, styles and components. It replaces t | Changes | The counter's store (Redis → Workers KV), the Workers build, tests, the KV root and the deploy contract; page copy says KV instead of Redis | | Decisions locked | (1) Workers KV, not a Durable Object: the template is a demo counter and KV is the one-to-one of Vercel KV; the design names the DO upgrade path. (2) `wrangler.jsonc` is rendered per environment from the wiring document — and, since KR4, committed as the fixture render, because the deploy lane checks it exists before the build (risk KR-E). (3) `force-dynamic` stays: the count is per request. (4) KR4: one landing — the plan, not a landing boundary, orders the namespace before the Worker. | | Gate | KR1 is the first user-visible rung. KR2 applies only with a linked workspace; it is verified by `terraform validate`. | -| Shipped as | `baseline-v1` ([#5](https://github.com/sourceplane/kv-redis-starter/pull/5)), then KR5 on `main`; proven offline (Baseline CI: contract, leak, placement and the e2e tier), deploy gated until a workspace is linked | +| Shipped as | `baseline-v1` ([#5](https://github.com/sourceplane/kv-redis-starter/pull/5)), `baseline-v2` ([#6](https://github.com/sourceplane/kv-redis-starter/pull/6), [#7](https://github.com/sourceplane/kv-redis-starter/pull/7)); proven offline (Baseline CI: contract, leak, placement and the e2e tier), deploy gated until a workspace is linked | ## Read order @@ -34,4 +34,4 @@ The port keeps the template's page, layout, styles and components. It replaces t | KR2 — the KV namespace from Terraform | `infra/terraform/cloudflare-kv` | the root validates; the wiring keys match the template | | KR3 — ready to instantiate | README, as-built status | a reader can run, test, preview and deploy it | | KR4 — a baseline, in one landing | card, build document, rename, bootstrap tooling, tests | a new product goes from nothing to live in one landing, the KV namespace applied before the Worker; Baseline CI green | -| KR5 — the cirrus standard | no kiox, generated component docs, the context pack, status that agrees with the tags | Baseline CI green with the docs check | +| KR5 — the cirrus standard | no kiox, generated component docs, the context pack, status that agrees with the tags; the console card reads `subdomain` from the Cloudflare connection | Baseline CI green with the docs check | diff --git a/specs/epics/kv-redis-starter/epic.yaml b/specs/epics/kv-redis-starter/epic.yaml index 5710afc..d10dd7c 100644 --- a/specs/epics/kv-redis-starter/epic.yaml +++ b/specs/epics/kv-redis-starter/epic.yaml @@ -44,4 +44,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: [KR-6] + - "the console card reads subdomain from the Cloudflare connection (from: connection.cloudflare.workersSubdomain), as cirrus-baseline since baseline-v23" + tasks: [KR-6, KR-7] diff --git a/specs/epics/kv-redis-starter/implementation-plan.md b/specs/epics/kv-redis-starter/implementation-plan.md index 34ade11..185839b 100644 --- a/specs/epics/kv-redis-starter/implementation-plan.md +++ b/specs/epics/kv-redis-starter/implementation-plan.md @@ -58,7 +58,7 @@ fresh repository: `wrangler.jsonc` committed, dev rendering the fixture, - the status file records what is proven offline and what only a live bootstrap can prove -## KR5 — the cirrus standard (KR-6) ✅ +## KR5 — the cirrus standard (KR-6, KR-7) ✅ Bring the baseline to cirrus-baseline's standard, with nothing about the counter itself changing. @@ -74,6 +74,12 @@ counter itself changing. `open-risks.md` beside the two pages a product ships with — this repository's own, so no module places them. - **Status that agrees with the tags.** KR4 is shipped and tagged. +- **The subdomain from the Cloudflare connection (KR-7).** The card's + `subdomain` input declares `from: connection.cloudflare.workersSubdomain`, + as cirrus-baseline since `baseline-v23`: the console fills it from the + connection the build is bound to and renders no field; `manifest.test.sh` + accepts the source only while the card requires `cloudflare`. A hand-run + build still passes `--set subdomain`. **Done when** - nothing outside this milestone's own record names kiox (`git grep -i diff --git a/tasks/KR-7.TaskContract.yaml b/tasks/KR-7.TaskContract.yaml new file mode 100644 index 0000000..7789072 --- /dev/null +++ b/tasks/KR-7.TaskContract.yaml @@ -0,0 +1,24 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: KR-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), as cirrus-baseline does since baseline-v23, so a console or `--from bst_…` build never asks for it and it always names the account the deploy tokens mint from; a hand-run build still passes it with --set + 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 spec.requires.integrations lists cloudflare" + - testing/manifest.test.sh accepts that source only when the card requires the provider's integration, and fails naming the input when it does not (mutation-checked) + - BOOTSTRAP.md, docs/phases/README.md and repo-blueprint.yaml say a hand-run build still 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 [])}