diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index 67f0d19..ecfacfe 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -64,6 +64,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 ac6d66c..7f9e109 100644 --- a/ai/context/current.md +++ b/ai/context/current.md @@ -18,13 +18,13 @@ then the Worker deployed), then records what went live (`02-docs`). | | | |---|---| -| Latest tag | `baseline-v1` (BL4) | -| On `main` since | BL5 — the cirrus standard (no kiox, generated component docs, this context pack) and SVG uploads closed (risk BL-L) | +| Latest tag | `baseline-v2` (BL5 — the cirrus standard: no kiox, generated component docs, this context pack, and the console card reading `subdomain` from the Cloudflare connection; SVG uploads closed, risk BL-L); `baseline-v1` is BL4 | | Proven live | No. Everything short of the platform is proven offline in Baseline CI, an upload round-tripped through the built Worker included; a live bootstrap from a tag is still to come (risk BL-G) | `baseline-v1` accepts any `image/*` upload, SVG included, and serves it from the product's own origin (BL-L). A product built from it needs BL5's change -to `apps/web/lib/blob`, the delivery route and the uploader. +to `apps/web/lib/blob`, the delivery route and the uploader, which +`baseline-v2` carries. ## Where to read @@ -38,7 +38,6 @@ to `apps/web/lib/blob`, the delivery route and the uploader. ## Next -1. Cut the next `baseline-vN` with `tag.yml`, so the registry can pin BL5 and - no new product starts with SVG uploads open. -2. Bootstrap one product from that tag against a workspace whose Cloudflare - account has R2 enabled (BL-J), and record its timings (closes BL-G). +1. Bootstrap one product from `baseline-v2` against a workspace whose + Cloudflare account has R2 enabled (BL-J), and record its timings (closes + BL-G). diff --git a/ai/context/decisions.md b/ai/context/decisions.md index 6f70463..3f5bb6c 100644 --- a/ai/context/decisions.md +++ b/ai/context/decisions.md @@ -18,3 +18,4 @@ reads in order. | 10 | Uploads are raster images only (PNG, JPEG, GIF, WebP, AVIF), one list shared by the route and the uploader; the delivery route serves every object under `default-src 'none'; sandbox` | `image/*` admitted SVG, which the route served from the app's origin as script — a stored XSS | risk BL-L, IMPLEMENTATION-STATUS (BL5) | | 11 | orun is pinned only where it runs (the `orun-action` `version:` in each workflow); no kiox | `kiox.yaml` pinned a version (v2.15.0) nothing ran | IMPLEMENTATION-STATUS (BL5) | | 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 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 (BL-7) | diff --git a/ai/context/open-risks.md b/ai/context/open-risks.md index 46a51ac..244d95d 100644 --- a/ai/context/open-risks.md +++ b/ai/context/open-risks.md @@ -13,5 +13,5 @@ Accepted, and worth knowing before you change them: BL-A (the upload is buffered through the Worker), BL-C (anonymous uploads, as upstream), BL-I (the bootstrap floor plans every edge enforced), BL-J (R2 is switched on per account by its owner), BL-K (a custom domain is the owner's -step). Resolved in BL5: BL-L (SVG uploads), for products built from a later -tag than `baseline-v1`. +step). Resolved in BL5: BL-L (SVG uploads), for products built from +`baseline-v2` on. diff --git a/blueprint.yaml b/blueprint.yaml index acaaebb..34d9bdf 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 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 71e84af..7d0c75b 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 e446958..dbdfd11 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 fdd314e..fbeac43 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 | |------|---------|--------|------------| -| [`blob-starter/`](./blob-starter/) | **BL** | ✅ Shipped (`baseline-v1`); live bootstrap pending | Vercel's Blob Next.js Starter, equivalent in code and function, on Cloudflare Workers with uploads stored in R2 — and an Orun baseline that instantiates it in one landing (BL4) | +| [`blob-starter/`](./blob-starter/) | **BL** | ✅ Shipped (`baseline-v2`); live bootstrap pending | Vercel's Blob Next.js Starter, equivalent in code and function, on Cloudflare Workers with uploads stored in R2 — and an Orun baseline that instantiates it in one landing (BL4) | As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`. diff --git a/specs/epics/blob-starter/IMPLEMENTATION-STATUS.md b/specs/epics/blob-starter/IMPLEMENTATION-STATUS.md index c2141a2..50686c4 100644 --- a/specs/epics/blob-starter/IMPLEMENTATION-STATUS.md +++ b/specs/epics/blob-starter/IMPLEMENTATION-STATUS.md @@ -10,7 +10,7 @@ the code departed from `design.md` or from the upstream template. | BL2 — the R2 bucket from Terraform | ✅ Shipped (validated; apply gated on a linked workspace) | [#3](https://github.com/sourceplane/blob-starter/pull/3) | | BL3 — ready to instantiate | ✅ Shipped | [#4](https://github.com/sourceplane/blob-starter/pull/4) | | BL4 — a baseline, in one landing | ✅ Shipped (offline-proven; no live bootstrap yet, risk BL-G) | [#5](https://github.com/sourceplane/blob-starter/pull/5) (BL-5), tagged `baseline-v1` | -| BL5 — the cirrus standard, SVG uploads closed | ✅ Shipped | BL-6 — on `main` after `baseline-v1`, not yet tagged | +| BL5 — the cirrus standard, SVG uploads closed | ✅ Shipped | [#6](https://github.com/sourceplane/blob-starter/pull/6) (BL-6), [#7](https://github.com/sourceplane/blob-starter/pull/7) (BL-7), tagged `baseline-v2` | ## Departures from the upstream template @@ -110,6 +110,40 @@ 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 | BL4 "to be tagged" | BL4 shipped and tagged `baseline-v1`; the page-copy note names the Vercel logo it kept | the tag existed; the documents had not caught up | +### The subdomain from the Cloudflare connection (BL-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` 81 files) and +`testing/leak.test.sh` (81 files derived; 74 shipped sources name no factory +path); at v2.78.4, `testing/placement.test.sh` (81 tracked files; +cloudflare-r2 → web; `--resume` changes nothing); `orun task check BL-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 (BL5) - `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer,wire}.test.sh` diff --git a/specs/epics/blob-starter/README.md b/specs/epics/blob-starter/README.md index aaec571..079ae9f 100644 --- a/specs/epics/blob-starter/README.md +++ b/specs/epics/blob-starter/README.md @@ -8,7 +8,7 @@ The port keeps the template's page, uploader, progress bar, toasts and styles. I | Field | Value | |-------|-------| -| Status | ✅ BL0–BL4 shipped (#1–#5), tagged `baseline-v1`; BL5 (the cirrus standard, SVG uploads closed — BL-6) on `main`, not yet tagged. R2 apply and live deploy proven only by a live bootstrap (risk BL-G) | +| Status | ✅ BL0–BL5 shipped (#1–#7; BL4 tagged `baseline-v1`, BL5 — the cirrus standard, SVG uploads closed, BL-6 and BL-7 — tagged `baseline-v2`). R2 apply and live deploy proven only by a live bootstrap (risk BL-G) | | Cluster | **BL** (BL0–BL5) | | Owner(s) | `apps/web` (the uploader, the routes, `lib/blob`) · `tests/web` · `infra/terraform/cloudflare-r2` | | Builds on | `cirrus-baseline` conventions: the R2 root and the `@@wiring(...)@@` deploy-time render; the `kv-redis-starter` port's binding shape | @@ -16,7 +16,7 @@ The port keeps the template's page, uploader, progress bar, toasts and styles. I | Changes | The store (Vercel Blob → R2), the upload path (client token → upload route), the Workers build, tests, the R2 root, the deploy contract; page copy says R2; since BL5, raster uploads only and a sandboxed delivery route (risk BL-L) | | Decisions locked | (1) The upload goes through the Worker (one route, bounded at 50MB), not a presigned R2 URL: it keeps the template's server-side checks where they were. (2) Delivery stays a private route (`/api/blob?pathname=`), as upstream. (3) `wrangler.jsonc` rendered per environment — and, since BL4, committed as the fixture render, because the deploy lane checks it exists before the build (risk BL-E). (4) BL4: one landing — the plan, not a landing boundary, orders the bucket before the Worker; the bucket's apply has a token of its own (`r2-data`), because the deploy token cannot touch R2. | | Gate | BL1 is the first user-visible rung. BL2 applies only with a linked workspace; verified by `terraform validate`. | -| Shipped as | `baseline-v1` ([#5](https://github.com/sourceplane/blob-starter/pull/5)), then BL5 on `main`; proven offline (Baseline CI: an upload round-tripped through the built Worker under `wrangler dev`), deploy gated until a workspace is linked | +| Shipped as | `baseline-v1` ([#5](https://github.com/sourceplane/blob-starter/pull/5)), `baseline-v2` ([#6](https://github.com/sourceplane/blob-starter/pull/6), [#7](https://github.com/sourceplane/blob-starter/pull/7)); proven offline (Baseline CI: an upload round-tripped through the built Worker under `wrangler dev`), deploy gated until a workspace is linked | ## Read order @@ -34,4 +34,4 @@ The port keeps the template's page, uploader, progress bar, toasts and styles. I | BL2 — the R2 bucket from Terraform | `infra/terraform/cloudflare-r2` | the root validates; the wiring key matches the template | | BL3 — ready to instantiate | README, as-built status | a reader can run, test, preview and deploy it | | BL4 — a baseline, in one landing | card, build document, rename, bootstrap tooling, tests | a new product goes from nothing to live in one landing, the R2 bucket applied before the Worker; Baseline CI green | -| BL5 — the cirrus standard, SVG uploads closed | raster-only uploads and a sandboxed delivery route; no kiox, generated component docs, the context pack, status that agrees with the tags | an SVG upload is refused and a served object cannot run script; Baseline CI green with the docs check | +| BL5 — the cirrus standard, SVG uploads closed | raster-only uploads and a sandboxed delivery route; no kiox, generated component docs, the context pack, status that agrees with the tags; the console card reads `subdomain` from the Cloudflare connection | an SVG upload is refused and a served object cannot run script; Baseline CI green with the docs check | diff --git a/specs/epics/blob-starter/epic.yaml b/specs/epics/blob-starter/epic.yaml index 85886ea..cb6f860 100644 --- a/specs/epics/blob-starter/epic.yaml +++ b/specs/epics/blob-starter/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: [BL-6] + - "the console card reads subdomain from the Cloudflare connection (from: connection.cloudflare.workersSubdomain), as cirrus-baseline since baseline-v23" + tasks: [BL-6, BL-7] diff --git a/specs/epics/blob-starter/implementation-plan.md b/specs/epics/blob-starter/implementation-plan.md index 0d0964b..124a433 100644 --- a/specs/epics/blob-starter/implementation-plan.md +++ b/specs/epics/blob-starter/implementation-plan.md @@ -60,7 +60,7 @@ enforced `dependsOn: cloudflare-r2` on main, `packages/`. - the status file records what is proven offline and what only a live bootstrap can prove -## BL5 — the cirrus standard, SVG uploads closed (BL-6) ✅ +## BL5 — the cirrus standard, SVG uploads closed (BL-6, BL-7) ✅ One security fix to the app, and the baseline brought to cirrus-baseline's standard around it. @@ -82,6 +82,12 @@ standard around it. `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.** BL4 is shipped and tagged. +- **The subdomain from the Cloudflare connection (BL-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** - `tests/web` refuses an SVG upload (400), stores each raster type, and finds diff --git a/tasks/BL-7.TaskContract.yaml b/tasks/BL-7.TaskContract.yaml new file mode 100644 index 0000000..ea8da0f --- /dev/null +++ b/tasks/BL-7.TaskContract.yaml @@ -0,0 +1,25 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: BL-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 + - ai/context/open-risks.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 [])}