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
2 changes: 1 addition & 1 deletion .baseline/product/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Merges to `main` deploy it to `stage` and `prod`.

<!-- 08-docs:begin -->
Not recorded yet. The bootstrap's last phase probes every live URL and
writes the addresses, the workspace and the secrets inventory into
writes the addresses, the workspace and the secrets the product uses into
[ai/context/deployment.md](ai/context/deployment.md); how the product
deploys and how to operate it is in
[ai/context/operations.md](ai/context/operations.md).
Expand Down
2 changes: 1 addition & 1 deletion .baseline/product/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

> Not rendered yet. The bootstrap's `08-docs` phase probes every live URL and
> regenerates this file from what answered — the workspace, the URLs and
> their status, and the secrets inventory by name. Until then, nothing here
> their status, and the secrets the product uses, by name. Until then, nothing here
> claims the product is live. The operating contract is
> [operations.md](operations.md).
23 changes: 16 additions & 7 deletions .github/workflows/baseline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,16 @@ jobs:
with:
# The bootstrap floor (BOOTSTRAP.md), not the product lane pin: the
# blueprint's `orun.run/watch@v1` `sha:` exists from v2.58.5, and an
# older CLI refuses the whole document at parse; v2.58.6 is where a
# landing's check wait covers the whole PR run; v2.58.7 knows
# orun.doctor/check@v1's `githubOwner`; v2.58.8 reads
# orun.secrets/exists@v1's `environments`; v2.58.10 defers a probe
# older CLI refuses the whole document at parse; v2.58.7 knows
# orun.doctor/check@v1's `githubOwner`; v2.58.10 defers a probe
# about a project the bootstrap has not created yet; v2.58.11 fills
# an input declared `from: workspace`.
version: v2.58.11
# an input declared `from: workspace`; v2.87.0 mints the deploy
# credentials in one `secrets` reconcile (an older CLI refuses
# `has no parameter "secrets"`); and v2.88.0 runs the task set-up in
# the background (`background: true`) and checks a landing in the
# box before it merges (`checks: local`). The placement tier below
# runs this same CLI.
version: v2.88.0
- name: repo-blueprint.yaml, read by the pinned CLI
run: |
set -euo pipefail
Expand All @@ -129,9 +132,15 @@ jobs:
# the step nothing here had ever taken, and where orun BE-O12's two
# defects lived. It needs node for rebrand alongside orun, and about ten
# seconds. Still offline: placement writes files, and since BE-O12 a run
# with hooks off does not probe.
# with hooks off does not probe. And pnpm, at the product's own pin
# (package.json `packageManager`): with no lockfile hook, the branded
# tree is checked against the lockfile it ships, frozen, as every lane
# installs it.
- uses: actions/setup-node@v6
with:
node-version: "20"
- uses: pnpm/action-setup@v4
with:
version: 10.12.1
- name: Tier 1 — the tree is placed, branded, and made to answer
run: bash testing/placement.test.sh
55 changes: 31 additions & 24 deletions BOOTSTRAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,42 @@ layer is now a typed action inside the binary, which is why the version floor
matters and why a phase can be run alone, months later, from a fresh
container.

Target wall-clock: **about half an hour** (it was under an hour; see
[docs/phases/TIMINGS.md](docs/phases/TIMINGS.md) for what a run measured). Five landings instead of eight, each
pull request checked by `plan` alone because its merge runs the lanes on
main anyway, the worker fleet deployed in two parallel waves instead of in
binding order, and stage and prod deployed side by side until `08-docs`
restores the promotion gate — [docs/phases/README.md](docs/phases/README.md)
Target wall-clock: **about thirteen minutes** — an estimate summed from the
phases (12 + 1) until a one-landing build measures it; the last measurement
was five landings ([docs/phases/TIMINGS.md](docs/phases/TIMINGS.md)). The
shape: the task set-up in the background while ONE landing is placed,
branded and checked in the box (`orun validate` and `orun plan`, no runner
waited for), then one convergence that deploys the data plane, the
migrations, the fleet with its bindings, the edge and the console in
dependency order, stage and prod side by side, then a short docs landing
that restores the promotion gate — [docs/phases/README.md](docs/phases/README.md)
has the account. The Cloudflare-only data plane creates in seconds, which is
where this baseline is cheaper than a Postgres-backed one.

## 0. What you need

- GitHub org access (repo creation) and a machine with `git`, `gh`, `node`
(≥20), `pnpm`, `python3`, and the `orun` CLI **≥ v2.58.11**. That is the
(≥20), `pnpm`, `python3`, and the `orun` CLI **≥ v2.88.0**. That is the
floor for RUNNING the bootstrap; the product's own `ci.yml` lane pin is a
separate, lower floor (≥ v2.56.2). v2.56.0 carried the phase overlay (before
it there is no `--phase` and `hooks.{pre,post,await}` does not parse);
v2.56.2 let a branded phase satisfy the next one's requirement; v2.58.4
resolves a milestone name and a rendered bool; v2.58.5 is the first that
can bootstrap at all — it writes each phase's files on that phase's turn,
its landing commits, seeds an empty repository and deletes the branch it
merged, and a convergence watches the commit it landed (`sha:`); and v2.58.6
is the first whose landing waits for a PR's whole CI run — every phase here
is a pull request that must go green before it merges; and v2.58.7 checks
that the workspace's GitHub connection is to the account that owns the
repository (`githubOwner`), without which no PR is ever seen by the platform;
and v2.58.8 looks for the wiring secrets on the project's environments,
where the infrastructure publishes them (`secrets/exists` `environments`);
v2.58.10 treats a project the bootstrap has not created yet as "not yet"
rather than a failed preflight, without which every fresh build stops before
its first phase; and v2.58.11 fills `orunWorkspace` from the workspace the
build runs in (`from: workspace`), which is the only way a console build has
of saying it.
merged, and a convergence watches the commit it landed (`sha:`); and v2.58.7
checks that the workspace's GitHub connection is to the account that owns
the repository (`githubOwner`), without which no PR is ever seen by the
platform; v2.58.10 treats a project the bootstrap has not created yet as
"not yet" rather than a failed preflight, without which every fresh build
stops before its first phase; v2.58.11 fills `orunWorkspace` from the
workspace the build runs in (`from: workspace`), which is the only way a
console build has of saying it; v2.87.0 mints the three deploy credentials
in one `secrets` reconcile, side by side; and v2.88.0 runs the task set-up
in the background (`background: true`), so the placement, the rebrand, the
repository and the secrets run beside it, and checks each landing in the
box before it merges (`checks: local`: `orun validate`, then `orun plan` as
the pull request and as the merge), so no landing waits for a runner.
- A Cloudflare account (Workers paid plan for the fleet) and its **Account
API token** (the console's Connect recipe lists the exact permission
groups). It is the ONLY provider credential this baseline needs — and it
Expand Down Expand Up @@ -158,8 +162,9 @@ minutes, so the consent can be clicked while it waits:
token's permission groups omit D1 Write, the `d1-edit` mint is refused
(`parent_grant_insufficient`) and `01-product` stops with that
message — re-issue the token with D1 Write, re-connect, and re-run the
phase. Its three secret hooks are a *reconcile*: keys that exist are kept,
keys that are missing are re-minted against the ACTIVE connection.
phase. Its one `secrets` hook is a *reconcile* of all three keys: keys that
exist are kept, keys that are missing are re-minted against the ACTIVE
connection, side by side.

## 2. Headless / container mode (Daytona, CI, any sandbox)

Expand Down Expand Up @@ -199,7 +204,7 @@ every phase's state and is the flag for that.

| requirement | detail |
|---|---|
| image deps | `git`, `gh`, `node` (≥20), `pnpm`, `python3`, `curl`, `orun` ≥ v2.58.11 to run the bootstrap. The product's `ci.yml` lane pin (≥ v2.56.2) is its own floor |
| image deps | `git`, `gh`, `node` (≥20), `pnpm`, `python3`, `curl`, `orun` ≥ v2.88.0 to run the bootstrap. The product's `ci.yml` lane pin (≥ v2.56.2) is its own floor |
| `ORUN_TOKEN` | orun access token; the typed actions authenticate with it (no login flow) |
| `GITHUB_TOKEN` | fine-grained PAT: **read** on `sourceplane/cirrus` (the clone); on the PRODUCT repo: **contents write** (pushes), **pull-requests write** (landings), **actions read+write** (`orun.run/watch@v1` watches runs and auto-resumes via `gh run rerun`), **checks read**; **repo create** on the org if `01-product` creates the repo (or pre-create it — supported) |
| pinning | the clone's `--branch <tag>` pins EVERYTHING: the blueprint, its modules, and the hooks' scripts all come from that one commit. Use a tag for reproducible bootstraps; `main` for latest |
Expand Down Expand Up @@ -267,11 +272,13 @@ that logic. Then move the registry row in orun-cloud's
| Terraform: resource already exists (10014 etc.) with empty platform state | `adopt.tf` handles this by importing at plan time — present in the d1 and kv roots. Roots without adoption must be state-migrated or the resource deleted. |
| Convergence run fails, lanes look transient | `orun.run/watch@v1` already resumes it ×3 (`gh run rerun --failed` = true resume: exec-id + `--retry`). Re-running the phase re-enters the watch on the same run. |
| Convergence failed AFTER the phase's PR merged; re-running the phase lands nothing and redeploys nothing | Expected on its own: the merge put every file in place, phase state is derived from the tree, and `plan --changed` deploys only what changed. Re-run the phase (`--phase <name>`, `--redo <name>` under `--resume`, or the console's Retry): its `retouch` hook writes `# orun: redeploy <phase> <stamp>` as the last line of each affected `component.yaml`, so the landing has a diff and the phase's components redeploy. If the landing is still empty, the hook did not run (`--run-hooks`) or the contract names no component — `node tooling/bootstrap/retouch.mjs --check …` in the product tree says which. |
| Worker verify lane: missing `WIRING_*` secret | Its terraform upstream hasn't applied (check that lane first) — inside one convergence run the DAG guarantees order (every reader declares an enforced `dependsOn` on the infra component); across manual partial runs it does not. |
| Worker verify lane: missing `WIRING_*` secret | Its terraform upstream hasn't applied (check that lane first) — inside one convergence run the DAG guarantees order (every reader declares an enforced `dependsOn` on the infra component); across manual partial runs it does not. There is no separate wiring check after the convergence: a document the apply did not publish shows here, in its readers' lanes. |
| D1 lane or db-migrate: `Authentication error (10000)` | The lane resolved `CLOUDFLARE_API_TOKEN` (workers-deploy), which cannot touch D1. Both D1 components must bind `CLOUDFLARE_D1_TOKEN`. |
| 01-product parks: `waiting for github for <org> (connected: <account>)` | The workspace's GitHub connection is to a different account than the one the product repository will live under, so the platform would never see its pull requests. Connect the GitHub App installation on `<org>` to the workspace (console → Integrations → GitHub), then `--resume`. |
| CLI login dies with 429 `rate_limited` | Fixed ≥ v2.48.1 (redeem honors Retry-After). Upgrade the CLI. |
| `unknown flag: --phase`, `cannot unmarshal !!map into []scaffold.Hook`, or `orun.run/watch@v1 has no parameter "sha"` | The CLI is below the v2.58.11 floor. This blueprint is not readable by an older one. |
| `unknown flag: --phase`, `cannot unmarshal !!map into []scaffold.Hook`, `orun.run/watch@v1 has no parameter "sha"`, `has no parameter "secrets"`, `has no parameter "checks"`, or another parse error in the blueprint | The CLI is below the v2.88.0 floor. This blueprint is not readable by an older one. |
| `land` stops: `the landing's own check failed — orun plan for …` | The product's tree does not plan — the line after it is orun's own error (an unknown component type, a composition that does not resolve). Nothing was pushed. Fix the tree (or the baseline) and re-run the phase. |
| `land` waits on CI after all | The product's repository requires a status check on `main` (branch protection or a ruleset), so GitHub refused the early merge; the landing waits for the check as a `checks: ci` landing would, then merges. |
| A fresh build fails in a worker deploy with `10143` (service binding target not found) | The worker does not wait on `policy-worker`, whose pre-deploy places every binding target (`tooling/deploy/fleet-stubs.mjs`): its `dependsOn: policy-worker` must be `mode: enforced`. `testing/fleet-stubs.test.sh` checks every binding holder. |
| The product's `intent.yaml` says `workspace: ws_SET_ME`, or its secret refs name the repository (`secret://<repo>/…`) | `orunWorkspace` was empty: set it, or run the build in the workspace (ORUN_WORKSPACE) with a CLI ≥ v2.58.11, which fills it from there. |
| `✕ input "productname" is required` | Required inputs are validated before anything else, so this names the key nobody typed. All three requireds — `reponame`, `productname`, `githuborg` — must be set on every invocation, including single-phase ones. The domain is not one of them (since baseline-v25): a product is born with the placeholder `<reponame>.example.com`. |
Expand Down
4 changes: 2 additions & 2 deletions ai/context/operations.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# cirrus-baseline — operating contract (for humans and agents)

This is the standing guide to how this product is deployed and operated.
Instance facts (live URLs, workspace, secrets inventory) live in
Instance facts (live URLs, workspace, the secrets it uses) live in
[deployment.md](deployment.md), regenerated by the baseline's `08-docs`
phase;
this file is the contract that stays true between deployments. It is
Expand Down Expand Up @@ -77,7 +77,7 @@ Caveats that matter:

## Secrets model

- **Brokered provider secrets** (project rung): `CLOUDFLARE_API_TOKEN`
- **Brokered provider secrets** (workspace scope): `CLOUDFLARE_API_TOKEN`
(workers + KV), `CLOUDFLARE_D1_TOKEN` (D1 — the deploy token
deliberately cannot reach it), and `CLOUDFLARE_ACCOUNT_ID` — pointers
minted per-run from the workspace's Cloudflare connection. No long-lived
Expand Down
9 changes: 9 additions & 0 deletions apps/admin-worker/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ spec:
type: cloudflare-worker-turbo
lifecycle: production
owner: platform
# Its pages, attached to it in the workspace's catalog: what the Docs
# library shows for it, and what the catalog's docs and runbook checks read.
# Generated from what this manifest declares
# (tooling/catalog/gen-component-docs.mjs).
docs:
overview: docs/overview.md
pages:
- { path: docs/architecture.md, role: architecture, title: Architecture }
- { path: docs/runbook.md, role: runbook, title: Runbook }
domain: starter-runtime
path: apps/admin-worker
dependsOn:
Expand Down
9 changes: 9 additions & 0 deletions apps/api-edge/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ spec:
type: cloudflare-worker-turbo
lifecycle: production
owner: platform
# Its pages, attached to it in the workspace's catalog: what the Docs
# library shows for it, and what the catalog's docs and runbook checks read.
# Generated from what this manifest declares
# (tooling/catalog/gen-component-docs.mjs).
docs:
overview: docs/overview.md
pages:
- { path: docs/architecture.md, role: architecture, title: Architecture }
- { path: docs/runbook.md, role: runbook, title: Runbook }
domain: starter-runtime
path: apps/api-edge
dependsOn:
Expand Down
3 changes: 2 additions & 1 deletion apps/api-edge/docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Part of the cirrus-baseline runtime: a Cloudflare Worker deployed per environmen
- **membership-worker** — Cloudflare Worker for the Membership org runtime
- **metering-worker** — Cloudflare Worker for the Metering API surface (usage recording, quota checks)
- **notifications-worker** — Cloudflare Worker for the Notifications bounded context
- **policy-worker** — Cloudflare Worker for policy authorization decisions

## Depended on by

- **web-console-next** — Next.js 15 + opennextjs/cloudflare delivery of the cirrus-baseline web console (per-environment, Workers + Static Assets)
- (none)
9 changes: 9 additions & 0 deletions apps/billing-worker/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ spec:
type: cloudflare-worker-turbo
lifecycle: production
owner: platform
# Its pages, attached to it in the workspace's catalog: what the Docs
# library shows for it, and what the catalog's docs and runbook checks read.
# Generated from what this manifest declares
# (tooling/catalog/gen-component-docs.mjs).
docs:
overview: docs/overview.md
pages:
- { path: docs/architecture.md, role: architecture, title: Architecture }
- { path: docs/runbook.md, role: runbook, title: Runbook }
domain: starter-runtime
path: apps/billing-worker
dependsOn:
Expand Down
1 change: 1 addition & 0 deletions apps/billing-worker/docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Part of the cirrus-baseline runtime: a Cloudflare Worker deployed per environmen
## Depends on

- **policy-worker** — Cloudflare Worker for policy authorization decisions
- **cloudflare-d1** — Provisions the Cloudflare D1 platform database for stage and prod

## Depended on by

Expand Down
9 changes: 9 additions & 0 deletions apps/config-worker/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ spec:
type: cloudflare-worker-turbo
lifecycle: production
owner: platform
# Its pages, attached to it in the workspace's catalog: what the Docs
# library shows for it, and what the catalog's docs and runbook checks read.
# Generated from what this manifest declares
# (tooling/catalog/gen-component-docs.mjs).
docs:
overview: docs/overview.md
pages:
- { path: docs/architecture.md, role: architecture, title: Architecture }
- { path: docs/runbook.md, role: runbook, title: Runbook }
domain: starter-runtime
path: apps/config-worker
dependsOn:
Expand Down
1 change: 1 addition & 0 deletions apps/config-worker/docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Part of the cirrus-baseline runtime: a Cloudflare Worker deployed per environmen

- **membership-worker** — Cloudflare Worker for the Membership org runtime
- **policy-worker** — Cloudflare Worker for policy authorization decisions
- **cloudflare-d1** — Provisions the Cloudflare D1 platform database for stage and prod

## Depended on by

Expand Down
9 changes: 9 additions & 0 deletions apps/events-worker/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ spec:
type: cloudflare-worker-turbo
lifecycle: production
owner: platform
# Its pages, attached to it in the workspace's catalog: what the Docs
# library shows for it, and what the catalog's docs and runbook checks read.
# Generated from what this manifest declares
# (tooling/catalog/gen-component-docs.mjs).
docs:
overview: docs/overview.md
pages:
- { path: docs/architecture.md, role: architecture, title: Architecture }
- { path: docs/runbook.md, role: runbook, title: Runbook }
domain: starter-runtime
path: apps/events-worker
dependsOn:
Expand Down
1 change: 1 addition & 0 deletions apps/events-worker/docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Part of the cirrus-baseline runtime: a Cloudflare Worker deployed per environmen

- **membership-worker** — Cloudflare Worker for the Membership org runtime
- **policy-worker** — Cloudflare Worker for policy authorization decisions
- **cloudflare-d1** — Provisions the Cloudflare D1 platform database for stage and prod

## Depended on by

Expand Down
9 changes: 9 additions & 0 deletions apps/identity-worker/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ spec:
type: cloudflare-worker-turbo
lifecycle: production
owner: platform
# Its pages, attached to it in the workspace's catalog: what the Docs
# library shows for it, and what the catalog's docs and runbook checks read.
# Generated from what this manifest declares
# (tooling/catalog/gen-component-docs.mjs).
docs:
overview: docs/overview.md
pages:
- { path: docs/architecture.md, role: architecture, title: Architecture }
- { path: docs/runbook.md, role: runbook, title: Runbook }
domain: starter-runtime
path: apps/identity-worker
dependsOn:
Expand Down
Loading
Loading