From eb29b577a3ed161de1a916d32b708f6042506875 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 09:04:16 +0000 Subject: [PATCH] =?UTF-8?q?SA8:=20the=20turso=20v8=20shape=20=E2=80=94=20o?= =?UTF-8?q?ne=20secrets=20hook=20per=20provider,=20no=20Checks,=20docs=20i?= =?UTF-8?q?n=20the=20catalog,=20tasks=20in=20the=20background,=20landings?= =?UTF-8?q?=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, adapted to this repository's two providers and seven components. A. One secrets hook per provider (turso TU9). The five single-key reconciles each read the workspace's connections and secrets before their create, one after another. orun's `secrets: [{key, template}]` declares them together: `secrets-cloudflare` (CLOUDFLARE_API_TOKEN workers-deploy, CLOUDFLARE_HYPERDRIVE_TOKEN hyperdrive-edit, CLOUDFLARE_ACCOUNT_ID account-id) and `secrets-supabase` (SUPABASE_ACCESS_TOKEN management-access, SUPABASE_ORG_ID org-id). Two hooks, not one: a reconcile reads one provider's connection, and the two share no other parameter. Keys, templates and the card's order are unchanged. manifest.test.sh and placement.test.sh read the `secrets` form beside `keys`. B. No Checks workflow; docs in the catalog; no domain/component clash (turso TU10). checks.yml is gone: a product carries ci.yml alone, and a bootstrap's landings are checked in the box. testing/e2e.test.sh runs the landing's own checks from a LANDING_CHECKS list (the six commands checks.yml ran), and the leak gate no longer requires checks.yml. Every component attaches its generated overview, architecture and runbook in `spec.docs`; web-tests and db-tests get descriptions (their overviews regenerated). apps/web's domain is `app`, not `web`: a domain and a component share one name space in the catalog. coverage.test.sh holds both rules. C. The fast shape on orun v2.88.0 (turso TU11). The task set-up runs in the background; each phase finds its task in `post`, just before its landing; both landings are `checks: local`; the convergence watch reads every 5 s; no `pnpm install --lockfile-only` hook; 02-docs has no final probe and no narrate.await, and its render asks the platform nothing (a static names-only secrets table that says where each key lives, and a pointer to the console's Secrets and Integrations pages). The `wiring` await is gone entirely. Each of its four keys is resolved in the same convergence, fail-closed at job start, from the readers' component.yaml secretEnv, by a job that waits for its publisher on main: SUPABASE_PROJECT_REF and SUPABASE_DB_PASSWORD by cloudflare-hyperdrive and db-migrate, SUPABASE_DB_URL by db-migrate, WIRING_CLOUDFLARE_HYPERDRIVE by web's deploy (both rungs in each job). A missing one fails its lane, so a green run already proves all four. phases.test.sh replaces the rule that demanded the await: each published key must be read that way on stage and prod, or else awaited — and a key already read must not be. The floor is v2.88.0: baseline.yml's blueprint and product tiers (both read the blueprint; the floor is newer than ci.yml's lane pin, v2.78.4, which stays), and BOOTSTRAP.md with its troubleshooting row. expectedMinutes 18 + 2 → 17 + 1, card 20 → 18 ("about eighteen minutes"); estimates, not measurements — no bootstrap of this baseline has been timed. phases.test.sh holds the fast shape. Worth knowing (true of turso too): a product PR's `quick-check` lanes (db, db-tests, web-tests) only install and check structure, so with checks.yml gone nothing in a product's CI runs typecheck, lint or the tests; the baseline's e2e tier still runs them on the landing before a tag. The product README now says these are local `pnpm` scripts. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01CJuLwDKfEaQGAEuBpJvN5Q --- .baseline/product/README.md | 5 +- .github/workflows/baseline.yml | 25 ++- .github/workflows/checks.yml | 46 ---- BOOTSTRAP.md | 42 ++-- README.md | 3 +- ai/context/current.md | 2 +- ai/context/decisions.md | 3 +- ai/context/deployment.md | 6 +- ai/context/open-risks.md | 2 +- ai/context/operations.md | 2 +- apps/web/component.yaml | 12 +- blueprint.yaml | 26 +-- docs/phases/01-product.md | 26 ++- docs/phases/02-docs.md | 7 +- docs/phases/README.md | 27 ++- hooks/render-deployment-docs.sh | 69 +++--- infra/db-migrate/component.yaml | 8 + .../cloudflare-hyperdrive/component.yaml | 8 + infra/terraform/supabase/component.yaml | 8 + packages/db/component.yaml | 8 + repo-blueprint.yaml | 200 ++++++++++-------- testing/coverage.test.sh | 40 ++++ testing/e2e.test.sh | 48 +++-- testing/leak.test.sh | 2 +- testing/lib/bootstrap.sh | 4 +- testing/manifest.test.sh | 9 +- testing/phases.test.sh | 200 ++++++++++++++---- testing/placement.test.sh | 19 +- tests/db/component.yaml | 9 + tests/db/docs/overview.md | 2 + tests/web/component.yaml | 9 + tests/web/docs/overview.md | 2 + tooling/catalog/gen-component-docs.py | 7 +- 33 files changed, 558 insertions(+), 328 deletions(-) delete mode 100644 .github/workflows/checks.yml diff --git a/.baseline/product/README.md b/.baseline/product/README.md index f6c3688..0287aba 100644 --- a/.baseline/product/README.md +++ b/.baseline/product/README.md @@ -13,7 +13,7 @@ Orun's `db-migrate` applies the schema, all on every merge to `main`. Not recorded yet. The bootstrap's last phase writes the live URLs, the -workspace, whether Stripe is connected and the secrets inventory into +workspace, whether Stripe is connected 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). @@ -177,5 +177,4 @@ yours in the same pull request as `BASE_URL`. | Workflow | What it runs | |---|---| -| `checks.yml` | install, wire fixture, typecheck, lint, test, build — every pull request (not pushes: on `main`, `ci.yml` must be the only run a commit has) | -| `ci.yml` | the Orun pipeline: `orun plan --changed`, then one job per lane; applies, migrates and deploys stage → prod on merge | +| `ci.yml` | the Orun pipeline, and the only workflow: `orun plan --changed`, then one job per lane. A pull request runs the verify lanes — the app built and dry-deployed for each environment, both Terraform roots checked and planned, the migrations planned and their checksums verified — with nothing applied or deployed (typecheck, lint and the tests are `pnpm` scripts you run, above); a merge applies, migrates and deploys stage → prod | diff --git a/.github/workflows/baseline.yml b/.github/workflows/baseline.yml index 9554e24..d14c5c7 100644 --- a/.github/workflows/baseline.yml +++ b/.github/workflows/baseline.yml @@ -8,7 +8,7 @@ name: Baseline CI # product installs, builds, migrates, deploys (dry), serves and signs a user # up with no Stripe key. # -# ─── 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 @@ -69,14 +69,18 @@ jobs: # placement tier (the offline bootstrap: both phases placed and finished by # the blueprint's own hooks, then the product's own `orun plan` for the # 01-product merge — supabase, then cloudflare-hyperdrive, then db-migrate, - # then web, enforced — and a --resume that changes nothing). + # then web, enforced — and a --resume that changes nothing). The floor is + # v2.88.0 (the task set-up in the background, the landings checked in the + # box, the deploy credentials minted in one `secrets` reconcile per + # provider), newer than the product's lane pin (v2.78.4, ci.yml), so the + # product's own plans here read the per-edge `modeRules` as its CI does. blueprint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - uses: sourceplane/orun-action@v1.2.0 with: - version: v2.58.11 + version: v2.88.0 - uses: pnpm/action-setup@v4 with: version: 10.12.1 @@ -103,23 +107,26 @@ jobs: git config --global user.name "baseline ci" bash testing/placement.test.sh - # Tier 2. THE PRODUCT IT PRODUCES WORKS: the 01-product landing under the - # checks its pull request waits on; the migrations applied by the product's + # Tier 2. THE PRODUCT IT PRODUCES WORKS: the 01-product landing installed, + # its fixture rendered, type-checked, linted, tested and built (its own pull + # request runs `plan` alone, and the landing is checked in the box with + # `orun validate` and `orun plan`); the migrations applied by the product's # own runner to a local Postgres (through a stand-in for the one Supabase # Management API endpoint it calls); the stage lane's own structure check, # build, output check and dry deploy in the job tree orun stages; and the # built Worker served over that database with no Stripe key and no # AUTH_SECRET — its smoke, every route, and a sign-up, sign-in and dashboard. - # Pinned at the product's lane version, because that is the orun its CI - # runs. The runner image carries PostgreSQL 16 (not started); the test - # starts its own on a random port. + # 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. The runner image carries PostgreSQL 16 + # (not started); the test starts its own on a random port. 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 67bd6a0..0000000 --- a/.github/workflows/checks.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Checks - -# Credential-free verification: install, render the offline wrangler fixture, -# typecheck, lint, test and build, on every pull request, linked or not. No -# database and no Stripe account: nothing here connects to either. -# `ci.yml` is the Orun pipeline beside it (plan/run with brokered Cloudflare -# and Supabase 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, the watch can read this run -# green while ci.yml's deploy lanes failed, and call the product converged. -# On main the convergence builds and tests everything 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 c3d8afb..933ee55 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -12,22 +12,27 @@ not separate workflows. The console card the platform renders is brokered secrets and the programme, and `testing/manifest.test.sh` holds it to what the build document does. -Target wall-clock: **about twenty minutes** — an estimate summed from the -phases until a bootstrap measures it: one landing, then one convergence per -environment (stage and prod side by side until `02-docs` restores the +Target wall-clock: **about eighteen minutes** — an estimate summed from the +phases (17 + 1) until a bootstrap measures it. The shape: the task set-up in +the background while ONE landing is placed, branded and checked in the box +(`orun validate` and `orun plan`, no runner waited for), then one convergence +per environment (stage and prod side by side until `02-docs` restores the promotion gate) that creates the Supabase project (five to seven minutes), the Hyperdrive config, applies the migrations and builds and deploys the app, -in that order. +in that order, then a short docs landing. ## 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 wait on the PR's whole CI run, `githubOwner` on the doctor - probe, `environments` on the secrets probe, `from: workspace`). The - product's own `ci.yml` pins its lanes separately (v2.78.4), and that pin is - what reads the per-edge `mode` rules the convergence order relies on. + CLI **≥ v2.88.0** — the floor for RUNNING the bootstrap (the phase overlay, + `githubOwner` on the doctor probe, `from: workspace`, the deploy + credentials minted in one `secrets` reconcile per provider, 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), and that pin — or anything newer, as the floor + is — is what reads the per-edge `mode` rules the convergence order relies + on. - A **Cloudflare** account (the free plan is enough for one Worker with static assets and Hyperdrive) and its Account API token with the permission groups the console's Connect recipe lists — Workers Scripts and @@ -83,8 +88,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 five brokered credentials; then the whole product in one PR — intent, CI, tooling, identity, the Supabase and Hyperdrive Terraform roots, the migrations, the app and its tests | the convergence green (supabase → cloudflare-hyperdrive → db-migrate → web, per environment), the four published secrets on stage and prod, `/` and `/api/health` answering on both workers.dev URLs | -| `02-docs` | `ai/context/deployment.md` from probed facts (Stripe's state included); prod's promotion gate and dev's push lanes restored | the final probe | +| `01-product` | the repository, created and linked; the five brokered credentials; then the whole product in one PR — intent, CI, tooling, identity, the Supabase and Hyperdrive Terraform roots, the migrations, the app and its tests | its commit validated and planned in the box (as the PR and as the merge), then merged; the convergence green (supabase → cloudflare-hyperdrive → db-migrate → web, per environment — each resolving what the apply before it published); `/` and `/api/health` answering on both workers.dev URLs | +| `02-docs` | `ai/context/deployment.md` from probed facts (Stripe's state included); 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-saas --run-hooks \ @@ -182,10 +187,10 @@ bash testing/e2e.test.sh # + network for pnpm, psql and a PostgreSQL ser The offline bootstrap (`testing/lib/bootstrap.sh`) places both phases in order and finishes each with the blueprint's OWN `run:` hooks — read out of `repo-blueprint.yaml`, not transcribed — so the retouch marker, the rebrand, -the re-tenant, the deferrals and their restore, the lockfile and the -deployment record all run exactly as a real bootstrap runs them. Only the -platform's typed actions (task, repo, reconcile, land, watch, secrets, -probe) and the `link` step are stood in for, a landing becoming a commit. +the re-tenant, the deferrals and their restore and the deployment record +all run exactly as a real bootstrap runs them. Only the platform's typed +actions (task, repo, reconcile, land, watch, probe) and the `link` step are +stood in for, a landing becoming a commit. What no test here can do is the clouds' half: create a Supabase project, apply the Hyperdrive config, mint a token, deploy for real. The Terraform @@ -225,13 +230,16 @@ at the tag and refuses the whole catalogue if it 404s. | supabase apply: project limit reached | the Supabase org's plan allows fewer projects than stage + prod need; free one or upgrade, then re-run `01-product` | | hyperdrive apply: Authentication error (10000) | the Hyperdrive token lacks the permission; reconnect Cloudflare with the recipe's permission groups and re-run the phase — the reconcile re-mints only what is missing | | hyperdrive or db-migrate: `secret resolution failed … SUPABASE_*` | the supabase apply for that environment did not publish; its lane's log says why. Both wait on it, enforced | +| web: `secret resolution failed … WIRING_CLOUDFLARE_HYPERDRIVE_*` | a Hyperdrive apply published no wiring: the root lost its `secretOutputs`, or its lane was not in the plan. Re-run the phase; its retouch marker re-plans the Hyperdrive root | +| `land` stops: `the landing's own check failed — orun plan for …` | the product's tree does not plan — the line after it is orun's own error (an unknown component type, a composition that does not resolve). Nothing was pushed. Fix the tree (or the baseline) and re-run the phase | +| `land` waits on CI after all | the product's repository requires a status check on `main` (branch protection or a ruleset), so GitHub refused the early merge; the landing waits for the check as a `checks: ci` landing would, then merges | | db-migrate: `row-level security would lock the app out of …` | migration 030 refused: `postgres` (Hyperdrive's role) neither owns the tables in `public` nor bypasses RLS. Nothing was enabled; give `postgres` the tables or BYPASSRLS and re-run `01-product` | | web smoke: `/api/health` 503 | `database: unreachable` — the Hyperdrive config is wrong or the project is paused; `schema: missing` — db-migrate did not run for that environment | | `build-app` fails: `Symlink apps/web/node_modules/next is invalid, it points out of the filesystem root` | the product's intent pins stack-tectonic ≥ 0.20.0, whose lane-scoped install links each job's node_modules out of its tree, which Next 16's Turbopack refuses. Pin 0.19.0 (`intent.yaml` says why) | | `verify-app-structure` fails: `test -f "wrangler.jsonc"` | the product's `apps/web/wrangler.jsonc` is not committed. It must be — the check runs before the build in a fresh checkout (`pnpm run wire:fixture` renders it) | | 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 components re-plan; the project and the config are adopted, not recreated | -| The convergence reported green, then `verify` got 404 | a second workflow ran on the push to main and the watch took its run. Only `ci.yml` may run on a push to main; `checks.yml` runs on pull requests only | +| The convergence reported green, then `verify` got 404 | a second workflow ran on the push to main and the watch took its run. Only `ci.yml` may run on a push to main | | 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` | | `✕ 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 | diff --git a/README.md b/README.md index 58b1e9f..745eca1 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,6 @@ carries. | Workflow | What it runs | Ships to a product | |---|---|---| -| `checks.yml` | install, wire fixture, 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; applies, migrates and 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 app built and dry-deployed per environment, both Terraform roots checked and planned, the migrations planned), except the bootstrap's own landings (`orun/BASE-*`), where `plan` alone runs and nothing waits for it — the landing was checked in the build box; a merge applies, migrates and 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 and the product's own plans; the product built, migrated into a local Postgres, dry-deployed, served and signed up on | no | | `tag.yml` | cuts a `baseline-vN` tag (manual) | no | diff --git a/ai/context/current.md b/ai/context/current.md index 9ec4a24..dbb0d11 100644 --- a/ai/context/current.md +++ b/ai/context/current.md @@ -26,7 +26,7 @@ and serves without it. |---|---| | Latest tag | `baseline-v3` (SA7, [#8](https://github.com/sourceplane/saas-starter/pull/8) — the domain is set later: the console asks for no domain, and a product is born with the placeholder `.example.com` in `BASE_DOMAIN` for an owner to replace) | | Before it | `baseline-v2` (SA6, [#7](https://github.com/sourceplane/saas-starter/pull/7) — the cirrus standard: no kiox, generated component docs, this context pack, and the workers.dev subdomain read from the Cloudflare connection instead of asked); `baseline-v1` (SA5, [#6](https://github.com/sourceplane/saas-starter/pull/6) — the baseline) | -| Proven live | No. Everything short of the platform is proven offline in Baseline CI: the e2e tier migrates a local Postgres with the product's own runner, builds in orun's staged job tree, and signs a user up and in with no Stripe key and no `AUTH_SECRET`. No bootstrap from a tag has run against a workspace: neither Terraform root has been applied, db-migrate has not run against a real project, nothing has deployed, and the card's twenty minutes is unmeasured (SA-M) | +| Proven live | No. Everything short of the platform is proven offline in Baseline CI: the e2e tier migrates a local Postgres with the product's own runner, builds in orun's staged job tree, and signs a user up and in with no Stripe key and no `AUTH_SECRET`. No bootstrap from a tag has run against a workspace: neither Terraform root has been applied, db-migrate has not run against a real project, nothing has deployed, and the card's eighteen minutes is unmeasured (SA-M) | ## Where to read diff --git a/ai/context/decisions.md b/ai/context/decisions.md index faaff28..20198ad 100644 --- a/ai/context/decisions.md +++ b/ai/context/decisions.md @@ -14,9 +14,10 @@ reads in order. | 6 | A fresh product needs no hand-set secret: Stripe is optional (pricing says checkout is not connected, the webhook answers 503), and the session key defaults to one the database generates (`020_app_secrets`) unless `AUTH_SECRET` is set | A bootstrapped product is deployed by a convergence nobody attends, and no platform brokers Stripe | risk SA-J | | 7 | Row-level security with no policy on every table in `public`; migration `030` refuses to run if `postgres` would be locked out | Supabase's Data API serves `public` to the anon key; the app connects as the tables' owner | risk SA-L | | 8 | Infra before app on main: supabase → cloudflare-hyperdrive → db-migrate → web, enforced; advisory on a pull request | Each component reads what the one before it published; a migration is the one step a re-run cannot take back, so it runs last before the Worker | design.md §4, IMPLEMENTATION-STATUS (SA5) | -| 9 | One landing (`01-product`) then the record (`02-docs`); `ci.yml` plans nothing while `intent.yaml` names `ws_CHANGE_ME`; `checks.yml` on pull requests only | A landing has a fixed cost; a bootstrap cannot set a repository variable (replaced the `ORUN_CI` gate); a push to main must start `ci.yml` alone | `repo-blueprint.yaml`, IMPLEMENTATION-STATUS (SA5) | +| 9 | One landing (`01-product`) then the record (`02-docs`); `ci.yml` plans nothing while `intent.yaml` names `ws_CHANGE_ME`; `checks.yml` on pull requests only (that clause superseded by 15) | A landing has a fixed cost; a bootstrap cannot set a repository variable (replaced the `ORUN_CI` gate); a push to main must start `ci.yml` alone | `repo-blueprint.yaml`, IMPLEMENTATION-STATUS (SA5) | | 10 | stack-tectonic 0.19.0, not 0.20.0 | 0.20.0's lane-scoped install is refused by Turbopack | `intent.yaml`, IMPLEMENTATION-STATUS (SA5) | | 11 | orun is pinned only where it runs (the `orun-action` `version:` in each workflow); no kiox | `kiox.yaml` pinned a version (v2.15.0) nothing ran | IMPLEMENTATION-STATUS (SA6) | | 12 | Component docs are generated from the manifests and checked in CI | A hand-written copy of the dependency graph and bindings drifts silently | `tooling/catalog/gen-component-docs.py` | | 13 | `subdomain` is read from the Cloudflare connection (`from: connection.cloudflare.workersSubdomain`), never asked | It belongs to the account like its id and has one right answer; a typed one could only be wrong, and showed up after deploy in `BASE_URL`, the smoke and the probes | `blueprint.yaml`, IMPLEMENTATION-STATUS (SA-8) | | 14 | The console asks for no domain; an empty `productdomain` brands the placeholder `.example.com` | The app goes live on workers.dev and nothing in the build needs a domain (Stripe returns to `BASE_URL`, the workers.dev URL until an owner sets it); attaching one is an owner's step, and the placeholder keeps the place the domain goes in the repository, ready to replace | `repo-blueprint.yaml`, `tooling/rebrand/rebrand.mjs`, IMPLEMENTATION-STATUS (SA-9) | +| 15 | The turso-starter v8 shape on orun v2.88.0: no `checks.yml` (a product carries `ci.yml` alone); the brokered keys in one `secrets` reconcile per provider; every component's generated pages attached in `spec.docs`, and the app's domain `app`, not `web`; the task set-up in the background, each landing checked in the box (`checks: local`), the watch at 5 s, and no await of what the convergence already resolves | A bootstrap waited on things that did not need waiting for (a runner's plan of a tree in the box, the task plane, one platform round trip per key); the catalog attached no docs and the `web` domain hid the `web` component; a green convergence already proves every published key, because each is resolved fail-closed by a job that waits for its publisher | `repo-blueprint.yaml`, `testing/phases.test.sh`, `testing/coverage.test.sh` (SA8) | diff --git a/ai/context/deployment.md b/ai/context/deployment.md index cea5104..6e7bb8e 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, whether Stripe is connected, and the secrets inventory by -> name. Until then, nothing here claims the product is live. The operating -> contract is [operations.md](operations.md). +> their status, whether Stripe is connected, 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/open-risks.md b/ai/context/open-risks.md index 7c5b3aa..2fba16f 100644 --- a/ai/context/open-risks.md +++ b/ai/context/open-risks.md @@ -7,7 +7,7 @@ what is still live, so it should be short. | ID | Risk | State | What closes it | |---|---|---|---| -| SA-M | No bootstrap has been timed (the card's twenty minutes is summed from estimates); neither Terraform root has been applied from this repository and db-migrate has not run against a real project — so whether `postgres` owns the tables there, which migration `030`'s guard checks before it enables RLS (SA-L), is also unobserved | OPEN | One bootstrap from a tag against a workspace with Cloudflare and Supabase connected | +| SA-M | No bootstrap has been timed (the card's eighteen minutes is summed from estimates); neither Terraform root has been applied from this repository and db-migrate has not run against a real project — so whether `postgres` owns the tables there, which migration `030`'s guard checks before it enables RLS (SA-L), is also unobserved | OPEN | One bootstrap from a tag against a workspace with Cloudflare and Supabase connected | Accepted, and worth knowing before you change them: SA-A (a `postgres` client per request), SA-D (the deploy sets no Worker secret; Stripe's keys diff --git a/ai/context/operations.md b/ai/context/operations.md index ae28358..ac00d97 100644 --- a/ai/context/operations.md +++ b/ai/context/operations.md @@ -2,7 +2,7 @@ This is the standing guide to how this product is deployed and operated. Instance facts (live URLs, workspace, whether Stripe is connected, the -secrets inventory) live in [deployment.md](deployment.md), rendered from +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 access enough context to reason about and operate the product diff --git a/apps/web/component.yaml b/apps/web/component.yaml index ae9b472..487dc4a 100644 --- a/apps/web/component.yaml +++ b/apps/web/component.yaml @@ -7,7 +7,17 @@ spec: type: cloudflare-workers-assets-turbo lifecycle: production owner: platform - domain: web + # 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 `web`: a domain and a component share one name space in the + # catalog, and a domain called `web` hid this component from it. + domain: app path: apps/web # Its own lane per environment: the Next.js build is the longest job in the # plan, and a shared lane would wait on it. diff --git a/blueprint.yaml b/blueprint.yaml index d7a5c27..0521954 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -24,7 +24,7 @@ metadata: Postgres a Supabase project reached through Hyperdrive. Terraform creates both per environment, db-migrate applies the schema, and CI deploys it all to stage and prod on merge, in that order. Stripe connects after the build. - Live in about twenty minutes. + Live in about eighteen minutes. tags: [saas, stripe, supabase, cloudflare, nextjs] spec: source: @@ -108,13 +108,14 @@ 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. Five keys, five - # scopes, on purpose — the deploy token deliberately cannot touch - # Hyperdrive. Stripe's keys are not here: no connection mints them. + # hooks mint these, brokered, during 01-product — one hook per provider. ─ + # Transcribed from those hooks' own `provider:` and `secrets:` ({key, + # template}) values, in their 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. Five keys, five scopes, on purpose — the deploy + # token deliberately cannot touch Hyperdrive. Stripe's keys are not here: + # no connection mints them. secrets: - key: CLOUDFLARE_API_TOKEN provider: cloudflare @@ -154,10 +155,11 @@ 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. An estimate until a bootstrap - # measures it: a Supabase project takes five to seven minutes to come up, - # and the app's deploy waits on it, on Hyperdrive and on the migrations. - expectedMinutes: 20 + # Summed from the phases' expectedMinutes (17 + 1). An estimate until a + # bootstrap measures it: a Supabase project takes five to seven minutes to + # come up, and the app's deploy waits on it, on Hyperdrive and on the + # migrations. + expectedMinutes: 18 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 cf3831b..07cd725 100644 --- a/docs/phases/01-product.md +++ b/docs/phases/01-product.md @@ -33,9 +33,12 @@ push to main and reads the order off it: ## 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` | one trailing `# orun: redeploy 01-product ` line in each component `.baseline/tasks/01-product.TaskContract.yaml` names (supabase, cloudflare-hyperdrive, db, db-migrate, web), so a RE-RUN has a diff to land | | `git-init`, `stage` | the tree becomes a git repository with a populated index (the rebrand enumerates `git ls-files`) | | `rebrand` | renames the baseline's identity to the product's: the slug (intent, worker, secret project, the `repo` the Supabase project and Hyperdrive config are named after), the name seam, the domain, the workers.dev subdomain. The upstream template's own links and every migration are left alone | @@ -43,13 +46,13 @@ push to main and reads the order off it: | `work-tree` | strips this repository's `work:` block from the product's intent | | `promotion`, `dev-lanes` | defer prod's wait on stage and dev's push lanes until `02-docs` | | `restage`, `rebrand-verify` | the sweep: no baseline identity left | -| `pnpm-lockfile` | confirms the complete lockfile `root-pnpm-lock` placed | | `repo` | `orun.repo/ensure@v1`: creates (or finds) `/` | | `link` | the repository becomes the workspace's (`orun cloud link`, best effort; `orun cloud check` is the gate). Every convergence lane authenticates over GitHub OIDC through that link | -| `secret-*` | five `orun.integrations/reconcile@v1` hooks, one key and one scope each: `CLOUDFLARE_API_TOKEN` (workers-deploy), `CLOUDFLARE_HYPERDRIVE_TOKEN` (hyperdrive-edit), `CLOUDFLARE_ACCOUNT_ID` (account-id), `SUPABASE_ACCESS_TOKEN` (management-access), `SUPABASE_ORG_ID` (org-id). Keys that exist are kept | -| `land` | one PR, checked (Checks, and `plan` alone on a bootstrap branch), then merged | -| `converge` (await) | `orun.run/watch@v1` on the merge commit's run; resumes it up to three times | -| `wiring` (await) | `orun.secrets/exists@v1`: `SUPABASE_PROJECT_REF`, `SUPABASE_DB_PASSWORD`, `SUPABASE_DB_URL` and `WIRING_CLOUDFLARE_HYPERDRIVE` on stage and prod | +| `secrets-cloudflare` | `orun.integrations/reconcile@v1`, Cloudflare's three keys in one hook, each under its own scope, created side by side: `CLOUDFLARE_API_TOKEN` (workers-deploy, the app's deploy), `CLOUDFLARE_HYPERDRIVE_TOKEN` (hyperdrive-edit — the deploy token cannot touch Hyperdrive), `CLOUDFLARE_ACCOUNT_ID` (account-id). Keys that exist are kept | +| `secrets-supabase` | the same for Supabase's two: `SUPABASE_ACCESS_TOKEN` (management-access, the project and the migrations), `SUPABASE_ORG_ID` (org-id) | +| `task` | finds the phase's task 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 (`plan` alone on a bootstrap branch) | +| `converge` (await) | `orun.run/watch@v1` on the merge commit's run, read every 5 s; resumes it up to three times | | `verify` (await) | `orun.http/probe@v1`: `/` and `/api/health` on both workers.dev URLs | ## What the convergence does, per environment @@ -79,8 +82,12 @@ owner adds one (the product's README, "Connect Stripe"). ## Verify / done means -- The convergence for the merge commit is green on stage and prod. -- The four published secrets exist on stage and prod. +- The convergence for the merge commit is green on stage and prod — in it, + Hyperdrive and db-migrate resolved the Supabase project's + `SUPABASE_PROJECT_REF`, `SUPABASE_DB_PASSWORD` and `SUPABASE_DB_URL`, and + the app's deploy `WIRING_CLOUDFLARE_HYPERDRIVE`, from stage and prod, where + every later run reads them. A missing one fails its lane, so there is no + separate check that they exist. - `/` and `/api/health` answer on both workers.dev URLs. ## Failure modes @@ -91,6 +98,9 @@ owner adds one (the product's README, "Connect Stripe"). | supabase apply: `does not support oauth access` | the provider is above 1.5.x, which reads billing endpoints an OAuth token cannot — `~> 1.5.1` is pinned for this reason | | supabase apply: project name already exists | `adopt.tf` looks the project up by name and imports it — if you removed that file, restore it | | hyperdrive or db-migrate lane: secret resolution failed (`SUPABASE_*`) | the supabase apply for that environment did not publish — read its log; both wait on it, so they show as not run | +| web lane: secret resolution failed (`WIRING_CLOUDFLARE_HYPERDRIVE_*`) | a Hyperdrive apply did not publish its wiring (the root lost its `secretOutputs`, or its lane was not in the plan) — read the cloudflare-hyperdrive lane; re-run the phase and its retouch marker re-plans it | +| `land`: `the landing's own check failed — orun plan for …` | the placed tree does not plan; the next line is orun's own error. Nothing was pushed. Fix it (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 | | hyperdrive apply: Authentication error (10000) | the token in play is workers-deploy, which deliberately cannot touch Hyperdrive — the component binds `CLOUDFLARE_HYPERDRIVE_TOKEN` | | db-migrate: checksum mismatch | an applied migration's file changed. Never edit one; add a new migration | | db-migrate: `row-level security would lock the app out of …` | migration 030's guard: the tables in `public` are not owned by `postgres` (the role Hyperdrive connects as), and `postgres` has neither SUPERUSER nor BYPASSRLS. Nothing was enabled and the app did not deploy. Give `postgres` the tables (`ALTER TABLE … OWNER TO postgres`) or BYPASSRLS, then re-run the phase | diff --git a/docs/phases/02-docs.md b/docs/phases/02-docs.md index 2982c0a..a51c804 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 `/` and `/api/health` on both environments, reads whether the pricing page still says Stripe is not connected, 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 `/` and `/api/health` on both environments, reads whether the pricing page still says Stripe is not connected, and regenerates `ai/context/deployment.md` — the identity, the probed URLs, the secrets the product uses by name and where each lives — 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 5e92c50..e0b2d8f 100644 --- a/docs/phases/README.md +++ b/docs/phases/README.md @@ -9,8 +9,13 @@ container the same operation as running them all. Each phase follows the same contract: -> **place its modules → brand them → land them as one pull request → watch -> the convergence that merge triggers (auto-resumed) → verify the outcome.** +> **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.** + +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. @@ -19,7 +24,7 @@ product's repository is wherever `--out` points. | phase | lands | verified by | |---|---|---| -| [`01-product`](01-product.md) | **the GitHub repo created**, then the WHOLE product in one PR: intent, CI, tooling, the Supabase and Hyperdrive Terraform roots, the migrations, the app and its tests — one convergence provisions and deploys it in dependency order | convergence green; `SUPABASE_*` and `WIRING_CLOUDFLARE_HYPERDRIVE` published on stage and prod; `/` and `/api/health` answer on both | +| [`01-product`](01-product.md) | **the GitHub repo created**, then the WHOLE product in one PR: intent, CI, tooling, the Supabase and Hyperdrive Terraform roots, the migrations, the app and its tests — one convergence provisions and deploys it in dependency order | convergence green (each component resolving what the apply before it published); `/` and `/api/health` answer on both | | [`02-docs`](02-docs.md) | the live-deployment record; the promotion gate and dev's lanes put back | committed manifest matches probed reality | **One landing builds the product.** The order the data plane needs — the @@ -36,14 +41,20 @@ A job resolves its secrets when it starts, so each one reads what the apply before it published: Hyperdrive the project's ref and password, db-migrate the project's credentials, the app's deploy the Hyperdrive id it binds. `testing/placement.test.sh` reads that order off the product's own -`orun plan --trigger github-push-main`. +`orun plan --trigger github-push-main`. Each job reads them from the place +every later run looks, and a missing one fails its lane, so a green +convergence already says all of it is there — there is no separate check. 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 the phase watches. `checks.yml` (install, typecheck, -lint, test, build) runs on every pull request regardless. +convergence is what the phase watches. The product carries no other +workflow: the baseline's own CI (Tier 2) installs, renders the fixture, +type-checks, lints, tests and builds this landing before a tag is cut, and +every later pull request in the product runs `ci.yml`'s verify lanes. There is no custom-domain phase: the app answers on workers.dev. Attaching a domain needs zone permissions the brokered `workers-deploy` token does not diff --git a/hooks/render-deployment-docs.sh b/hooks/render-deployment-docs.sh index 28d2be6..13c280f 100755 --- a/hooks/render-deployment-docs.sh +++ b/hooks/render-deployment-docs.sh @@ -10,15 +10,22 @@ # What it writes (in ): # ai/context/deployment.md — REGENERATED: URLs with live probe results # (the app, its database check, whether Stripe -# is connected yet), identity, secrets -# inventory BY NAME, integrations +# is connected yet), 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 }" @@ -36,10 +43,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="?" @@ -76,17 +79,6 @@ for pair in "stage|$stage_url" "prod|$prod_url"; do done stripe_stage="$(stripe_state "$stage_url")"; stripe_prod="$(stripe_state "$prod_url")" -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. @@ -103,15 +95,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}-web-stage\`, \`${brand}-web-prod\` on \`${sub}.workers.dev\` | | CI lane CLI pin | orun \`${lanepin}\` (\`.github/workflows/ci.yml\`) | @@ -136,25 +127,23 @@ Stripe is not a provider the platform brokers: its keys are Worker secrets the owner adds per environment (README, "Connect Stripe"). Everything else — sign-up, sign-in, the dashboard, teams — works without them. -## Secrets inventory (names only) - -Project rung: -${secrets_proj} - -Environment \`stage\`: -${secrets_stage} +## Secrets (names only) -Environment \`prod\`: -${secrets_prod} - -Provider secrets are BROKERED (minted per run from the workspace's Cloudflare -and Supabase connections; no long-lived values at rest). The Supabase -project's ref, password and URL and the Hyperdrive wiring are published by -the Terraform applies onto the stage and prod rungs. - -## Workspace integrations - -${integrations} +| secret | where | what it is | +|---|---|---| +| \`CLOUDFLARE_API_TOKEN\` | the workspace | BROKERED from its Cloudflare connection (\`workers-deploy\`): deploys the app's Worker | +| \`CLOUDFLARE_HYPERDRIVE_TOKEN\` | the workspace | BROKERED (\`hyperdrive-edit\`): applies the Hyperdrive config — the deploy token cannot touch Hyperdrive | +| \`CLOUDFLARE_ACCOUNT_ID\` | the workspace | the Cloudflare connection's account id — a fact, not a credential | +| \`SUPABASE_ACCESS_TOKEN\` | the workspace | BROKERED from its Supabase connection (\`management-access\`): creates the project and runs the migrations | +| \`SUPABASE_ORG_ID\` | the workspace | the Supabase connection's organization id — a fact, not a credential | +| \`SUPABASE_PROJECT_REF\`, \`SUPABASE_DB_PASSWORD\`, \`SUPABASE_DB_URL\` | \`${repo}\` on stage and on prod | written by the Supabase root's apply: the project's ref, its database password and its connection URL, read by Hyperdrive and the migrations | +| \`WIRING_CLOUDFLARE_HYPERDRIVE\` | \`${repo}\` on stage and on prod | written by the Hyperdrive root's apply: the config's id and name, not a credential | + +Brokered secrets are minted per run, so no long-lived value is at rest. +Stripe's keys are Worker secrets, not workspace secrets (above). 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 @@ -169,7 +158,7 @@ import re begin, end = "", "" body = f"""{begin} This product is **live**. Verified URLs, identity, whether Stripe is connected -and the secrets inventory are recorded in +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/infra/db-migrate/component.yaml b/infra/db-migrate/component.yaml index d50e884..532399d 100644 --- a/infra/db-migrate/component.yaml +++ b/infra/db-migrate/component.yaml @@ -13,6 +13,14 @@ spec: type: db-migrate 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: infra # Migrations read the Supabase connection from the orun secrets the diff --git a/infra/terraform/cloudflare-hyperdrive/component.yaml b/infra/terraform/cloudflare-hyperdrive/component.yaml index e6e386c..c03e4a3 100644 --- a/infra/terraform/cloudflare-hyperdrive/component.yaml +++ b/infra/terraform/cloudflare-hyperdrive/component.yaml @@ -12,6 +12,14 @@ spec: type: terraform 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: infra # Hyperdrive's origin is the Supabase project's Postgres, whose ref and diff --git a/infra/terraform/supabase/component.yaml b/infra/terraform/supabase/component.yaml index eea6afb..7bc4cdf 100644 --- a/infra/terraform/supabase/component.yaml +++ b/infra/terraform/supabase/component.yaml @@ -12,6 +12,14 @@ spec: type: terraform 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: infra parameters: diff --git a/packages/db/component.yaml b/packages/db/component.yaml index d6bf94c..68d3add 100644 --- a/packages/db/component.yaml +++ b/packages/db/component.yaml @@ -7,6 +7,14 @@ 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: data subscribe: environments: diff --git a/repo-blueprint.yaml b/repo-blueprint.yaml index 582ea0f..43d2276 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -191,6 +191,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 @@ -327,15 +331,23 @@ 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. (Under an orun older than v2.60, which has -# no run-level list, that hook is what creates the task — same identity, same -# result, one phase late.) +# 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. hooks: preInstantiate: - id: epic uses: orun.task/ensure@v1 + background: true with: kind: epic slug: "{{ .inputs.epicSlug }}" @@ -351,6 +363,7 @@ hooks: owner: me - id: m01 uses: orun.task/ensure@v1 + background: true with: kind: milestone epic: "{{ .inputs.epicSlug }}" @@ -361,6 +374,7 @@ hooks: - the home page and /api/health answer on both workers.dev URLs - id: m02 uses: orun.task/ensure@v1 + background: true with: kind: milestone epic: "{{ .inputs.epicSlug }}" @@ -370,6 +384,7 @@ hooks: - prod waits on stage again, and dev verifies every merge to main again - id: t01 uses: orun.task/ensure@v1 + background: true with: kind: task epic: "{{ .inputs.epicSlug }}" @@ -386,6 +401,7 @@ hooks: contract: .baseline/tasks/01-product.TaskContract.yaml - id: t02 uses: orun.task/ensure@v1 + background: true with: kind: task epic: "{{ .inputs.epicSlug }}" @@ -422,7 +438,15 @@ phases: - name: 01-product title: The product, built in one landing description: The whole tree — manifests, CI, tooling, the Supabase and Hyperdrive roots, the migrations, the app and its tests — branded, landed as one pull request, and provisioned and deployed by one convergence. - expectedMinutes: 18 + # An estimate, not a measurement: no bootstrap of this baseline has been + # timed. The convergence is most of it — a Supabase project takes five to + # seven minutes to come up, then Hyperdrive, the migrations and the app's + # build, deploy and smoke, stage and prod side by side. One minute less + # than before the v2.88.0 shape: on turso-starter's measured build that + # shape takes about a minute out of the same steps — the task set-up in + # the background, the landing checked in the box instead of by a runner, + # the watch reading every 5 s instead of 40. + expectedMinutes: 17 narrate: start: "Creating the repository and landing the whole product in one pull request — the app, its migrations, and the Terraform for a Supabase project and a Hyperdrive config per environment. Then one convergence provisions and deploys it in order. Usually about {{ .meta.expectedMinutes }} minutes." await: "One convergence is running per environment: the Supabase project first (five to seven minutes to come up), then Hyperdrive over its database, then the migrations, then the app. Nothing is stuck." @@ -446,19 +470,6 @@ phases: waitSeconds: 600 pollSeconds: 20 hooks: - pre: - # The epic, every milestone and every task already exist (the - # run-level list above). This finds the task and yields its key, which - # the landing binds the pull request to. - - 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 post: # A RE-RUN MUST HAVE SOMETHING TO LAND. A convergence can fail AFTER # its PR merged, and the merge has already put every file on main; @@ -532,11 +543,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 placed the baseline's complete lockfile and the whole - # tree is here, so this only confirms it — the Checks and every lane - # install with --frozen-lockfile. - - 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 @@ -565,12 +571,15 @@ phases: - link - "{{ .inputs.orunWorkspace }}" - "{{ .inputs.githuborg }}/{{ .inputs.reponame }}" - # The provider credentials, brokered, one hook per template: - # `integrations/reconcile` mints from ONE connection with ONE scope - # template, and these five keys are five scopes on purpose — the - # deploy token deliberately cannot touch Hyperdrive. Keys that already - # exist are kept. After the link, before the landing whose convergence - # uses them: + # The provider credentials, brokered, in ONE hook PER PROVIDER (orun + # >= v2.87.0): `secrets` mints each key under its own scope template + # from the one connection of that provider the build is bound to, + # reading the connections and the existing secrets once and creating + # the missing keys side by side. Two hooks, because a reconcile reads + # one connection: Cloudflare's three keys, then Supabase's two. Five + # keys are still five scopes on purpose — the deploy token + # deliberately cannot touch Hyperdrive. Keys that already exist are + # kept. After the link, before the landing whose convergence uses them: # CLOUDFLARE_API_TOKEN web's deploy (the composition's binding) # CLOUDFLARE_HYPERDRIVE_TOKEN cloudflare-hyperdrive's provider # CLOUDFLARE_ACCOUNT_ID web's deploy, cloudflare-hyperdrive @@ -578,42 +587,45 @@ phases: # SUPABASE_ORG_ID supabase (TF_VAR_supabaseOrgId) # Stripe's keys are not minted: no connection brokers them, and the # product deploys without them (its README, "Connect Stripe"). - - id: secret-workers-deploy + - id: secrets-cloudflare uses: orun.integrations/reconcile@v1 with: provider: cloudflare - keys: [CLOUDFLARE_API_TOKEN] - template: workers-deploy - - id: secret-hyperdrive-edit - uses: orun.integrations/reconcile@v1 - with: - provider: cloudflare - keys: [CLOUDFLARE_HYPERDRIVE_TOKEN] - template: hyperdrive-edit - - id: secret-account-id - uses: orun.integrations/reconcile@v1 - with: - provider: cloudflare - keys: [CLOUDFLARE_ACCOUNT_ID] - template: account-id - - id: secret-supabase-access + secrets: + - { key: CLOUDFLARE_API_TOKEN, template: workers-deploy } + - { key: CLOUDFLARE_HYPERDRIVE_TOKEN, template: hyperdrive-edit } + - { key: CLOUDFLARE_ACCOUNT_ID, template: account-id } + - id: secrets-supabase uses: orun.integrations/reconcile@v1 with: provider: supabase - keys: [SUPABASE_ACCESS_TOKEN] - template: management-access - - id: secret-supabase-org - uses: orun.integrations/reconcile@v1 + secrets: + - { key: SUPABASE_ACCESS_TOKEN, template: management-access } + - { key: SUPABASE_ORG_ID, template: org-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: supabase - keys: [SUPABASE_ORG_ID] - template: org-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 - # (install, typecheck, lint, test, build) and `plan` — on a bootstrap - # branch (`orun/BASE-…`) the lanes are skipped (ci.yml), because the - # merge runs every one of them on main a minute later, for real, and - # the convergence after the merge is what this phase 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 the convergence after it is what this phase + # watches to green. - id: land uses: orun.pr/land@v1 narrate: "The product is merged into main." @@ -622,6 +634,7 @@ phases: epic: "{{ .inputs.epicSlug }}" branchSlug: "{{ .phase.name }}" title: "feat: {{ .inputs.productname }}, the whole product from the saas-starter baseline" + checks: local await: - id: converge uses: orun.run/watch@v1 @@ -635,17 +648,24 @@ phases: repo: "{{ .inputs.githuborg }}/{{ .inputs.reponame }}" resumeBudget: 3 waitSeconds: 3600 - # WHERE THE OUTPUTS ARE PUBLISHED: each apply lease-publishes its - # outputs to the project's ENVIRONMENT rungs (stage and prod), not to - # the workspace. The Supabase project's three, which Hyperdrive and - # db-migrate read, and the Hyperdrive wiring the app's deploy renders. - - id: wiring - uses: orun.secrets/exists@v1 - narrate: "The Supabase credentials and the Hyperdrive wiring are published on stage and prod." - with: - keys: [SUPABASE_PROJECT_REF, SUPABASE_DB_PASSWORD, SUPABASE_DB_URL, WIRING_CLOUDFLARE_HYPERDRIVE] - project: "{{ .inputs.reponame }}" - environments: [stage, prod] + # 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 SEPARATE CHECK OF WHAT THE APPLIES PUBLISH. Each apply + # lease-publishes its outputs to the project's stage and prod rungs, + # and every one of the four is resolved IN THIS CONVERGENCE, from the + # place every later run looks (the readers' component.yaml + # `secretEnv`, fail-closed when a job starts), by a job that waits for + # its publisher on main (`mode: enforced`): + # SUPABASE_PROJECT_REF, SUPABASE_DB_PASSWORD + # cloudflare-hyperdrive (its origin) + # and db-migrate, per environment + # SUPABASE_DB_URL db-migrate, per environment + # WIRING_CLOUDFLARE_HYPERDRIVE web's deploy, both rungs in each job + # A missing document fails that lane, so a green run already says all + # four are there. testing/phases.test.sh fails if one of them loses + # its reader, and asks for an `orun.secrets/exists@v1` await again for + # any key nothing in the convergence reads. - id: verify uses: orun.http/probe@v1 narrate: "The app and its database check answered on stage and prod." @@ -657,31 +677,22 @@ phases: - "https://{{ .inputs.reponame }}-web-prod.{{ .inputs.subdomain }}.workers.dev/api/health" # 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. + # 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: the render's probes, a landing checked in the box, a merge. + expectedMinutes: 1 narrate: start: "Now recording what was actually built — probing every URL, noting whether Stripe is connected yet, 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 product 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 @@ -696,6 +707,16 @@ 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. - id: land uses: orun.pr/land@v1 narrate: "The deployment record is merged into main." @@ -704,13 +725,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 }}-web-stage.{{ .inputs.subdomain }}.workers.dev" - - "https://{{ .inputs.reponame }}-web-stage.{{ .inputs.subdomain }}.workers.dev/api/health" - - "https://{{ .inputs.reponame }}-web-prod.{{ .inputs.subdomain }}.workers.dev" - - "https://{{ .inputs.reponame }}-web-prod.{{ .inputs.subdomain }}.workers.dev/api/health" + checks: local diff --git a/testing/coverage.test.sh b/testing/coverage.test.sh index 1ee1577..6b1cd50 100755 --- a/testing/coverage.test.sh +++ b/testing/coverage.test.sh @@ -95,6 +95,46 @@ 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 two test suites had none. +# +# And a domain may not share a component's name. The catalog keys entities by +# name, so the `web` domain (`spec.domain: web`) took the `web` component's +# place, and the product's one deployable was missing from its own catalog. +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 + for domain in (spec.get("domain"), (meta.get("labels") or {}).get("domain")): + if domain: + domains.setdefault(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 a920023..9a48527 100644 --- a/testing/e2e.test.sh +++ b/testing/e2e.test.sh @@ -6,11 +6,13 @@ # and that its own plan converges in the right order. This proves it WORKS, # by doing to it what its own pipelines will: # -# 1. at the 01-product landing (the commit its PR merges), run what -# `checks.yml` runs on that PR — install with the lockfile the phase -# placed, render the wrangler fixture (which must change nothing: the -# render is committed), typecheck, lint, test, build. That landing WAITS -# on its checks; +# 1. at the 01-product landing (the commit its PR merges), install with the +# lockfile the product ships, render the wrangler fixture (which must +# change nothing: the render is committed), typecheck, lint, test, build. +# The landing itself is checked in the build box with `orun validate` +# and `orun plan` alone (`checks: local`), and its PR runs `plan` alone +# (an `orun/BASE-*` branch), so THIS is where a product those steps +# refuse is caught: before the tag, not after a build has merged it; # 2. a Postgres of its own on a random port, with Supabase's roles — the # database a Supabase project would be: `postgres` a login role WITHOUT # superuser or BYPASSRLS, `anon` and `authenticated` with the Data API's @@ -93,24 +95,25 @@ 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 NEXT_TELEMETRY_DISABLED=1 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 — what the product's Checks +# workflow ran on a pull request before the product carried ci.yml alone — +# run here at once on the whole tree. +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 } # One job of a plan, written out as the runner would run it: each `run:` step @@ -160,7 +163,7 @@ bootstrap_offline "$root" "$tree" "$values" "$scratch/logs" > "$scratch/bootstra echo " 2 phases placed and landed" # ── 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" s01="$(git -C "$tree" rev-parse HEAD~1)" at01="$scratch/at-01/$repo" git -C "$tree" worktree add -q "$at01" "$s01" @@ -196,10 +199,11 @@ git -C "$prtree" checkout -q main (cd "$prtree" && orun plan --intent intent.yaml --trigger github-pull-request --base empty --head HEAD --env stage \ --output "$scratch/plan-pr.json") > "$scratch/plan-pr.log" 2>&1 \ || { echo "FAIL: orun plan (pull request)" >&2; tail -15 "$scratch/plan-pr.log" >&2; exit 1; } -# This tier runs the orun the product's CI pins, which reads the per-edge -# `modeRules`: on a pull request — which applies and deploys nothing — the -# infrastructure edges that order a push to main are advisory, so no lane -# waits on another. (placement.test.sh checks the push to main's order.) +# This tier runs the bootstrap floor, newer than the orun the product's CI +# pins, and both read the per-edge `modeRules`: on a pull request — which +# applies and deploys nothing — the infrastructure edges that order a push to +# main are advisory, so no lane waits on another. (placement.test.sh checks +# the push to main's order.) python3 - "$scratch/plan-pr.json" <<'PY' import json, sys jobs = {j["component"]: j for j in json.load(open(sys.argv[1]))["jobs"] if j["environment"] == "stage"} diff --git a/testing/leak.test.sh b/testing/leak.test.sh index a1a7262..f5ddfd3 100755 --- a/testing/leak.test.sh +++ b/testing/leak.test.sh @@ -93,7 +93,7 @@ for p in placed: if "README.md" not in placed: bad("README.md would not ship") MUST = ( - ".github/workflows/ci.yml", ".github/workflows/checks.yml", ".rebrand/values.json", + ".github/workflows/ci.yml", ".rebrand/values.json", "apps/web/component.yaml", "apps/web/lib/site.ts", "apps/web/lib/auth/secret.ts", # COMMITTED, because the composition checks it exists before the build: "apps/web/wrangler.jsonc", "apps/web/wrangler.template.jsonc", "apps/web/wiring.fixture.json", diff --git a/testing/lib/bootstrap.sh b/testing/lib/bootstrap.sh index b4a75f7..9ecb534 100755 --- 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. # # The output directory starts EMPTY, as a real one does: no discovery root is # made here, so a phase that leaves orun's repo-scale gate one to find (apps/, diff --git a/testing/manifest.test.sh b/testing/manifest.test.sh index 5374cb5..64f04c8 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 three keys is +# three 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 871ea83..7449a24 100755 --- a/testing/phases.test.sh +++ b/testing/phases.test.sh @@ -19,6 +19,17 @@ # reads the restaged tree, the credentials are minted after the link and # before the landing whose convergence uses them), and a reorder fails live. # +# What the applies publish is not checked by a separate await: every key is +# resolved in the convergence, when a job starts, by a component that waits +# for its publisher on main — so a green convergence says the key is there, +# from the place every later run looks. This file holds that for each key, +# and asks for an `orun.secrets/exists@v1` await for any key nothing reads. +# +# And the shape that keeps a bootstrap fast (orun >= v2.88.0): 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. # @@ -56,16 +67,20 @@ HOOK_ONLY = {"02-docs"} # The phase that DEPLOYS, and so must give a re-run something to land. DEPLOYS = {"01-product"} +# 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. +PRE = {"01-product": [], "02-docs": []} # The post hooks, in the order they must run (the brief's chain): the # re-run marker and the git index; the rebrand and the re-tenant; the three # rewrites a product needs before it lands; the restage and the verify; the -# lockfile; the repository and its link; one brokered reconcile per key; -# the landing. `secret-*` stands for the reconcile hooks, checked below. +# repository and its link; one brokered `secrets` reconcile per provider +# (checked below); the task, then the landing. POST_ORDER = { "01-product": ["retouch", "git-init", "stage", "rebrand", "orun-workspace", "work-tree", "promotion", "dev-lanes", "restage", "rebrand-verify", - "pnpm-lockfile", "repo", "link", "secret-*", "land"], - "02-docs": ["promotion", "dev-lanes", "render", "land"], + "repo", "link", "secrets-cloudflare", "secrets-supabase", "task", "land"], + "02-docs": ["promotion", "dev-lanes", "render", "task", "land"], } # The scripts behind the run: hooks that rewrite intent.yaml, with the mode # each must be called in. @@ -77,8 +92,12 @@ RUNS = { ("02-docs", "dev-lanes"): ("tooling/bootstrap/dev-lanes.mjs", "--restore"), ("02-docs", "render"): ("hooks/render-deployment-docs.sh", None), } -AWAIT_ORDER = {"01-product": ["orun.run/watch@", "orun.secrets/exists@", "orun.http/probe@"], - "02-docs": ["orun.http/probe@"]} +# 01-product watches its convergence and probes the app; it awaits nothing +# the convergence already proved (below — a published key nothing reads puts +# an `orun.secrets/exists@` between the two). 02-docs awaits nothing: its +# render probes as it writes, and its landing redeploys nothing. +AWAIT_ORDER = {"01-product": ["orun.run/watch@", "orun.http/probe@"], + "02-docs": []} by_name = {p["name"]: p for p in phases} names = [p["name"] for p in phases] @@ -144,26 +163,41 @@ def hooks_of(p): run_hooks = list((bp.get("hooks") or {}).get("preInstantiate") or []) # ── the hook chain, in order ────────────────────────────────────────────── +for name, want in PRE.items(): + got = [h.get("id") for h in ((by_name.get(name, {}).get("hooks") or {}).get("pre") or [])] + if got != want: + bad(f"phase {name}'s pre hooks are {got}; want {want} — a task found in `pre` waits " + f"for the background task set-up before the phase has done anything") for name, want in POST_ORDER.items(): p = by_name.get(name) if not p: continue post = (p.get("hooks") or {}).get("post") or [] ids = [h.get("id") for h in post] - folded = [] - for i in ids: - tok = "secret-*" if (i or "").startswith("secret-") else i - if not folded or folded[-1] != tok: - folded.append(tok) - if folded != want: + if ids != want: bad(f"phase {name}'s post hooks run {ids}; the chain is {want}") + # THE BROKERED KEYS, 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 are two hooks; two + # hooks whose other parameters are the same are one hook written twice. + shared = {} for h in post: - if (h.get("id") or "").startswith("secret-") and not (h.get("uses") or "").startswith("orun.integrations/reconcile@"): + if (h.get("id") or "").startswith("secrets") and not (h.get("uses") or "").startswith("orun.integrations/reconcile@"): bad(f"phase {name} hook {h.get('id')} is not an orun.integrations/reconcile@v1") - if (h.get("uses") or "").startswith("orun.integrations/reconcile@"): - keys = (h.get("with") or {}).get("keys") or [] - if len(keys) != 1: - bad(f"phase {name} hook {h.get('id')} reconciles {keys} — one key per hook, one scope per key") + if not (h.get("uses") or "").startswith("orun.integrations/reconcile@"): + continue + w = h.get("with") or {} + if "keys" in w or "template" in w or not w.get("secrets"): + bad(f"phase {name} hook {h.get('id')} does not use the `secrets: [{{key, template}}]` form — " + f"one template per hook reads the connections and the secrets once per key") + if h.get("id") != f"secrets-{w.get('provider')}": + bad(f"phase {name} hook {h.get('id')} mints from {w.get('provider')}; name it secrets-{w.get('provider')}") + same = tuple(sorted((k, str(v)) for k, v in w.items() if k != "secrets")) + if same in shared: + bad(f"phase {name} hooks {shared[same]} and {h.get('id')} take the same parameters {dict(same)} — " + f"merge them into one `secrets` list") + shared.setdefault(same, h.get("id")) for (ph, hid), (script, mode) in RUNS.items(): if ph != name: continue @@ -171,36 +205,80 @@ for name, want in POST_ORDER.items(): argv = " ".join((hook or {}).get("run") or []) if script not in argv or (mode and mode not in argv): bad(f"phase {name} hook {hid} must run {script} {mode or ''}".rstrip()) -for name, want in AWAIT_ORDER.items(): - awaits = ((by_name.get(name) or {}).get("hooks") or {}).get("await") or [] - got = [h.get("uses") or "" for h in awaits] - if len(got) != len(want) or not all(g.startswith(w) for g, w in zip(got, want)): - bad(f"phase {name}'s await hooks are {got}; they must be {want} (in that order)") -# ── the await checks what the infrastructure publishes, on stage and prod ─ -# Each infra component's `secretOutputs` is what its apply lease-publishes; -# the landing's `orun.secrets/exists@v1` must ask for exactly those keys — -# every WIRING_* document and the Supabase project's credentials — on the -# environments that apply them. -published = set() -for comp in sorted(root.glob("infra/**/component.yaml")): - params = ((yaml.safe_load(comp.read_text()) or {}).get("spec") or {}).get("parameters") or {} - for pair in str(params.get("secretOutputs") or "").split(","): +# ── what the infrastructure publishes is read in the convergence ────────── +# Each infra component's `secretOutputs` is what its apply lease-publishes to +# the project's stage and prod rungs. A key is PROVED by the convergence when +# a component resolves it from that place as its job starts (a `secretEnv` +# reference, fail-closed: a missing document fails the lane) and waits for +# the publisher on a merge to main (`mode: enforced`, advisory on a pull +# request), on both stage and prod. Such a key needs no await; a key nothing +# reads that way must be awaited with `orun.secrets/exists@v1` on stage and +# prod in 01-product — and a key the convergence already proves must not be, +# because that await is a platform round trip that can only agree. +comps = {} +for f in root.rglob("component.yaml"): + if "node_modules" in f.parts: + continue + d = yaml.safe_load(f.read_text()) or {} + comps[(d.get("metadata") or {}).get("name")] = (f.relative_to(root).as_posix(), d.get("spec") or {}) +def enforced_on_main(spec, target): + edge = next((d for d in spec.get("dependsOn") or [] if d.get("component") == target), None) + rules = (edge or {}).get("modeRules") or [] + return bool(edge) and edge.get("mode") == "enforced" and any( + r.get("mode") == "advisory" and (r.get("when") or {}).get("triggerRef") == "github-pull-request" + for r in rules) +published = {} +for name, (rel, spec) in comps.items(): + for pair in str((spec.get("parameters") or {}).get("secretOutputs") or "").split(","): if "=" in pair: - published.add(pair.split("=", 1)[0].strip()) + published[pair.split("=", 1)[0].strip()] = name if not published: bad("no infra component declares secretOutputs — this check has gone blind") +proved, readers_of = set(), {} +for key, pub in sorted(published.items()): + covered = set() + for name, (rel, spec) in comps.items(): + if name == pub: + continue + subscribed = {e.get("name") for e in ((spec.get("subscribe") or {}).get("environments") or [])} + for ref in (spec.get("secretEnv") or {}).values(): + m = re.fullmatch(r"secret://[^/]+/[^/]+/([^/]+)/([A-Z0-9_]+)", str(ref)) + if not m or m.group(2) != key: + continue + readers_of.setdefault(key, set()).add(name) + if not enforced_on_main(spec, pub): + bad(f"{rel} resolves {key} and does not wait for {pub} on a merge to main — declare " + f"dependsOn {pub} with mode: enforced and a modeRules advisory on github-pull-request") + continue + env = m.group(1) + on = subscribed & {"stage", "prod"} + covered |= on if "{{" in env else ({env} if on and env in ("stage", "prod") else set()) + if covered >= {"stage", "prod"}: + proved.add(key) awaits = ((by_name.get("01-product") or {}).get("hooks") or {}).get("await") or [] exists = [h for h in awaits if (h.get("uses") or "").startswith("orun.secrets/exists@")] -if exists: - w = exists[0].get("with") or {} - if set(w.get("keys") or []) != published: - bad(f"01-product awaits secrets {sorted(w.get('keys') or [])}; the infrastructure " - f"publishes {sorted(published)}") +awaited = {k for h in exists for k in ((h.get("with") or {}).get("keys") or [])} +if set(published) - proved - awaited: + bad(f"01-product neither reads nor awaits {sorted(set(published) - proved - awaited)} — nothing in " + f"the convergence resolves it on stage and prod, so await it with orun.secrets/exists@v1") +if awaited & proved: + bad(f"01-product awaits {sorted(awaited & proved)}, which the convergence already resolves " + f"({', '.join(sorted({r for k in awaited & proved for r in readers_of.get(k, ())}))}) — drop them") +for h in exists: + w = h.get("with") or {} if sorted(w.get("environments") or []) != ["prod", "stage"]: bad(f"01-product awaits the published secrets on {w.get('environments')}, not stage and prod") if w.get("project") != "{{ .inputs.reponame }}": bad("01-product awaits the published secrets in another project than the product's") +# A key nothing reads is awaited between the watch and the probe. +if set(published) - proved: + AWAIT_ORDER["01-product"] = ["orun.run/watch@", "orun.secrets/exists@", "orun.http/probe@"] +for name, want in AWAIT_ORDER.items(): + awaits = ((by_name.get(name) or {}).get("hooks") or {}).get("await") or [] + got = [h.get("uses") or "" for h in awaits] + if len(got) != len(want) or not all(g.startswith(w) for g, w in zip(got, want)): + bad(f"phase {name}'s await hooks are {got}; they must be {want} (in that order)") for name in names: for h in ((by_name[name].get("hooks") or {}).get("await") or []): if (h.get("uses") or "").startswith("orun.http/probe@"): @@ -233,6 +311,43 @@ for p in phases: bad(f"phase {p['name']} deploys and does not watch the convergence of the " f"commit it merged (orun.run/watch@v1 with sha: mergeSha)") +# ── 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") +# No phase reaches the task plane in `pre`: that waits for the background at +# once, before the phase has placed a file — the old order. +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']} pre hook {h.get('id')} uses {h['uses']} — find the task in " + f"`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 a minute of 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") + # ── every phase's task is one the run-level list opens, in the same order ─ def task_names(hooks): return [(h.get("with") or {}).get("name") for h in hooks @@ -329,8 +444,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 @@ -361,7 +483,9 @@ placed_n = sum(len(p.get("modules") or []) for p in phases) 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 (all in 01-product), {len(HOOK_ONLY)} hook-only — in execution order") -print(f" the hook chain in order; 01-product awaits {sorted(published)} on stage and prod") +print(f" the hook chain in order; the convergence resolves {sorted(proved)} on stage and prod, " + f"each from a job that waits for its publisher" + (f"; 01-product awaits {sorted(awaited)}" if awaited else "")) +print(f" the fast shape: the task set-up in the background, no `pre` hook, every landing checks: local") print(f" {narrated} authored narration lines, every reference resolving") PY diff --git a/testing/placement.test.sh b/testing/placement.test.sh index dfde39c..5904411 100644 --- a/testing/placement.test.sh +++ b/testing/placement.test.sh @@ -12,7 +12,7 @@ # 2. THE OFFLINE BOOTSTRAP (testing/lib/bootstrap.sh) — both phases placed in # order, each finished by the blueprint's OWN `run:` hooks (the retouch # marker, rebrand, re-tenant, work-tree strip, the deferrals and their -# restore, the lockfile, the deployment record), each landing a commit; +# restore, the deployment record), each landing a commit; # 3. the product it ends with: branded with no residue, carrying nothing of # the factory and naming none of it, re-tenanted, its gates restored, its # record rendered, its wrangler config committed; @@ -30,9 +30,8 @@ # testing/e2e.test.sh goes on from here: it installs, migrates, builds and # serves the product, and signs a user up on it. # -# Needs: orun, node, pnpm, python3 (+PyYAML), git. No credential. The pnpm -# lockfile confirmation 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)" @@ -240,10 +239,10 @@ git -C "$at01" checkout -q "$s01" # The PRODUCT's CI plans with its own lane pin (ci.yml), not with the orun # that places the blueprint: per-edge `modeRules` — advisory on a pull -# request — are read by that pin, and the bootstrap floor (v2.58.11) plans -# them enforced everywhere. So the pull-request half below holds only when -# this orun is at least the product's pin; e2e.test.sh, pinned at the lane -# version, asserts it again. +# request — are read by that pin, and an orun older than it (v2.58.11, the +# bootstrap's floor before v2.88.0) plans them enforced everywhere. So the +# pull-request half below holds only when this orun is at least the +# product's pin — which the floor now is; e2e.test.sh asserts it again. lane_pin="$(sed -n 's/^ *version: *v\([0-9.]*\) *$/\1/p' "$tree/.github/workflows/ci.yml" | head -1)" this_orun="$(orun --version | sed -n 's/.*version v\{0,1\}\([0-9.]*\).*/\1/p' | head -1)" @@ -332,8 +331,10 @@ else: # from the product's own plan (component secretEnv AND the compositions' # bindings), the blueprint's reconcile hooks and the components' secretOutputs. bp = yaml.safe_load((root / "repo-blueprint.yaml").read_text()) +# Either form a reconcile takes: `secrets: [{key, template}]`, or `keys`. minted = {k for p in bp["phases"] for slot in (p.get("hooks") or {}).values() for h in slot - if (h.get("uses") or "").startswith("orun.integrations/reconcile@") for k in h["with"]["keys"]} + if (h.get("uses") or "").startswith("orun.integrations/reconcile@") + for k in [s["key"] for s in h["with"].get("secrets") or []] + list(h["with"].get("keys") or [])} published = set() for comp in tree.glob("infra/**/component.yaml"): so = str(((yaml.safe_load(comp.read_text()) or {}).get("spec") or {}).get("parameters", {}).get("secretOutputs") or "") diff --git a/tests/db/component.yaml b/tests/db/component.yaml index 7f6c72e..89332e6 100644 --- a/tests/db/component.yaml +++ b/tests/db/component.yaml @@ -2,10 +2,19 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: db-tests + description: The migrations' tests (the manifest and its checksums, each migration the twin of the app's drizzle-kit one, and row-level security on every table in public after every migration, on an in-process Postgres) 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/db/docs/overview.md b/tests/db/docs/overview.md index ea4ef3f..5247b20 100644 --- a/tests/db/docs/overview.md +++ b/tests/db/docs/overview.md @@ -1,5 +1,7 @@ # db-tests +The migrations' tests (the manifest and its checksums, each migration the twin of the app's drizzle-kit one, and row-level security on every table in public after every migration, on an in-process Postgres) + The test suite for **db**. It deploys nothing: its lane installs, builds and runs the tests. | | | diff --git a/tests/web/component.yaml b/tests/web/component.yaml index 352f7ad..c8c942d 100644 --- a/tests/web/component.yaml +++ b/tests/web/component.yaml @@ -2,10 +2,19 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: web-tests + description: The app's tests (sessions and passwords, the session key, the dashboard proxy, Stripe before and after it is connected, the committed wrangler config) 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/web/docs/overview.md b/tests/web/docs/overview.md index 3534e6b..23828b3 100644 --- a/tests/web/docs/overview.md +++ b/tests/web/docs/overview.md @@ -1,5 +1,7 @@ # web-tests +The app's tests (sessions and passwords, the session key, the dashboard proxy, Stripe before and after it is connected, the committed wrangler config) + The test suite for **web**. 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