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
13 changes: 7 additions & 6 deletions .baseline/product/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace that Terraform provisions per environment.

<!-- 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 site uses into
[ai/context/deployment.md](ai/context/deployment.md); how the site deploys
and how to operate it is in
[ai/context/operations.md](ai/context/operations.md).
Expand Down Expand Up @@ -84,8 +84,7 @@ The Worker binds the namespace as `KV`. Its id is never hand-written:
(placeholder ids) for local work and verification, and on every deploy from
the document the `cloudflare-kv` Terraform root publishes after its apply
(`WIRING_CLOUDFLARE_KV`, per environment). Edit the template, then
`pnpm run wire:fixture`; Checks fails if the committed `wrangler.jsonc` is
not the fixture render.
`pnpm run wire:fixture` and commit the render with the template.

KV is eventually consistent: a run recorded in one location can read as the
previous one elsewhere for up to a minute — invisible for "fetched N ago".
Expand All @@ -100,9 +99,11 @@ the Worker builds with that environment's namespace id and deploys — to
only verifies. The Worker is `cron-starter-web-<env>` on your account's
workers.dev subdomain, and every deploy is smoke-tested over HTTP:
`/api/data/1m` must carry a run the every-minute trigger recorded in the last
ten minutes. `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.)
ten minutes. A pull request runs the same pipeline's verify lanes, with
nothing applied or deployed: the KV namespace planned for stage and prod, and
the Worker 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 token and account id are brokered per run from the workspace's
Expand Down
44 changes: 27 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
# namespace before the Worker on a merge — 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 site built from this repository. These jobs run
Expand Down Expand Up @@ -69,20 +69,25 @@ 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 KV 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 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 @@ -98,34 +103,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 KV 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 KV 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, its
# schedules fired 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.

54 changes: 30 additions & 24 deletions BOOTSTRAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,27 @@ 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 fifteen 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 KV namespace
applied on stage and prod, then the Worker built with its id and deployed,
stage and prod side by side, each smoke waiting for the every-minute Cron
Trigger's first recorded run — then a short docs landing that restores the
promotion gate.
Target wall-clock: **about thirteen minutes** — an estimate summed from the
phases (12 + 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 KV namespace applied on
stage and prod, then the Worker built with its id and deployed, stage and
prod side by side, each smoke waiting for the every-minute Cron Trigger's
first recorded run — 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 (the Free plan is enough: the product registers ONE
Cron Trigger per Worker, two in all, and dispatches its seven schedules
from it; Free allows five per account) and its **Account API token** with
Expand Down Expand Up @@ -83,8 +86,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 KV root, the Worker (page, API routes, Cron Trigger) and its tests; the brokered Cloudflare secrets | its PR's checks green and merged; the convergence green (KV applied, then the Worker built, deployed, smoke-tested on a run its every-minute trigger recorded); `WIRING_CLOUDFLARE_KV` 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 KV root, the Worker (page, API routes, Cron Trigger) and its tests; the brokered Cloudflare secrets (the deploy token, the account id) | its commit validated and planned in the box (as the PR and as the merge), then merged; the convergence green (KV applied, then the Worker — which resolves `WIRING_CLOUDFLARE_KV` — built, deployed, smoke-tested on a run its every-minute trigger recorded); 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-crons --run-hooks \
Expand Down Expand Up @@ -131,8 +134,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_KV_<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 Down Expand Up @@ -195,10 +199,10 @@ bash testing/e2e.test.sh # + network for pnpm and Hacker News: the produ
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,
probe) are stood in for, a landing becoming a commit. The end-to-end tier
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, probe) are stood in for,
a landing becoming a commit. The end-to-end tier
then serves the built Worker with `wrangler dev --test-scheduled`, fires the
trigger through the scheduled handler on the clock and at crafted times that
make each schedule due, and reads each record back. What no
Expand Down Expand Up @@ -235,12 +239,14 @@ at the tag and refuses the whole catalogue if it 404s.
| web smoke fails after its retries: no recent `fetchedAt` on `/api/data/1m` | the trigger had not fired yet (a new trigger can take up to fifteen minutes to reach every location), or its run threw — `wrangler tail <reponame>-web-<env>` shows it. The watch resumes the failed lane up to three times |
| KV lane: title already exists (10014) | `adopt.tf` imports a namespace of the same title; restore it if removed. Two products with one `reponame` in one account share titles — pick another `reponame` |
| web lane fails resolving `WIRING_CLOUDFLARE_KV_<ENV>` | that environment's KV apply failed — read its lane; the web lane waits on it |
| `wiring` await stops: `WIRING_CLOUDFLARE_KV` missing on stage or prod | the convergence was green but the apply published nothing: the KV component lost its `secretOutputs`, or its lane was not in the plan. Re-run the phase; its retouch marker re-plans the KV root |
| web lane: `WIRING_CLOUDFLARE_KV` not found | that environment's KV apply published nothing: the KV component lost its `secretOutputs`, or its lane was not in the plan. Re-run the phase; its retouch marker re-plans the KV 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 KV root and the Worker re-plan |
| 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