From d82985ff0eb0b743bcdab723ec4498908c681fbf Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 09:34:10 +0000 Subject: [PATCH] =?UTF-8?q?EM6:=20the=20turso=20v8=20shape=20=E2=80=94=20o?= =?UTF-8?q?ne=20secrets=20hook,=20no=20Checks,=20docs=20in=20the=20catalog?= =?UTF-8?q?,=20tasks=20in=20the=20background,=20landings=20checked=20here?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit What sourceplane/turso-starter became across baseline-v6, v7 and v8, brought to the edge middleware recipes (one Worker, apps/recipes, and its test suite, tests/recipes; one Cloudflare provider; no infra, no wiring). A. One secrets hook. The two single-template reconciles (secret-workers-deploy, secret-account-id) are one `secrets` reconcile (orun >= v2.87.0): one connections read, one secrets read, the missing keys created side by side. Same provider and no other parameters, so they merge; keys, templates and order are the card's. manifest.test.sh reads the `secrets` form beside `keys`. phases.test.sh's rule "one key per reconcile" is replaced by the `secrets`-form rule (one hook per provider, named `secrets` when it is the only one, no two hooks with the same parameters). docs/phases and the card's comment name the one hook. B. No Checks workflow; docs in the catalog; recipes found. - checks.yml is gone. A product's pull requests verify through ci.yml's lanes, a bootstrap's landings in the box; the e2e tier runs the steps it ran (install, the fixture render, typecheck, lint, test, build) from its own LANDING_CHECKS list, and the leak gate no longer requires it. The PR lanes build, type-check and dry-deploy the Worker; recipes-tests' quick-check lane only installs and checks structure, so nothing in a product's CI lints or runs the tests. The product README, its operating contract and the card's outcome line ("A test per recipe, run with pnpm test", was "on every pull request") now say so. - Both components attach overview, architecture and runbook in spec.docs (the pages were already generated). recipes-tests gets a description; its overview is regenerated with gen-component-docs.py. - apps/recipes' domain is `app`, not `recipes`: the catalog keys a domain and a component by name, and a `recipes` domain hides the `recipes` component. - coverage.test.sh holds both rules (the three pages attached and present, a description, no domain named like a component). C. The fast shape on orun v2.88.0. - The run-level task set-up runs in the background (`background: true` on all five hooks); each phase's `task` moves from `pre` to `post`, just before `land`, so neither phase has a `pre` hook. - Both landings are `checks: local` and merge without waiting for CI. - The convergence watch reads every 5 s (was the action's 40). - No `pnpm-lockfile` hook: the shipped lockfile is installed frozen by the lanes and by the e2e tier. - 02-docs: no final probe and no narrate.await. The render asks the platform nothing (no `orun workspace`, `orun secrets list` or `orun integrations list`); the record names CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID (workspace scope) and the owner-set basic-auth pair (the project's stage and prod rungs), and points to the console's Secrets and Integrations pages. The "secrets inventory" wording follows. - No orun.secrets/exists await existed (nothing publishes wiring), so none is removed or kept; phases.test.sh's stricter rule (no such await without an infra component) stays. - expectedMinutes 6 + 2 -> 5 + 1, the card 8 -> 6, "about six minutes"; estimates, not measured on this shape. - Floor v2.88.0: BOOTSTRAP.md (with the `has no parameter "checks"` row) and baseline.yml's blueprint and product tiers — the e2e's offline bootstrap reads the blueprint, so the product tier takes the floor too. ci.yml's lane pin (v2.78.4) is unchanged. The blueprint job's setup-node asks for no pnpm cache: with the lockfile hook gone that job runs no pnpm, and setup-node v5's own cache would fail it on a missing store. - phases.test.sh: the hook order with no `pre` hook and the task before each landing, and the fast-shape rules (every preInstantiate hook background, no task-plane `pre` hook, every landing checks: local, the watch at most 10 s, no lockfile re-resolve). narrate.await is required where a phase awaits and refused where it awaits nothing. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01CJuLwDKfEaQGAEuBpJvN5Q --- .baseline/product/README.md | 11 +- .github/workflows/baseline.yml | 30 +++-- .github/workflows/checks.yml | 45 ------- BOOTSTRAP.md | 48 +++++--- README.md | 3 +- ai/context/deployment.md | 2 +- ai/context/operations.md | 7 +- apps/recipes/component.yaml | 12 +- blueprint.yaml | 29 ++--- docs/phases/01-product.md | 29 +++-- docs/phases/02-docs.md | 7 +- docs/phases/README.md | 52 ++++++--- hooks/render-deployment-docs.sh | 63 ++++------ repo-blueprint.yaml | 162 +++++++++++++++----------- testing/coverage.test.sh | 41 +++++++ testing/e2e.test.sh | 48 ++++---- testing/leak.test.sh | 2 +- testing/lib/bootstrap.sh | 4 +- testing/manifest.test.sh | 9 +- testing/phases.test.sh | 124 +++++++++++++++----- testing/placement.test.sh | 7 +- tests/recipes/component.yaml | 9 ++ tests/recipes/docs/overview.md | 2 + tooling/catalog/gen-component-docs.py | 7 +- 24 files changed, 454 insertions(+), 299 deletions(-) delete mode 100644 .github/workflows/checks.yml diff --git a/.baseline/product/README.md b/.baseline/product/README.md index 38a4221..e70fcb9 100644 --- a/.baseline/product/README.md +++ b/.baseline/product/README.md @@ -11,7 +11,7 @@ Vercel-only primitive underneath swapped for Cloudflare's. 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). @@ -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-` 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 diff --git a/.github/workflows/baseline.yml b/.github/workflows/baseline.yml index 8472486..2993b90 100644 --- a/.github/workflows/baseline.yml +++ b/.github/workflows/baseline.yml @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml deleted file mode 100644 index 408eed7..0000000 --- a/.github/workflows/checks.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Checks - -# Credential-free verification: install, render the offline wrangler fixtures, -# typecheck, lint, test and build, on every pull request, linked or not. -# `ci.yml` is the Orun pipeline beside it (plan/run with brokered Cloudflare -# credentials, deploys on merge); it plans nothing until intent.yaml names a -# workspace. -# -# PULL REQUESTS ONLY — not pushes to main. A push to main must start exactly -# one workflow, `ci.yml`, because a bootstrap's convergence watch -# (`orun.run/watch@v1` with `sha:`) takes the newest run for the merge commit -# from ANY workflow: with this one on push too, a watch can see this run go -# green while ci.yml's deploy lanes failed, and call the product converged. On -# main the convergence builds and typechecks the Worker anyway. -on: - pull_request: - workflow_dispatch: - -concurrency: - group: checks-${{ github.event_name == 'pull_request' && github.ref || github.run_id }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} - -permissions: - contents: read - -jobs: - checks: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - uses: pnpm/action-setup@v4 - with: - version: 10.12.1 - - uses: actions/setup-node@v5 - with: - node-version: 22 - cache: pnpm - - run: pnpm install --frozen-lockfile - # Templated deployables render their wrangler config from the committed - # fixture; an unresolved wiring token fails here, not at deploy time. - - run: pnpm run wire:fixture - - run: pnpm typecheck - - run: pnpm lint - - run: pnpm test - - run: pnpm build diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index 9b1a084..b805936 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -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 @@ -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 \ @@ -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`. @@ -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 /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 | diff --git a/README.md b/README.md index aed3a62..9b9dcff 100644 --- a/README.md +++ b/README.md @@ -140,8 +140,7 @@ its `app.use(, …)` 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 | diff --git a/ai/context/deployment.md b/ai/context/deployment.md index 573bc81..0cd2841 100644 --- a/ai/context/deployment.md +++ b/ai/context/deployment.md @@ -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). diff --git a/ai/context/operations.md b/ai/context/operations.md index b14d6ce..53ab6f4 100644 --- a/ai/context/operations.md +++ b/ai/context/operations.md @@ -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 @@ -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). diff --git a/apps/recipes/component.yaml b/apps/recipes/component.yaml index 58360e7..ab90929 100644 --- a/apps/recipes/component.yaml +++ b/apps/recipes/component.yaml @@ -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 diff --git a/blueprint.yaml b/blueprint.yaml index 4ae586b..789481d 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -24,7 +24,7 @@ metadata: user-agent rendering and Bloom-filter redirects, each a recipe under its own path on one Hono-routed Cloudflare Worker, with a test per recipe and CI that deploys it to stage and prod on merge. One provider, one consent, - one token, one landing. Live in about eight minutes. + one token, one landing. Live in about six minutes. tags: [middleware, hono, workers, cloudflare, recipes] spec: source: @@ -46,7 +46,7 @@ spec: outcome: - Live on stage and prod in one landing - Every merge redeploys, smoke-tested - - A test per recipe, on every pull request + - A test per recipe, run with pnpm test requires: # Cloudflare is the only provider connection a bootstrap needs. GitHub @@ -104,12 +104,13 @@ spec: # the fix, before anything is created. 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. + # ── PREVIEW ONLY. repo-blueprint.yaml's one `orun.integrations/reconcile@v1` + # hook (`secrets`) mints these, brokered, during 01-product. ────────────── + # Transcribed from that hook's own `secrets:` list (each key and its + # `template:`), in its order, 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. # # NOT here: BASIC_AUTH_USER / BASIC_AUTH_PASSWORD, the basic-auth recipe's # pair. No provider holds them, so the platform cannot broker them and the @@ -144,11 +145,13 @@ 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 (6 + 2): one landing whose PR - # waits on Checks and `plan`, one convergence of two deploy lanes (stage - # and prod side by side, a wrangler bundle each — no framework build), - # then the record. An estimate until a bootstrap measures it. - expectedMinutes: 8 + # Summed from the phases' expectedMinutes (5 + 1): one landing checked + # in the box (`orun validate` and `orun plan`, no runner waited for) + # while the task set-up runs in the background, one convergence of two + # deploy lanes (stage and prod side by side, a wrangler bundle each — no + # framework build), then the record, checked the same way. An estimate + # until a bootstrap of this shape measures it. + expectedMinutes: 6 tokenChannel: ORUN_TOKEN_FILE # how a runner hands over its refreshed token verify: urls: diff --git a/docs/phases/01-product.md b/docs/phases/01-product.md index 479e7c5..6f774af 100644 --- a/docs/phases/01-product.md +++ b/docs/phases/01-product.md @@ -1,8 +1,9 @@ # 01-product — the product, in one landing -**Places** every module: the root manifests, CI (`ci.yml`, `checks.yml`), -tooling, the identity file, the two context pages, `apps/recipes` (the -Worker of recipes and its deploy contract) and `tests/recipes` (vitest). Then +**Places** every module: the root manifests, CI (`ci.yml` — the baseline's +own `baseline.yml` and `tag.yml` are ignored), tooling, the identity file, +the two context pages, `apps/recipes` (the Worker of recipes and its deploy +contract) and `tests/recipes` (vitest). Then it creates the repository, lands all of it as ONE pull request, and watches the ONE convergence that merge triggers deploy the Worker to stage and prod. @@ -14,9 +15,12 @@ it waits. ## What runs +The run's task set-up — the epic, both milestones, both tasks — runs in the +background from the start (`background: true`), so every hook up to `task` +runs beside it; `task` is the first that waits for it. + | hook | what it does | |---|---| -| `task` (pre) | finds the phase's task and yields its key | | `retouch` | the redeploy marker on `apps/recipes/component.yaml` and `tests/recipes/component.yaml` (`.baseline/tasks/01-product.TaskContract.yaml`'s `affects`) | | `git-init`, `git-stage` | the tree becomes a repository with a populated index (`rebrand` reads `git ls-files`) | | `rebrand` | the identity rename: the repo slug, `SITE_NAME` and `SOURCE_URL` in `apps/recipes/src/site.ts`, the Worker name `-recipes`, the domain, the workers.dev subdomain, the runtime secrets' refs | @@ -24,12 +28,12 @@ it waits. | `work-tree` | strips the baseline's `work:` block from `intent.yaml` | | `promotion`, `dev-lanes` | defer prod's wait on stage and dev's push activation until `02-docs` | | `git-restage`, `rebrand-verify` | the residue sweep over the rewritten tree | -| `pnpm-lockfile` | confirms the complete lockfile (`--lockfile-only`) | | `repo` | `orun.repo/ensure@v1` — creates `/` (pre-created is supported) | | `link` | links the repository to the workspace, best effort, and stops naming the fix if `orun cloud check` says it is not | -| `secret-workers-deploy`, `secret-account-id` | `orun.integrations/reconcile@v1` — `CLOUDFLARE_API_TOKEN` (`workers-deploy`) and `CLOUDFLARE_ACCOUNT_ID` (`account-id`), brokered; keys that exist are kept | -| `land` | one PR, merged once its CI is green (Checks, and `plan` — the lanes are skipped on a bootstrap branch) | -| `converge` (await) | `orun.run/watch@v1` on the merge commit's run (only `ci.yml` runs on a push to main); resumes it up to three times | +| `secrets` | `orun.integrations/reconcile@v1`, both keys in one hook, created side by side: `CLOUDFLARE_API_TOKEN` from the `workers-deploy` template (Workers Scripts, the Worker's deploy); `CLOUDFLARE_ACCOUNT_ID`, the connection fact; keys that exist are kept | +| `task` | finds the phase's task (opened by the run-level list) and yields its key — waiting, if it must, for the background set-up | +| `land` | one PR bound to the task, its commit checked in the box first (`checks: local`: `orun validate`, then `orun plan` as the PR and as the merge would plan it, under a second); merged without waiting for the PR's CI | +| `converge` (await) | `orun.run/watch@v1` on the merge commit's run (only `ci.yml` runs on a push to main), read every 5 s; resumes it up to three times | | `verify` (await) | `orun.http/probe@v1` on both workers.dev URLs | There is no `orun.secrets/exists@v1` in the await: no infra component, so no @@ -58,6 +62,14 @@ deploy lane: `{"message":"hello world!"}`, retried with backoff for workers.dev propagation. +`recipes-tests` verifies on dev only, on a pull request, and there its lane +installs and checks the package's structure; it does not run the tests. The +landing's own pull request runs `plan` alone, and nothing waits for it — the +same plan ran in the box before the push. The baseline's own CI ran the +typecheck, lint and tests on this exact tree before the tag was cut; in the +product they are `pnpm typecheck`, `pnpm lint` and `pnpm test`, run before a +push. + ## Verified The convergence run for the merge commit is green, and @@ -74,5 +86,6 @@ The convergence run for the merge commit is green, and | deploy lane: Authentication error (10000) | the connection's token lacks Workers Scripts Write. Re-issue it with the permission groups the console's Connect recipe lists | | smoke fails right after the FIRST deploy | workers.dev route propagation; the composition retries the first deploy and the smoke with backoff (stack-tectonic ≥ 0.19.0). A convergence resume clears what is left | | the watch says green, the probe says 404 | another workflow ran on the push and the watch took its run. Only `ci.yml` may run on a push to main | +| `land`: `the landing's own check failed — orun plan for …` | the placed tree does not plan; the next line is orun's error. Nothing was pushed. Fix it and re-run the phase | | `/basic-auth-password` answers 503 | expected on a fresh product: its owner has not set `BASIC_AUTH_USER` / `BASIC_AUTH_PASSWORD` (the product README, "Secrets") | | re-run lands nothing | the hooks did not run (`--run-hooks`), or the contract names no component — `node tooling/bootstrap/retouch.mjs --check --affects .baseline/tasks/01-product.TaskContract.yaml` in the product's tree says which | diff --git a/docs/phases/02-docs.md b/docs/phases/02-docs.md index 7072d37..b7b5827 100644 --- a/docs/phases/02-docs.md +++ b/docs/phases/02-docs.md @@ -11,12 +11,11 @@ no phase may require this one.) | hook | what it does | |---|---| -| `task` (pre) | finds the phase's task and yields its key | | `promotion` | restores `environments.prod.promotion` — from now on prod deploys only after stage | | `dev-lanes` | restores dev's activation on pushes to main | -| `render` | `hooks/render-deployment-docs.sh`: probes `/`, `/json-response` and `/basic-auth-password` on both environments (the last says whether the basic-auth pair is set), lists the secrets by name and the workspace's integrations, and regenerates `ai/context/deployment.md` and the README's live-deployment section | -| `land` | one PR, waited for and merged. It touches no component, so it deploys nothing | -| `verify` (await) | the same probe `01-product` ended on | +| `render` | `hooks/render-deployment-docs.sh`: probes `/`, `/json-response` and `/basic-auth-password` on both environments (the last says whether the basic-auth pair is set) and regenerates `ai/context/deployment.md` — the identity, the probed URLs, the secrets the deployment uses by name — and the README's live-deployment section. It asks the platform nothing: what the workspace holds right now is on the console's Secrets and Integrations pages, which the record points to | +| `task` | finds the phase's task and yields its key | +| `land` | one PR, its commit checked in the box (`checks: local`) and merged. It touches no component, so it deploys nothing — and there is nothing after it to wait for: the render's probes are the phase's check | ## Re-running it diff --git a/docs/phases/README.md b/docs/phases/README.md index 056c46d..3a78238 100644 --- a/docs/phases/README.md +++ b/docs/phases/README.md @@ -8,11 +8,15 @@ one at a time with `--phase `, or the whole sequence unattended with is a selection on one artifact, which is what makes running one alone, months later, from a fresh container the same operation as running them all. -Each phase follows the same contract: +The product phase follows the contract every deploying phase does: -> **place its modules → brand them → land them as one pull request → watch -> the convergence that merge triggers (auto-resumed) → verify the outcome -> over HTTP.** +> **place its modules → brand them → check them in the box and land them as +> one pull request → watch the convergence that merge triggers +> (auto-resumed) → verify the outcome over HTTP.** + +The run's task set-up — the epic, a milestone per phase, a task per landing +— runs in the background from the start; the first hook that needs it, the +phase's `task`, waits for it. Run from the baseline checkout (the blueprint's source is `path: .`); the product's repository is wherever `--out` points. @@ -24,11 +28,17 @@ states it in the document: the engine refuses a phase whose predecessor is not placed, and names it. Every landing is a pull request on a branch named for its task -(`orun/BASE--`). On those branches `ci.yml` runs `plan` only — the -intent, every component and every composition resolve — and skips the lanes, +(`orun/BASE--`), checked before it is pushed: `orun validate`, then +`orun plan` as the pull request and as the merge would plan it, in the box, +in under a second (`checks: local`). Then it merges; nothing waits for the +PR's CI. On those branches `ci.yml` runs `plan` only and skips the lanes, because the merge runs them on main a minute later, for real, and that -convergence is what `01-product` watches. `checks.yml` (install, typecheck, -lint, test, build) runs on every pull request regardless. +convergence is what `01-product` watches. The product carries no other +workflow: the baseline's own CI (Tier 2) installs, renders the fixtures, +type-checks, lints, tests and builds this landing before a tag is cut. A +later pull request in the product runs `ci.yml`'s verify lanes, which build, +type-check and dry-deploy the Worker; they do not lint or run the tests, so +its developers run those before a push. | phase | lands | verified by | |---|---|---| @@ -45,7 +55,9 @@ the code changes with it; the repository names the domain only in There is no infra either: the Worker's bindings are vars, a rate limiting binding `wrangler deploy` creates, and owner-seeded secrets. Nothing is provisioned before the Worker, nothing lease-publishes a `WIRING_*` secret, -and `01-product`'s await has no secrets check. +and `01-product`'s await has no secrets check. `02-docs` awaits nothing: its +render probes every URL as it writes the record, and its landing redeploys +nothing. ## Inputs @@ -103,21 +115,27 @@ lands, its `post` hooks make them the product's: side, and dev stays off main, until `02-docs` puts both back). 4. `git-restage`, `rebrand --verify` — a sweep that fails on any of this baseline's identity left behind. -5. `pnpm install --lockfile-only` — confirms the complete lockfile - `root-pnpm-lock` placed. -6. `orun.repo/ensure@v1`, then `link` — the repository exists and is the +5. `orun.repo/ensure@v1`, then `link` — the repository exists and is the workspace's before anything lands in it. -7. `orun.integrations/reconcile@v1`, once per brokered key — - `CLOUDFLARE_API_TOKEN` (`workers-deploy`) and `CLOUDFLARE_ACCOUNT_ID` - (`account-id`). -8. `orun.pr/land@v1` — the one pull request, merged once its checks are green. +6. `secrets` — one `orun.integrations/reconcile@v1` for both brokered keys, + created side by side: `CLOUDFLARE_API_TOKEN` (`workers-deploy`) and + `CLOUDFLARE_ACCOUNT_ID` (`account-id`). +7. `task` — the phase's task found (waiting, if it must, for the background + set-up), and its key. +8. `orun.pr/land@v1` — the one pull request, its commit checked in the box + (`checks: local`) and merged. + +The baseline's complete lockfile ships as it is: it carries no identity, and +the lanes install it with `--frozen-lockfile`, as the baseline's own CI does +on this exact tree before a tag. `testing/phases.test.sh` holds this order. ## When a phase fails - **Before it lands** (a probe that timed out, a rebrand residue, a refused - link): nothing was merged. Fix what the message names and re-run the phase. + link, a tree the landing's own `orun plan` refuses): nothing was merged. + Fix what the message names and re-run the phase. - **After it lands** (the convergence went red): the files are on main. `orun.run/watch@v1` has already resumed the run up to three times. Re-run the phase (`--phase 01-product`, `--redo 01-product` under `--resume`, or diff --git a/hooks/render-deployment-docs.sh b/hooks/render-deployment-docs.sh index b5180d3..7eec4e0 100755 --- a/hooks/render-deployment-docs.sh +++ b/hooks/render-deployment-docs.sh @@ -9,15 +9,22 @@ # # What it writes (in ): # ai/context/deployment.md — REGENERATED: URLs with live probe results, -# identity, secrets inventory BY NAME, -# integrations +# identity, and the secrets the deployment +# uses BY NAME # ai/context/operations.md — healed from the baseline's copy if absent # (the static operating contract; never rewritten) # README.md — the section between # is replaced (appended after the title if the # README predates the markers) # -# No secret VALUE is ever read or written here — inventories are names only. +# No secret VALUE is ever read or written here — secrets are named, not read. +# +# IT ASKS THE PLATFORM NOTHING. The record used to carry the workspace's slug, +# its secrets listed per rung and its integrations — five CLI calls, one after +# another, from the build box — and all of it is what the console shows live +# and this file could only show as it was the day it was written. The record +# keeps what the repository is the right place for: the identity the code +# names, what answered at the URLs, and where to look for the rest. set -euo pipefail out="${1:?usage: render-deployment-docs.sh }" @@ -35,10 +42,6 @@ sub="$(val subdomain)"; [ -n "$sub" ] || sub="your-workers-subdomain" [ -n "$ws" ] || ws="$(sed -n 's/^[[:space:]]*workspace:[[:space:]]*\([^[:space:]#]*\).*/\1/p' intent.yaml | head -1)" [ -n "$ws" ] || ws="?" -# Workspace slug via the direct backend read; tolerate failure. -slug="$( { orun workspace "$ws" 2>/dev/null || true; } | sed -n 's/^ *slug: *//p' | head -1)" -[ -n "$slug" ] || slug="?" - # CI lane pin (what version the deploy lanes run). lanepin="$(sed -n 's/^ *version: *\(v[0-9.]*\) *$/\1/p' .github/workflows/ci.yml 2>/dev/null | head -1)" [ -n "$lanepin" ] || lanepin="?" @@ -65,17 +68,6 @@ for env in stage prod; do rows+="| basic-auth-password (${env}) | ${url}/basic-auth-password | $(auth_badge "$(probe "$url/basic-auth-password")") |"$'\n' done -secrets_list() { { orun secrets list --org "$ws" "$@" 2>/dev/null || true; } | awk 'NR>1 && NF {print " - "$1}'; } -secrets_proj="$(secrets_list --project)"; [ -n "$secrets_proj" ] || secrets_proj=" - (listing unavailable to this credential)" -secrets_stage="$(secrets_list --env stage)"; [ -n "$secrets_stage" ] || secrets_stage=" - (listing unavailable to this credential)" -secrets_prod="$(secrets_list --env prod)"; [ -n "$secrets_prod" ] || secrets_prod=" - (listing unavailable to this credential)" -integrations="$( { orun integrations list --org "$ws" --json 2>/dev/null || true; } | python3 -c " -import json,sys -try: rows=json.load(sys.stdin) -except Exception: rows=[] -out=[f\" - {r.get('provider','?')}: {r.get('status','?')}\" for r in rows] -print('\n'.join(out) if out else ' - (listing unavailable to this credential)')" )" - now="$(date -u +%Y-%m-%dT%H:%M:%SZ)" # Heal the static operating contract when the product predates it. @@ -92,15 +84,14 @@ cat > ai/context/deployment.md < GENERATED by the \`02-docs\` phase on ${now}; re-run it to refresh > (idempotent; see [operations.md](operations.md)). Hand-edits here are -> overwritten. No secret values appear in this file — inventories are names -> only. +> overwritten. No secret values appear in this file — secrets are named only. ## Identity | | | |---|---| | repository / project slug | \`${repo}\` | -| Orun workspace | \`${ws}\` (slug \`${slug}\`) | +| Orun workspace | \`${ws}\` | | declared in | \`intent.yaml\` → \`execution.state.workspace\` | | Workers | \`${brand}-recipes-stage\`, \`${brand}-recipes-prod\` on \`${sub}.workers.dev\` | | CI lane CLI pin | orun \`${lanepin}\` (\`.github/workflows/ci.yml\`) | @@ -113,26 +104,18 @@ ${rows} Every recipe answers under its own path on the same Worker (\`/\` lists them). The \`dev\` environment is verify-only by design — no deployed URL. -## Secrets inventory (names only) - -Project rung: -${secrets_proj} +## Secrets (names only) -Environment \`stage\`: -${secrets_stage} - -Environment \`prod\`: -${secrets_prod} - -Provider secrets are BROKERED (minted per run from the workspace's Cloudflare -connection; no long-lived values at rest). \`BASIC_AUTH_USER\` and -\`BASIC_AUTH_PASSWORD\` are the owner's to set per environment (see -[operations.md](operations.md)); until both are, the basic-auth recipe -answers its setup page. - -## Workspace integrations +| secret | where | what it is | +|---|---|---| +| \`CLOUDFLARE_API_TOKEN\` | the workspace | BROKERED from its Cloudflare connection (\`workers-deploy\`): deploys the Worker and pushes any runtime secret its owner seeds | +| \`CLOUDFLARE_ACCOUNT_ID\` | the workspace | the connection's account id — a fact, not a credential | +| \`BASIC_AUTH_USER\`, \`BASIC_AUTH_PASSWORD\` | \`${repo}\` on stage and on prod, when set | the basic-auth recipe's pair, the owner's to set per environment (see [operations.md](operations.md)); until both are, that recipe answers its setup page | -${integrations} +Brokered secrets are minted per run, so no long-lived value is at rest. What +the workspace holds right now (every secret by name, and its integrations +and their health) is on the console's Secrets and Integrations pages for +\`${ws}\`. ## How this deployment changes @@ -146,7 +129,7 @@ python3 - <<'PY' import re begin, end = "", "" body = f"""{begin} -This product is **live**. Verified URLs, identity and the secrets inventory +This product is **live**. Verified URLs, identity and the secrets it uses are recorded in [ai/context/deployment.md](ai/context/deployment.md) (re-rendered by the `02-docs` phase); how it deploys and how to operate it: [ai/context/operations.md](ai/context/operations.md). diff --git a/repo-blueprint.yaml b/repo-blueprint.yaml index 6cc4332..1dc441c 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -182,6 +182,10 @@ modules: source: baseline from: pnpm-workspace.yaml to: pnpm-workspace.yaml + # The baseline's complete lockfile, as it is: the whole tree lands at once + # and the lockfile carries no identity, so there is nothing to re-resolve — + # the lanes install it with --frozen-lockfile, and the baseline's own CI + # (testing/e2e.test.sh) does the same on this exact tree before a tag. - name: root-pnpm-lock mode: copy source: baseline @@ -296,16 +300,25 @@ modules: # new milestone after the last, and a task naming a milestone the epic does # not have yet would create it out of order. # -# Each phase's own `pre` hook runs `orun.task/ensure@v1` on its task again. -# Same identity, so it finds rather than creates, and it is how the phase gets -# the task's KEY for its landing. The MILESTONE keeps the phase's name: it is -# the identity the engine's phase events, the plane's evidence and the -# console's rows all meet on, and the card's `programme.milestones` names the -# same list. +# IN THE BACKGROUND (orun >= v2.88.0, `background: true` on every hook here). +# Nothing a phase does before its landing reads the task plane — the provider +# check, the placement, the rebrand, the repository, the secrets — so the +# whole list runs beside 01-product instead of before it, in order. A hook +# that works on the plane (`orun.task/ensure@v1`, `orun.pr/land@v1`) waits +# for it to finish; a failure here stops the build at the next hook. +# +# Each phase's own `task` hook runs `orun.task/ensure@v1` on its task again, +# just before its landing. Same identity, so it finds rather than creates, +# and it is how the phase gets the task's KEY for its landing; it sits in +# `post` rather than `pre` so that everything before it overlaps with this +# list. The MILESTONE keeps the phase's name: it is the identity the engine's +# phase events, the plane's evidence and the console's rows all meet on, and +# the card's `programme.milestones` names the same list. hooks: preInstantiate: - id: epic uses: orun.task/ensure@v1 + background: true with: kind: epic slug: "{{ .inputs.epicSlug }}" @@ -320,6 +333,7 @@ hooks: owner: me - id: m01 uses: orun.task/ensure@v1 + background: true with: kind: milestone epic: "{{ .inputs.epicSlug }}" @@ -330,6 +344,7 @@ hooks: - the Worker deployed on stage and prod, its smoke green, the index answering on both workers.dev URLs - id: m02 uses: orun.task/ensure@v1 + background: true with: kind: milestone epic: "{{ .inputs.epicSlug }}" @@ -339,6 +354,7 @@ hooks: - prod waits on stage again - id: t01 uses: orun.task/ensure@v1 + background: true with: kind: task epic: "{{ .inputs.epicSlug }}" @@ -354,6 +370,7 @@ hooks: contract: .baseline/tasks/01-product.TaskContract.yaml - id: t02 uses: orun.task/ensure@v1 + background: true with: kind: task epic: "{{ .inputs.epicSlug }}" @@ -386,7 +403,13 @@ phases: - name: 01-product title: The product, built in one landing description: The whole tree — manifests, CI, tooling, identity, the Worker of recipes and its tests — branded, landed as one pull request, and deployed by one convergence. - expectedMinutes: 6 + # An estimate, not a measurement of this shape: a minute under the 6 it + # was, for what v2.88.0 takes out of the wait — the task set-up in the + # background, the landing checked here instead of by a runner, the watch + # reading every 5 s instead of 40 (about a minute on turso-starter's + # measured build). The rest is the merge's convergence: a wrangler bundle, + # deploy and smoke, stage and prod side by side. + expectedMinutes: 5 narrate: start: "Creating the repository and landing the whole product in one pull request — intent, CI, tooling, the Worker of thirteen recipes and its tests. Then one convergence deploys the Worker to stage and prod. Usually about {{ .meta.expectedMinutes }} minutes." await: "One convergence is deploying the Worker to stage and prod side by side, each deploy smoke-tested over HTTP. Nothing is stuck." @@ -411,21 +434,6 @@ phases: waitSeconds: 600 pollSeconds: 20 hooks: - pre: - # The epic, the milestones and the tasks already exist (the run-level - # list above). This finds the task and yields its key, which the - # landing binds the pull request to. (Under an orun older than v2.60, - # which has no run-level list, this hook is what creates the task — - # same identity, same result.) - - id: task - uses: orun.task/ensure@v1 - with: - kind: task - epic: "{{ .inputs.epicSlug }}" - milestone: "{{ .phase.name }}" - name: "Build the product in one landing" - prefix: BASE - contract: .baseline/tasks/01-product.TaskContract.yaml # The identity chain. The end of 01-product is the moment the whole tree # is placed. rebrand.mjs enumerates the tree with `git ls-files`, so the # output has to be a git repository with a populated index BEFORE it @@ -499,12 +507,6 @@ phases: run: ["git", "add", "-A"] - id: rebrand-verify run: ["node", "{{ .baseline.dir }}/tooling/rebrand/rebrand.mjs", "--verify", "--values", ".rebrand/values.json"] - # root-pnpm-lock places the baseline's complete lockfile and the whole - # tree is here, so this only confirms it (a no-op). The lanes and - # Checks install with --frozen-lockfile. The lockfile carries no - # identity. - - id: pnpm-lockfile - run: ["pnpm", "install", "--lockfile-only"] # The repo has to exist before there is anywhere to land. - id: repo uses: orun.repo/ensure@v1 @@ -533,31 +535,49 @@ phases: - link - "{{ .inputs.orunWorkspace }}" - "{{ .inputs.githuborg }}/{{ .inputs.reponame }}" - # The deploy credentials, brokered, one hook per template: - # `integrations/reconcile` mints from ONE connection with ONE scope - # template. The deploy lane binds both keys (the cloudflare-worker-turbo - # composition's deploy `secretBindings`). Keys that already exist are - # kept. After the link, before the landing whose convergence uses - # them. The basic-auth pair is NOT here: no provider holds it, so it is - # the owner's to seed (the component's `optionalSecretEnv`). - - id: secret-workers-deploy + # The deploy credentials, brokered, in ONE hook (orun >= v2.87.0): + # `secrets` mints each key under its own scope template from the one + # connection the build is bound to, reading the connections and the + # existing secrets once and creating the missing keys side by side. + # `workers-deploy` is the Worker's deploy (Workers Scripts); the + # account id is a connection fact. The deploy lane binds both keys + # (the cloudflare-worker-turbo composition's deploy `secretBindings`). + # Keys that already exist are kept. After the link, before the landing + # whose convergence uses them. The basic-auth pair is NOT here: no + # provider holds it, so it is the owner's to seed (the component's + # `optionalSecretEnv`). + - id: secrets uses: orun.integrations/reconcile@v1 with: provider: cloudflare - keys: [CLOUDFLARE_API_TOKEN] - template: workers-deploy - - id: secret-account-id - uses: orun.integrations/reconcile@v1 + secrets: + - { key: CLOUDFLARE_API_TOKEN, template: workers-deploy } + - { key: CLOUDFLARE_ACCOUNT_ID, template: account-id } + # The task this landing closes, and its key. The run-level list above + # opens it in the background; this is the first hook that needs it, + # so it is the one that waits for that list (orun >= v2.88.0) — every + # hook before it ran while the task plane was still being set up. + - id: task + uses: orun.task/ensure@v1 with: - provider: cloudflare - keys: [CLOUDFLARE_ACCOUNT_ID] - template: account-id - # THE PRODUCT IS A PULL REQUEST THAT IS CHECKED, THEN MERGED. This - # landing waits for its PR's whole CI run (orun >= v2.58.6): Checks - # over the product, and `plan` — on a bootstrap branch (`orun/BASE-…`) - # the lanes are skipped (ci.yml), because the merge runs them on main - # a minute later, for real, and the convergence after the merge is - # what the `await` below watches to green. + kind: task + epic: "{{ .inputs.epicSlug }}" + milestone: "{{ .phase.name }}" + name: "Build the product in one landing" + prefix: BASE + contract: .baseline/tasks/01-product.TaskContract.yaml + # THE PRODUCT IS A PULL REQUEST THAT IS CHECKED, THEN MERGED — checked + # HERE (`checks: local`, orun >= v2.88.0): `orun validate`, then + # `orun plan` as the pull request and as the merge to main plan it, + # on the commit, before it is pushed. That is what the PR's `plan` + # job checks (the intent, every component and every composition + # resolve), plus the merge's own plan, in under a second instead of a + # runner's ~25 s. A tree that fails is never pushed. The PR's CI still + # runs (`plan` alone on a bootstrap branch, `orun/BASE-…`, ci.yml); + # nothing waits for it. The merge runs every lane on main a minute + # later, for real, and that convergence is what `await` watches. (The + # typecheck, lint and tests ran over this same tree in Baseline CI's + # e2e tier before the tag.) - id: land uses: orun.pr/land@v1 narrate: "The product is merged into main." @@ -566,6 +586,7 @@ phases: epic: "{{ .inputs.epicSlug }}" branchSlug: "{{ .phase.name }}" title: "feat: {{ .inputs.productname }}, the Edge Middleware recipes on one Worker" + checks: local await: - id: converge uses: orun.run/watch@v1 @@ -578,6 +599,9 @@ phases: repo: "{{ .inputs.githuborg }}/{{ .inputs.reponame }}" resumeBudget: 3 waitSeconds: 1800 + # Read every 5 s, not the action's 40: the build goes on the + # moment the run is green instead of up to 40 s after it. + pollSeconds: 5 # No `orun.secrets/exists@v1` here: there is no infra component, so # nothing lease-publishes a WIRING_* secret and nothing waits on one. - id: verify @@ -589,31 +613,23 @@ phases: - "https://{{ .inputs.reponame }}-recipes-prod.{{ .inputs.subdomain }}.workers.dev" # Places nothing. It records what 01-product built, from PROBED facts - # rather than from what the blueprint intended — which is why it runs last - # and why its verify is the probe 01-product ends on. + # rather than from what the blueprint intended — which is why it runs last. + # Its render probes every URL as it writes the record, and this landing + # redeploys nothing, so there is no probe after it to wait for. - name: 02-docs title: The deployment, recorded description: The live-deployment manifest, rendered from probed reality, and the promotion gate and dev's lanes put back. - expectedMinutes: 2 + # An estimate, not a measurement: the render's probes, the task found, + # the commit checked here and merged — nothing built, nothing waited on. + expectedMinutes: 1 narrate: start: "Now recording what was actually built — probing every URL and writing the deployment manifest into the repository." - await: "Probing the live endpoints one last time." done: "ai/context/deployment.md now records the live deployment, written from probed facts, and prod waits on stage again. {{ .meta.elapsed }}." failed: "The deployment record did not land. The Worker is still live; only the write-up is missing." modules: [] requires: phases: [01-product] hooks: - pre: - - id: task - uses: orun.task/ensure@v1 - with: - kind: task - epic: "{{ .inputs.epicSlug }}" - milestone: "{{ .phase.name }}" - name: "Record the live deployment" - prefix: BASE - contract: .baseline/tasks/02-docs.TaskContract.yaml post: # THE PRODUCT GOES LIVE WITH ITS PROMOTION GATE. 01-product deferred # `prod.promotion.dependsOn: [stage]`; this, the last landing, puts it @@ -628,6 +644,17 @@ phases: run: ["node", "{{ .baseline.dir }}/tooling/bootstrap/dev-lanes.mjs", "--restore"] - id: render run: ["bash", "{{ .baseline.dir }}/hooks/render-deployment-docs.sh", ".", "{{ .inputs.orunWorkspace }}", "{{ .baseline.dir }}"] + - id: task + uses: orun.task/ensure@v1 + with: + kind: task + epic: "{{ .inputs.epicSlug }}" + milestone: "{{ .phase.name }}" + name: "Record the live deployment" + prefix: BASE + contract: .baseline/tasks/02-docs.TaskContract.yaml + # Checked here and merged, as 01-product's landing is; nothing here + # builds. - id: land uses: orun.pr/land@v1 narrate: "The deployment record is merged into main." @@ -636,11 +663,4 @@ phases: epic: "{{ .inputs.epicSlug }}" branchSlug: "{{ .phase.name }}" title: "docs(deployment): record the live deployment state" - await: - - id: verify - uses: orun.http/probe@v1 - narrate: "Every live URL answered on the final probe." - with: - urls: - - "https://{{ .inputs.reponame }}-recipes-stage.{{ .inputs.subdomain }}.workers.dev" - - "https://{{ .inputs.reponame }}-recipes-prod.{{ .inputs.subdomain }}.workers.dev" + checks: local diff --git a/testing/coverage.test.sh b/testing/coverage.test.sh index 4afc1c5..a4e3b45 100755 --- a/testing/coverage.test.sh +++ b/testing/coverage.test.sh @@ -95,6 +95,47 @@ for comp in BASELINE_ONLY: if not (root / comp).exists(): bad(f"{comp} is declared baseline-only and does not exist — drop the entry") +# ── WHAT THE CATALOG SEES OF EACH COMPONENT ─────────────────────────────── +# +# Every component ships its generated pages (overview, architecture, runbook) +# and must ATTACH them in `spec.docs`: a `docs/` folder no manifest declares is +# never attached, so a fresh product's Docs library showed nothing for any +# component and the catalog failed every one of them on docs and on runbook. +# A component also needs a description: it is the catalog's one-line answer to +# "what is this", and the test suite had none. +# +# And a domain may not share a component's name. The catalog keys entities by +# name, so a `recipes` domain (`spec.domain: recipes`) takes the `recipes` +# component's place, and the product's one deployable goes missing from its +# own catalog (as the live builds of turso-starter and portfolio-starter-kit, +# built the same way with a `web` domain, showed). +WANT_DOCS = {"overview": "docs/overview.md", "architecture": "docs/architecture.md", "runbook": "docs/runbook.md"} +names, domains = {}, {} +for comp in components: + if comp in BASELINE_ONLY: + continue + doc = yaml.safe_load((root / comp / "component.yaml").read_text()) or {} + meta, spec = doc.get("metadata") or {}, doc.get("spec") or {} + names[meta.get("name")] = comp + if spec.get("domain"): + domains.setdefault(spec["domain"], comp) + if not (meta.get("description") or "").strip(): + bad(f"{comp}/component.yaml has no metadata.description — the catalog shows the component with nothing to say") + docs = spec.get("docs") or {} + got = {"overview": docs.get("overview")} + for page in docs.get("pages") or []: + got[page.get("role")] = page.get("path") + for role, path in WANT_DOCS.items(): + if got.get(role) != path: + bad(f"{comp}/component.yaml does not attach {path} as its {role} " + f"(spec.docs) — the page ships and the catalog never sees it") + elif not (root / comp / path).is_file(): + bad(f"{comp}/component.yaml attaches {path}, which does not exist") +for domain, comp in sorted(domains.items()): + if domain in names: + bad(f"{comp} declares domain `{domain}`, which is also the name of the " + f"component in {names[domain]} — the catalog keeps one of the two") + # ── WHAT `ignore` ACTUALLY EXCLUDES (BE6) ────────────────────────────────── # # orun matches an ignore entry two ways, and WHICH ONE depends on the entry: diff --git a/testing/e2e.test.sh b/testing/e2e.test.sh index 205c795..eed7576 100755 --- a/testing/e2e.test.sh +++ b/testing/e2e.test.sh @@ -4,12 +4,17 @@ # placement.test.sh proves the tree a bootstrap ends with is the right tree. # This proves it WORKS, by doing to it what its own pipelines will: # -# 1. at the 01-product landing (the commit its one pull request merges), run -# what `checks.yml` runs on that PR — install with the placed lockfile, -# render fixtures, typecheck, lint, test, build — read out of the -# workflow the product carries. That landing WAITS on its checks, so a -# product they refuse is a bootstrap that never lands. 02-docs, the only -# later landing, must touch nothing those checks read; +# 1. at the 01-product landing (the commit its one pull request merges), +# the landing's own checks — install with the lockfile the product +# ships, render fixtures, typecheck, lint, test, build. The landing is +# checked in the box with `orun validate` and `orun plan` alone +# (`checks: local`; its PR's CI on an `orun/BASE-*` branch is `plan` +# alone), and a later pull request of the product runs ci.yml's verify +# lanes, which build, type-check and dry-deploy the Worker but neither +# lint nor test it — so THIS is where a product those steps refuse is +# caught: before the tag, not after a build has merged it. 02-docs, the +# only later landing, must touch nothing those checks read, so the +# finished product passes them too; # 2. the stage lane's own steps, EXACTLY as the product's `orun plan` for # that pull request renders them (the PR-trigger plan: `deploy-dry-run` # is not in the deploy profile, so it is the plan that carries every @@ -41,7 +46,8 @@ # # Needs: orun, node, pnpm, python3 (+PyYAML), git, curl, setsid, and the # network for `pnpm install` (or a warm store). A few minutes: two installs -# and two Worker bundles. +# and two Worker bundles (the landing's checks over the product, and the +# stage lane's own in its staged tree). set -euo pipefail here="$(cd "$(dirname "$0")" && pwd)" root="$(cd "$here/.." && pwd)" @@ -76,24 +82,26 @@ values="$here/fixtures/acme.json" repo="$(python3 -c "import json,sys;print(json.load(open(sys.argv[1]))['reponame'])" "$values")" export CI=1 WRANGLER_SEND_METRICS=false TURBO_TELEMETRY_DISABLED=1 -# What checks.yml runs, step for step, read out of the workflow the product -# carries so the two cannot drift: every `run:` of its one job, in order. +# The landing's own checks, step for step, run here at once on the whole +# tree. A pull request in the product builds, type-checks and dry-deploys the +# Worker through ci.yml's lanes; the lint and the tests run here, and by hand +# before a push. +LANDING_CHECKS=( + "pnpm install --frozen-lockfile" + "pnpm run wire:fixture" + "pnpm typecheck" + "pnpm lint" + "pnpm test" + "pnpm build" +) checks() { # DIR LOG local dir="$1" log="$2" cmd - while IFS= read -r cmd; do + for cmd in "${LANDING_CHECKS[@]}"; do echo " \$ $cmd" | tee -a "$log" if ! (cd "$dir" && bash -c "$cmd") >> "$log" 2>&1; then echo "FAIL: \`$cmd\` failed in $dir" >&2; tail -40 "$log" >&2; return 1 fi - done < <(python3 - "$dir/.github/workflows/checks.yml" <<'PY' -import sys, yaml -wf = yaml.safe_load(open(sys.argv[1])) -for job in wf["jobs"].values(): - for step in job["steps"]: - if "run" in step: - print(step["run"].strip()) -PY -) + done } # A free port for each wrangler dev, so a run never collides with another @@ -123,7 +131,7 @@ echo " 2 phases placed and landed" s01="$(git -C "$tree" rev-parse HEAD~1)" # ── 1. the product's own pull request ────────────────────────────────────── -echo "── 01-product's landing, under the checks its PR waits on" +echo "── 01-product's landing: install, the fixture render, typecheck, lint, test, build" git -C "$tree" worktree add -q "$scratch/at-01" "$s01" checks "$scratch/at-01" "$scratch/checks-01.log" later="$(git -C "$tree" diff --name-only "$s01" HEAD)" diff --git a/testing/leak.test.sh b/testing/leak.test.sh index 8a4d554..ee8082d 100755 --- a/testing/leak.test.sh +++ b/testing/leak.test.sh @@ -84,7 +84,7 @@ for p in placed: # ── the product's README, not this repository's ─────────────────────────── if "README.md" not in placed: bad("README.md would not ship") -for must in (".github/workflows/ci.yml", ".github/workflows/checks.yml", +for must in (".github/workflows/ci.yml", "apps/recipes/component.yaml", "apps/recipes/src/site.ts", "apps/recipes/wrangler.jsonc", "apps/recipes/.dev.vars.example", "tests/recipes/component.yaml", "tests/recipes/src/site.test.ts", diff --git a/testing/lib/bootstrap.sh b/testing/lib/bootstrap.sh index b74d404..624287b 100644 --- a/testing/lib/bootstrap.sh +++ b/testing/lib/bootstrap.sh @@ -14,8 +14,8 @@ # workspace; # - `{{ .inputs.* }}` render from the fixture. # Everything else — the retouch marker, the rebrand, the re-tenant, the -# work-tree strip, the deferrals and their restore, the lockfile, the -# deployment-docs render — runs exactly as declared. +# work-tree strip, the deferrals and their restore, the deployment-docs +# render — runs exactly as declared. # # Needs: orun, node, pnpm, python3 (+PyYAML), git. diff --git a/testing/manifest.test.sh b/testing/manifest.test.sh index 5374cb5..a834d4d 100755 --- a/testing/manifest.test.sh +++ b/testing/manifest.test.sh @@ -83,13 +83,16 @@ def uses(phase, action): yield hook # THE SECRETS THE BOOTSTRAP MINTS. `orun.integrations/reconcile@v1` is what -# `create-secrets.sh` was written out longhand as: one connection, one scope -# template, the keys it ensures. Read per key so a hook minting two keys under -# one template is three facts rather than one. +# `create-secrets.sh` was written out longhand as: one connection, and per key +# the scope template it is minted under — `secrets: [{key, template}]`, or +# `keys` sharing one `template`. Read per key so a hook minting two keys is +# two facts rather than one. blueprint_secrets = {} for phase in bp_phases: for hook in uses(phase, "orun.integrations/reconcile@v1"): w = hook.get("with") or {} + for item in (w.get("secrets") or []): + blueprint_secrets[item.get("key")] = (w.get("provider"), item.get("template")) for key in (w.get("keys") or []): blueprint_secrets[key] = (w.get("provider"), w.get("template")) diff --git a/testing/phases.test.sh b/testing/phases.test.sh index a117502..a5aaf70 100755 --- a/testing/phases.test.sh +++ b/testing/phases.test.sh @@ -11,6 +11,12 @@ # landing time, live, with nothing in this repository having looked wrong. # Moving one is a deliberate change, argued in the diff that edits both places. # +# And the shape that keeps a bootstrap fast (orun >= v2.88.0, turso-starter +# baseline-v8's): the run-level task set-up runs in the background, each +# phase finds its task just before its landing, each landing checks its +# commit here (`checks: local`), and the convergence watch reads every few +# seconds. +# # Adapted from sourceplane/cirrus-baseline's testing/phases.test.sh: the # narration rules and the hook-only rule are Cirrus's, unchanged. # @@ -55,21 +61,25 @@ DEPLOYS = {"01-product"} # first stage so it is branded and landed; git before the rebrand, which reads # `git ls-files`; the re-tenant, work-tree strip and deferrals before the # re-stage and the residue sweep; the repository and its link before the -# reconcile, which mints for the linked project, and all of it before the one +# reconcile, which mints for the linked project; the task, then the one # landing; the watch before the probe. -# `secret-*` stands for the reconcile hooks, one per brokered key, in a run. +# No phase has a `pre` hook: the task is found in `post`, just before the +# landing, so that everything before it runs beside the background task +# set-up. The brokered keys are one `secrets` reconcile (checked below). +# 02-docs awaits nothing: its render probes as it writes, and its landing +# redeploys nothing. HOOK_ORDER = { "01-product": { - "pre": ["task"], + "pre": [], "post": ["retouch", "git-init", "git-stage", "rebrand", "orun-workspace", "work-tree", "promotion", "dev-lanes", "git-restage", "rebrand-verify", - "pnpm-lockfile", "repo", "link", "secret-*", "land"], + "repo", "link", "secrets", "task", "land"], "await": ["converge", "verify"], }, "02-docs": { - "pre": ["task"], - "post": ["promotion", "dev-lanes", "render", "land"], - "await": ["verify"], + "pre": [], + "post": ["promotion", "dev-lanes", "render", "task", "land"], + "await": [], }, } # What each `run:` hook runs, by id — the script and the flag, so a hook that @@ -81,7 +91,6 @@ HOOK_RUNS = { ("01-product", "promotion"): ("tooling/bootstrap/promotion.mjs", "--defer"), ("01-product", "dev-lanes"): ("tooling/bootstrap/dev-lanes.mjs", "--defer"), ("01-product", "rebrand-verify"): ("tooling/rebrand/rebrand.mjs", "--verify"), - ("01-product", "pnpm-lockfile"): ("pnpm", "--lockfile-only"), ("02-docs", "promotion"): ("tooling/bootstrap/promotion.mjs", "--restore"), ("02-docs", "dev-lanes"): ("tooling/bootstrap/dev-lanes.mjs", "--restore"), ("02-docs", "render"): ("hooks/render-deployment-docs.sh", ""), @@ -89,12 +98,12 @@ HOOK_RUNS = { HOOK_USES = { ("01-product", "task"): "orun.task/ensure@v1", ("01-product", "repo"): "orun.repo/ensure@v1", + ("01-product", "secrets"): "orun.integrations/reconcile@v1", ("01-product", "land"): "orun.pr/land@v1", ("01-product", "converge"): "orun.run/watch@v1", ("01-product", "verify"): "orun.http/probe@v1", ("02-docs", "task"): "orun.task/ensure@v1", ("02-docs", "land"): "orun.pr/land@v1", - ("02-docs", "verify"): "orun.http/probe@v1", } by_name = {p["name"]: p for p in phases} @@ -207,23 +216,17 @@ for p in phases: f"repository does not have") # ── the hooks, in the order the bootstrap runs them ─────────────────────── -def collapse(ids): - out = [] - for i in ids: - i = "secret-*" if (i or "").startswith("secret-") else i - if not out or out[-1] != i: - out.append(i) - return out - for name, slots in HOOK_ORDER.items(): p = by_name.get(name) if p is None: continue h = p.get("hooks") or {} for slot, want in slots.items(): - now = collapse([x.get("id") for x in (h.get(slot) or [])]) + now = [x.get("id") for x in (h.get(slot) or [])] if now != want: - bad(f"phase {name} {slot} hooks are {now}; the bootstrap runs {want}") + why = (" — a task found in `pre` waits for the background task set-up before " + "the phase has done anything") if slot == "pre" else "" + bad(f"phase {name} {slot} hooks are {now}; the bootstrap runs {want}{why}") for x in [y for slot in ("pre", "post", "await") for y in (h.get(slot) or [])]: hid = x.get("id") if (name, hid) in HOOK_RUNS: @@ -235,16 +238,34 @@ for name, slots in HOOK_ORDER.items(): bad(f"phase {name} hook {hid} uses {x.get('uses')!r}, not {HOOK_USES[(name, hid)]}") # The brokered keys are minted where the product deploys: in 01-product, after -# the link and before the landing, one reconcile per scope template. -for p in phases: - for x in hooks_of(p): - if (x.get("uses") or "").startswith("orun.integrations/reconcile@"): - if p["name"] not in DEPLOYS: - bad(f"phase {p['name']} reconciles {x.get('with', {}).get('keys')} — the " - f"brokered keys belong to the phase that deploys") - if len((x.get("with") or {}).get("keys") or []) != 1: - bad(f"hook {x.get('id')} mints {x.get('with', {}).get('keys')} — one key per " - f"reconcile, so each key names its own scope template") +# the link and before the landing, in ONE `secrets` reconcile per provider +# (orun >= v2.87.0): each key under its own scope template, the connections and +# the existing secrets read once per hook, the missing keys created side by +# side. A reconcile reads one connection, so two providers would be two hooks +# (`secrets-`); two hooks whose other parameters are the same are one +# hook written twice. +reconciles = [(p, x) for p in phases for x in hooks_of(p) + if (x.get("uses") or "").startswith("orun.integrations/reconcile@")] +shared = {} +for p, x in reconciles: + w = x.get("with") or {} + want = "secrets" if len(reconciles) == 1 else f"secrets-{w.get('provider')}" + if x.get("id") != want: + bad(f"reconcile hook {x.get('id')} mints from {w.get('provider')}; name it {want}") + if p["name"] not in DEPLOYS: + bad(f"phase {p['name']} reconciles {[i.get('key') for i in w.get('secrets') or []]} — the " + f"brokered keys belong to the phase that deploys") + if "keys" in w or "template" in w or not w.get("secrets"): + bad(f"hook {x.get('id')} does not use the `secrets: [{{key, template}}]` form — one " + f"template per hook reads the connections and the secrets once per key") + for item in w.get("secrets") or []: + if not item.get("key") or not item.get("template"): + bad(f"hook {x.get('id')} mints {item} — every key names its own scope template") + same = tuple(sorted((k, str(v)) for k, v in w.items() if k != "secrets")) + if same in shared: + bad(f"hooks {shared[same]} and {x.get('id')} take the same parameters {dict(same)} — " + f"merge them into one `secrets` list") + shared.setdefault(same, x.get("id")) # No infra component, no wiring secret to wait for: an `orun.secrets/exists@v1` # await exists exactly when the tree has a component under infra/. @@ -258,6 +279,43 @@ for p in phases: if has_infra and p["name"] in DEPLOYS and not waits: bad(f"phase {p['name']} deploys infra and does not check its WIRING_* secrets") +# ── THE FAST SHAPE (orun >= v2.88.0) ────────────────────────────────────── +# The run-level list is the task set-up, all of it in the background: the +# first phase's provider check, placement, rebrand, repository and secrets +# run while it opens the epic, the milestones and the tasks. +for h in run_hooks: + if not h.get("background"): + bad(f"hooks.preInstantiate {h.get('id')} is not `background: true` — the first phase " + f"waits for it before doing anything, though nothing before its landing reads it") +# A `pre` hook on the task plane would wait for that background at once, +# before the phase had placed a file — the old order, whatever its id. +for p in phases: + for h in ((p.get("hooks") or {}).get("pre") or []): + if (h.get("uses") or "").startswith(("orun.task/", "orun.pr/")): + bad(f"phase {p['name']}'s pre hook {h.get('id')} uses {h['uses']}, which waits for the " + f"background task set-up — find the task in `post`, just before the landing") +# Every landing checks its commit here and merges, instead of waiting ~25 s +# for a runner to plan the tree this box just wrote. +for p in phases: + for h in hooks_of(p): + if (h.get("uses") or "").startswith("orun.pr/land@") and (h.get("with") or {}).get("checks") != "local": + bad(f"phase {p['name']} lands with checks {(h.get('with') or {}).get('checks', 'ci')!r}, " + f"not 'local' — it waits for a runner to plan a tree that is here") +# The convergence watch reads every few seconds, not the action's default 40. +for p in phases: + for h in ((p.get("hooks") or {}).get("await") or []): + if (h.get("uses") or "").startswith("orun.run/watch@"): + every = (h.get("with") or {}).get("pollSeconds") + if not isinstance(every, int) or every > 10: + bad(f"phase {p['name']} watches its convergence every {every or 40} s; at most 10 — " + f"the build goes on that much after the run is green") +# The shipped lockfile is installed frozen by the lanes and by the baseline's +# e2e tier; a hook re-resolving it is network for nothing. +for p in phases: + for h in hooks_of(p): + if "--lockfile-only" in (h.get("run") or []): + bad(f"phase {p['name']} hook {h.get('id')} re-resolves the lockfile the baseline ships") + # The deploying phase probes the Worker the card's verify URL names. card = yaml.safe_load((root / "blueprint.yaml").read_text()) card_urls = ((card.get("spec") or {}).get("verify") or {}).get("urls") or [] @@ -332,8 +390,15 @@ def check_line(where, line, slot, hook_ids): for p in phases: n = p.get("narrate") or {} ids = {h.get("id") for h in hooks_of(p)} + awaits = bool((p.get("hooks") or {}).get("await")) for slot in ("start", "await", "done", "failed"): line = n.get(slot) + if slot == "await" and not awaits: + # A phase that waits on nothing never says its await line. + if line: + bad(f"phase {p['name']} declares narrate.await and has no await hooks — " + f"nobody would ever read it") + continue if not line: bad(f"phase {p['name']} declares no narrate.{slot}") continue @@ -365,6 +430,7 @@ narrated = sum(len(p.get("narrate") or {}) for p in phases) narrated += sum(1 for p in phases for h in hooks_of(p) if h.get("narrate")) print(f" {len(phases)} phases, {placed_n} modules, {len(HOOK_ONLY)} hook-only — in execution order") print(f" every hook in the order the bootstrap runs it; {', '.join(sorted(DEPLOYS))} deploys and probes the card's URLs") +print(f" the fast shape: the task set-up in the background, no `pre` hook, every landing checks: local, the watch every few seconds") print(f" {narrated} authored narration lines, every reference resolving") PY diff --git a/testing/placement.test.sh b/testing/placement.test.sh index bbc03c4..ac9710c 100755 --- a/testing/placement.test.sh +++ b/testing/placement.test.sh @@ -13,7 +13,7 @@ # order, `02-docs` onto what `01-product` landed, each finished by the # blueprint's OWN `run:` hooks (the retouch marker, the rebrand, the # re-tenant, the work-tree strip, the deferrals and their restore, the -# lockfile, the deployment record), each landing a commit; +# deployment record), each landing a commit; # 3. the product it ends with: branded with no residue, carrying nothing of # the factory — no factory file, and no shipped file that names one — # re-tenanted, its gates restored, its record rendered; @@ -29,9 +29,8 @@ # testing/e2e.test.sh goes on from here: it installs, builds, dry-deploys and # serves the product and runs its smoke against it. # -# Needs: orun, node, pnpm, python3 (+PyYAML), git. No credential. The pnpm -# lockfile check and the deployment-record probes reach the network if they -# can, and pass without it. +# Needs: orun, node, pnpm, python3 (+PyYAML), git. No credential. The +# deployment-record probes reach the network if they can, and pass without it. set -euo pipefail here="$(cd "$(dirname "$0")" && pwd)" root="$(cd "$here/.." && pwd)" diff --git a/tests/recipes/component.yaml b/tests/recipes/component.yaml index 0806177..15aeb6a 100644 --- a/tests/recipes/component.yaml +++ b/tests/recipes/component.yaml @@ -2,10 +2,19 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: recipes-tests + description: The Worker's vitest suite (the index, the site identity and each of the thirteen recipes, driven in-process through Hono with a fake rate limiter), run with pnpm test spec: type: turbo-package 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 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 } domain: tests subscribe: environments: diff --git a/tests/recipes/docs/overview.md b/tests/recipes/docs/overview.md index a2f1819..e806a9a 100644 --- a/tests/recipes/docs/overview.md +++ b/tests/recipes/docs/overview.md @@ -1,5 +1,7 @@ # recipes-tests +The Worker's vitest suite (the index, the site identity and each of the thirteen recipes, driven in-process through Hono with a fake rate limiter), run with pnpm test + The test suite for **recipes**. It deploys nothing: its lane installs, builds and runs the tests. | | | diff --git a/tooling/catalog/gen-component-docs.py b/tooling/catalog/gen-component-docs.py index 9a39931..743782b 100644 --- a/tooling/catalog/gen-component-docs.py +++ b/tooling/catalog/gen-component-docs.py @@ -4,8 +4,11 @@ python3 tooling/catalog/gen-component-docs.py # write python3 tooling/catalog/gen-component-docs.py --check # fail on drift (CI) -The Orun workspace's Docs library renders the `docs/` folder next to every -`component.yaml`. These pages are generated, not hand-written, because almost +Every `component.yaml` attaches its `docs/` folder in `spec.docs` (overview, +architecture, runbook), which is what the Orun workspace's Docs library shows +and what the catalog's docs and runbook checks read; a folder nothing declares +is never attached (testing/coverage.test.sh holds the rule). These pages are +generated, not hand-written, because almost everything in them is already declared somewhere CI validates: the component's manifest (type, description, dependencies, environments, the secrets a lane resolves, the smoke), its Worker config (bindings, triggers, the wiring the