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
10 changes: 6 additions & 4 deletions .baseline/product/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ it to stage, then prod.

<!-- 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 API uses into
[ai/context/deployment.md](ai/context/deployment.md); how the API deploys
and how to operate it is in
[ai/context/operations.md](ai/context/operations.md).
Expand Down Expand Up @@ -63,9 +63,11 @@ against the workspace in `intent.yaml`. The API deploys to `stage`, then to
`prod` once stage has converged on the same commit; `dev` only verifies. The
Worker is `hono-api-api-<env>` on your account's workers.dev subdomain, and
every deploy is smoke-tested over HTTP: `/health` must answer `"status":"ok"`
for that environment. `checks.yml` runs install, typecheck, lint, test and
build on every pull request. (A push to `main` runs `ci.yml` alone, which
builds, tests and deploys.)
for that environment. 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 or run the tests, so run `pnpm typecheck`,
`pnpm lint` and `pnpm test` before you push. (A push to `main` builds,
deploys and smoke-tests.)

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
29 changes: 19 additions & 10 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 API 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 API built from this repository. These jobs run
Expand Down Expand Up @@ -73,13 +73,19 @@ 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
# Nothing in this job installs (the offline bootstrap runs no pnpm
# since the lockfile hook went), so there is no pnpm store to
# cache — and setup-node v5's own pnpm cache, on by itself because
# package.json names a packageManager, fails the job in its post
# step when it finds none.
package-manager-cache: false
- name: repo-blueprint.yaml, read by the pinned CLI
run: |
set -euo pipefail
Expand All @@ -100,20 +106,23 @@ jobs:
git config --global user.name "baseline ci"
bash testing/placement.test.sh

# Tier 2. THE API IT PRODUCES WORKS: both landings under the checks their
# pull requests wait on, every run step of the stage lane's pull-request
# plan (the structure check before any build, the build, the typecheck, the
# dry deploy) in the job tree orun stages, and the Worker served by
# `wrangler dev --env stage` and smoke-tested with the component's own smoke
# command. Pinned at the API's lane version, because that is the orun the
# API's CI runs.
# Tier 2. THE API IT PRODUCES WORKS: both landings installed, their
# fixtures rendered, type-checked, linted, tested and built, every run step
# of the stage lane's pull-request plan (the structure check before any
# build, the build, the typecheck, the dry deploy) in the job tree orun
# stages, and the Worker served by `wrangler dev --env stage` and
# smoke-tested with the component's own smoke command. Pinned at the
# bootstrap floor (v2.88.0): the offline bootstrap reads the blueprint (its
# one `secrets` reconcile, its background task set-up, its landings checked
# in the box), and the floor is newer than the API's lane pin (v2.78.4),
# which is all the lane steps need.
api:
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
46 changes: 0 additions & 46 deletions .github/workflows/checks.yml

This file was deleted.

43 changes: 26 additions & 17 deletions BOOTSTRAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,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 nine minutes** — an estimate summed from the
phases until a bootstrap measures it: ONE landing that places the whole API
and one convergence that deploys it to stage and prod side by side, then the
record. It is cirrus-baseline's one-landing shape (baseline-v22): no
scaffold landing of its own, no second landing for the app.
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 the whole API,
brands it and is checked in the box (`orun validate` and `orun plan`, no
runner waited for), then one convergence that deploys it to stage and prod
side by side, then a short record landing, checked the same way. It is
cirrus-baseline's one-landing shape (baseline-v22): no scaffold landing of
its own, no second landing for the app. 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 API'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 API's own `ci.yml` pins its lanes
separately (v2.78.4).
- A Cloudflare account (the free plan is enough for one Worker) and its
**Account API token** with Workers Scripts Write (the console's Connect
Expand Down Expand Up @@ -76,8 +83,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 API in one PR — intent, CI, tooling, identity, `apps/api` + `tests/api`; the brokered Cloudflare secrets | its PR's checks, then the convergence green (build, deploy, smoke) and `/health` answering on both workers.dev URLs |
| `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 API in one PR — intent, CI, tooling, identity, `apps/api` + `tests/api`; the brokered Cloudflare secrets | its commit validated and planned in the box (as the PR and as the merge), then merged; the convergence green (build, deploy, smoke) and `/health` answering on both workers.dev URLs |
| `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 ~/apis/acme-api --run-hooks \
Expand Down Expand Up @@ -162,11 +169,11 @@ bash testing/e2e.test.sh # + network for pnpm: the API built, dry-deploy
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, reconcile, land,
watch, probe) are stood in for, a landing becoming a commit on top of
orun's `Initial commit`.
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, reconcile, land, watch, probe)
are stood in for, a landing becoming a commit on top of orun's `Initial
commit`.

## 5. Cutting a baseline tag (maintainers)

Expand All @@ -193,10 +200,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 API'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 API'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 API redeploys |
| The API'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 <api>/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 |
| 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 (`testing/coverage.test.sh` holds it); read the CI run on main for the real result |
| the convergence planned no lanes at all | the merge's push had no `before` to diff against (a first push straight onto an unborn `main`). The landing merges a pull request into orun's `Initial commit`, so its push has one; re-run the phase and its retouch marker re-plans the API |
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ Add a route with `app.get(...)` (or `post`, `route`, middleware) in

| Workflow | What it runs | Ships to an API |
|---|---|---|
| `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 an API 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' `quick-check` lane installs and checks the package, it does not run them), except the bootstrap's own landings (`orun/BASE-*`), where `plan` alone is the check; 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 API built, dry-deployed and served | no |
| `tag.yml` | cuts a `baseline-vN` tag (manual) | no |
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 API uses, by name. Until then, nothing here
> claims the API is live. The operating contract is
> [operations.md](operations.md).
13 changes: 8 additions & 5 deletions ai/context/operations.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# hono-api — operating contract (for humans and agents)

This is the standing guide to how this API 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 @@ -18,14 +18,17 @@ desired-state repo.
text, `GET /health` answers `{"status":"ok","name":…,"environment":…}`,
anything else is a 404. It binds nothing — no KV, D1, R2 or service
binding — and holds no runtime secret.
- **`tests/api`** — vitest driving the app in-process with `app.request()`,
verified on the `dev` rung.
- **`tests/api`** — vitest driving the app in-process with `app.request()`.
A pull request's lanes do not run it (its `quick-check` lane on `dev`
installs and checks the package; the Worker's lanes build, type-check and
dry-deploy it): run `pnpm typecheck`, `pnpm lint` and `pnpm test` before
you push.
- **`tooling/*`** — shared TypeScript and ESLint configuration, and the
deploy-time wrangler renderer for workers that take wiring.

Environments: **`stage`** and **`prod`** are deployed; **`dev` is
verify-only by design** — lanes build, test and dry-run the deploy, nothing
deploys.
verify-only by design** — lanes build, type-check and dry-run the deploy,
nothing deploys.

## Identity and tenancy

Expand Down
13 changes: 12 additions & 1 deletion apps/api/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@ spec:
type: cloudflare-worker-turbo
lifecycle: production
owner: platform
domain: api
# 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 `api`: a domain and a component share one name space in the
# catalog, and a domain called `api` would take this component's place in
# it — the API missing from its own catalog.
domain: app
path: apps/api
# No dependsOn: the API reads no wiring and binds nothing, so there is no
# infra component to deploy before it. A component under infra/ that this
Expand Down
19 changes: 10 additions & 9 deletions blueprint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ metadata:
welcome route and a JSON health check — bundled by wrangler into one
Cloudflare Worker with no adapter, vitest tests that drive it in-process,
and CI that deploys it to stage and prod on merge, smoke-tested over HTTP.
One provider, one consent, one landing. Live in under ten minutes.
One provider, one consent, one landing. Live in about six minutes.
tags: [api, hono, workers, cloudflare, typescript]
spec:
source:
Expand Down Expand Up @@ -103,11 +103,12 @@ spec:
from: connection.cloudflare.workersSubdomain

# ── PREVIEW ONLY. repo-blueprint.yaml's `orun.integrations/reconcile@v1`
# hooks mint these, brokered, during 01-product. ──────────────────────────
# Transcribed from those hooks' own `keys:` and `template:` values, so
# testing/manifest.test.sh compares this list to the document that mints
# them. The console renders them read-only: no credential is ever typed,
# shown or stored. Keys that already exist are kept.
# hook mints these, brokered, during 01-product. ──────────────────────────
# Transcribed from that hook's own `secrets:` list (each key and its
# `template:`), so testing/manifest.test.sh compares this list to the
# document that mints them. The console renders them read-only: no
# credential is ever typed, shown or stored. Keys that already exist are
# kept.
secrets:
- key: CLOUDFLARE_API_TOKEN
provider: cloudflare
Expand All @@ -134,9 +135,9 @@ spec:
# THE BUILD DOCUMENT. There is no umbrella workflow and no agent brief:
# every phase is declared in it and orun runs it.
blueprint: repo-blueprint.yaml
# Summed from the phases' expectedMinutes (01-product 6, 02-docs 3). An
# estimate until a bootstrap measures it.
expectedMinutes: 9
# Summed from the phases' expectedMinutes (01-product 5, 02-docs 1). An
# estimate until a bootstrap of this shape measures it.
expectedMinutes: 6
tokenChannel: ORUN_TOKEN_FILE # how a runner hands over its refreshed token
# The API's URL per environment, as the console links it: the welcome route.
# The phases' own probes read /health on the same Worker.
Expand Down
Loading
Loading