From ed2b76c4fc39e41465a13e7867266727f1d7b715 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 09:55:04 +0000 Subject: [PATCH] =?UTF-8?q?SS9:=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, three components and the build panel's stricter narration rules (SS8), which stay. A. One secrets hook per provider (turso TU9). The four 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_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. Keys, templates and the card's order are unchanged; each hook keeps a narrate line the panel shows. 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 gets a description (its overview 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. The product README and AGENTS.md now say a pull request's lanes build and dry-deploy but type-check, lint and test nothing, so developers run those before they push; the baseline's e2e tier runs them before a tag. 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 instead of 40; no `pnpm install --lockfile-only` hook; 02-docs has no final probe (its render probes as it writes) and its render asks the platform nothing — the five CLI calls (workspace slug, three secret listings, integrations) are gone, replaced by 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, key by key. WIRING_SUPABASE is no longer awaited: web's stage and prod deploys resolve it as their job starts, from the place every later deploy reads it (optionalSecretEnv, so stage need not wait on prod's apply), after the apply (`mode: enforced` on main), and the build's render (tooling/wire/live.mjs --env) exits 1 when that environment's document is missing — a green convergence proves it. SUPABASE_PROJECT_REF, SUPABASE_DB_PASSWORD and SUPABASE_DB_URL stay awaited: nothing in this product reads them, so a green run says nothing about them. phases.test.sh replaces the rule that demanded the await for every published key: each must be read fail-closed on stage and prod by a job that waits for its publisher (an optional reference counts only with that live render), 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; ci.yml's lane pin, v2.78.4, stays), the blueprint job's setup-node with no package-manager cache (nothing there runs pnpm now), and BOOTSTRAP.md with its troubleshooting rows. expectedMinutes 13 + 2 → 12 + 1, card 15 → 13 ("about thirteen minutes"); estimates, not measurements. This landing also stops waiting on Checks' full Next.js build (its checks.yml had no bootstrap-branch skip), so the real saving may be larger than turso's minute. phases.test.sh holds the fast shape; the repository's stricter rule — no phase authors narrate.await — stays. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01CJuLwDKfEaQGAEuBpJvN5Q --- .baseline/product/AGENTS.md | 11 +- .baseline/product/README.md | 12 +- .github/workflows/baseline.yml | 31 +++- .github/workflows/checks.yml | 47 ----- BOOTSTRAP.md | 41 +++-- README.md | 5 +- ai/context/current.md | 8 +- ai/context/decisions.md | 1 + ai/context/deployment.md | 4 +- ai/context/open-risks.md | 7 +- ai/context/operations.md | 8 +- apps/web/component.yaml | 12 +- blueprint.yaml | 27 +-- docs/phases/01-product.md | 27 ++- docs/phases/02-docs.md | 7 +- docs/phases/README.md | 38 ++-- hooks/render-deployment-docs.sh | 68 +++---- infra/terraform/supabase/component.yaml | 8 + repo-blueprint.yaml | 205 +++++++++++---------- testing/coverage.test.sh | 40 +++++ testing/e2e.test.sh | 49 ++--- testing/leak.test.sh | 2 +- testing/lib/bootstrap.sh | 4 +- testing/manifest.test.sh | 9 +- testing/phases.test.sh | 229 +++++++++++++++++++----- testing/placement.test.sh | 19 +- tests/web/component.yaml | 9 + tests/web/docs/overview.md | 2 + tooling/catalog/gen-component-docs.py | 7 +- 29 files changed, 592 insertions(+), 345 deletions(-) delete mode 100644 .github/workflows/checks.yml diff --git a/.baseline/product/AGENTS.md b/.baseline/product/AGENTS.md index 8c89e33..ddb12d4 100644 --- a/.baseline/product/AGENTS.md +++ b/.baseline/product/AGENTS.md @@ -40,8 +40,10 @@ stage before prod. `dev` only verifies. one branch, one pull request against `main` — `orun pr open` names the branch after the task and records it in the pull request. - Before you push: `pnpm install`, `pnpm run wire:fixture`, `pnpm typecheck`, - `pnpm lint`, `pnpm test`, `pnpm build`. `checks.yml` runs the same on the - pull request; `orun validate` and `orun plan` show what `ci.yml` will plan. + `pnpm lint`, `pnpm test`, `pnpm build`. Nothing runs them for you: the pull + request's `ci.yml` lanes build and dry-deploy the app and plan the Supabase + root, and type-check, lint and test nothing. `orun validate` and + `orun plan` show what `ci.yml` will plan. - Merging is deploying. Watch the run on `main`, then probe the URLs in `ai/context/deployment.md`: a run that planned nothing deployed nothing. - A table in `public` gets row-level security and `auth.uid()` policies in the @@ -62,7 +64,8 @@ stage before prod. `dev` only verifies. redirect allow-list and `mailer_autoconfirm`, and undoes a dashboard edit. - Secret values, anywhere — the repository, `ai/context/`, a log, GitHub. Provider credentials are brokered per run; secrets are inspected by name. -- `checks.yml` on pull requests only: on `main`, `ci.yml` is the one run a - commit has. +- `ci.yml` as the only workflow on a push to `main`: whatever watches a + merge reads the newest run for its commit, and a second workflow there + could be the run it reads. - The last line of a `component.yaml` (`# orun: redeploy …`) is a deploy trigger; change it only to redeploy that component. diff --git a/.baseline/product/README.md b/.baseline/product/README.md index 23b848e..025c4fd 100644 --- a/.baseline/product/README.md +++ b/.baseline/product/README.md @@ -12,9 +12,9 @@ pointed at the app, on every merge to `main`. Not recorded yet. The bootstrap's last phase writes the live URLs, the -workspace, how sign-up behaves on each environment and the secrets inventory -into [ai/context/deployment.md](ai/context/deployment.md); how the product -deploys and how to operate it is in +workspace, how sign-up behaves on each environment 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). @@ -43,6 +43,9 @@ pnpm test pnpm build # next build + opennextjs-cloudflare build → apps/web/.open-next ``` +Run them before you push: a pull request's CI builds and dry-deploys the +app, but type-checks, lints and tests nothing. + The build needs no Supabase project: without one it inlines the committed `wrangler.jsonc`'s placeholder values, and nothing calls them. @@ -143,5 +146,4 @@ records the domain. Replace it with yours in the same pull request as | 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 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, the Supabase root checked and planned — with nothing applied or deployed (typecheck, lint and the tests are `pnpm` scripts you run before you push, above); a merge applies and deploys stage → prod | diff --git a/.github/workflows/baseline.yml b/.github/workflows/baseline.yml index e984bdb..89125c5 100644 --- a/.github/workflows/baseline.yml +++ b/.github/workflows/baseline.yml @@ -8,7 +8,7 @@ name: Baseline CI # and that the product installs, builds, deploys (dry), serves and signs a # user up and in through Supabase Auth (a local stand-in). # -# ─── 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,20 +69,30 @@ 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 web, enforced — and a --resume that - # changes nothing). + # 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 - uses: actions/setup-node@v5 with: node-version: 22 + # This job installs nothing either: with no lockfile hook the offline + # bootstrap never runs pnpm, so there is no store, and the pnpm cache + # setup-node v5 turns on by itself (package.json names a packageManager) + # fails the job saving a path that does not exist whenever no earlier + # cache exists for the lockfile. + package-manager-cache: false - name: repo-blueprint.yaml, read by the pinned CLI run: | set -euo pipefail @@ -103,8 +113,10 @@ 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; a local Postgres with Supabase's roles + # 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`); a local Postgres with Supabase's roles # and a stand-in for the Supabase endpoints the app and the SQL editor call # (Auth, and the Management API's query endpoint); the stage lane's own # structure check, build — inlining the stage wiring it is handed — output @@ -112,16 +124,17 @@ jobs: # served against that stand-in — its smoke, every route, a sign-up, a # sign-in, the protected page, the email-confirmation route, and the # tutorial's table closed to the Data API's roles by row-level security. - # 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 53a8fd4..0000000 --- a/.github/workflows/checks.yml +++ /dev/null @@ -1,47 +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 -# Supabase project: the build inlines the fixture's URL and key, and nothing -# here calls them. -# `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 02623c6..0baeb17 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -12,21 +12,28 @@ not separate workflows. The console card the platform renders is brokered secrets and the programme, and `testing/manifest.test.sh` holds it to what the build document does. -Target wall-clock: **about fifteen minutes** — an estimate summed from the -phases until a bootstrap measures it: one landing, then one convergence per -environment (stage and prod side by side until `02-docs` restores the +Target wall-clock: **about thirteen minutes** — an estimate summed from the +phases (12 + 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), -sets its Auth, and builds and deploys the app, in that order. +sets its Auth, and builds and deploys the app, 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, `environments` on the secrets probe, + `from: workspace`, a landing's `label`, 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 its Account API token with the permission groups the console's Connect recipe lists — Workers Scripts among them. @@ -87,8 +94,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 four brokered credentials; then the whole product in one PR — intent, CI, tooling, identity, the Supabase Terraform root, the app and its tests | the convergence green (supabase → 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 (how sign-up behaves included); prod's promotion gate and dev's push lanes restored | the final probe | +| `01-product` | the repository, created and linked; the four brokered credentials; then the whole product in one PR — intent, CI, tooling, identity, the Supabase Terraform root, 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 → web, per environment — the app's deploy resolving the `WIRING_SUPABASE` the apply before it published); the project's three database credentials, which nothing in the convergence reads, on stage and prod; `/` and `/api/health` answering on both workers.dev URLs | +| `02-docs` | `ai/context/deployment.md` from probed facts (how sign-up behaves 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-notes --run-hooks \ @@ -183,8 +190,8 @@ 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 +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, secrets, probe) and the `link` step are stood in for, a landing becoming a commit. @@ -226,14 +233,16 @@ at the tag and refuses the whole catalogue if it 404s. | supabase apply: project limit reached | the organization has no room for the two projects stage and prod need (the free plan allows two active projects per organization). Pause or delete one, or upgrade, then re-run `01-product` | | supabase apply: `does not support oauth access` | a supabase provider ≥ 1.6 reads billing endpoints the brokered OAuth token cannot; the root pins `~> 1.5.1` — keep it | | supabase apply: `Unable to read API keys` / `Unable to update auth settings` | the Supabase connection's grant does not cover the project's API keys or its Auth configuration (not yet exercised live with the platform's OAuth app). Reconnect Supabase with a personal access token and re-run `01-product`; the reconcile re-mints only what is missing | -| web: `wire: missing wiring documents … WIRING_SUPABASE_` | the supabase apply for that environment did not publish; its lane's log says why. web waits on it, enforced | +| web: `wire: missing wiring documents … WIRING_SUPABASE_` | the supabase apply for that environment did not publish; its lane's log says why. web waits on it, enforced — and this is the check that the wiring is there: nothing awaits it separately | +| `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 | | web smoke: `/api/health` 503 | `auth: key refused` — the inlined key is not the project's; `auth: unreachable` — the project is paused or still coming up | | `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) | | Sign-up says the address cannot be mailed | confirmation was turned on without SMTP: Supabase's own email reaches only the organization's members. Add SMTP, or set `authEmailConfirmation` back to `"false"` | | 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 is 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 939e7d5..84d4307 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,6 @@ every browser by design, and Row Level Security is the boundary. | 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 and deploys stage → prod on merge. 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 in the job tree orun stages, dry-deployed, and served against a local Supabase stand-in — a sign-up, a sign-in, the protected page, the confirm route, the tutorial's table under RLS | no | +| `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, the Supabase root planned; no typecheck, lint or tests), 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 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 01-product landing installed, its fixture rendered, type-checked, linted, tested and built, then built in the job tree orun stages, dry-deployed, and served against a local Supabase stand-in — a sign-up, a sign-in, the protected page, the confirm route, the tutorial's table under RLS | no | | `tag.yml` | cuts a `baseline-vN` tag (manual) | no | diff --git a/ai/context/current.md b/ai/context/current.md index a6d5e9e..9b3d990 100644 --- a/ai/context/current.md +++ b/ai/context/current.md @@ -19,7 +19,8 @@ environment), then records what went live (`02-docs`). | | | |---|---| | Latest tag | `baseline-v4` (SS7 — 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); `baseline-v3` is SS6 (the cirrus standard), `baseline-v2` SS5, `baseline-v1` SS4 | -| In review | SS8 (SS-10) — the build reads true in the console's build panel (saas-build-panel BV4): honest, short step lines, no authored await line (the engine says what a phase waits on), labelled landings, a quiet docs re-probe, and an `AGENTS.md` in every product. Untagged | +| In review | SS9 — the turso-starter v8 shape on the orun v2.88.0 floor: one `secrets` reconcile per provider, no `checks.yml`, every component's pages attached in the catalog and the app's domain `app`, the task set-up in the background, both landings checked in the box (`checks: local`), the watch at 5 s, no lockfile hook and no docs re-probe, and an await only of the three database credentials nothing reads (not `WIRING_SUPABASE`); the card's estimate 15 → 13 minutes. Untagged | +| Merged, untagged | SS8 (SS-10) — the build reads true in the console's build panel (saas-build-panel BV4): honest, short step lines, no authored await line (the engine says what a phase waits on), labelled landings, and an `AGENTS.md` in every product | | Proven live | No. Nothing has been applied against a real Supabase organization: no Terraform apply, no live deploy, no live bootstrap (risk SS-I). Everything short of the platform is proven offline in Baseline CI, against a local Supabase stand-in | ## Where to read @@ -34,9 +35,8 @@ environment), then records what went live (`02-docs`). ## Next -1. Cut `baseline-v5` once SS8 merges, so the registry can pin a build whose - lines the panel reads true (the labels and the quiet re-probe take effect - with orun v2.86; earlier releases ignore them). +1. Cut `baseline-v5` once SS9 merges (it carries SS8 too), so the registry + can pin a build on the v2.88.0 floor whose lines the panel reads true. 2. Bootstrap one product from the latest tag against a workspace with a Supabase connection, and record its timings — the apply, the brokered token's reach to the API-keys and Auth-config endpoints, a sign-up on the diff --git a/ai/context/decisions.md b/ai/context/decisions.md index ebf76ad..45834af 100644 --- a/ai/context/decisions.md +++ b/ai/context/decisions.md @@ -22,3 +22,4 @@ reads in order. | 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 (the origin is `SITE_URL`, else workers.dev); 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 (SS-9) | | 15 | No phase authors an await line, and every step line holds for each outcome its hook can have | The build panel shows hook lines verbatim as progress and a phase's waiting line as what the build waits on — also while a connection probe waits. Only the engine knows what that is, and with no authored line it says it (": <reason>"); its reasons are whole clauses, so an authored frame such as "Waiting on {{ .meta.waitingOn }}." read "Waiting on waiting for …". And a line written for one outcome ("merged" when there was nothing to land) lies in the other (saas-build-panel BV4) | `repo-blueprint.yaml`, `testing/phases.test.sh`, IMPLEMENTATION-STATUS (SS-10) | | 16 | Every product ships `AGENTS.md`, from `.baseline/product/` like its README | The build ends by handing the owner a prompt to clone the repository with a coding agent; the agent needs to know what to read and what not to touch. At this repository's root it would brief this repository's agents about the product | `repo-blueprint.yaml` (`root-agents`), IMPLEMENTATION-STATUS (SS-10) | +| 17 | 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, no docs re-probe, and an await only of what the convergence does not read — the project's three database credentials, not `WIRING_SUPABASE` | A bootstrap waited on things that did not need waiting for (a runner's checks and plan of a tree in the box, the task plane, a platform round trip for a document the app's deploy already resolves fail-closed after the apply); the catalog attached no docs and the `web` domain hid the `web` component | `repo-blueprint.yaml`, `testing/phases.test.sh`, `testing/coverage.test.sh` (SS9) | diff --git a/ai/context/deployment.md b/ai/context/deployment.md index d03f612..60196f8 100644 --- a/ai/context/deployment.md +++ b/ai/context/deployment.md @@ -3,5 +3,5 @@ > 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, how sign-up behaves on each environment's Supabase project, -> and the secrets inventory by name. Until then, nothing here claims the -> product is live. The operating contract is [operations.md](operations.md). +> 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 f4338a0..945747e 100644 --- a/ai/context/open-risks.md +++ b/ai/context/open-risks.md @@ -10,6 +10,7 @@ only what is still live, so it should be short. | SS-I | Unproven against a real organization: no Terraform apply, live deploy or live bootstrap yet — so whether the brokered Supabase token reaches the API-keys and Auth-config endpoints, whether a new project still returns a legacy anon key, and the wall-clock are all unknown | OPEN | One bootstrap from a tag against a workspace with a Supabase connection | | SS-A | `cacheComponents` on OpenNext: the prerendered shells are served from the read-only static-assets cache; a later Next or OpenNext could break the combination | WATCH (mitigated) | Holds while nothing revalidates; dropping `cacheComponents` is the one-line fallback | -Accepted, and worth knowing before you change them: SS-K (the bootstrap floor, -orun v2.58.11, plans `modeRules` as enforced; the product's lane pin reads -them). Settled: SS-D (Node ≥ 25 `localStorage` stub; CI builds on Node 22). +Settled: SS-K (the bootstrap floor, once orun v2.58.11, planned `modeRules` +as enforced; it is v2.88.0 now, newer than the product's lane pin, and reads +them as the pin does), SS-D (Node ≥ 25 `localStorage` stub; CI builds on +Node 22). diff --git a/ai/context/operations.md b/ai/context/operations.md index ad29122..83292c9 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, how sign-up behaves on each -environment, the secrets inventory) live in [deployment.md](deployment.md), +environment, the secrets it uses) live in [deployment.md](deployment.md), rendered from probed reality by the bootstrap's `02-docs` phase; this file is the contract that stays true between deployments. It is written to give an agent with repository read access enough context to reason about and operate @@ -26,10 +26,12 @@ component-native desired-state repo. Three components: into one Worker plus Static Assets. It talks to Supabase over HTTPS with supabase-js (`@supabase/ssr`): the browser directly, the Worker on the server — never a Postgres connection. -- **`tests/web`** — the vitest suite, verified on the `dev` rung. +- **`tests/web`** — the vitest suite (`pnpm test`). Its `dev` lane installs + it and checks its structure; it does not run the tests, so run them (and + `pnpm typecheck`, `pnpm lint`) before you push. Environments: **`stage`** and **`prod`** are deployed; **`dev` is -verify-only by design** — lanes build and test, nothing deploys. +verify-only by design** — lanes build and verify, nothing deploys. ## Identity and tenancy diff --git a/apps/web/component.yaml b/apps/web/component.yaml index 7f7bf96..7832796 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 906053a..e3283ac 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -25,7 +25,7 @@ metadata: per environment — two in all, stage and prod, which is the free plan's limit per organization — points its Auth at the Worker, and CI deploys the app to both on merge, after its project. Sign-up works on the first - deploy, no email server needed. Live in about fifteen minutes. + deploy, no email server needed. Live in about thirteen minutes. tags: [supabase, auth, cloudflare, nextjs] spec: source: @@ -109,14 +109,15 @@ 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. Four keys, four - # scopes: the app needs no Hyperdrive, D1, KV or R2, and no database - # migration step — it reaches Supabase over HTTPS with the project's - # publishable key, which the Terraform apply publishes itself. + # 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. Four keys, four scopes: the app needs no + # Hyperdrive, D1, KV or R2, and no database migration step — it reaches + # Supabase over HTTPS with the project's publishable key, which the + # Terraform apply publishes itself. secrets: - key: CLOUDFLARE_API_TOKEN provider: cloudflare @@ -152,10 +153,10 @@ 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 build waits on it. - expectedMinutes: 15 + # Summed from the phases' expectedMinutes (12 + 1). An estimate until a + # bootstrap measures it: a Supabase project takes five to seven minutes to + # come up, and the app's build waits on it. + expectedMinutes: 13 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 511ec1c..9a5cd69 100644 --- a/docs/phases/01-product.md +++ b/docs/phases/01-product.md @@ -30,9 +30,12 @@ main and reads the order off it: `supabase → web`. ## 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 <stamp>` line in each component `.baseline/tasks/01-product.TaskContract.yaml` names (supabase, 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 is named after), the name seam, the domain, the workers.dev subdomain (the Worker's URL and the project's Auth Site URL). The upstream template's own links are left alone | @@ -40,13 +43,14 @@ main and reads the order off it: `supabase → web`. | `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) `<githuborg>/<reponame>` | | `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-*` | four `orun.integrations/reconcile@v1` hooks, one key and one scope each: `CLOUDFLARE_API_TOKEN` (workers-deploy), `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; labelled `Product` in the build panel | -| `converge` (await) | `orun.run/watch@v1` on the merge commit's run; resumes it up to three times | -| `wiring` (await) | `orun.secrets/exists@v1`: `WIRING_SUPABASE`, `SUPABASE_PROJECT_REF`, `SUPABASE_DB_PASSWORD` and `SUPABASE_DB_URL` on stage and prod | +| `secrets-cloudflare` | `orun.integrations/reconcile@v1`, Cloudflare's two keys in one hook, each under its own scope, created side by side: `CLOUDFLARE_API_TOKEN` (workers-deploy, the app's deploy) and `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, its API keys, its Auth settings) and `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); labelled `Product` in the build panel | +| `converge` (await) | `orun.run/watch@v1` on the merge commit's run, read every 5 s; resumes it up to three times | +| `wiring` (await) | `orun.secrets/exists@v1`: `SUPABASE_PROJECT_REF`, `SUPABASE_DB_PASSWORD` and `SUPABASE_DB_URL` on stage and prod — the apply's outputs that nothing in the convergence reads. Not `WIRING_SUPABASE`: the app's deploy resolves it, and fails without it, in the convergence (below) | | `verify` (await) | `orun.http/probe@v1`: `/` and `/api/health` on both workers.dev URLs | ## What the convergence does, per environment @@ -72,8 +76,13 @@ off. The owner turns it on later (the product's README, "Email"). ## 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, + the app's deploy resolved `WIRING_SUPABASE` from stage and prod, where + every later deploy reads it, and its render fails without it, so there is + no separate check that it exists. +- The project's three database credentials (`SUPABASE_PROJECT_REF`, + `SUPABASE_DB_PASSWORD`, `SUPABASE_DB_URL`) exist on stage and prod: no + component reads them yet, so they are asked of the platform. - `/` and `/api/health` answer on both workers.dev URLs. ## Failure modes @@ -87,6 +96,8 @@ off. The owner turns it on later (the product's README, "Email"). | supabase apply: the project never reports `ACTIVE_HEALTHY` | the project is still coming up after ten minutes, or failed to. Its state is in the Supabase dashboard; re-run the phase once it is healthy (the project is adopted, not recreated) | | supabase apply: project name already exists | `adopt.tf` looks the project up by name and imports it — if you removed that file, restore it | | web: `wire: missing wiring documents … WIRING_SUPABASE_<ENV>` | the supabase apply for that environment did not publish — read its log; web waits on it, so it shows as not run | +| `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 | | web smoke: `/api/health` 503 | `auth: key refused` — the key the build inlined is not the project's (a stale wiring document); `auth: unreachable` — the project is paused or the URL is wrong | | `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 (lane-scoped install), which Next 16's Turbopack refuses. Pin 0.19.0 — `intent.yaml` says why | | `verify-app-structure` fails: `test -f wrangler.jsonc` | `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) | diff --git a/docs/phases/02-docs.md b/docs/phases/02-docs.md index e91fe85..0785c4d 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 from the health check whether sign-up is open and whether it asks for email confirmation, 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, labelled `Docs` in the build panel. It touches no component, so it deploys nothing | -| `verify` (await) | the same probe `01-product` ended on, `quiet`: it files no second set of addresses | +| `render` | `hooks/render-deployment-docs.sh`: probes `/` and `/api/health` on both environments, reads from the health check whether sign-up is open and whether it asks for email confirmation, and regenerates `ai/context/deployment.md` — the identity, the probed URLs, how sign-up behaves, 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, labelled `Docs` in the build panel. 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, and the panel keeps the one set of addresses `01-product` filed | ## Re-running it diff --git a/docs/phases/README.md b/docs/phases/README.md index 122b288..df7470b 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 Terraform root, the app and its tests — one convergence provisions and deploys it in dependency order | convergence green; `WIRING_SUPABASE` and the project's three database credentials 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 Terraform root, the app and its tests — one convergence provisions and deploys it in dependency order | convergence green (the app's deploy resolving the `WIRING_SUPABASE` the apply published); the project's three database credentials, which nothing reads yet, published on stage and prod; `/` 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 app needs — the Supabase @@ -35,14 +40,25 @@ A job resolves its secrets when it starts, so the app's deploy reads the wiring document the apply published: the project's URL and publishable key, rendered into the Worker's vars and inlined into the browser bundle. `testing/placement.test.sh` reads that order off the product's own -`orun plan --trigger github-push-main`. +`orun plan --trigger github-push-main`. The deploy reads the document from +the place every later deploy looks, and its render fails without it, so a +green convergence already says it is there — there is no separate check. +Only what nothing in the convergence reads (the project's three database +credentials) is asked of the platform afterwards. Every landing is a pull request on a branch named for its task -(`orun/BASE-<n>-<phase>`). On those branches `ci.yml` runs `plan` only — the -intent, every component and every composition resolve — and skips the lanes, +(`orun/BASE-<n>-<phase>`), 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. Its pull requests run `ci.yml`'s verify lanes — the app built and +dry-deployed per environment, the Supabase root planned — which type-check, +lint and test nothing; 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 the product's README and `AGENTS.md` tell its developers to run +those steps before they push. 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 @@ -64,9 +80,9 @@ world, briefly, and no line asserts a state (`testing/phases.test.sh`): whether this build created it, a landing names its pull request or says there was nothing to land, a brokered key's holds whether it was minted now or kept; -- each landing carries a `label:` (`Product`, `Docs`), and `02-docs`'s - re-probe is `quiet: true`, so the panel gets one set of addresses. orun - releases before v2.86 ignore both keys. +- each landing carries a `label:` (`Product`, `Docs`), and `02-docs` has no + re-probe — its render probes as it writes — so the panel gets the one set + of addresses `01-product`'s probe filed. ## Inputs diff --git a/hooks/render-deployment-docs.sh b/hooks/render-deployment-docs.sh index 005d78f..230571f 100755 --- a/hooks/render-deployment-docs.sh +++ b/hooks/render-deployment-docs.sh @@ -10,15 +10,22 @@ # What it writes (in <out>): # ai/context/deployment.md — REGENERATED: URLs with live probe results # (the app, its Supabase Auth check, how -# sign-up behaves there), identity, secrets -# inventory BY NAME, integrations +# sign-up behaves there), 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 <!-- 02-docs:begin/end --> # 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 <out> <workspace> <baseline-dir>}" @@ -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="?" @@ -81,17 +84,6 @@ for pair in "stage|$stage_url" "prod|$prod_url"; do done auth_stage="$(auth_state "$stage_url")"; auth_prod="$(auth_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. @@ -108,15 +100,14 @@ cat > ai/context/deployment.md <<EOF > 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\`) | @@ -141,26 +132,21 @@ A project without an SMTP server of its own emails only its organization's members, so email confirmation is off until the owner turns it on (README, "Email"; \`authEmailConfirmation\` in the supabase component). -## 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 wiring (URL and publishable key) and its ref, database password and -database URL are published by the Terraform apply 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_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, reads its API keys and sets its Auth | +| \`SUPABASE_ORG_ID\` | the workspace | the Supabase connection's organization id — a fact, not a credential | +| \`WIRING_SUPABASE\` | \`${repo}\` on stage and on prod | written by the Supabase root's apply: the project's URL and publishable key, which the app's deploy reads — public by design, 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 — for you, and for any migration step you add | + +Brokered secrets are minted per run, so no long-lived value is at rest. The +service-role key is never published. 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 @@ -175,7 +161,7 @@ import re begin, end = "<!-- 02-docs:begin -->", "<!-- 02-docs:end -->" body = f"""{begin} This product is **live**. Verified URLs, identity, how sign-up behaves and -the secrets inventory are recorded in +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/terraform/supabase/component.yaml b/infra/terraform/supabase/component.yaml index 6860064..ad57c9a 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/repo-blueprint.yaml b/repo-blueprint.yaml index 2e590ca..9b4c067 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -202,6 +202,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 @@ -336,15 +340,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 narrate: 'Epic {{ .hooks.epic.outputs.key }} is open.' with: kind: epic @@ -361,6 +373,7 @@ hooks: owner: me - id: m01 uses: orun.task/ensure@v1 + background: true with: kind: milestone epic: "{{ .inputs.epicSlug }}" @@ -371,6 +384,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 }}" @@ -380,6 +394,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 }}" @@ -396,6 +411,7 @@ hooks: contract: .baseline/tasks/01-product.TaskContract.yaml - id: t02 uses: orun.task/ensure@v1 + background: true with: kind: task epic: "{{ .inputs.epicSlug }}" @@ -433,7 +449,17 @@ phases: - name: 01-product title: The product, built in one landing description: The whole tree — manifests, CI, tooling, the Supabase root, the app and its tests — branded, landed as one pull request, and provisioned and deployed by one convergence. - expectedMinutes: 13 + # 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 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. This landing also no longer waits on the Checks + # workflow's full Next.js build (its pull request ran it), so the real + # saving may be larger; until a bootstrap is timed, only the minute. + expectedMinutes: 12 # The console's build panel shows these lines verbatim, and the hooks' # own `narrate:` below as its progress, so each says one true thing, # briefly. NO `await` LINE, in either phase: a wait is also what the @@ -462,19 +488,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; @@ -548,11 +561,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 @@ -582,10 +590,14 @@ 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, one key per hook. 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 two keys, then Supabase's two. 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_ACCOUNT_ID web's deploy # SUPABASE_ACCESS_TOKEN supabase's provider: the project, its API @@ -596,44 +608,50 @@ phases: # supabase apply publishes in WIRING_SUPABASE itself. # # Each line is static: a hook id with a `-` cannot be named in a - # template, and the line is true whether the key was minted now or + # template, and the line is true whether the keys were minted now or # kept from an earlier run. - - id: secret-workers-deploy - uses: orun.integrations/reconcile@v1 - narrate: "CLOUDFLARE_API_TOKEN, for Workers deploys, is in place from the Cloudflare connection." - with: - provider: cloudflare - keys: [CLOUDFLARE_API_TOKEN] - template: workers-deploy - - id: secret-account-id + - id: secrets-cloudflare uses: orun.integrations/reconcile@v1 - narrate: "CLOUDFLARE_ACCOUNT_ID is in place from the Cloudflare connection." + narrate: "CLOUDFLARE_API_TOKEN, for Workers deploys, and CLOUDFLARE_ACCOUNT_ID are in place from the Cloudflare connection." with: provider: cloudflare - keys: [CLOUDFLARE_ACCOUNT_ID] - template: account-id - - id: secret-supabase-access + secrets: + - { key: CLOUDFLARE_API_TOKEN, template: workers-deploy } + - { key: CLOUDFLARE_ACCOUNT_ID, template: account-id } + - id: secrets-supabase uses: orun.integrations/reconcile@v1 - narrate: "SUPABASE_ACCESS_TOKEN, for the Supabase projects, is in place from the Supabase connection." + narrate: "SUPABASE_ACCESS_TOKEN, for the Supabase projects, and SUPABASE_ORG_ID are in place from the Supabase connection." with: provider: supabase - keys: [SUPABASE_ACCESS_TOKEN] - template: management-access - - id: secret-supabase-org - uses: orun.integrations/reconcile@v1 - narrate: "SUPABASE_ORG_ID is in place from the Supabase connection." + 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. - # A landing succeeds only once its PR is merged; `landed` is "false" - # when main already had every file (a re-run with nothing to land). + 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. A landing succeeds only once its PR is merged; + # `landed` is "false" when main already had every file (a re-run + # with nothing to land). - id: land uses: orun.pr/land@v1 label: Product @@ -643,6 +661,7 @@ phases: epic: "{{ .inputs.epicSlug }}" branchSlug: "{{ .phase.name }}" title: "feat: {{ .inputs.productname }}, the whole product from the supabase-starter baseline" + checks: local await: - id: converge uses: orun.run/watch@v1 @@ -656,17 +675,31 @@ phases: repo: "{{ .inputs.githuborg }}/{{ .inputs.reponame }}" resumeBudget: 3 waitSeconds: 3600 + # 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 # WHERE THE OUTPUTS ARE PUBLISHED: the apply lease-publishes its # outputs to the project's ENVIRONMENT rungs (stage and prod), not to - # the workspace. WIRING_SUPABASE — the project URL and publishable key - # the app's deploy renders and inlines — and Lumen's three database - # credentials, kept for the owner and for any migration step a later - # change adds. + # the workspace. Only what NOTHING in this convergence reads is asked + # of the platform here: + # WIRING_SUPABASE — the project URL and publishable key — is NOT + # awaited: web's deploy resolves this environment's document as + # its job starts, from the place every later deploy reads it + # (apps/web/component.yaml's optionalSecretEnv), after the apply, + # `mode: enforced` on main; and its build's render + # (tooling/wire/live.mjs --env) fails the lane when that document + # is missing. A green convergence already says it is there, on + # stage and on prod. + # SUPABASE_PROJECT_REF, SUPABASE_DB_PASSWORD, SUPABASE_DB_URL — + # Lumen's three database credentials, kept for the owner and for + # any migration step a later change adds — ARE: no component of + # this product reads them, so a green run says nothing about them. + # testing/phases.test.sh holds the split, key by key. - id: wiring uses: orun.secrets/exists@v1 - narrate: "WIRING_SUPABASE and the database credentials are published on stage and prod." + narrate: "The Supabase project's database credentials are published on stage and prod." with: - keys: [WIRING_SUPABASE, SUPABASE_PROJECT_REF, SUPABASE_DB_PASSWORD, SUPABASE_DB_URL] + keys: [SUPABASE_PROJECT_REF, SUPABASE_DB_PASSWORD, SUPABASE_DB_URL] project: "{{ .inputs.reponame }}" environments: [stage, prod] - id: verify @@ -680,12 +713,14 @@ 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: "Probing the live URLs and writing down what answered." done: "The deployment record is on main, and prod waits on stage again ({{ .meta.elapsed }})." @@ -694,16 +729,6 @@ phases: 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 @@ -719,6 +744,18 @@ phases: - id: render narrate: "ai/context/deployment.md and the README's live section are written from what each URL answered." run: ["bash", "{{ .baseline.dir }}/hooks/render-deployment-docs.sh", ".", "{{ .inputs.orunWorkspace }}", "{{ .baseline.dir }}"] + - id: task + uses: orun.task/ensure@v1 + with: + kind: task + epic: "{{ .inputs.epicSlug }}" + milestone: "{{ .phase.name }}" + name: "Record the live deployment" + prefix: BASE + contract: .baseline/tasks/02-docs.TaskContract.yaml + # Checked here and merged, as 01-product's landing is. Nothing after + # it: the render's probes are this phase's check, and 01-product's + # probe already filed the addresses, once. - id: land uses: orun.pr/land@v1 label: Docs @@ -728,16 +765,4 @@ phases: epic: "{{ .inputs.epicSlug }}" branchSlug: "{{ .phase.name }}" title: "docs(deployment): record the live deployment state" - await: - # The addresses 01-product's probe recorded; quiet, so this re-probe - # files no second set of them. - - id: verify - uses: orun.http/probe@v1 - quiet: true - 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..3ed4580 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 test suite 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 1502ff1..6095080 100644 --- a/testing/e2e.test.sh +++ b/testing/e2e.test.sh @@ -6,11 +6,14 @@ # 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`), its PR runs `plan` alone (an +# `orun/BASE-*` branch), and a product's pull-request lanes run none of +# these steps, so THIS is where a product those steps refuse is caught: +# before the tag, not after a build has merged it; # 2. a Supabase project of its own, stood in for: a Postgres on a random # port with Supabase's roles (testing/lib/local-postgres.sh) and the # endpoints this product and its tutorial call on a project — Auth @@ -101,24 +104,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 @@ -168,7 +172,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" @@ -223,10 +227,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 -# edge that orders a push to main is 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 edge that orders a push to main is +# 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 a9964b8..93f86b1 100755 --- a/testing/leak.test.sh +++ b/testing/leak.test.sh @@ -98,7 +98,7 @@ if "README.md" not in placed: if "AGENTS.md" not in placed: bad("AGENTS.md would not ship — a coding agent starts there") 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/supabase/errors.ts", # The build reads the Supabase project from the wrangler config: "apps/web/next.config.ts", 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 4b2154b..0a88c7f 100755 --- a/testing/manifest.test.sh +++ b/testing/manifest.test.sh @@ -83,13 +83,16 @@ def uses(phase, action): yield hook # THE SECRETS THE BOOTSTRAP MINTS. `orun.integrations/reconcile@v1` is what -# `create-secrets.sh` was written out longhand as: one connection, one scope -# template, the keys it ensures. Read per key so a hook minting two keys under -# one template is three facts rather than one. +# `create-secrets.sh` was written out longhand as: one connection, and per key +# the scope template it is minted under — `secrets: [{key, template}]`, or +# `keys` sharing one `template`. Read per key so a hook minting two keys is +# two facts rather than one. blueprint_secrets = {} for phase in bp_phases: for hook in uses(phase, "orun.integrations/reconcile@v1"): w = hook.get("with") or {} + for item in (w.get("secrets") or []): + blueprint_secrets[item.get("key")] = (w.get("provider"), item.get("template")) for key in (w.get("keys") or []): blueprint_secrets[key] = (w.get("provider"), w.get("template")) diff --git a/testing/phases.test.sh b/testing/phases.test.sh index ecb2cf7..f747e26 100755 --- a/testing/phases.test.sh +++ b/testing/phases.test.sh @@ -19,6 +19,18 @@ # 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 when the +# convergence already proves it: a key that a component resolves as its job +# starts, failing without it, and that waits for its publisher on main, is +# there — from the place every later run looks — once the convergence is +# green. This file holds that for each key, and asks for an +# `orun.secrets/exists@v1` await for every 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. # @@ -55,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. @@ -76,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; between the two it +# awaits only the published keys nothing in the convergence reads (below — +# with none, the `orun.secrets/exists@` drops out). 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] @@ -143,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("secret") 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 @@ -170,36 +205,105 @@ 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 — -# the WIRING_SUPABASE 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 that waits for the publisher on a merge to main (`mode: +# enforced`, advisory on a pull request) resolves it from that place as its +# job starts and fails without it, on both stage and prod: +# - a `secretEnv` reference fails the job when the document is missing; +# - an `optionalSecretEnv` reference does not — the job starts without it — +# so it proves the key on an environment only when the component's build +# renders that environment's document with tooling/wire/live.mjs +# (`--components <publisher> --env "${ORUN_ENVIRONMENT}"`), which exits 1 +# when the document is not there. That is how web reads WIRING_SUPABASE: +# optional, because stage's deploy may start before prod's apply has +# published. +# 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) +def renders_live(spec, pub): + build = str((spec.get("parameters") or {}).get("buildCommand") or "") + m = re.search(r"tooling/wire/live\.mjs\b[^;&|]*?--components\s+([\w,-]+)[^;&|]*?--env\s+\"?\$\{ORUN_ENVIRONMENT\}", build) + return bool(m) and pub in m.group(1).split(",") +published = {} +for name, (rel, spec) in comps.items(): + if not rel.startswith("infra/"): + continue + 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 [])} + refs = [(as_env, ref, False) for as_env, ref in (spec.get("secretEnv") or {}).items()] + refs += [(as_env, ref, True) for as_env, ref in (spec.get("optionalSecretEnv") or {}).items()] + for as_env, ref, optional in refs: + 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"} + envs = on if "{{" in env else ({env} if env in on else set()) + if optional: + # Proves only the rung the job's own render demands, under the + # name live.mjs reads it by. + want_env = f"WIRING_{pub.upper().replace('-', '_')}_{env.upper()}" + if "{{" in env or as_env != want_env or not renders_live(spec, pub): + continue + covered |= envs + 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") +if awaited - set(published): + bad(f"01-product awaits {sorted(awaited - set(published))}, which no infra component publishes") +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@"): @@ -232,6 +336,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 @@ -366,10 +507,12 @@ for p in phases: # "<title>: <reason>"; the reasons are whole clauses, so no authored frame # around `.meta.waitingOn` reads true); every step a reader should see # says what it left behind; every landing names its pull request for the -# reader (`label`); and a hook-only phase's re-probe files no second set of -# addresses (`quiet`). `label`, `pin` and `quiet` are orun >= v2.86 keys that -# earlier releases ignore — their shapes are checked here. -NARRATED = {"01-product": ["repo", "link", "secret-*", "land"], +# reader (`label`); and a hook-only phase files no second set of addresses — +# it has no re-probe (its render probes as it writes; the fast shape above), +# and one that came back would have to be `quiet`. `label`, `pin` and +# `quiet` are orun >= v2.86 keys, below the bootstrap floor (v2.88.0) — +# their shapes are checked here. +NARRATED = {"01-product": ["repo", "link", "secrets-*", "land"], "02-docs": ["render", "land"]} for p in phases: if (p.get("narrate") or {}).get("await"): @@ -416,7 +559,9 @@ 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")) narrated += sum(1 for h in run_hooks 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)}, which nothing reads" if awaited else "")) +print(f" the fast shape: the task set-up in the background, no `pre` hook, every landing checks: local, the watch at ≤ 10 s") print(f" {narrated} authored narration lines, every reference resolving") PY diff --git a/testing/placement.test.sh b/testing/placement.test.sh index 35e10c2..02373d2 100755 --- 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; @@ -31,9 +31,8 @@ # testing/e2e.test.sh goes on from here: it installs, builds and serves the # product against a local Supabase stand-in, 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)" @@ -265,10 +264,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)" @@ -355,8 +354,10 @@ else: # the owner and for a migration step the product does not have yet — named # here, so a fifth unread key cannot slip in. 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/web/component.yaml b/tests/web/component.yaml index 352f7ad..bc51179 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 vitest suite (the session proxy and its matcher, /api/health, what the auth forms say when Supabase refuses, the Next config and the committed wrangler config), run with pnpm test spec: type: turbo-package lifecycle: production owner: platform + # Its pages, attached to it in the workspace's catalog: what the Docs + # library shows for it, and what the catalog's docs and runbook checks read. + # Generated from what this manifest and its sources declare. + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: tests subscribe: environments: diff --git a/tests/web/docs/overview.md b/tests/web/docs/overview.md index 3534e6b..bbc02f7 100644 --- a/tests/web/docs/overview.md +++ b/tests/web/docs/overview.md @@ -1,5 +1,7 @@ # web-tests +The app's vitest suite (the session proxy and its matcher, /api/health, what the auth forms say when Supabase refuses, the Next config and the committed wrangler config), run with pnpm test + 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