Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions BOOTSTRAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ orun new --blueprint repo-blueprint.yaml \
--set subdomain=<workers-dev-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
Expand Down
10 changes: 4 additions & 6 deletions ai/context/current.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ db-migrate → web per environment), then records what went live (`02-docs`).

| | |
|---|---|
| Latest tag | `baseline-v2` (TU5, one landing); `baseline-v1` is TU4's four-phase build |
| On `main` since | TU6 — the cirrus standard (no kiox, generated component docs, this context pack) |
| Latest tag | `baseline-v3` (TU6 — the cirrus standard: no kiox, generated component docs, this context pack, and the console card reading `subdomain` from the Cloudflare connection); `baseline-v2` is TU5 (one landing), `baseline-v1` TU4's four-phase build |
| Proven live | No. Everything short of the platform is proven offline in Baseline CI, the migration lane against a stand-in D1 API and a todo round-tripped through the built Worker included; a live bootstrap from a tag is still to come (risk TU-E) |

## Where to read
Expand All @@ -34,7 +33,6 @@ db-migrate → web per environment), then records what went live (`02-docs`).

## Next

1. Bootstrap one product from a tag against a workspace whose Cloudflare
token can mint D1 Edit as well as Workers Scripts (TU-F), and record its
timings (closes TU-E).
2. Cut the next `baseline-vN` with `tag.yml` so the registry can pin TU6.
1. Bootstrap one product from `baseline-v3` against a workspace whose
Cloudflare token can mint D1 Edit as well as Workers Scripts (TU-F), and
record its timings (closes TU-E).
1 change: 1 addition & 0 deletions ai/context/decisions.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ reads in order.
| 10 | stack-tectonic 0.19.0, not 0.20.0 | 0.20.0 links the install out of the job's tree, which Next 16's Turbopack refuses | `intent.yaml` (the pin's comment) |
| 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 (TU6) |
| 12 | Component docs are generated from the manifests and checked in CI | A hand-written copy of the dependency graph, bindings and migrations 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 (TU-8) |
12 changes: 12 additions & 0 deletions blueprint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,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. ─────────────────────────
Expand Down
6 changes: 4 additions & 2 deletions docs/phases/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,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.
Expand Down
7 changes: 6 additions & 1 deletion repo-blueprint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion specs/epics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ folder is the adoption; the merge creates the epic in the workspace.

| Epic | Cluster | Status | What it is |
|------|---------|--------|------------|
| [`turso-starter/`](./turso-starter/) | **TU** | ✅ Shipped (`baseline-v2`); live bootstrap pending | Vercel's Next.js + Turso starter, equivalent in code and function, on Cloudflare Workers with the todos in D1 — and an Orun baseline that instantiates it in one landing, its database applied and migrated before the Worker deploys (TU4, rebuilt in TU5) |
| [`turso-starter/`](./turso-starter/) | **TU** | ✅ Shipped (`baseline-v3`); live bootstrap pending | Vercel's Next.js + Turso starter, equivalent in code and function, on Cloudflare Workers with the todos in D1 — and an Orun baseline that instantiates it in one landing, its database applied and migrated before the Worker deploys (TU4, rebuilt in TU5) |

As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`.
37 changes: 36 additions & 1 deletion specs/epics/turso-starter/IMPLEMENTATION-STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ the code departed from `design.md` or from the upstream template.
| TU3 — ready to instantiate | ✅ Shipped | [#4](https://github.com/sourceplane/turso-starter/pull/4) |
| TU4 — a baseline | ✅ Shipped (four phases; rebuilt by TU5) | [#5](https://github.com/sourceplane/turso-starter/pull/5) (TU-5), tagged `baseline-v1` |
| TU5 — a baseline, in one landing | ✅ Shipped (offline-proven; no live bootstrap yet, risk TU-E) | [#6](https://github.com/sourceplane/turso-starter/pull/6) (TU-6), tagged `baseline-v2` |
| TU6 — the cirrus standard | ✅ Shipped | TU-7 — on `main` after `baseline-v2`, not yet tagged |
| TU6 — the cirrus standard | ✅ Shipped | [#7](https://github.com/sourceplane/turso-starter/pull/7) (TU-7), [#8](https://github.com/sourceplane/turso-starter/pull/8) (TU-8), tagged `baseline-v3` |

## Departures from the upstream template

Expand Down Expand Up @@ -155,6 +155,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 | TU5 "in review … to be tagged `baseline-v1`"; an unlabeled Verified section ("the table created on first render", 3 tests) | TU4 `baseline-v1`, TU5 `baseline-v2`; the section is labeled TU1–TU3 | the tags existed; the documents had not caught up |

### The subdomain from the Cloudflare connection (TU-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 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.<provider>.<fact>` 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, package, Terraform, migration,
test or tooling file.

Verified: `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer,wire}.test.sh`
green; `gen-component-docs.py --check` green (6 components); at v2.58.11,
`orun new --status` on `repo-blueprint.yaml` (`01-product` 106 files) and
`testing/leak.test.sh` (106 files derived; 100 shipped sources name no
factory path); at v2.78.4, `testing/placement.test.sh` (106 tracked files;
cloudflare-d1 → db-migrate → web; `--resume` changes nothing); `orun task
check TU-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 (TU6)

- `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer,wire}.test.sh`
Expand Down
6 changes: 3 additions & 3 deletions specs/epics/turso-starter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ The port keeps the page, the form, the server actions and the todo list. It adds

| Field | Value |
|-------|-------|
| Status | ✅ TU0–TU5 shipped (#1–#6): TU4 tagged `baseline-v1`, TU5 tagged `baseline-v2`; TU6 (the cirrus standard, TU-7) on `main`, not yet tagged. D1 apply, migrations and live deploy proven only by a live bootstrap (risk TU-E) |
| Status | ✅ TU0–TU6 shipped (#1–#8): TU4 tagged `baseline-v1`, TU5 tagged `baseline-v2`, TU6 (the cirrus standard, TU-7 and TU-8) tagged `baseline-v3`. D1 apply, migrations and live deploy proven only by a live bootstrap (risk TU-E) |
| Cluster | **TU** (TU0–TU6) |
| Owner(s) | `apps/web` (the page, the actions, `lib/turso.ts`) · `tests/web` · `infra/terraform/cloudflare-d1` · `packages/db` + `infra/db-migrate` (the schema, TU5) · `tests/db` |
| Builds on | `cirrus-baseline`: its `cloudflare-d1` root and the `@@wiring(...)@@` deploy-time render; the `kv-redis-starter` port's binding shape |
| Upstream | [vercel/next.js `examples/with-turso`](https://github.com/vercel/next.js/tree/canary/examples/with-turso) |
| Changes | The client (libSQL → D1 binding, same `execute` shape), the Workers build, tests, the D1 root, the deploy contract; page copy says D1 |
| Decisions locked | (1) ~~The table is created on first use, as upstream does~~ — since TU5 the table is a migration (`packages/db`), applied by Cirrus's `db-migrate` shape between the D1 apply and the Worker's deploy (risk TU-A). (2) `wrangler.jsonc` rendered per environment — and, since TU5, committed as the fixture render, because the deploy lane checks it exists before the build (risk TU-G). (3) No local `dev.db` file: `wrangler dev` and `next dev` get a local D1 (`db:migrate:local` creates the table). (4) TU5: one landing — the plan, not a landing boundary, orders the database, its schema and the Worker. |
| Gate | TU1 is the first user-visible rung. TU2 applies only with a linked workspace; verified by `terraform validate`. |
| Shipped as | `baseline-v2` ([#6](https://github.com/sourceplane/turso-starter/pull/6), one landing), then TU6 on `main`; `baseline-v1` is TU4's four-phase build ([#5](https://github.com/sourceplane/turso-starter/pull/5)). Proven offline (Baseline CI: a todo round-tripped through a local D1 under `wrangler dev`), deploy gated until a workspace is linked |
| Shipped as | `baseline-v3` ([#7](https://github.com/sourceplane/turso-starter/pull/7), [#8](https://github.com/sourceplane/turso-starter/pull/8), TU6), `baseline-v2` ([#6](https://github.com/sourceplane/turso-starter/pull/6), one landing); `baseline-v1` is TU4's four-phase build ([#5](https://github.com/sourceplane/turso-starter/pull/5)). Proven offline (Baseline CI: a todo round-tripped through a local D1 under `wrangler dev`), deploy gated until a workspace is linked |

## Read order

Expand All @@ -35,4 +35,4 @@ The port keeps the page, the form, the server actions and the todo list. It adds
| TU3 — ready to instantiate | README, as-built status | a reader can run, test, preview and deploy it |
| TU4 — a baseline | card, build document (four phases, the database its own), rename, bootstrap tooling, tests | a new todo list goes from nothing to live, its D1 database included; Baseline CI green |
| TU5 — a baseline, in one landing | the build document rebuilt as `01-product` + `02-docs` (cirrus-baseline v22), the schema as migrations (`packages/db`, `infra/db-migrate`), the deploy-lane fixes | a new todo list goes from nothing to live in one landing, D1 applied, then migrated, then the Worker deployed; Baseline CI green |
| TU6 — the cirrus standard | no kiox, generated component docs, the context pack, status that agrees with the tags | Baseline CI green with the docs check |
| TU6 — 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 |
3 changes: 2 additions & 1 deletion specs/epics/turso-starter/epic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,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: [TU-7]
- "the console card reads subdomain from the Cloudflare connection (from: connection.cloudflare.workersSubdomain), as cirrus-baseline since baseline-v23"
tasks: [TU-7, TU-8]
8 changes: 7 additions & 1 deletion specs/epics/turso-starter/implementation-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ The build document rebuilt the cirrus-baseline v22 way (`01-product`,
- the status file records what is proven offline and what only a live
bootstrap can prove

## TU6 — the cirrus standard (TU-7) ✅
## TU6 — the cirrus standard (TU-7, TU-8) ✅

Bring the baseline to cirrus-baseline's standard, with nothing about the
product itself changing.
Expand All @@ -83,6 +83,12 @@ product itself changing.
repository's own, so no module places them.
- **Status that agrees with the tags.** TU4 is `baseline-v1`, TU5
`baseline-v2`.
- **The subdomain from the Cloudflare connection (TU-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 (its specs, task and context
Expand Down
24 changes: 24 additions & 0 deletions tasks/TU-8.TaskContract.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: orun.io/v1
kind: TaskContract
metadata:
name: TU-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
15 changes: 13 additions & 2 deletions testing/manifest.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.<provider>.<fact>` 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 [])}
Expand Down
Loading