diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index 241eeb3..93ce216 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -55,6 +55,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 an API.** 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 82e7da8..e979dbe 100644 --- a/ai/context/current.md +++ b/ai/context/current.md @@ -16,8 +16,8 @@ own repository and takes it to live on stage and prod in one landing | | | |---|---| -| Latest tag | `baseline-v1` (HA3) | -| On `main` since | HA4 — the cirrus standard (no kiox, generated component docs, this context pack) | +| Latest tag | `baseline-v2` (HA4 — 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` (HA3 — the baseline) | | Proven live | No. Everything short of the platform is proven offline in Baseline CI; a live bootstrap from a tag is still to come (risk HA-F) | ## Where to read @@ -32,6 +32,5 @@ own repository and takes it to live on stage and prod in one landing ## Next -1. Bootstrap one API from the next tag against a workspace, and record its +1. Bootstrap one API from `baseline-v2` against a workspace, and record its timings (closes HA-F). -2. Cut the next `baseline-vN` with `tag.yml` so the registry can pin HA4. diff --git a/ai/context/decisions.md b/ai/context/decisions.md index ca32294..94e64a0 100644 --- a/ai/context/decisions.md +++ b/ai/context/decisions.md @@ -16,3 +16,4 @@ reads in order. | 8 | stack-tectonic 0.19.0, not 0.20.0 | The family's one pin: 0.20.0's linked install breaks the Next.js baselines | risk HA-J | | 9 | 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 (HA4) | | 10 | 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` | +| 11 | `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 (HA-6) | diff --git a/blueprint.yaml b/blueprint.yaml index bde3331..01e6b18 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -88,6 +88,18 @@ spec: pattern: "^[a-z0-9][a-z0-9-]{0,62}$" help: The workers.dev subdomain of the Cloudflare account the API 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 check, 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 9b4fbe2..ab7e9b4 100644 --- a/docs/phases/README.md +++ b/docs/phases/README.md @@ -64,8 +64,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 5e860ef..cc8a0d4 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -50,7 +50,12 @@ inputs: subdomain: type: string default: "your-workers-subdomain" - description: The workers.dev subdomain of the Cloudflare account the API deploys into — its URLs, the deploy's smoke, the probes. + description: >- + The workers.dev subdomain of the Cloudflare account the API 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 63bb420..2d29edf 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 | |------|---------|--------|------------| -| [`hono-api/`](./hono-api/) | **HA** | ✅ Shipped (`baseline-v1`); live bootstrap pending | Vercel's Hono boilerplate, equivalent in code and function, as a Cloudflare Worker — and an Orun baseline that instantiates it in one landing (HA3) | +| [`hono-api/`](./hono-api/) | **HA** | ✅ Shipped (`baseline-v2`); live bootstrap pending | Vercel's Hono boilerplate, equivalent in code and function, as a Cloudflare Worker — and an Orun baseline that instantiates it in one landing (HA3) | As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`. diff --git a/specs/epics/hono-api/IMPLEMENTATION-STATUS.md b/specs/epics/hono-api/IMPLEMENTATION-STATUS.md index 4743c35..762fcdc 100644 --- a/specs/epics/hono-api/IMPLEMENTATION-STATUS.md +++ b/specs/epics/hono-api/IMPLEMENTATION-STATUS.md @@ -9,7 +9,7 @@ the code departed from `design.md` or from the upstream template. | HA1 — the API on Workers | ✅ Shipped | [#2](https://github.com/sourceplane/hono-api/pull/2) | | HA2 — ready to instantiate | ✅ Shipped | [#3](https://github.com/sourceplane/hono-api/pull/3) | | HA3 — a baseline | ✅ Shipped | [#4](https://github.com/sourceplane/hono-api/pull/4) (HA-4), tagged `baseline-v1` | -| HA4 — the cirrus standard | ✅ Shipped | HA-5 — on `main` after `baseline-v1`, not yet tagged | +| HA4 — the cirrus standard | ✅ Shipped | [#5](https://github.com/sourceplane/hono-api/pull/5) (HA-5), [#6](https://github.com/sourceplane/hono-api/pull/6) (HA-6), tagged `baseline-v2` | ## Departures from the upstream template @@ -68,6 +68,41 @@ Nothing about the API 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 | HA3 "in review" | HA3 shipped and tagged `baseline-v1` | the tag existed; the documents had not caught up | +### The subdomain from the Cloudflare connection (HA-6) + +`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, 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 token 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 an API carries changes: the rename, the smoke and the probes read + the value exactly as before. + +Verified: + +- `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer}.test.sh` + green; `gen-component-docs.py --check` green (2 components). +- Mutation: with `cloudflare` dropped from `spec.requires.integrations`, + `manifest.test.sh` fails with exactly one finding, naming + `inputs[subdomain]`; restored, it passes. +- At v2.58.11 (the blueprint job's pin): `orun new --status` reads the + document (`01-product` pending, 44 files); `testing/leak.test.sh` 44 files + derived, every one read; `testing/placement.test.sh` 44 files placed, both + landings, the API's own plan deploys `api` to stage and prod. +- `orun task check HA-6` complete. + ## Verified (HA4) - `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer}.test.sh` diff --git a/specs/epics/hono-api/README.md b/specs/epics/hono-api/README.md index 6a19a37..4f0ceb9 100644 --- a/specs/epics/hono-api/README.md +++ b/specs/epics/hono-api/README.md @@ -8,7 +8,7 @@ The upstream code stays the code. The port adds the Worker's config (`wrangler.j | Field | Value | |-------|-------| -| Status | ✅ HA0–HA3 shipped (#1–#4), tagged `baseline-v1`; HA4 (the cirrus standard, HA-5) on `main`, not yet tagged. Not yet proven by a live bootstrap (risk HA-F) | +| Status | ✅ HA0–HA3 shipped (#1–#4), tagged `baseline-v1`; HA4 (the cirrus standard, HA-5 #5 and HA-6 #6) tagged `baseline-v2`. Not yet proven by a live bootstrap (risk HA-F) | | Cluster | **HA** (HA0–HA4) | | Owner(s) | `apps/api` (the Worker) · `tests/api` (the in-process request tests) | | Builds on | `cirrus-baseline` conventions (intent, components, `checks.yml` gate, gated `ci.yml`) and the `cloudflare-worker-turbo` composition its workers deploy with — no bounded context of the fleet is needed | @@ -16,7 +16,7 @@ The upstream code stays the code. The port adds the Worker's config (`wrangler.j | Changes | Adds the Worker config, the monorepo wrapper, tests and the deploy contract; the template's app code is untouched but for the welcome line's link | | Decisions locked | (1) A plain Worker (`cloudflare-worker-turbo`), not Pages Functions and not an adapter: Hono's default export is already a Workers module handler. (2) `wrangler.jsonc` is committed, not rendered: the Worker binds nothing, so there is nothing to wire. (3) Per-environment deploys through wrangler `env` sections (`--env stage` / `--env prod`), naming `hono-api-api-{stage,prod}`. (4) No infra root. | | Gate | HA1 is the first user-visible rung (the API serves from a Worker). | -| Shipped as | `baseline-v1` ([#4](https://github.com/sourceplane/hono-api/pull/4)), then HA4 on `main`; proven offline (Baseline CI), deploy gated until a workspace is linked | +| Shipped as | `baseline-v1` ([#4](https://github.com/sourceplane/hono-api/pull/4)), then `baseline-v2` (HA4: [#5](https://github.com/sourceplane/hono-api/pull/5), [#6](https://github.com/sourceplane/hono-api/pull/6)); proven offline (Baseline CI), deploy gated until a workspace is linked | ## Read order @@ -33,4 +33,4 @@ The upstream code stays the code. The port adds the Worker's config (`wrangler.j | HA1 — the API on Workers | `apps/api` bundled by wrangler, `tests/api`, green checks | `wrangler dev` answers `/` with the welcome text; Checks green | | HA2 — ready to instantiate | README, as-built status | a reader can run, test, preview and deploy it | | HA3 — a baseline | card, build document, rename, bootstrap tooling, tests | a new API goes from nothing to live in one landing; Baseline CI green | -| HA4 — the cirrus standard | no kiox, generated component docs, the context pack, status that agrees with the tags | Baseline CI green with the docs check | +| HA4 — 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/hono-api/epic.yaml b/specs/epics/hono-api/epic.yaml index 2648dbc..d40067a 100644 --- a/specs/epics/hono-api/epic.yaml +++ b/specs/epics/hono-api/epic.yaml @@ -38,4 +38,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 an API" - "every milestone's status row agrees with the tags" - tasks: [HA-5] + - "the console card reads subdomain from the Cloudflare connection (from: connection.cloudflare.workersSubdomain), as cirrus-baseline since baseline-v23" + tasks: [HA-5, HA-6] diff --git a/specs/epics/hono-api/implementation-plan.md b/specs/epics/hono-api/implementation-plan.md index c974eba..4759e43 100644 --- a/specs/epics/hono-api/implementation-plan.md +++ b/specs/epics/hono-api/implementation-plan.md @@ -65,6 +65,11 @@ itself changing. `open-risks.md` beside the two pages an API ships with — this repository's own, so no module places them. - **Status that agrees with the tags.** HA3 is shipped and tagged. +- **The subdomain from the Cloudflare connection (HA-6).** 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 only this milestone's own record, and the leak gate and the offline diff --git a/tasks/HA-6.TaskContract.yaml b/tasks/HA-6.TaskContract.yaml new file mode 100644 index 0000000..c031d8e --- /dev/null +++ b/tasks/HA-6.TaskContract.yaml @@ -0,0 +1,25 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: HA-6 + 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/hono-api/** + - tasks/HA-6.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 [])}