From eb819e30e77119b233851e5d188d44070d844d97 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 09:51:49 +0000 Subject: [PATCH] =?UTF-8?q?CS6:=20the=20turso=20v8=20shape=20=E2=80=94=20o?= =?UTF-8?q?ne=20secrets=20hook,=20no=20Checks,=20docs=20in=20the=20catalog?= =?UTF-8?q?,=20tasks=20in=20the=20background,=20landings=20checked=20here?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit What sourceplane/turso-starter became across baseline-v6, v7 and v8, brought to the Sanity blog (two phases, 01-product and 02-docs; web and its tests; one Cloudflare provider, Sanity connected by the owner later; no infra, no wiring). A. One secrets hook. The two single-template reconciles (secret-workers-deploy, secret-account-id) are one `secrets` reconcile (orun >= v2.87.0): one connections read, one secrets read, the missing keys created side by side. Same provider and no other parameters, so they merge; keys, templates and order are the card's. There is no Sanity reconcile to keep apart: no platform connection mints Sanity's keys. manifest.test.sh reads the `secrets` form beside `keys`; the card's comment and docs/phases/01-product.md name the one hook. B. No Checks workflow; docs in the catalog; web found. - checks.yml is gone. The landing's PR waited on it (a full Next.js build); a blog's pull requests now verify through ci.yml's lanes, a bootstrap's landings through `plan`. The e2e tier runs the steps it ran (install, the fixture render, the committed config is that render, typecheck, lint, test, build) from its own LANDING_CHECKS list, at both landings as before; the leak gate no longer requires it. web's verify lanes build and dry-deploy and do not lint or run the tests, so the blog's README and its operating contract say to run them before a push, and the baseline's README CI table says what a PR runs. - apps/web and tests/web attach overview, architecture and runbook in spec.docs (the pages were already generated by tooling/catalog/gen-component-docs.py); web-tests gets a description and the generator rewrote its overview. The generator's docstring follows turso's. - apps/web's domain is `app`, not `web`: the catalog keys a domain and a component by name, so the `web` domain hid the `web` component. No component is named `app`. - coverage.test.sh holds both rules (the three pages attached and present, a description, no domain named like a component). C. The fast shape on orun v2.88.0. - The run-level task set-up runs in the background (`background: true` on all five hooks); each phase's `task` moves from `pre` to `post`, just before `land`, so neither phase has a `pre` hook. - Both landings are `checks: local` (orun validate, then orun plan as the PR and as the merge, in the box) and merge without waiting for CI. - The convergence watch reads every 5 s (it was the action's 40). - No `pnpm-lockfile` hook: the shipped lockfile is installed frozen by the lanes and by the e2e tier. - 02-docs: no final probe and no narrate.await (its render probes as it writes, and the landing redeploys nothing). 01-product keeps its probe. - The render asks the platform nothing: the five calls (`orun workspace`, three `orun secrets list`, `orun integrations list`) are gone. The record names CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID (workspace), SANITY_PROJECT_ID and SANITY_DATASET (the project's stage and prod, once the owner stores them) and the SANITY_API_READ_TOKEN Worker secret, and points to the console's Secrets and Integrations pages. The "secrets inventory" wording in ai/context and the blog's README follows. - No orun.secrets/exists await existed (nothing publishes wiring), so none is removed or kept. - expectedMinutes 12 + 2 -> 11 + 1, the card 14 -> 12, BOOTSTRAP "about twelve minutes"; estimates, not measured on this shape. - Floor v2.88.0: BOOTSTRAP.md (with the `has no parameter "checks"` row and the two `land` rows) and baseline.yml's blueprint tier, its placement step and its blog tier — each reads the blueprint, as turso's do since TU9. ci.yml's lane pin (v2.78.4) is unchanged. The blueprint tier's setup-node asks for no pnpm cache: with the lockfile hook gone that job never runs pnpm. - phases.test.sh: this repository's copy carries cirrus's pinned 01-product chain, so that chain is what changed — `secrets` and `task` before `land`, no `pnpm-lockfile`, one `secrets: [{key, template}]` reconcile per provider (replacing "one key per hook"), awaits `converge` then `verify` (an infra component now stops the test until turso's reader rule is ported, instead of demanding a wiring await), 02-docs awaiting nothing (replacing the rule that demanded its final probe). Plus turso's fast-shape rules: no `pre` hook and no task-plane `pre` hook, every preInstantiate hook background, every landing checks: local, the watch at most 10 s; narrate.await required where a phase awaits and refused where it awaits nothing. specs/ and tasks/ are untouched. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01CJuLwDKfEaQGAEuBpJvN5Q --- .baseline/product/README.md | 13 +- .github/workflows/baseline.yml | 46 ++++--- .github/workflows/checks.yml | 51 -------- BOOTSTRAP.md | 52 +++++--- README.md | 11 +- ai/context/deployment.md | 4 +- ai/context/operations.md | 8 +- apps/web/component.yaml | 12 +- blueprint.yaml | 16 +-- docs/phases/01-product.md | 27 ++-- docs/phases/02-docs.md | 7 +- docs/phases/README.md | 36 ++++-- hooks/render-deployment-docs.sh | 65 ++++------ repo-blueprint.yaml | 172 ++++++++++++++------------ testing/coverage.test.sh | 39 ++++++ testing/e2e.test.sh | 49 ++++---- testing/leak.test.sh | 2 +- testing/lib/bootstrap.sh | 4 +- testing/manifest.test.sh | 9 +- testing/phases.test.sh | 139 ++++++++++++++++----- testing/placement.test.sh | 13 +- tests/web/component.yaml | 9 ++ tests/web/docs/overview.md | 2 + tooling/catalog/gen-component-docs.py | 7 +- 24 files changed, 475 insertions(+), 318 deletions(-) delete mode 100644 .github/workflows/checks.yml diff --git a/.baseline/product/README.md b/.baseline/product/README.md index 13e8ab8..82d5d76 100644 --- a/.baseline/product/README.md +++ b/.baseline/product/README.md @@ -12,7 +12,7 @@ template, ported to Workers. Not recorded yet. The bootstrap's last phase writes the live URLs, the -workspace and the secrets inventory into +workspace and the secrets the blog uses into [ai/context/deployment.md](ai/context/deployment.md); how the blog deploys and how to operate it is in [ai/context/operations.md](ai/context/operations.md). @@ -90,7 +90,8 @@ pnpm test pnpm build # typegen + next build + opennextjs-cloudflare build → apps/web/.open-next ``` -That needs no Sanity project (Checks runs exactly this). With one: +That needs no Sanity project, and is what to run before you push: a pull +request builds the blog but does not lint or run its tests. With a project: ```bash cd apps/web @@ -126,9 +127,11 @@ environment, with that environment's Sanity project, and deploys — to only verifies. The Worker is `cms-sanity-web-` on your account's workers.dev subdomain, and every deploy is smoke-tested over HTTP: the home page must render and the draft-mode route must refuse a request without a -preview secret. `checks.yml` runs install, typecheck, lint, test and build -on every pull request. (A push to `main` runs `ci.yml` alone, which builds -and deploys.) +preview secret. A pull request runs the same pipeline's verify lanes: the +blog built and dry-deployed for each environment, with nothing deployed. +They do not lint or run the tests, so run `pnpm typecheck`, `pnpm lint` and +`pnpm test` before you push. (A push to `main` builds, deploys and +smoke-tests.) The pipeline holds one credential, GitHub's own `GITHUB_TOKEN`. The Cloudflare token and account id are brokered per run from the workspace's diff --git a/.github/workflows/baseline.yml b/.github/workflows/baseline.yml index 05a9d01..2c42c54 100644 --- a/.github/workflows/baseline.yml +++ b/.github/workflows/baseline.yml @@ -8,7 +8,7 @@ name: Baseline CI # produces installs, builds, deploys (dry) and serves with no Sanity project # behind it. # -# ─── 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 blog built from this repository. These jobs run @@ -68,21 +68,26 @@ jobs: # nothing. Then the leak gate (what a product would carry, derived by the # floor too), and the placement tier (the offline bootstrap: both phases # placed and finished by the blueprint's own hooks, then the product's own - # `orun plan` for the 01-product merge, under the product's lane pin, - # below). + # `orun plan` for the 01-product merge, below). blueprint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - uses: sourceplane/orun-action@v1.2.0 with: - version: v2.58.11 + version: v2.88.0 - uses: pnpm/action-setup@v4 with: version: 10.12.1 - uses: actions/setup-node@v5 with: node-version: 22 + # This job installs nothing either: with 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 @@ -98,34 +103,39 @@ jobs: - name: the leak gate — what a product carries run: bash testing/leak.test.sh # The placement tier ENDS with the product's own `orun plan` — what the - # product's ci.yml runs — so it runs under the product's lane pin, not - # the bootstrap floor: the plan a convergence waits on is the lane - # pin's (its optional secret refs included), and the test refuses an - # orun older than the pin rather than assert the wrong CLI's plan. Its - # placements are valid under either. + # product's ci.yml runs — so it needs an orun at the product's lane pin + # (v2.78.4) or newer: the plan a convergence waits on is the lane pin's + # (its optional secret refs included), and the test refuses an orun + # older than the pin rather than assert the wrong CLI's plan. The + # offline bootstrap before it reads the blueprint, which takes the + # bootstrap floor (v2.88.0: the one `secrets` reconcile, the task set-up + # in the background, the landings checked in the box), so this tier + # runs the floor, which is newer than the lane pin. - uses: sourceplane/orun-action@v1.2.0 with: - version: v2.78.4 + version: v2.88.0 - name: placement — the offline bootstrap, and the product's own plan run: | git config --global user.email ci@example.invalid git config --global user.name "baseline ci" bash testing/placement.test.sh - # Tier 2. THE BLOG IT PRODUCES WORKS, WITH NO SANITY PROJECT: its one - # landing under the checks its pull request waits on, the stage lane's own - # structure check, build, output check and dry deploy in the tree orun - # stages, and the built Worker served and smoke-tested with the component's - # own smoke command — the sample posts, the "connect your Sanity project" - # notice, the Studio's connect page and draft mode's refusal. Pinned at the - # product's lane version, because that is the orun the product's CI runs. + # Tier 2. THE BLOG IT PRODUCES WORKS, WITH NO SANITY PROJECT: each landing + # installed, its fixture rendered, type-checked, linted, tested and built, + # the stage lane's own structure check, build, output check and dry deploy + # in the tree orun stages, and the built Worker served and smoke-tested with + # the component's own smoke command — the sample posts, the "connect your + # Sanity project" notice, the Studio's connect page and draft mode's + # refusal. 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. blog: 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 77b3f48..0000000 --- a/.github/workflows/checks.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Checks - -# Credential-free verification: install, render the offline wrangler fixtures, -# typecheck, lint, test and build, on every pull request, linked or not. -# `ci.yml` is the Orun pipeline beside it (plan/run with brokered Cloudflare -# credentials, deploys on merge); it plans nothing until intent.yaml names a -# workspace. -# -# PULL REQUESTS ONLY — not pushes to main. A push to main must start exactly -# one workflow, `ci.yml`, because the 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 first live bootstrap -# watched this run go green while ci.yml's deploy lanes had failed, and called -# the blog converged. On main the convergence builds and tests the blog -# anyway. The baseline's coverage gate holds the rule. -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 - # …and the render is what is committed. The deploy lane checks that the - # config exists before it builds, so wrangler.jsonc is in the tree as the - # fixture render; a template edited without re-rendering fails here. - - name: the committed wrangler config is the fixture render - run: git diff --exit-code - - run: pnpm typecheck - - run: pnpm lint - - run: pnpm test - - run: pnpm build diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index a42b37a..88a041c 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -12,21 +12,26 @@ not separate workflows. The console card the platform renders is brokered secrets and the programme, and `testing/manifest.test.sh` holds it to what the build document does. -Target wall-clock: **about fourteen minutes** — an estimate summed from the -phases until a bootstrap measures it: ONE landing that places the whole blog -(its pull request waits on a full Next.js build in Checks) and one -convergence that builds and deploys it to stage and prod side by side, then -the record. It is cirrus-baseline's one-landing shape (baseline-v22): no -scaffold landing of its own, no second landing for the app. +Target wall-clock: **about twelve minutes** — an estimate summed from the +phases (11 + 1) until a bootstrap on this shape measures it. The shape: the +task set-up in the background while ONE landing places the whole blog, +brands it and checks it in the box (`orun validate` and `orun plan`, no +runner waited for — its pull request no longer waits on a full Next.js build +in Checks), then one convergence that builds and deploys it to stage and +prod side by side, then a short docs landing that records it. It is +cirrus-baseline's one-landing shape (baseline-v22): no scaffold landing of +its own, no second landing for the app. ## 0. What you need - GitHub org access (repository creation) and a machine with `git`, `node` (≥ 22), `pnpm` (10.12.1), `python3` with PyYAML, `curl`, and the `orun` - CLI **≥ v2.58.11** — the floor for RUNNING the bootstrap (the phase overlay, - landings that commit per phase and wait on the PR's whole CI run, - `githubOwner` on the doctor probe, a probe deferred for a project not yet - created, and `from: workspace`). The blog's own `ci.yml` pins its lanes + CLI **≥ v2.88.0** — the floor for RUNNING the bootstrap (the phase overlay, + landings that commit per phase, `githubOwner` on the doctor probe, a probe + deferred for a project not yet created, `from: workspace`, the deploy + credentials minted in one `secrets` reconcile, the task set-up run in the + background (`background: true`), and landings checked in the box before + they merge (`checks: local`)). The blog's own `ci.yml` pins its lanes separately (v2.78.4). - A Cloudflare account (the free plan is enough for one Worker with Static Assets) and its **Account API token** with Workers Scripts Write (the @@ -83,8 +88,8 @@ phase whose files are present but branded derives as `drifted`, and | phase | what it lands | verified by | |---|---|---| -| `01-product` | the repository, created and linked; the WHOLE blog in one PR — intent, CI, tooling, identity, `apps/web` + `tests/web`; the brokered Cloudflare secrets | its PR's checks, then the convergence green (build, deploy, smoke) and the blog answering on both workers.dev URLs | -| `02-docs` | `ai/context/deployment.md` from probed facts; prod's promotion gate and dev's push lanes restored | the final probe | +| `01-product` | the repository, created and linked; the WHOLE blog in one PR — intent, CI, tooling, identity, `apps/web` + `tests/web`; the brokered Cloudflare secrets | its commit validated and planned in the box (as the PR and as the merge), then merged; the convergence green (build, deploy, smoke) and the blog answering on both workers.dev URLs | +| `02-docs` | `ai/context/deployment.md` from probed facts; prod's promotion gate and dev's push lanes restored | the render's own probes, recorded; the commit checked in the box and merged | ```bash orun new --blueprint repo-blueprint.yaml --out ~/blogs/acme-notes --run-hooks \ @@ -181,18 +186,23 @@ each runs locally the same way: ```bash for t in manifest phases coverage rebrand retouch bootstrap-defer; do bash testing/$t.test.sh; done bash testing/leak.test.sh # needs orun -bash testing/placement.test.sh # needs orun ≥ ci.yml's pin, node, pnpm: the offline bootstrap -bash testing/e2e.test.sh # + network for pnpm: the blog built, dry-deployed and served, no Sanity project +bash testing/placement.test.sh # needs orun ≥ the floor (and so ≥ ci.yml's pin), node, pnpm: the offline bootstrap +bash testing/e2e.test.sh # + network for pnpm: each landing type-checked, linted, tested and built; the blog dry-deployed and served, no Sanity project ``` The offline bootstrap (`testing/lib/bootstrap.sh`) places both phases in order and finishes each with the blueprint's OWN `run:` hooks — read out of `repo-blueprint.yaml`, not transcribed — so the retouch marker, the rebrand, -the re-tenant, the work-tree strip, the deferrals and their restore, the -lockfile and the deployment record all run exactly as a real bootstrap runs -them. Only the platform's typed actions (task, repo, link, reconcile, land, -watch, probe) are stood in for, a landing becoming a commit on top of -orun's `Initial commit`. +the re-tenant, the work-tree strip, the deferrals and their restore and the +deployment record all run exactly as a real bootstrap runs them. Only the +platform's typed actions (task, repo, link, reconcile, land, watch, probe) +are stood in for, a landing becoming a commit on top of orun's `Initial +commit`. + +The bootstrap's landings check their commit in the box (`orun validate` and +`orun plan`) and the blog's pull requests build and dry-deploy it; neither +lints or runs the tests. The e2e tier is where those run, on each landing, +before a tag is cut. ## 5. Cutting a baseline tag (maintainers) @@ -223,10 +233,12 @@ at the tag and refuses the whole catalogue if it 404s. | The live blog says "Sample content" | expected until a Sanity project is connected (§3). Not a failure | | Connected, but `/` answers 500 | the project id or dataset is wrong, or the dataset is private without a token. Check `orun secrets list --env ` and the project in Sanity's console; fix the secret and redeploy | | The Studio says it cannot sign in / CORS | the Worker URL is not in the Sanity project's CORS origins with credentials allowed | +| `land` stops: `the landing's own check failed — orun plan for …` | the blog'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 blog's repository requires a status check on `main` (branch protection or a ruleset), so GitHub refused the early merge; the landing waits for the check as a `checks: ci` landing would, then merges | | Convergence failed AFTER the PR merged; re-running lands nothing | expected on its own — the files are on main. Re-run the phase (`--phase 01-product`, `--redo 01-product`, or the console's Retry): its `retouch` hook gives the landing a diff and the blog redeploys | | The blog'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 | | the convergence reported green, then `verify` got 404 from both URLs | a second workflow ran on the push to main and the watch took its run. Only `ci.yml` runs on a push to main (`testing/coverage.test.sh` holds it); read the CI run on main for the real result | | the convergence planned no lanes at all | the merge's push had no `before` to diff against (a first push straight onto an unborn `main`). The landing merges a pull request into orun's `Initial commit`, so its push has one; re-run the phase and its retouch marker re-plans the blog | diff --git a/README.md b/README.md index 28eb1a8..0a6d315 100644 --- a/README.md +++ b/README.md @@ -94,8 +94,10 @@ pnpm build # typegen + next build + opennextjs-cloudflare build → a pnpm --filter @app/web preview # wrangler dev over the built Worker: the sample posts, unconnected ``` -That much needs no Sanity project (`Checks` runs exactly this). To see your -own content: +That much needs no Sanity project: the baseline's own e2e tier +(`testing/e2e.test.sh`) runs exactly this on each landing before a tag, and +a blog's developers run it before a push — a blog's pull request builds and +dry-deploys it, and does not lint or run the tests. To see your own content: ```bash cd apps/web @@ -141,7 +143,6 @@ pnpm preview # wrangler dev over the built Worker | Workflow | What it runs | Ships to a blog | |---|---|---| -| `checks.yml` | install, wire fixtures (and that the committed config is their render), typecheck, lint, test, build — every PR (not pushes: on main, `ci.yml` must be the only run a commit has, because the bootstrap's convergence watch takes the newest one) | yes | -| `ci.yml` | the Orun pipeline: `orun plan --changed`, then one job per lane; deploys stage → prod on merge. It plans nothing while `intent.yaml` names the placeholder workspace `ws_CHANGE_ME`, as this repository does | yes | -| `baseline.yml` | the baseline's own tiers: contract tests, the blueprint read by the pinned orun, the leak gate, the offline bootstrap, the blog built, dry-deployed and served with no Sanity project | no | +| `ci.yml` | the Orun pipeline, and the only workflow a blog carries: `orun plan --changed`, then one job per lane. A pull request runs the verify lanes (the blog built and dry-deployed per environment; they do not lint or run the tests), except the bootstrap's own landings (`orun/BASE-*`), where `plan` alone is the check; a merge deploys stage → prod. It plans nothing while `intent.yaml` names the placeholder workspace `ws_CHANGE_ME`, as this repository does | yes | +| `baseline.yml` | the baseline's own tiers: contract tests and the component docs' drift check, the blueprint read by the pinned orun, the leak gate, the offline bootstrap, each landing installed, its fixture rendered, type-checked, linted, tested and built, then the blog built in a staged job tree, dry-deployed and served with no Sanity project | no | | `tag.yml` | cuts a `baseline-vN` tag (manual) | no | diff --git a/ai/context/deployment.md b/ai/context/deployment.md index 4516011..9c960d5 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, whether each blog reads a Sanity project yet, and the -> secrets inventory by name. Until then, nothing here claims the blog is -> live. The operating contract is [operations.md](operations.md). +> secrets the blog uses, by name. Until then, nothing here claims the blog +> is live. The operating contract is [operations.md](operations.md). diff --git a/ai/context/operations.md b/ai/context/operations.md index b0fb75f..45d5557 100644 --- a/ai/context/operations.md +++ b/ai/context/operations.md @@ -1,7 +1,7 @@ # cms-sanity — operating contract (for humans and agents) This is the standing guide to how this blog is deployed and operated. -Instance facts (live URLs, workspace, secrets inventory) live in +Instance facts (live URLs, workspace, the secrets it uses) live in [deployment.md](deployment.md), rendered from probed reality by the bootstrap's `02-docs` phase; this file is the contract that stays true between deployments. It is written to give an agent with repository read @@ -19,7 +19,9 @@ Cloudflare, expressed as an Orun component-native desired-state repo. and ships as static assets; `/api/draft-mode/enable` turns on draft mode for the Studio's live preview. - **`tests/web`** — vitest over the Sanity helpers, the draft-mode route and - the unconnected blog, verified on the `dev` rung. + the unconnected blog. No lane lints or runs the tests: a pull request + builds and dry-deploys the blog, so run `pnpm typecheck && pnpm lint && + pnpm test` before you push. - **`tooling/*`** — shared TypeScript and ESLint configuration, and the wrangler renderer for a deployable that comes to take wiring. @@ -27,7 +29,7 @@ There is no infrastructure component: Sanity is a hosted service the blog reads over HTTPS, not something this repository provisions. 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 dry-deploy, nothing deploys. ## Sanity: connected, or sample posts diff --git a/apps/web/component.yaml b/apps/web/component.yaml index 9e1b69a..e1217c6 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 ab79ad9..88fde3e 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -108,11 +108,11 @@ spec: # the fix, before anything is created. from: connection.cloudflare.workersSubdomain - # ── PREVIEW ONLY. repo-blueprint.yaml's `orun.integrations/reconcile@v1` - # hooks mint these, brokered, during 01-product. ────────────────────────── - # Transcribed from those hooks' own `keys:` and `template:` values, so - # testing/manifest.test.sh compares this list to the document that mints - # them. The console renders them read-only: no credential is ever typed, + # ── PREVIEW ONLY. repo-blueprint.yaml's one `orun.integrations/reconcile@v1` + # hook (`secrets`) mints these, brokered, during 01-product. ────────────── + # Transcribed from that hook's own `secrets:` list (each key and its + # template), 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. The Sanity project id, # dataset and read token are not here: no platform connection can mint # them, the blog is built and deployed without them, and its owner adds @@ -145,9 +145,9 @@ spec: # THE BUILD DOCUMENT. There is no umbrella workflow and no agent brief: # every phase is declared in it and orun runs it. blueprint: repo-blueprint.yaml - # Summed from the phases' expectedMinutes (01-product 12, 02-docs 2). An - # estimate until a bootstrap measures it. - expectedMinutes: 14 + # Summed from the phases' expectedMinutes (01-product 11, 02-docs 1). An + # estimate until a bootstrap on this shape measures it. + expectedMinutes: 12 tokenChannel: ORUN_TOKEN_FILE # how a runner hands over its refreshed token # The blog's URL per environment, as the console links it. verify: diff --git a/docs/phases/01-product.md b/docs/phases/01-product.md index 4661db1..a597d06 100644 --- a/docs/phases/01-product.md +++ b/docs/phases/01-product.md @@ -3,8 +3,8 @@ **Places** everything a blog built from this baseline is made of, as ONE pull request: the root manifests (`intent.yaml`, `package.json`, the pnpm workspace and lockfile, `turbo.json`), `.github/workflows` -(`ci.yml` and `checks.yml` — the baseline's own `baseline.yml` and -`tag.yml` are ignored), the shared TypeScript/ESLint config and the wrangler +(`ci.yml` — the baseline's own `baseline.yml` and `tag.yml` are +ignored), the shared TypeScript/ESLint config and the wrangler renderer, the blog's README and its two context pages, the identity file `.rebrand/values.json`, `.gitkeep` files for the four discovery roots, and `apps/web` (the Next.js app, its Studio and its deploy contract) with @@ -19,9 +19,12 @@ deploys and serves with no Sanity project behind it. ## What runs +The run's task set-up — the epic, both milestones, both tasks — runs in the +background from the start (`background: true`), so every hook up to `task` +runs beside it; `task` is the first that waits for it. + | hook | what it does | |---|---| -| `task` (pre) | finds the phase's task (opened by the run-level list) and yields its key | | `retouch` | the redeploy marker on `apps/web/component.yaml` and `tests/web/component.yaml` (`.baseline/tasks/01-product.TaskContract.yaml`'s `affects`) | | `git-init`, `git-stage` | the rebrand enumerates with `git ls-files`, so the tree is a staged repo first | | `rebrand` | renames the baseline's identity to the blog's (`tooling/rebrand/rebrand.mjs`): the repo slug, the Worker name, the secret project, the `SITE_NAME` seam, the domain, the subdomain — and leaves the upstream template's `examples/cms-sanity` links alone | @@ -30,13 +33,12 @@ deploys and serves with no Sanity project behind it. | `promotion` | defers prod's wait on stage until `02-docs` (both environments deploy side by side) | | `dev-lanes` | keeps dev's verify lanes off main's convergences until `02-docs` | | `git-restage`, `rebrand-verify` | refuses the landing if any baseline identity is left | -| `pnpm-lockfile` | confirms the placed lockfile (`--lockfile-only`) | | `repo` | `orun.repo/ensure@v1` — creates `githuborg/reponame` (private unless `repoPrivate=false`) | | `link` | `orun cloud link` (best effort) then `orun cloud check` — an unlinked repo stops here | -| `secret-workers-deploy` | `orun.integrations/reconcile@v1` — ensures `CLOUDFLARE_API_TOKEN`, brokered from the Cloudflare connection with the `workers-deploy` scope | -| `secret-account-id` | ensures `CLOUDFLARE_ACCOUNT_ID`, the connection fact | -| `land` | one PR, waited for (Checks + `plan`) and merged | -| `converge` (await) | `orun.run/watch@v1` on the merge commit's run; resumes it up to three times | +| `secrets` | `orun.integrations/reconcile@v1`, both keys in one hook, created side by side: `CLOUDFLARE_API_TOKEN`, brokered from the Cloudflare connection with the `workers-deploy` scope; `CLOUDFLARE_ACCOUNT_ID`, the connection fact | +| `task` | finds the phase's task (opened by the run-level list) and yields its key — waiting, if it must, for the background set-up | +| `land` | one PR bound to the task, its commit checked in the box first (`checks: local`: `orun validate`, then `orun plan` as the PR and as the merge would plan it, under a second); merged without waiting for the PR's CI | +| `converge` (await) | `orun.run/watch@v1` on the merge commit's run, read every 5 s; resumes it up to three times | | `verify` (await) | `orun.http/probe@v1` on both workers.dev URLs | There is no `orun.secrets/exists@v1` await: the blog has no infra component, @@ -71,6 +73,14 @@ verifies on dev only). Each lane: Stage and prod deploy side by side (the promotion gate is deferred). +`web-tests` has a lane on dev alone, so the merge plans nothing for it. The +landing's own pull request runs `plan` alone, and nothing waits for it — the +same plan ran in +the box before the push: the baseline's own CI installed, type-checked, +linted, tested and built this exact tree before the tag was cut. A blog's +later pull requests build and dry-deploy it and do not lint or run the +tests; its developers run them before a push. + ## Verified The convergence run for the merge commit is green, and @@ -83,6 +93,7 @@ The convergence run for the merge commit is green, and | parks on `waiting for github for ` | the workspace's GitHub connection is to another account. Connect the App installation on `` (console → Integrations → GitHub), then `--resume` | | parks on the `providers` probe for cloudflare | Cloudflare is not connected to the workspace. Connect it (console → Integrations → Cloudflare, paste the Account API token) | | `link` fails: `… is not linked to workspace` | the credential cannot write links and the platform has not linked the repo. Allow-list it (console → Settings → Git repos) and re-run the phase | +| `land`: `the landing's own check failed — orun plan for …` | the placed tree does not plan; the next line is orun's error. Nothing was pushed. Fix it and re-run the phase | | `rebrand-verify` lists leftovers | a file carries an identity form no rule renames. Add a rule to `tooling/rebrand/rebrand.mjs` (and a case to `testing/rebrand.test.sh`) | | `intent.yaml` says `workspace: ws_SET_ME` | `orunWorkspace` was empty and the build ran outside a workspace. Set it and re-run | | deploy lane: `secret resolution failed … CLOUDFLARE_API_TOKEN` | the reconcile did not run or minted against a revoked connection. Re-connect and re-run the phase; the reconcile re-mints only what is missing | diff --git a/docs/phases/02-docs.md b/docs/phases/02-docs.md index d12b1e2..e04cf4d 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 `/`, `/studio` and the draft-mode route on both environments (and records whether each blog reads a Sanity project yet or still shows its sample posts), lists the secrets by name and the workspace's integrations, and regenerates `ai/context/deployment.md` and the README's live-deployment section | -| `land` | one PR, waited for and merged. It touches no component, so it deploys nothing | -| `verify` (await) | the same probe `01-product` ended on | +| `render` | `hooks/render-deployment-docs.sh`: probes `/`, `/studio` and the draft-mode route on both environments (and records whether each blog reads a Sanity project yet or still shows its sample posts) and regenerates `ai/context/deployment.md` — the identity, the probed URLs, the secrets the blog uses by name and where each lives — and the README's live-deployment section. It asks the platform nothing: what the workspace holds right now is on the console's Secrets and Integrations pages, which the record points to | +| `task` | finds the phase's task and yields its key | +| `land` | one PR, its commit checked in the box (`checks: local`) and merged. It touches no component, so it deploys nothing — and there is nothing after it to wait for: the render's probes are the phase's check | ## Re-running it diff --git a/docs/phases/README.md b/docs/phases/README.md index 472c49d..c0b7138 100644 --- a/docs/phases/README.md +++ b/docs/phases/README.md @@ -9,9 +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 -> over HTTP.** +> **place its modules → brand them → check them in the box and land them as +> one pull request → watch the convergence that merge triggers +> (auto-resumed) → verify the outcome over HTTP.** + +The run's task set-up — the epic, a milestone per phase, a task per landing +— runs in the background from the start; the first hook that needs it, the +phase's `task`, waits for it. Run from the baseline checkout (the blueprint's source is `path: .`); the blog's repository is wherever `--out` points. @@ -38,12 +42,17 @@ states it in the document: the engine refuses a phase whose predecessor is not placed, and names it. Every landing is a pull request on a branch named for its task -(`orun/BASE--`). On those branches `ci.yml` runs `plan` only — the -intent, every component and every composition resolve — and skips the lanes, -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, and the landing waits for -it. +(`orun/BASE--`), checked before it is pushed: `orun validate`, then +`orun plan` as the pull request and as the merge would plan it, in the box, +in under a second (`checks: local`). Then it merges; nothing waits for the +PR's CI. On those branches `ci.yml` runs `plan` only — the intent, every +component and every composition resolve — and skips the lanes, because the +merge runs them on main a minute later, for real, and that convergence is +what the phase watches. The blog carries no other workflow: the baseline's +own CI (Tier 2) installs, renders the fixture, type-checks, lints, tests and +builds each landing before a tag is cut. A blog's later pull requests run +`ci.yml`'s verify lanes, which build and dry-deploy it and do not lint or +run the tests. | phase | lands | verified by | |---|---|---| @@ -115,9 +124,12 @@ lands, its `post` hooks make them the blog's: deferrals → `git add` → `rebrand --verify` — the identity rename over the whole tree, the re-tenant, and a sweep that fails on any of this baseline's identity left behind. -4. `pnpm install --lockfile-only` — the baseline's complete lockfile is - already placed, so this confirms it. -5. `repo`, `link`, the two brokered credentials, `land`. +4. `repo`, `link`, the brokered credentials in one `secrets` reconcile, + `task` (the first hook that waits for the background task set-up), and + `land`, its commit checked in the box (`checks: local`). + +There is no lockfile step: the baseline's complete lockfile is placed as it +is, and the lanes install it with `--frozen-lockfile`. ## When a phase fails diff --git a/hooks/render-deployment-docs.sh b/hooks/render-deployment-docs.sh index a617169..7b3ef19 100755 --- a/hooks/render-deployment-docs.sh +++ b/hooks/render-deployment-docs.sh @@ -11,15 +11,22 @@ # ai/context/deployment.md — REGENERATED: URLs with live probe results # (and whether each blog reads a Sanity project # yet or still shows its sample posts), -# identity, secrets inventory BY NAME, -# integrations +# identity, and the secrets the blog uses BY +# NAME # ai/context/operations.md — healed from the baseline's copy if absent # (the static operating contract; never rewritten) # README.md — the section between # is replaced (appended after the title if the # README predates the markers) # -# No secret VALUE is ever read or written here — inventories are names only. +# No secret VALUE is ever read or written here — secrets are named, not read. +# +# IT ASKS THE PLATFORM NOTHING. The record used to carry the workspace's slug, +# its secrets listed per rung and its integrations — five CLI calls, one after +# another, from the build box — and all of it is what the console shows live +# and this file could only show as it was the day it was written. The record +# keeps what the repository is the right place for: the identity the code +# names, what answered at the URLs, and where to look for the rest. set -euo pipefail out="${1:?usage: render-deployment-docs.sh }" @@ -37,10 +44,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="?" @@ -74,17 +77,6 @@ for pair in "stage|$stage_url" "prod|$prod_url"; do rows+="| draft mode (${env}) | ${url}/api/draft-mode/enable | answers $(probe "$url/api/draft-mode/enable") without a preview secret (401 expected) |"$'\n' done -secrets_list() { { orun secrets list --org "$ws" "$@" 2>/dev/null || true; } | awk 'NR>1 && NF {print " - "$1}'; } -secrets_proj="$(secrets_list --project)"; [ -n "$secrets_proj" ] || secrets_proj=" - (listing unavailable to this credential)" -secrets_stage="$(secrets_list --env stage)"; [ -n "$secrets_stage" ] || secrets_stage=" - (listing unavailable to this credential)" -secrets_prod="$(secrets_list --env prod)"; [ -n "$secrets_prod" ] || secrets_prod=" - (listing unavailable to this credential)" -integrations="$( { orun integrations list --org "$ws" --json 2>/dev/null || true; } | python3 -c " -import json,sys -try: rows=json.load(sys.stdin) -except Exception: rows=[] -out=[f\" - {r.get('provider','?')}: {r.get('status','?')}\" for r in rows] -print('\n'.join(out) if out else ' - (listing unavailable to this credential)')" )" - now="$(date -u +%Y-%m-%dT%H:%M:%SZ)" # Heal the static operating contract when the blog predates it. @@ -101,15 +93,14 @@ cat > ai/context/deployment.md < GENERATED by the \`02-docs\` phase on ${now}; re-run it to refresh > (idempotent; see [operations.md](operations.md)). Hand-edits here are -> overwritten. No secret values appear in this file — inventories are names -> only. +> overwritten. No secret values appear in this file — secrets are named only. ## Identity | | | |---|---| | repository / project slug | \`${repo}\` | -| Orun workspace | \`${ws}\` (slug \`${slug}\`) | +| Orun workspace | \`${ws}\` | | declared in | \`intent.yaml\` → \`execution.state.workspace\` | | Workers | \`${brand}-web-stage\`, \`${brand}-web-prod\` on \`${sub}.workers.dev\` | | CI lane CLI pin | orun \`${lanepin}\` (\`.github/workflows/ci.yml\`) | @@ -121,26 +112,20 @@ cat > ai/context/deployment.md <" body = f"""{begin} -This blog is **live**. Verified URLs, identity and the secrets inventory are +This blog is **live**. Verified URLs, identity and the secrets it uses are recorded in [ai/context/deployment.md](ai/context/deployment.md) (re-rendered by the `02-docs` phase); how it deploys and how to operate it: [ai/context/operations.md](ai/context/operations.md). diff --git a/repo-blueprint.yaml b/repo-blueprint.yaml index c6d3606..6178152 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -181,6 +181,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 @@ -291,16 +295,25 @@ modules: # new milestone after the last, and a task naming a milestone the epic does # not have yet would create it out of order. # -# Each phase's own `pre` hook runs `orun.task/ensure@v1` on its task again. -# Same identity, so it finds rather than creates, and it is how the phase gets -# the task's KEY for its landing. The MILESTONE keeps the phase's name: it is -# the identity the engine's phase events, the plane's evidence and the -# console's rows all meet on, and the card's `programme.milestones` names the -# same list. +# IN THE BACKGROUND (orun >= v2.88.0, `background: true` on every hook here). +# Nothing a phase does before its landing reads the task plane — the provider +# check, the placement, the rebrand, the repository, the secrets — so the +# whole list runs beside 01-product instead of before it, in order. A hook +# that works on the plane (`orun.task/ensure@v1`, `orun.pr/land@v1`) waits +# for it to finish; a failure here stops the build at the next hook. +# +# Each phase's own `task` hook runs `orun.task/ensure@v1` on its task again, +# just before its landing. Same identity, so it finds rather than creates, +# and it is how the phase gets the task's KEY for its landing; it sits in +# `post` rather than `pre` so that everything before it overlaps with this +# list. The MILESTONE keeps the phase's name: it is the identity the engine's +# phase events, the plane's evidence and the console's rows all meet on, and +# the card's `programme.milestones` names the same list. hooks: preInstantiate: - id: epic uses: orun.task/ensure@v1 + background: true with: kind: epic slug: "{{ .inputs.epicSlug }}" @@ -315,6 +328,7 @@ hooks: owner: me - id: m01 uses: orun.task/ensure@v1 + background: true with: kind: milestone epic: "{{ .inputs.epicSlug }}" @@ -325,6 +339,7 @@ hooks: - the blog answers on both workers.dev URLs - id: m02 uses: orun.task/ensure@v1 + background: true with: kind: milestone epic: "{{ .inputs.epicSlug }}" @@ -334,6 +349,7 @@ hooks: - prod waits on stage again - id: t01 uses: orun.task/ensure@v1 + background: true with: kind: task epic: "{{ .inputs.epicSlug }}" @@ -350,6 +366,7 @@ hooks: contract: .baseline/tasks/01-product.TaskContract.yaml - id: t02 uses: orun.task/ensure@v1 + background: true with: kind: task epic: "{{ .inputs.epicSlug }}" @@ -383,10 +400,13 @@ phases: - name: 01-product title: The blog, built in one landing description: The whole tree — manifests, CI, tooling, identity, the Next.js app and its tests — branded, landed as one pull request, and deployed by one convergence. - # An estimate until a bootstrap measures it: the pull request's Checks (a - # full Next.js build), the merge, then the blog's build, deploy and smoke - # on stage and prod side by side. - expectedMinutes: 12 + # An estimate, not a measurement: the landing no longer waits on a full + # Next.js build in Checks — its commit is checked here (`checks: local`) + # and merged — the task set-up runs in the background, and the watch + # reads every 5 s. What is left is the merge's convergence: the blog's + # build, deploy and smoke on stage and prod side by side. Lowered by a + # minute from the old 12 until a bootstrap on this shape measures it. + expectedMinutes: 11 narrate: start: "Creating the repository and landing the whole blog in one pull request — intent, CI, tooling, the Next.js app and its tests. Then one convergence deploys it to stage and prod side by side. Usually about {{ .meta.expectedMinutes }} minutes." await: "One convergence is deploying the blog to stage and prod: install, the Next.js build, deploy and a smoke in each. The build is the long pole; nothing is stuck." @@ -410,21 +430,10 @@ phases: waitSeconds: 600 pollSeconds: 20 hooks: - pre: - # The epic, the milestones and the tasks already exist (the run-level - # list above). This finds the task and yields its key, which the - # landing binds the pull request to. - - id: task - uses: orun.task/ensure@v1 - with: - kind: task - epic: "{{ .inputs.epicSlug }}" - milestone: "{{ .phase.name }}" - name: "Build the blog in one landing" - prefix: BASE - contract: .baseline/tasks/01-product.TaskContract.yaml - # The identity chain, then the repository, its link, its credentials and - # the landing — cirrus-baseline's 01-product, hook for hook. + # The identity chain, then the repository, its link, its credentials, + # the task and the landing — cirrus-baseline's 01-product, hook for hook. + # No `pre` hook: the task is found in `post`, just before the landing, + # so everything before it runs beside the background task set-up. # # rebrand.mjs enumerates the tree with `git ls-files`, so the output has # to be a git repository with a populated index BEFORE it runs. `git add @@ -497,11 +506,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 lanes and Checks - # install with --frozen-lockfile. The lockfile carries no identity. - - id: pnpm-lockfile - run: ["pnpm", "install", "--lockfile-only"] # The repo has to exist before there is anywhere to land. - id: repo uses: orun.repo/ensure@v1 @@ -530,34 +534,51 @@ phases: - link - "{{ .inputs.orunWorkspace }}" - "{{ .inputs.githuborg }}/{{ .inputs.reponame }}" - # The deploy credentials, brokered, one hook per template: - # `integrations/reconcile` mints from ONE connection with ONE scope - # template. The deploy lane binds both keys (the workers-assets - # composition's `secretBindings`); the blog reads no D1, R2, - # Hyperdrive or DNS, so no other scope is asked for. Keys that already - # exist are kept. After the link, before the landing whose convergence - # uses them. Nothing is minted for Sanity: no platform connection can, - # and the blog builds and serves without it (its optional secret refs - # skip a key nobody has stored). - - id: secret-workers-deploy + # The deploy credentials, brokered, in ONE hook (orun >= v2.87.0): + # `secrets` mints each key under its own scope template from the one + # connection the build is bound to, reading the connections and the + # existing secrets once and creating the missing keys side by side. + # The deploy lane binds both keys (the workers-assets composition's + # `secretBindings`); the blog reads no D1, R2, Hyperdrive or DNS, so + # no other scope is asked for. Keys that already exist are kept. + # After the link, before the landing whose convergence uses them. + # Nothing is minted for Sanity: no platform connection can, and the + # blog builds and serves without it (its optional secret refs skip a + # key nobody has stored). + - id: secrets uses: orun.integrations/reconcile@v1 with: provider: cloudflare - keys: [CLOUDFLARE_API_TOKEN] - template: workers-deploy - - id: secret-account-id - uses: orun.integrations/reconcile@v1 + secrets: + - { key: CLOUDFLARE_API_TOKEN, template: workers-deploy } + - { key: CLOUDFLARE_ACCOUNT_ID, template: account-id } + # The task this landing closes, and its key. The run-level list above + # opens it in the background; this is the first hook that needs it, + # so it is the one that waits for that list (orun >= v2.88.0) — every + # hook before it ran while the task plane was still being set up. + - id: task + uses: orun.task/ensure@v1 with: - provider: cloudflare - keys: [CLOUDFLARE_ACCOUNT_ID] - template: account-id - # THE BLOG IS A PULL REQUEST THAT IS CHECKED, THEN MERGED. This landing - # waits for its PR's whole CI run (orun >= v2.58.6): Checks over the - # whole tree (install, typecheck, lint, test and a full Next.js build, - # with no Sanity project), and `plan` — on a bootstrap branch - # (`orun/BASE-…`) the lanes are skipped (ci.yml), because the merge - # runs every one of them on main a minute later, for real, and the - # convergence after the merge is what this phase watches to green. + kind: task + epic: "{{ .inputs.epicSlug }}" + milestone: "{{ .phase.name }}" + name: "Build the blog in one landing" + prefix: BASE + contract: .baseline/tasks/01-product.TaskContract.yaml + # THE BLOG 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 + # waiting for a runner. Before, this landing waited on the PR's whole + # CI run — Checks' full Next.js build among it — for a tree the + # baseline's own e2e tier already built, tested and linted before + # the tag. 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 the merge is what this phase + # watches to green. - id: land uses: orun.pr/land@v1 narrate: "The blog is merged into main." @@ -566,6 +587,7 @@ phases: epic: "{{ .inputs.epicSlug }}" branchSlug: "{{ .phase.name }}" title: "feat: {{ .inputs.productname }}, a Sanity-backed blog on Workers, live on stage and prod" + checks: local # No wiring await: the blog has no infra component, so nothing # lease-publishes a WIRING_* secret for `orun.secrets/exists@v1` to find. await: @@ -580,6 +602,9 @@ phases: repo: "{{ .inputs.githuborg }}/{{ .inputs.reponame }}" resumeBudget: 3 waitSeconds: 1800 + # Read every 5 s, not the action's 40: the build goes on the + # moment the run is green instead of up to 40 s after it. + pollSeconds: 5 - id: verify uses: orun.http/probe@v1 narrate: "The blog answered on stage and prod." @@ -589,31 +614,23 @@ phases: - "https://{{ .inputs.reponame }}-web-prod.{{ .inputs.subdomain }}.workers.dev" # Places nothing. It records what 01-product built, from PROBED facts rather - # than from what the blueprint intended — which is why it runs last and why - # its verify is the probe 01-product ends on. + # 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, then a landing checked here and + # merged, with nothing after it to wait for. + expectedMinutes: 1 narrate: start: "Now recording what was actually built — probing every URL and writing the deployment manifest into the repository." - await: "Probing the live endpoints one last time." done: "ai/context/deployment.md now records the live deployment, written from probed facts, and prod waits on stage again. {{ .meta.elapsed }}." failed: "The deployment record did not land. The blog is still live; only the write-up is missing." modules: [] requires: phases: [01-product] hooks: - pre: - - id: task - uses: orun.task/ensure@v1 - with: - kind: task - epic: "{{ .inputs.epicSlug }}" - milestone: "{{ .phase.name }}" - name: "Record the live deployment" - prefix: BASE - contract: .baseline/tasks/02-docs.TaskContract.yaml post: # THE BLOG GOES LIVE WITH ITS PROMOTION GATE. 01-product deferred # `prod.promotion.dependsOn: [stage]`; this, the last landing, puts it @@ -628,6 +645,16 @@ phases: run: ["node", "{{ .baseline.dir }}/tooling/bootstrap/dev-lanes.mjs", "--restore"] - id: render run: ["bash", "{{ .baseline.dir }}/hooks/render-deployment-docs.sh", ".", "{{ .inputs.orunWorkspace }}", "{{ .baseline.dir }}"] + - id: task + uses: orun.task/ensure@v1 + with: + kind: task + epic: "{{ .inputs.epicSlug }}" + milestone: "{{ .phase.name }}" + name: "Record the live deployment" + prefix: BASE + contract: .baseline/tasks/02-docs.TaskContract.yaml + # Checked here and merged, as 01-product's landing is. - id: land uses: orun.pr/land@v1 narrate: "The deployment record is merged into main." @@ -636,11 +663,4 @@ phases: epic: "{{ .inputs.epicSlug }}" branchSlug: "{{ .phase.name }}" title: "docs(deployment): record the live deployment state" - await: - - id: verify - uses: orun.http/probe@v1 - narrate: "Every live URL answered on the final probe." - with: - urls: - - "https://{{ .inputs.reponame }}-web-stage.{{ .inputs.subdomain }}.workers.dev" - - "https://{{ .inputs.reponame }}-web-prod.{{ .inputs.subdomain }}.workers.dev" + checks: local diff --git a/testing/coverage.test.sh b/testing/coverage.test.sh index 1ee1577..4e802dd 100755 --- a/testing/coverage.test.sh +++ b/testing/coverage.test.sh @@ -95,6 +95,45 @@ 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 + if spec.get("domain"): + domains.setdefault(spec["domain"], comp) + if not (meta.get("description") or "").strip(): + bad(f"{comp}/component.yaml has no metadata.description — the catalog shows the component with nothing to say") + docs = spec.get("docs") or {} + got = {"overview": docs.get("overview")} + for page in docs.get("pages") or []: + got[page.get("role")] = page.get("path") + for role, path in WANT_DOCS.items(): + if got.get(role) != path: + bad(f"{comp}/component.yaml does not attach {path} as its {role} " + f"(spec.docs) — the page ships and the catalog never sees it") + elif not (root / comp / path).is_file(): + bad(f"{comp}/component.yaml attaches {path}, which does not exist") +for domain, comp in sorted(domains.items()): + if domain in names: + bad(f"{comp} declares domain `{domain}`, which is also the name of the " + f"component in {names[domain]} — the catalog keeps one of the two") + # ── WHAT `ignore` ACTUALLY EXCLUDES (BE6) ────────────────────────────────── # # orun matches an ignore entry two ways, and WHICH ONE depends on the entry: diff --git a/testing/e2e.test.sh b/testing/e2e.test.sh index 5805d54..b8ceaa6 100755 --- a/testing/e2e.test.sh +++ b/testing/e2e.test.sh @@ -6,12 +6,16 @@ # This proves it WORKS, by doing to it what its own pipelines will — on the # day it is built, when its owner has not connected a Sanity project yet: # -# 1. at the 01-product landing (the commit its one pull request merges), run -# what `checks.yml` runs on that PR — install with the placed lockfile, +# 1. at the 01-product landing (the commit its one pull request merges), the +# landing's own checks — install with the lockfile the product ships, # render fixtures and check the committed config is the render, -# typecheck, lint, test, build. That landing WAITS on its checks, so a -# product they refuse is a bootstrap that never lands; then the same at -# the 02-docs landing, which waits on them too; +# typecheck, lint, test, build. The bootstrap's landings are checked in +# the box with `orun validate` and `orun plan` alone (`checks: local`; +# their PR's CI on an `orun/BASE-…` branch is `plan` alone), and a +# product's later pull requests build and dry-deploy it through ci.yml's +# lanes, so THIS is where a product those steps refuse is caught: before +# the tag, not after a build has merged it. Then the same at the 02-docs +# landing, the finished blog; # 2. the stage lane's own steps, read out of `orun plan` in the product for # a pull request (the verify profile: the deploy profile has no dry run) # — EVERY `run:` step of the job, in order, exactly as planned: the @@ -80,24 +84,27 @@ export CI=1 WRANGLER_SEND_METRICS=false NEXT_TELEMETRY_DISABLED=1 TURBO_TELEMETR unset NEXT_PUBLIC_SANITY_PROJECT_ID NEXT_PUBLIC_SANITY_DATASET SANITY_API_READ_TOKEN SANITY_AUTH_TOKEN free_port() { python3 -c "import socket;s=socket.socket();s.bind(('127.0.0.1',0));print(s.getsockname()[1]);s.close()"; } -# What checks.yml runs, step for step, read out of the workflow the product -# carries so the two cannot drift: every `run:` of its one job, in order. +# The landing's own checks, step for step, run here at once on the whole +# tree. A pull request in the product builds and dry-deploys the blog +# through ci.yml's lanes; the lint and the tests run here, and by hand before +# a push. +LANDING_CHECKS=( + "pnpm install --frozen-lockfile" + "pnpm run wire:fixture" + "git diff --exit-code" + "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 } echo "── the offline bootstrap (testing/lib/bootstrap.sh)" @@ -107,17 +114,17 @@ bootstrap_offline "$root" "$tree" "$values" "$scratch/logs" > "$scratch/bootstra s00="$(git -C "$tree" rev-parse HEAD~2)"; s01="$(git -C "$tree" rev-parse HEAD~1)" echo " 2 phases placed and landed on orun's Initial commit" -# ── 1. the checks each landing waits on ──────────────────────────────────── -echo "── 01-product's landing, under the checks its PR waits on" +# ── 1. each landing's own checks ─────────────────────────────────────────── +echo "── 01-product's landing: install, the fixture render, typecheck, lint, test, build" git -C "$tree" worktree add -q "$scratch/at-01" "$s01" checks "$scratch/at-01" "$scratch/checks-01.log" # Its tree is not needed again, and the disk is shared. git -C "$tree" worktree remove --force "$scratch/at-01" -echo "── 02-docs's landing (the finished blog), under the same checks" +echo "── 02-docs's landing (the finished blog): the same checks" checks "$tree" "$scratch/checks-blog.log" grep -q '(Turbopack)' "$scratch/checks-blog.log" \ - || { echo "FAIL: the Checks build did not run on Turbopack" >&2; exit 1; } + || { echo "FAIL: the landing's build did not run on Turbopack" >&2; exit 1; } # ── 2. the stage lane, as a pull request plans it ────────────────────────── echo "── the stage lane: every run step the PR plan gives web@stage, in a staged job tree" diff --git a/testing/leak.test.sh b/testing/leak.test.sh index 54dd561..586f340 100755 --- a/testing/leak.test.sh +++ b/testing/leak.test.sh @@ -92,7 +92,7 @@ for p in placed: # ── the blog's README, not this repository's ────────────────────────────── if "README.md" not in placed: bad("README.md would not ship") -for must in (".github/workflows/ci.yml", ".github/workflows/checks.yml", +for must in (".github/workflows/ci.yml", "apps/web/component.yaml", "apps/web/wrangler.jsonc", "apps/web/app/site.ts", "apps/web/sanity/lib/sample.ts", "apps/web/sanity/lib/api.ts", "apps/web/app/(blog)/connect-sanity.tsx", "apps/web/app/(sanity)/studio/[[...tool]]/connect.tsx", diff --git a/testing/lib/bootstrap.sh b/testing/lib/bootstrap.sh index f98582c..a230204 100755 --- a/testing/lib/bootstrap.sh +++ b/testing/lib/bootstrap.sh @@ -18,8 +18,8 @@ # workspace; # - `{{ .inputs.* }}` render from the fixture. # Everything else — the rebrand, the re-tenant, the work-tree strip, the -# deferrals and their restore, the retouch marker, the lockfile seed and -# prune, the deployment-docs render — runs exactly as declared. +# deferrals and their restore, the retouch marker, the deployment-docs +# render — runs exactly as declared. # # Needs: orun, node, pnpm, python3 (+PyYAML), git. diff --git a/testing/manifest.test.sh b/testing/manifest.test.sh index 5374cb5..64f04c8 100755 --- a/testing/manifest.test.sh +++ b/testing/manifest.test.sh @@ -83,13 +83,16 @@ def uses(phase, action): yield hook # THE SECRETS THE BOOTSTRAP MINTS. `orun.integrations/reconcile@v1` is what -# `create-secrets.sh` was written out longhand as: one connection, one scope -# template, the keys it ensures. Read per key so a hook minting two keys under -# one template is three facts rather than one. +# `create-secrets.sh` was written out longhand as: one connection, and per key +# the scope template it is minted under — `secrets: [{key, template}]`, or +# `keys` sharing one `template`. Read per key so a hook minting three keys is +# three facts rather than one. blueprint_secrets = {} for phase in bp_phases: for hook in uses(phase, "orun.integrations/reconcile@v1"): w = hook.get("with") or {} + for item in (w.get("secrets") or []): + blueprint_secrets[item.get("key")] = (w.get("provider"), item.get("template")) for key in (w.get("keys") or []): blueprint_secrets[key] = (w.get("provider"), w.get("template")) diff --git a/testing/phases.test.sh b/testing/phases.test.sh index ef31195..0799d0b 100755 --- a/testing/phases.test.sh +++ b/testing/phases.test.sh @@ -16,6 +16,12 @@ # what `01-product` deferred. The hook chain of `01-product` is cirrus's, # hook for hook, and is pinned below. # +# And the shape that keeps a bootstrap fast (orun >= v2.88.0, ported from +# sourceplane/turso-starter baseline-v8): 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. # @@ -224,8 +230,15 @@ def check_line(where, line, slot, hook_ids): for p in phases: n = p.get("narrate") or {} ids = {h.get("id") for h in hooks_of(p)} + awaits = bool((p.get("hooks") or {}).get("await")) for slot in ("start", "await", "done", "failed"): line = n.get(slot) + if slot == "await" and not awaits: + # A phase that waits on nothing never says its await line. + if line: + bad(f"phase {p['name']} declares narrate.await and has no await hooks — " + f"nobody would ever read it") + continue if not line: bad(f"phase {p['name']} declares no narrate.{slot}") continue @@ -262,34 +275,50 @@ if watching != DEPLOYS: # ── 01-product's hook chain is cirrus-baseline's ───────────────────────────── # The identity chain (retouch before git exists, then git, rebrand, re-tenant, -# the work-tree strip, the two deferrals, restage, verify), the lockfile, the -# repository and its link, the brokered credentials — one reconcile per key, -# after the link and before the landing whose convergence uses them — and the -# landing. +# the work-tree strip, the two deferrals, restage, verify), the repository and +# its link, the brokered credentials — ONE `secrets` reconcile per provider +# (orun >= v2.87.0), after the link and before the landing whose convergence +# uses them — then the task, found just before the landing so that everything +# before it runs beside the background task set-up, and the landing. No +# lockfile hook: the shipped lockfile is installed frozen by the lanes and by +# testing/e2e.test.sh. No phase has a `pre` hook. +PRE = {"01-product": [], "02-docs": []} CHAIN = ["retouch", "git-init", "git-stage", "rebrand", "orun-workspace", "work-tree", "promotion", "dev-lanes", "git-restage", "rebrand-verify", - "pnpm-lockfile", "repo", "link", "land"] -TYPED = {"repo": "orun.repo/ensure@v1", "land": "orun.pr/land@v1"} + "repo", "link", "secrets", "task", "land"] +TYPED = {"repo": "orun.repo/ensure@v1", "secrets": "orun.integrations/reconcile@v1", + "task": "orun.task/ensure@v1", "land": "orun.pr/land@v1"} RUN_HAS = {"retouch": "retouch.mjs", "work-tree": "work-tree.mjs --strip", "promotion": "promotion.mjs --defer", "dev-lanes": "dev-lanes.mjs --defer", - "rebrand": "rebrand.mjs --values", "rebrand-verify": "rebrand.mjs --verify", - "pnpm-lockfile": "pnpm install --lockfile-only"} + "rebrand": "rebrand.mjs --values", "rebrand-verify": "rebrand.mjs --verify"} +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") product = by_name.get("01-product") or {} post = (product.get("hooks") or {}).get("post") or [] -reconciles = [h for h in post if (h.get("uses") or "") == "orun.integrations/reconcile@v1"] -chain = [h.get("id") for h in post if h not in reconciles] +chain = [h.get("id") for h in post] if chain != CHAIN: - bad(f"01-product's post hooks are {chain} (reconciles aside); cirrus-baseline's are {CHAIN}") -ids = [h.get("id") for h in post] -if reconciles and "link" in ids and "land" in ids: - at = [ids.index(h.get("id")) for h in reconciles] - if at != list(range(ids.index("link") + 1, ids.index("land"))): - bad("01-product's reconcile hooks must sit together between `link` and `land`") + bad(f"01-product's post hooks are {chain}; cirrus-baseline's are {CHAIN}") +# One reconcile per provider, every key it mints listed in `secrets:` with its +# own template: one connections read and one secrets read for all of them, +# the missing keys created side by side — not one hook (and two round trips) +# per key. This blog mints from Cloudflare alone: Sanity is not a provider the +# platform brokers. +reconciles = [h for h in post if (h.get("uses") or "") == "orun.integrations/reconcile@v1"] if not reconciles: bad("01-product mints no credential — its convergence deploys, and binds CLOUDFLARE_API_TOKEN") +providers = [(h.get("with") or {}).get("provider") for h in reconciles] +if len(set(providers)) != len(providers): + bad(f"01-product reconciles {providers} — one hook per provider, its keys in `secrets:`") for h in reconciles: - if len((h.get("with") or {}).get("keys") or []) != 1: - bad(f"reconcile hook {h.get('id')} mints {(h.get('with') or {}).get('keys')} — one key per hook, one scope per key") + w = h.get("with") or {} + items = w.get("secrets") or [] + if w.get("keys") or w.get("template") or not items or \ + any(not (i or {}).get("key") or not (i or {}).get("template") for i in items): + bad(f"reconcile hook {h.get('id')} does not mint its keys as `secrets: [{{key, template}}]` — " + f"one hook per provider, each key under its own scope template") for h in post: want = TYPED.get(h.get("id")) if want and h.get("uses") != want: @@ -298,14 +327,28 @@ for h in post: if need and need not in " ".join(h.get("run") or []): bad(f"01-product hook {h.get('id')} does not run `{need}`") -# The await: the convergence of the merge commit, then the wiring the infra -# lease-publishes (only when there IS infra), then the URLs. +# The await: the convergence of the merge commit, then the URLs. There is no +# wiring await (orun.secrets/exists@v1): this blog has no infra component, so +# nothing lease-publishes a WIRING_* document. Were one added, its readers +# would prove it instead — each resolving the document in the same +# convergence from its component.yaml secret refs, where every later run +# reads it, fail-closed, after waiting for its publisher on main +# (placement.test.sh's INFRA BEFORE APP) — which is the rule +# sourceplane/turso-starter's copy of this file holds. There is nothing here +# for that rule to read, so an infra component stops this test until it is +# ported (or until the wiring is awaited again). infra = sorted(c for c in components if c.startswith("infra/")) +if infra: + bad(f"{infra} would publish wiring this file does not check — port turso-starter's reader " + f"rule (each WIRING_* resolved in the convergence on stage and prod, the reader waiting " + f"for its publisher on main), or await it with orun.secrets/exists@v1") awaits = (product.get("hooks") or {}).get("await") or [] +if [h.get("id") for h in awaits] != ["converge", "verify"]: + bad(f"01-product's await hooks are {[h.get('id') for h in awaits]}; want ['converge', 'verify']") kinds = [(h.get("uses") or "").split("@")[0] for h in awaits] -want_kinds = ["orun.run/watch"] + (["orun.secrets/exists"] if infra else []) + ["orun.http/probe"] +want_kinds = ["orun.run/watch", "orun.http/probe"] if kinds != want_kinds: - bad(f"01-product awaits {kinds}; with {len(infra)} infra component(s) it must await {want_kinds}") + bad(f"01-product awaits {kinds}; it must await {want_kinds}") probe_urls = [] for h in awaits: if (h.get("uses") or "").startswith("orun.http/probe@"): @@ -314,21 +357,56 @@ for env in ("stage", "prod"): if not any(f"-{env}." in u for u in probe_urls): bad(f"01-product's probe names no {env} URL: {probe_urls}") -# 02-docs: puts back what 01-product deferred, renders the record, lands, and -# re-probes exactly what 01-product probed. +# 02-docs: puts back what 01-product deferred, renders the record, finds its +# task, lands — and awaits nothing: its render probes every URL as it writes +# the record, and its landing redeploys nothing, so there is no probe after +# it to wait for. docs = by_name.get("02-docs") or {} dpost = (docs.get("hooks") or {}).get("post") or [] -if [h.get("id") for h in dpost] != ["promotion", "dev-lanes", "render", "land"]: - bad(f"02-docs's post hooks are {[h.get('id') for h in dpost]}; want promotion, dev-lanes, render, land") +if [h.get("id") for h in dpost] != ["promotion", "dev-lanes", "render", "task", "land"]: + bad(f"02-docs's post hooks are {[h.get('id') for h in dpost]}; want promotion, dev-lanes, render, task, land") for h in dpost: argv = " ".join(h.get("run") or []) if h.get("id") in ("promotion", "dev-lanes") and "--restore" not in argv: bad(f"02-docs hook {h.get('id')} does not --restore") dawait = (docs.get("hooks") or {}).get("await") or [] -if [(h.get("uses") or "") for h in dawait] != ["orun.http/probe@v1"]: - bad("02-docs's await must be one orun.http/probe@v1 — it deploys nothing to watch") -elif ((dawait[0].get("with") or {}).get("urls") or []) != probe_urls: - bad("02-docs's final probe is not the URLs 01-product ends on") +if dawait: + bad(f"02-docs awaits {[h.get('id') for h in dawait]} — its render probes as it writes and its " + f"landing redeploys nothing, so there is nothing after it to wait for") + +# ── 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, link 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 keeps a `pre` hook on the task plane: it would wait for the whole +# background before the phase has placed a file — the old order, whatever +# its id. +TASK_PLANE = ("orun.task/", "orun.pr/") +for p in phases: + for h in ((p.get("hooks") or {}).get("pre") or []): + if (h.get("uses") or "").startswith(TASK_PLANE): + bad(f"phase {p['name']} pre hook {h.get('id')} uses {h['uses']} — it waits for " + f"the background task set-up; find the task in `post`, just before the landing") +# Every landing checks its commit here and merges, instead of waiting for a +# runner to plan (and, before, for Checks to build) 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") # ── what a baseline of this shape never grows back ──────────────────────── if (root / "flows").exists(): @@ -344,6 +422,7 @@ placed_n = sum(len(p.get("modules") or []) for p in phases) narrated = sum(len(p.get("narrate") or {}) for p in phases) narrated += sum(1 for p in phases for h in hooks_of(p) if h.get("narrate")) print(f" {len(phases)} phases, {placed_n} modules, {len(HOOK_ONLY)} hook-only — in execution order") +print(f" hooks in the one-landing order; task set-up in the background, every landing checked here") print(f" {narrated} authored narration lines, every reference resolving") PY diff --git a/testing/placement.test.sh b/testing/placement.test.sh index ee2ae91..d38c066 100755 --- a/testing/placement.test.sh +++ b/testing/placement.test.sh @@ -12,8 +12,8 @@ # 2. THE OFFLINE BOOTSTRAP (testing/lib/bootstrap.sh) — both phases placed in # order, finished by the blueprint's OWN `run:` hooks (retouch, rebrand, # re-tenant, work-tree strip, the deferrals and their restore, the -# lockfile, the deployment record), each landing a commit on top of -# orun's `Initial commit`; +# deployment record), each landing a commit on top of orun's `Initial +# commit`; # 3. the product it ends with: branded with no residue, carrying nothing of # the factory and naming none of its paths, re-tenanted, its gates # restored, its record rendered; @@ -30,9 +30,8 @@ # testing/e2e.test.sh goes on from here: it installs, builds and serves the # product and runs its smoke against it. # -# Needs: orun, node, pnpm, python3 (+PyYAML), git. No credential. The pnpm -# lockfile check and the deployment-record probes reach the network if they -# can, and pass without it. +# Needs: orun, node, pnpm, python3 (+PyYAML), git. No credential. The +# deployment-record probes reach the network if they can, and pass without it. set -euo pipefail here="$(cd "$(dirname "$0")" && pwd)" root="$(cd "$here/.." && pwd)" @@ -43,7 +42,9 @@ for bin in orun node pnpm python3 git; do command -v "$bin" >/dev/null || { echo "placement.test.sh needs $bin on PATH" >&2; exit 1; } done # Step 4 is the PRODUCT's own plan, so it must be planned by the orun the -# product's CI runs (ci.yml's pin) or newer, not by the bootstrap floor. +# product's CI runs (ci.yml's pin) or newer. The bootstrap's floor (v2.88.0) +# is newer than the pin, and is what baseline.yml runs this under: steps 1 +# and 2 read the blueprint, which an orun below the floor refuses. pin="$(sed -n 's/^ *version: *v\([0-9.]*\) *$/\1/p' "$root/.github/workflows/ci.yml" | head -1)" have="$(orun --version | sed -n 's/.*version \([0-9.]*\).*/\1/p')" python3 -c "import sys; v=lambda s: tuple(map(int, s.split('.'))); sys.exit(0 if v(sys.argv[1]) >= v(sys.argv[2]) else 1)" "$have" "$pin" \ diff --git a/tests/web/component.yaml b/tests/web/component.yaml index 352f7ad..4974eda 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 blog's vitest suite (the unconnected blog's sample posts and project configuration, the draft-mode route, image URLs, the date component and the blog's name), 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..754de84 100644 --- a/tests/web/docs/overview.md +++ b/tests/web/docs/overview.md @@ -1,5 +1,7 @@ # web-tests +The blog's vitest suite (the unconnected blog's sample posts and project configuration, the draft-mode route, image URLs, the date component and the blog's name), 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