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
16 changes: 9 additions & 7 deletions .baseline/product/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ says plainly that a payment provider must be connected first.

<!-- 02-docs:begin -->
Not recorded yet. The bootstrap's last phase writes the live URLs, the
workspace and the secrets inventory into
workspace and the secrets the store uses into
[ai/context/deployment.md](ai/context/deployment.md); how the store deploys
and how to operate it is in
[ai/context/operations.md](ai/context/operations.md).
Expand Down Expand Up @@ -122,9 +122,9 @@ revalidation of stale routes, through the Worker's own
local work and verification, and on every deploy from the document the
`cloudflare-r2` Terraform root publishes after its apply
(`WIRING_CLOUDFLARE_R2`, per environment). Edit the template, then
`pnpm run wire:fixture`; Checks fails if the committed `wrangler.jsonc` is not
the fixture render. The Durable Objects need no root: the migration in the
config creates them on the first deploy.
`pnpm run wire:fixture` and commit the render with the template. The Durable
Objects need no root: the migration in the config creates them on the first
deploy.

## How it deploys

Expand All @@ -136,9 +136,11 @@ storefront builds with that environment's bucket name and deploys — to
only verifies. The Worker is `commerce-web-<env>` on your account's
workers.dev subdomain, and every deploy is smoke-tested over HTTP: the home
page must answer, and `robots.txt` must name the origin it was asked on, which
only the Worker renders. `checks.yml` runs install, the fixture render,
typecheck, lint, test and build on every pull request. (A push to `main` runs
`ci.yml` alone, which applies, builds and deploys.)
only the Worker renders. A pull request runs the same pipeline's verify lanes,
with nothing applied or deployed: the R2 bucket planned for stage and prod,
and the storefront built and dry-deployed for each environment. They do not
run the tests or the linter — run those before you push (Getting started,
above). (A push to `main` applies, builds and deploys.)

The pipeline holds one credential, GitHub's own `GITHUB_TOKEN`. The Cloudflare
tokens and account id are brokered per run from the workspace's Cloudflare
Expand Down
45 changes: 28 additions & 17 deletions .github/workflows/baseline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: Baseline CI
# bucket before the Worker on a merge — and that the product it produces
# installs, builds, deploys (dry), serves, and takes a cart.
#
# ─── WHY THIS IS NOT IN ci.yml OR checks.yml ──────────────────────────────
# ─── WHY THIS IS NOT IN ci.yml ────────────────────────────────────────────
#
# `repo-blueprint.yaml`'s `github-workflows` module copies the WHOLE `.github`
# directory into every site built from this repository. These jobs run
Expand Down Expand Up @@ -69,20 +69,26 @@ jobs:
# floor too), and the placement tier (the offline bootstrap: both phases
# placed and finished by the blueprint's own hooks, then the product's own
# `orun plan` for the 01-product merge — the R2 apply before the Worker's
# deploy — under the product's lane pin, below).
# deploy — by an orun at or above the product's lane pin, below).
blueprint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: sourceplane/orun-action@v1.2.0
with:
version: v2.58.11
version: v2.88.0
- uses: pnpm/action-setup@v4
with:
version: 10.12.1
- uses: actions/setup-node@v5
with:
node-version: 22
# This job installs nothing either: with no lockfile hook the offline
# bootstrap never runs pnpm, so there is no store, and the pnpm cache
# setup-node v5 turns on by itself (package.json names a packageManager)
# fails the job saving a path that does not exist whenever no earlier
# cache exists for the lockfile.
package-manager-cache: false
- name: repo-blueprint.yaml, read by the pinned CLI
run: |
set -euo pipefail
Expand All @@ -98,34 +104,39 @@ jobs:
- name: the leak gate — what a product carries
run: bash testing/leak.test.sh
# The placement tier ENDS with the product's own `orun plan` — what the
# product's ci.yml runs — so it runs under the product's lane pin, not
# the bootstrap floor. v2.58.11 plans a pull request with apps/web
# waiting on the R2 plan: it does not apply a dependsOn edge's
# `modeRules`. The lane pin does (advisory on a PR, enforced on main),
# and the test refuses an orun older than the pin rather than assert
# the wrong CLI's plan. Its placements are valid under either.
# product's ci.yml runs — so it needs an orun at the product's lane pin
# or newer: one older than v2.78.4 plans a pull request with apps/web
# waiting on the R2 plan, because it does not apply a dependsOn edge's
# `modeRules` (advisory on a PR, enforced on main). The test refuses an
# orun older than the pin rather than assert the wrong CLI's plan. The
# offline bootstrap before it reads the blueprint, which takes the
# bootstrap floor (v2.88.0: the one `secrets` reconcile, the task set-up
# in the background, the landings checked in the box), so this tier
# runs the floor, which is newer than the lane pin.
- uses: sourceplane/orun-action@v1.2.0
with:
version: v2.78.4
version: v2.88.0
- name: placement — the offline bootstrap, and the product's own plan
run: |
git config --global user.email ci@example.invalid
git config --global user.name "baseline ci"
bash testing/placement.test.sh

# Tier 2. THE PRODUCT IT PRODUCES WORKS: its one landing under the checks
# its pull request waits on, the stage lane's own structure check, build
# (the live wiring render included), output check and dry deploy in the tree
# orun stages, and the built Worker served and smoke-tested with the
# component's own smoke command. Pinned at the product's lane version,
# because that is the orun the product's CI runs.
# Tier 2. THE PRODUCT IT PRODUCES WORKS: its one landing installed, its
# fixture rendered, type-checked, linted, tested and built, the stage lane's
# own structure check, build (the live wiring render included), output check
# and dry deploy in the tree orun stages, and the built Worker served and
# smoke-tested with the component's own smoke command. Pinned at the
# bootstrap floor (v2.88.0): the offline bootstrap reads the blueprint, and
# the floor is newer than the product's lane pin (v2.78.4), which is all the
# lane steps need.
site:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: sourceplane/orun-action@v1.2.0
with:
version: v2.78.4
version: v2.88.0
- uses: pnpm/action-setup@v4
with:
version: 10.12.1
Expand Down
51 changes: 0 additions & 51 deletions .github/workflows/checks.yml

This file was deleted.

58 changes: 33 additions & 25 deletions BOOTSTRAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,26 @@ not separate workflows. The console card the platform renders is
brokered secrets and the programme, and `testing/manifest.test.sh` holds it
to what the build document does.

Target wall-clock: **about sixteen minutes** — an estimate summed from the
phases until a bootstrap measures it: ONE landing whose pull request waits on
Checks (a full Next.js build), then one convergence — the R2 bucket applied
on stage and prod, then the storefront built with its name and deployed,
stage and prod side by side — then a short docs landing that restores the
promotion gate.
Target wall-clock: **about fourteen minutes** — an estimate summed from the
phases (13 + 1) until a bootstrap measures it; no build of this baseline has
been timed. 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 — the R2 bucket applied on stage
and prod, then the storefront built with its name and deployed, stage and
prod side by side — then a short docs landing that restores the promotion
gate.

## 0. What you need

- GitHub org access (repository creation) and a machine with `git`, `node`
(≥ 22), `pnpm` (10.12.1), `python3` with PyYAML, `curl`, and the `orun`
CLI **≥ v2.58.11** — the floor for RUNNING the bootstrap (the phase overlay,
landings that commit per phase and wait on the PR's whole CI run,
`githubOwner` on the doctor probe, `environments` on the secrets probe, a
probe deferred for a project not yet created, and `from: workspace`). The
product's own `ci.yml` pins its lanes separately (v2.78.4), and its plans
need that pin: the floor does not apply a `dependsOn` edge's `modeRules`.
CLI **≥ v2.88.0** — the floor for RUNNING the bootstrap (the phase overlay,
landings that commit per phase, `githubOwner` on the doctor probe, a probe
deferred for a project not yet created, `from: workspace`, the deploy
credentials minted in one `secrets` reconcile, the task set-up run in the
background (`background: true`), and landings checked in the box before
they merge (`checks: local`)). The product's own `ci.yml` pins its lanes
separately (v2.78.4).
- A Cloudflare account with **R2 enabled** (R2 must be activated once in the
dashboard, even on the free plan; Durable Objects with SQLite storage are
on the free plan too) and its **Account API token** with Workers Scripts
Expand Down Expand Up @@ -87,8 +90,8 @@ phase whose files are present but branded derives as `drifted`, and

| phase | what it lands | verified by |
|---|---|---|
| `01-product` | the repository, created and linked; the WHOLE product in one PR — intent, CI, tooling, identity, the R2 root, the storefront and its tests; the brokered Cloudflare secrets (deploy, R2, account id) | its PR's checks green and merged; the convergence green (R2 applied, then the storefront built, deployed, smoke-tested); `WIRING_CLOUDFLARE_R2` on stage and prod; both workers.dev URLs answering |
| `02-docs` | `ai/context/deployment.md` from probed facts; prod's promotion gate and dev's push lanes restored | the final probe |
| `01-product` | the repository, created and linked; the WHOLE product in one PR — intent, CI, tooling, identity, the R2 root, the storefront and its tests; the brokered Cloudflare secrets (deploy, R2, account id) | its commit validated and planned in the box (as the PR and as the merge), then merged; the convergence green (R2 applied, then the storefront — which resolves `WIRING_CLOUDFLARE_R2` — built, deployed, smoke-tested); both workers.dev URLs answering |
| `02-docs` | `ai/context/deployment.md` from probed facts; prod's promotion gate and dev's push lanes restored | the render's own probes, recorded; the commit checked in the box and merged |

```bash
orun new --blueprint repo-blueprint.yaml --out ~/sites/acme-shop --run-hooks \
Expand Down Expand Up @@ -135,8 +138,9 @@ need landings of its own. It does not, because the product's plan holds it:
environment's apply; on a pull request nothing deploys, so nothing waits.
- A job resolves its secrets when it STARTS, so `WIRING_CLOUDFLARE_R2_<ENV>`
is there when the deploy begins.
- The landing's `await` then asks the platform that the wiring exists on
stage and prod (`orun.secrets/exists@v1`) — every later deploy reads it.
- The deploy resolves the document from the place every later run looks
(its `component.yaml` secret refs), so a green convergence already says it
is there: a missing one fails its lane. There is no separate check.

`testing/phases.test.sh` fails if a component that reads a wiring document
does not wait for its publisher this way; `testing/placement.test.sh` plans
Expand All @@ -147,8 +151,10 @@ the product's own merge and asserts the R2 lanes run first.
`workers-deploy` grants Workers Scripts and KV write — and no R2. The R2
root's Terraform has to list the account's buckets (`adopt.tf`) and create
one, so it authenticates with its own key, `CLOUDFLARE_R2_TOKEN`, minted from
the `r2-data` template by a second `orun.integrations/reconcile@v1` hook and
bound in `infra/terraform/cloudflare-r2/component.yaml` as the provider's
the `r2-data` template — its own entry in the one
`orun.integrations/reconcile@v1` hook (`secrets`), beside the deploy token's
`workers-deploy` — and bound in
`infra/terraform/cloudflare-r2/component.yaml` as the provider's
`CLOUDFLARE_API_TOKEN` (the way a D1 root binds a `d1-edit` token). The card
(`blueprint.yaml` `spec.secrets`) mirrors the hook, and
`testing/manifest.test.sh` holds the two together.
Expand Down Expand Up @@ -217,9 +223,9 @@ bash testing/e2e.test.sh # + network for pnpm: the product built in the
The offline bootstrap (`testing/lib/bootstrap.sh`) places both phases in
order and finishes each with the blueprint's OWN `run:` hooks — read out of
`repo-blueprint.yaml`, not transcribed — so the retouch marker, the rebrand,
the re-tenant, the deferrals and their restore, the lockfile and the
deployment record all run exactly as a real bootstrap runs them. Only the
platform's typed actions (task, repo, link, reconcile, land, watch, secrets,
the re-tenant, the deferrals and their restore, and the deployment record
all run exactly as a real bootstrap runs them. Only the platform's typed
actions (task, repo, link, reconcile, land, watch, secrets,
probe) are stood in for, a landing becoming a commit. What no offline test
can do is the platform's half: the bucket applied for real (the R2 root is
held to `terraform validate`), the tokens minted, the deploy, the probes —
Expand Down Expand Up @@ -249,18 +255,20 @@ at the tag and refuses the whole catalogue if it 404s.
| `01-product` waits on the `providers` probe, then stops | Cloudflare is not connected. Connect it (console → Integrations), then re-run the phase — the probe is a wait, not a failure |
| `01-product` stops at `link` | the repository is not linked to the workspace and the credential cannot link it. Allow-list it (console → Settings → Git repos) and re-run the phase |
| Secret WRITE fails `not_found` while listings work | the API key's role is below admin; re-mint it with the admin role |
| `secret-r2-data` fails `parent_grant_insufficient` | the connection's token lacks Workers R2 Storage Write; add it, re-connect, re-run `01-product` |
| `secrets` fails `parent_grant_insufficient` on `CLOUDFLARE_R2_TOKEN` | the connection's token lacks Workers R2 Storage Write; add it, re-connect, re-run `01-product` |
| R2 lane: Authentication error (10000) | the R2 root is not authenticating with `CLOUDFLARE_R2_TOKEN` (its component.yaml), or the account has not activated R2 |
| deploy lane: Authentication error (10000) | the connection's token lacks Workers Scripts write; re-issue it, re-connect, re-run `01-product` |
| R2 lane: bucket already exists (10004) | `adopt.tf` imports a bucket of the same name; restore it if removed. Two products with one `reponame` in one account share bucket names — pick another `reponame` |
| web lane fails resolving `WIRING_CLOUDFLARE_R2_<ENV>` | that environment's R2 apply failed — read its lane; the web lane waits on it |
| `wiring` await stops: `WIRING_CLOUDFLARE_R2` missing on stage or prod | the convergence was green but the apply published nothing: the R2 component lost its `secretOutputs`, or its lane was not in the plan. Re-run the phase; its retouch marker re-plans the R2 root |
| web lane: `WIRING_CLOUDFLARE_R2` not found | that environment's R2 apply published nothing: the R2 component lost its `secretOutputs`, or its lane was not in the plan. Re-run the phase; its retouch marker re-plans the R2 root |
| `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 |
| Convergence failed AFTER the PR merged; re-running lands nothing | expected on its own — the files are on main. Re-run the phase (`--phase 01-product`, `--redo 01-product`, or the console's Retry): its `retouch` hook gives the landing a diff and the R2 root and the storefront re-plan |
| The live store shows the demo banner | no Shopify store is connected — expected after a bootstrap. The product's README, "Connecting Shopify" |
| The product's `intent.yaml` says `workspace: ws_SET_ME` | `orunWorkspace` was empty and the build ran outside a workspace; set it and re-run `01-product` |
| A bootstrap stopped before `02-docs`; prod no longer waits on stage | the gate is deferred, not dropped: run `02-docs`, or `node tooling/bootstrap/promotion.mjs --restore --file <product>/intent.yaml` |
| `✕ input "productname" is required` | all three required inputs (`reponame`, `productname`, `githuborg`) must be set on every invocation, single-phase ones included |
| `unknown flag: --phase` or a parse error in the blueprint | the CLI is below the v2.58.11 floor |
| `unknown flag: --phase`, `has no parameter "checks"`, `has no parameter "secrets"` or another parse error in the blueprint | the CLI is below the v2.88.0 floor |
| web lane `verify-app-structure` fails on `wrangler.jsonc` | the config is not committed. It is the fixture render of `wrangler.template.jsonc`: `pnpm run wire:fixture` and commit it |
| web lane `build-app`: `Symlink apps/web/node_modules/next is invalid, it points out of the filesystem root` | the product's intent pins stack-tectonic ≥ 0.20.0, whose lane-scoped install links each job's node_modules out of its tree, which Next 16's Turbopack refuses. Pin 0.19.0 (`intent.yaml` says why) |
| the convergence reported green, then `verify` got 404 | a second workflow ran on the push to main and the watch took its run. Only `ci.yml` may run on a push to main (`checks.yml` is pull-request only) |
| the convergence reported green, then `verify` got 404 | a second workflow ran on the push to main and the watch took its run. Only `ci.yml` may run on a push to main |
Loading
Loading