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
11 changes: 7 additions & 4 deletions .baseline/product/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Vercel-only primitive underneath swapped for Cloudflare's.

<!-- 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 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 Expand Up @@ -92,9 +92,12 @@ Merges to `main` converge through [Orun](https://github.com/sourceplane/orun):
against the workspace in `intent.yaml`. The Worker deploys to `stage`, then
to `prod` once stage has converged on the same commit; `dev` only verifies.
It is `edge-middleware-recipes-recipes-<env>` on your account's workers.dev
subdomain, and every deploy is smoke-tested over HTTP. `checks.yml` runs
install, typecheck, lint, test and build on every pull request. (A push to
`main` runs `ci.yml` alone, which builds, typechecks and deploys.)
subdomain, and every deploy is smoke-tested over HTTP. A pull request runs
the same pipeline's verify lanes: the Worker built, type-checked and
dry-deployed for each environment, with nothing deployed. They do not lint
it or run the tests, so run `pnpm lint` and `pnpm test` (and
`pnpm typecheck`) before you push. (A push to `main` builds, typechecks and
deploys.)

The pipeline holds one credential, GitHub's own `GITHUB_TOKEN`. The
Cloudflare token and account id are brokered per run from the workspace's
Expand Down
30 changes: 19 additions & 11 deletions .github/workflows/baseline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: Baseline CI
# placed tree comes up branded and carrying nothing of the factory, and that
# the product it produces installs, builds, deploys (dry) and serves.
#
# ─── 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 product built from this repository. These jobs run
Expand Down Expand Up @@ -58,7 +58,9 @@ jobs:

# Tier 1. THE BLUEPRINT, READ AND PLACED BY THE BINARY A BOOTSTRAP RUNS.
#
# Pinned at the bootstrap floor (BOOTSTRAP.md), not the product's lane pin:
# Pinned at the bootstrap floor (BOOTSTRAP.md: v2.88.0 — the one `secrets`
# reconcile, the task set-up in the background, the landings checked in the
# box), not the product's lane pin:
# every test here reads YAML with PyYAML, which parses anything well-formed;
# only the pinned orun can say whether the document is one a bootstrap can
# run. `--status` parses it, validates every hook against the action
Expand All @@ -73,13 +75,18 @@ jobs:
- 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 the lockfile hook gone the
# offline bootstrap never runs pnpm, so there is no store, and the
# cache setup-node v5 turns on by itself (package.json names a
# packageManager) fails the job on saving a path that does not exist.
package-manager-cache: false
- name: repo-blueprint.yaml, read by the pinned CLI
run: |
set -euo pipefail
Expand All @@ -100,20 +107,21 @@ jobs:
git config --global user.name "baseline ci"
bash testing/placement.test.sh

# Tier 2. THE PRODUCT IT PRODUCES WORKS: the landed product under the
# checks its pull request waits on, the stage lane's own steps (the
# structure check, the fixture render, the build, the typecheck and the dry
# deploy) in the job tree orun stages, and the Worker served and
# smoke-tested with the component's own smoke command, every recipe route
# read back. 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
# fixtures rendered, type-checked, linted, tested and built, the stage
# lane's own steps (the structure check, the fixture render, the build, the
# typecheck and the dry deploy) in the job tree orun stages, and the Worker
# served and smoke-tested with the component's own smoke command, every
# recipe route read back. 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.
product:
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
45 changes: 0 additions & 45 deletions .github/workflows/checks.yml

This file was deleted.

48 changes: 30 additions & 18 deletions BOOTSTRAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,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 eight minutes** — an estimate summed from the
phases until a bootstrap measures it: ONE landing that places and brands the
whole product, whose pull request waits on Checks and `plan`; ONE
convergence that deploys the Worker to stage and prod side by side (a
wrangler bundle each, no framework build); then the deployment record.
Target wall-clock: **about six minutes** — an estimate summed from the
phases (5 + 1) until a bootstrap of this shape measures it. The shape: the
task set-up in the background while ONE landing places and brands the whole
product and is checked in the box (`orun validate` and `orun plan`, no
runner waited for); ONE convergence that deploys the Worker to stage and
prod side by side (a wrangler bundle each, no framework build); then the
deployment record, checked the same way. orun v2.88.0's fast shape took
about a minute out of turso-starter's measured build; the same minute is
assumed here.

## 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, a probe deferred for a project not yet
created, and `from: workspace`). The product's own `ci.yml` pins its lanes
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 (the Worker's bundle is about 550 KiB gzipped, inside
the free plan's size limit) and its **Account API token** with Workers
Expand Down Expand Up @@ -81,8 +87,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 brokered Cloudflare secrets; then ONE pull request with everything — intent, CI, tooling, identity, `apps/recipes`, `tests/recipes` | its PR's checks green, merged; the convergence green (structure check, build, typecheck, deploy, smoke 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 brokered Cloudflare secrets; then ONE pull request with everything — intent, CI, tooling, identity, `apps/recipes`, `tests/recipes` | its commit validated and planned in the box (as the PR and as the merge), then merged; the convergence green (structure check, build, typecheck, deploy, smoke 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 render's own probes, recorded; the commit checked in the box and merged |

```bash
orun new --blueprint repo-blueprint.yaml --out ~/products/acme-recipes --run-hooks \
Expand Down Expand Up @@ -174,11 +180,15 @@ bash testing/e2e.test.sh # + network for pnpm: the product built, dry-de
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 work-tree strip, 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, land, watch,
probe, reconcile) are stood in for, a landing becoming a commit. The e2e
then runs the stage lane's steps exactly as the product's pull-request plan
the re-tenant, the work-tree strip, 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, land, watch, probe, reconcile)
are stood in for, a landing becoming a commit. The e2e then runs the
landing's own checks — install, the fixture render, typecheck, lint, test,
build. This is where the lint and the tests run before a tag: a product's
pull request runs `ci.yml`'s verify lanes, which build, type-check and
dry-deploy the Worker but neither lint nor test it. Then it runs the stage
lane's steps exactly as the product's pull-request plan
renders them — the structure check included — in the job tree orun stages,
and serves the Worker with `wrangler dev`.

Expand Down Expand Up @@ -207,10 +217,12 @@ at the tag and refuses the whole catalogue if it 404s.
| `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 |
| Deploy lane: Authentication error (10000) | the connection's token lacks Workers Scripts Write; re-issue it, re-connect, re-run `01-product` |
| `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 Worker redeploys |
| 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` |
| `/basic-auth-password` answers 503 on the live product | expected until the owner sets the pair (§3) |
| `✕ 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 |
| The convergence reported green, then `verify` got 404 from both URLs | a second workflow ran on the push to main and the watch took its run. Only `ci.yml` runs on a push to main (`checks.yml` is pull-request only); read the CI run on main for the real result |
| `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 |
| The convergence reported green, then `verify` got 404 from both URLs | 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, and a product carries no other workflow, so a workflow added on push is the cause; read the CI run on main for the real result |
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ its `app.use(<matcher>, …)` is the upstream's `export const config = { matcher

| Workflow | What it runs | Ships to a product |
|---|---|---|
| `checks.yml` | install, wire fixtures, typecheck, lint, test, build — every PR (not pushes: on main, `ci.yml` must be the only run a commit has, because the bootstrap's convergence watch takes the newest one) | yes |
| `ci.yml` | the Orun pipeline: `orun plan --changed`, then one job per lane; deploys stage → prod on merge. It plans nothing while `intent.yaml` names the placeholder workspace `ws_CHANGE_ME`, as this repository does | yes |
| `ci.yml` | the Orun pipeline, and the only workflow a product carries: `orun plan --changed`, then one job per lane. A pull request runs the verify lanes (the Worker built, type-checked and dry-deployed per environment; the tests package's lane installs it and checks its structure — they do not lint or run the tests; `baseline.yml`'s e2e tier runs those before each tag, and a product's README asks its developers to run them before a push), except the bootstrap's own landings (`orun/BASE-*`), which are checked in the box before they are pushed (`checks: local`) and whose PR runs `plan` alone; a merge deploys stage → prod. It plans nothing while `intent.yaml` names the placeholder workspace `ws_CHANGE_ME`, as this repository does | yes |
| `baseline.yml` | the baseline's own tiers: contract tests, the blueprint read by the pinned orun, the leak gate, the offline bootstrap, the product built, dry-deployed and served | no |
| `tag.yml` | cuts a `baseline-vN` tag (manual) | no |

Expand Down
2 changes: 1 addition & 1 deletion ai/context/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

> Not rendered yet. The bootstrap's `02-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).
7 changes: 4 additions & 3 deletions ai/context/operations.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# edge-middleware-recipes — 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), rendered from probed reality by the
bootstrap's `02-docs` phase; this file is the contract that stays true
between deployments. It is written to give an agent with repository read
Expand All @@ -21,8 +21,9 @@ component-native desired-state repo.
product's name and source link are `src/site.ts`. Bundled by wrangler's
esbuild; no build step beyond it, no static assets, no database.
- **`tests/recipes`** — one vitest file per recipe, driving the Worker
in-process through `app.request()`; verified on the `dev` rung and by
`checks.yml` on every pull request.
in-process through `app.request()`. A pull request's lanes do not run
them (its `dev` lane installs the package and checks its structure), nor
the linter: run `pnpm test` and `pnpm lint` before you push.
- **`tooling/*`** — shared TypeScript and ESLint configuration, and the
deploy-time wrangler renderer for workers that take wiring (this one does
not: its `wrangler.jsonc` is committed).
Expand Down
12 changes: 11 additions & 1 deletion apps/recipes/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@ spec:
type: cloudflare-worker-turbo
lifecycle: production
owner: platform
domain: recipes
# 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 and its sources declare.
docs:
overview: docs/overview.md
pages:
- { path: docs/architecture.md, role: architecture, title: Architecture }
- { path: docs/runbook.md, role: runbook, title: Runbook }
# `app`, not `recipes`: a domain and a component share one name space in
# the catalog, and a domain called `recipes` hid this component from it.
domain: app
path: apps/recipes
# The basic-auth recipe's pair, owner-seeded rather than brokered: no
# provider holds it, so nothing mints it. Best-effort references — an
Expand Down
Loading
Loading