diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index 04d622b..e170e49 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 6568339..ff73e27 100644 --- a/ai/context/current.md +++ b/ai/context/current.md @@ -18,8 +18,7 @@ environment), then records what went live (`02-docs`). | | | |---|---| -| Latest tag | `baseline-v2` (SS5 — the product's own origin); `baseline-v1` is SS4 | -| On `main` since | SS6 — the cirrus standard (no kiox, generated component docs, this context pack) | +| Latest tag | `baseline-v3` (SS6 — the cirrus standard: no kiox, generated component docs, this context pack, and the console card reading `subdomain` from the Cloudflare connection); `baseline-v2` is SS5, `baseline-v1` is SS4 | | Proven live | No. Nothing has been applied against a real Supabase organization: no Terraform apply, no live deploy, no live bootstrap (risk SS-I). Everything short of the platform is proven offline in Baseline CI, against a local Supabase stand-in | ## Where to read @@ -34,8 +33,7 @@ environment), then records what went live (`02-docs`). ## Next -1. Bootstrap one product from the next tag against a workspace with a +1. Bootstrap one product from `baseline-v3` against a workspace with a Supabase connection, and record its timings — the apply, the brokered token's reach to the API-keys and Auth-config endpoints, a sign-up on the first deploy (closes SS-I). -2. Cut the next `baseline-vN` with `tag.yml` so the registry can pin SS6. diff --git a/ai/context/decisions.md b/ai/context/decisions.md index 743db5d..6fe78d0 100644 --- a/ai/context/decisions.md +++ b/ai/context/decisions.md @@ -18,3 +18,4 @@ reads in order. | 10 | stack-tectonic 0.19.0, not 0.20.0 | 0.20.0's lane-scoped install is refused by Turbopack | IMPLEMENTATION-STATUS (SS4) | | 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 (SS6) | | 12 | Component docs are generated from the manifests and checked in CI | A hand-written copy of the dependency graph, bindings and published outputs 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 (SS-8) | diff --git a/blueprint.yaml b/blueprint.yaml index 3f6f1a3..b21a1d6 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -93,6 +93,19 @@ spec: pattern: "^[a-z0-9][a-z0-9-]{0,62}$" help: The workers.dev subdomain of the Cloudflare account the app deploys into. Supabase Auth sends its links there. 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 Site URL and redirect allow-list the Supabase + # project's Auth is given, 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 02bebc0..533b294 100644 --- a/docs/phases/README.md +++ b/docs/phases/README.md @@ -58,9 +58,11 @@ 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 it is the origin the Supabase project's - Auth sends its links to. +- `subdomain` — the workers.dev subdomain of the Cloudflare account you + deploy into. It is in every URL the phases probe, and it is the origin the + Supabase project's Auth sends its links to. 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 cd2a581..0482f5a 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -56,7 +56,10 @@ inputs: description: >- The workers.dev subdomain of the Cloudflare account the app deploys into — its URLs, the Site URL and redirect allow-list the Supabase - project's Auth is given, the probes. + project's Auth is given, 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 751f081..d831b88 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 | |------|---------|--------|------------| -| [`supabase-starter/`](./supabase-starter/) | **SS** | ✅ Shipped (`baseline-v2`); live bootstrap pending | Vercel's Next.js and Supabase Starter, equivalent in code and function, on Cloudflare Workers with the Supabase project provisioned by Orun — and an Orun baseline that instantiates it in one landing (SS4, `baseline-v1`) | +| [`supabase-starter/`](./supabase-starter/) | **SS** | ✅ Shipped (`baseline-v3`); live bootstrap pending | Vercel's Next.js and Supabase Starter, equivalent in code and function, on Cloudflare Workers with the Supabase project provisioned by Orun — and an Orun baseline that instantiates it in one landing (SS4, `baseline-v1`) | As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`. diff --git a/specs/epics/supabase-starter/IMPLEMENTATION-STATUS.md b/specs/epics/supabase-starter/IMPLEMENTATION-STATUS.md index ab963fb..14ae670 100644 --- a/specs/epics/supabase-starter/IMPLEMENTATION-STATUS.md +++ b/specs/epics/supabase-starter/IMPLEMENTATION-STATUS.md @@ -11,7 +11,7 @@ the code departed from `design.md` or from the upstream template. | SS3 — ready to instantiate | ✅ Shipped | [#4](https://github.com/sourceplane/supabase-starter/pull/4) | | SS4 — a baseline | ✅ Shipped | [#5](https://github.com/sourceplane/supabase-starter/pull/5) (SS-5), tagged `baseline-v1` | | SS5 — the product's own origin | ✅ Shipped | [#6](https://github.com/sourceplane/supabase-starter/pull/6) (SS-6), tagged `baseline-v2` | -| SS6 — the cirrus standard | ✅ Shipped | SS-7 — on `main` after `baseline-v2`, not yet tagged | +| SS6 — the cirrus standard | ✅ Shipped | [#7](https://github.com/sourceplane/supabase-starter/pull/7) (SS-7), [#8](https://github.com/sourceplane/supabase-starter/pull/8) (SS-8), tagged `baseline-v3` | ## Departures from the upstream template @@ -203,6 +203,41 @@ Nothing about the product 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 | SS5 "in review"; SS4 without its ✅ in the plan, SS5 without a section | SS4 shipped and tagged `baseline-v1`, SS5 shipped and tagged `baseline-v2`, both in the plan | the tags existed; the documents had not caught up | +### The subdomain from the Cloudflare connection (SS-8) + +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 Site URL and redirect +allow-list the Supabase project's Auth is given, 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, supabase]`). +- `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}.test.sh` +green; `gen-component-docs.py --check` green (3 components); `orun new +--status` on `repo-blueprint.yaml`, `testing/leak.test.sh` (112 files +derived, 104 text files read) and `testing/placement.test.sh` (112 tracked +files; supabase → web enforced on stage and prod; `--resume` changes nothing) +at v2.58.11; `orun task check SS-8` 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 (SS6) - `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer}.test.sh` diff --git a/specs/epics/supabase-starter/README.md b/specs/epics/supabase-starter/README.md index 0360475..3ca6ada 100644 --- a/specs/epics/supabase-starter/README.md +++ b/specs/epics/supabase-starter/README.md @@ -8,7 +8,7 @@ The upstream code stays the code: the `@supabase/ssr` server/browser clients, th | Field | Value | |-------|-------| -| Status | ✅ SS0–SS5 shipped (#1–#6; SS4 tagged `baseline-v1`, SS5 tagged `baseline-v2`); SS6 (the cirrus standard, SS-7) on `main`, not yet tagged. Supabase apply and live deploy gated on a linked workspace; not yet proven by a live bootstrap (risk SS-I) | +| Status | ✅ SS0–SS6 shipped (#1–#8; SS4 tagged `baseline-v1`, SS5 tagged `baseline-v2`, SS6 — the cirrus standard, SS-7 and SS-8 — tagged `baseline-v3`). Supabase apply and live deploy gated on a linked workspace; not yet proven by a live bootstrap (risk SS-I) | | Cluster | **SS** (SS0–SS6) | | Owner(s) | `apps/web` (the app) · `tests/web` (proxy tests) · `infra/terraform/supabase` (the project) | | Builds on | `lumen` conventions — the `supabase` Terraform root and the orun-secrets wiring; `cirrus-baseline` conventions for the repository shape | @@ -16,7 +16,7 @@ The upstream code stays the code: the `@supabase/ssr` server/browser clients, th | Changes | Adds the Workers build, the monorepo wrapper, tests, the Supabase root and the deploy contract. In the template's code (SS4): the product-name seam, `/api/health`, the build reading the project from the wrangler config, sign-up routing on the session it gets, the auth forms' error wording, and the tutorial's table under row-level security keyed on `auth.uid()` | | Decisions locked | (1) OpenNext on Workers + Static Assets. (2) The publishable key is a wrangler var, not a secret: RLS protects the data. (3) `wrangler.jsonc` is rendered from the template: committed as the fixture render (the composition checks it exists before the build), re-rendered per environment from the wiring document by the deploy lanes — and `next build` inlines the project from it (SS4; it was never committed before). (4) No Hyperdrive: the template never opens a Postgres connection, it speaks PostgREST over HTTPS. (5) Each project's Auth is pointed at its Worker by Terraform, email confirmation off until the project has SMTP (SS4). (6) The project first, then the app, enforced on main, advisory on pull requests (SS4). | | Gate | SS1 is the first user-visible rung. SS2 needs a workspace with a Supabase connection to apply; it is verified by `plan`. | -| Shipped as | `baseline-v1` ([#5](https://github.com/sourceplane/supabase-starter/pull/5)), `baseline-v2` ([#6](https://github.com/sourceplane/supabase-starter/pull/6)), then SS6 on `main`; proven offline (Baseline CI, against a local Supabase stand-in), apply and deploy gated until a workspace is linked | +| Shipped as | `baseline-v1` ([#5](https://github.com/sourceplane/supabase-starter/pull/5)), `baseline-v2` ([#6](https://github.com/sourceplane/supabase-starter/pull/6)), `baseline-v3` ([#7](https://github.com/sourceplane/supabase-starter/pull/7), [#8](https://github.com/sourceplane/supabase-starter/pull/8)); proven offline (Baseline CI, against a local Supabase stand-in), apply and deploy gated until a workspace is linked | ## Read order @@ -35,4 +35,4 @@ The upstream code stays the code: the `@supabase/ssr` server/browser clients, th | SS3 — ready to instantiate | README, as-built status | a reader can run, test, preview and deploy it | | SS4 — a baseline | card, build document, rename, bootstrap tooling, the product's README and context pack, tests | a new product goes from nothing to live on stage and prod in one landing, signing users up on its first deploy; Baseline CI green | | SS5 — the product's own origin | `metadataBase` from the build's `NEXT_PUBLIC_SITE_URL`, SITE_URL read by the supabase root too, the Deploy to Vercel button removed | the served pages' image links name the product's origin; no Vercel call to action | -| SS6 — the cirrus standard | no kiox, generated component docs, the context pack, status that agrees with the tags | Baseline CI green with the docs check | +| SS6 — 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/supabase-starter/epic.yaml b/specs/epics/supabase-starter/epic.yaml index 0a42641..9a2d2f5 100644 --- a/specs/epics/supabase-starter/epic.yaml +++ b/specs/epics/supabase-starter/epic.yaml @@ -53,4 +53,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: [SS-7] + - "the console card reads subdomain from the Cloudflare connection (from: connection.cloudflare.workersSubdomain), as cirrus-baseline since baseline-v23" + tasks: [SS-7, SS-8] diff --git a/specs/epics/supabase-starter/implementation-plan.md b/specs/epics/supabase-starter/implementation-plan.md index 50e9709..3febc28 100644 --- a/specs/epics/supabase-starter/implementation-plan.md +++ b/specs/epics/supabase-starter/implementation-plan.md @@ -110,6 +110,12 @@ product itself changing. repository's own, so no module places them. - **Status that agrees with the tags.** SS4 (`baseline-v1`) and SS5 (`baseline-v2`) are shipped and tagged. +- **The subdomain from the Cloudflare connection (SS-8).** 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/SS-8.TaskContract.yaml b/tasks/SS-8.TaskContract.yaml new file mode 100644 index 0000000..9a75558 --- /dev/null +++ b/tasks/SS-8.TaskContract.yaml @@ -0,0 +1,24 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: SS-8 + 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 [])}