diff --git a/.baseline/product/README.md b/.baseline/product/README.md index 8dd6180..a62dd33 100644 --- a/.baseline/product/README.md +++ b/.baseline/product/README.md @@ -11,7 +11,7 @@ environment. Not recorded yet. The bootstrap's last phase writes the live URLs, the -workspace and the secrets inventory into +workspace and the secrets the site uses into [ai/context/deployment.md](ai/context/deployment.md); how the site deploys and how to operate it is in [ai/context/operations.md](ai/context/operations.md). @@ -73,8 +73,7 @@ The Worker binds the namespace as `KV`; a tenant is `subdomain:` → (placeholder ids) for local work and verification, and on every deploy from the document the `cloudflare-kv` Terraform root publishes after its apply (`WIRING_CLOUDFLARE_KV`, per environment). Edit the template, then -`pnpm run wire:fixture`; Checks fails if the committed `wrangler.jsonc` is -not the fixture render. +`pnpm run wire:fixture` and commit the render with the template. KV is eventually consistent across locations: a tenant created in one place reads back at once there and within about a minute everywhere else. The @@ -90,9 +89,11 @@ deploys — to `stage`, then to `prod` once stage has converged on the same commit; `dev` only verifies. The Worker is `platforms-starter-kit-web-` on your account's workers.dev subdomain, and every deploy is smoke-tested over HTTP: `/` must be rendered for the host -it was asked on, and `/admin` must read the tenant list from KV. -`checks.yml` runs install, the fixture render, typecheck, lint, test and -build on every pull request. (A push to `main` runs `ci.yml` alone, which +it was asked on, and `/admin` must read the tenant list from KV. A pull +request runs the same pipeline's verify lanes, with nothing applied or +deployed: the KV namespace planned for stage and prod, and the app built and +dry-deployed for each environment. They do not run the tests or the linter +— run those before you push (Getting started, above). (A push to `main` applies, builds and deploys.) The pipeline holds one credential, GitHub's own `GITHUB_TOKEN`. The diff --git a/.github/workflows/baseline.yml b/.github/workflows/baseline.yml index e7c4a8f..6b8b497 100644 --- a/.github/workflows/baseline.yml +++ b/.github/workflows/baseline.yml @@ -8,7 +8,7 @@ name: Baseline CI # namespace before the Worker on a merge — and that the product it produces # installs, builds, deploys (dry) and serves. # -# ─── WHY THIS IS NOT IN ci.yml OR checks.yml ────────────────────────────── +# ─── WHY THIS IS NOT IN ci.yml ──────────────────────────────────────────── # # `repo-blueprint.yaml`'s `github-workflows` module copies the WHOLE `.github` # directory into every site built from this repository. These jobs run @@ -69,20 +69,25 @@ jobs: # 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 — the KV apply before the Worker's - # deploy — under the product's lane pin, below). + # deploy — by an orun at or above the product's lane pin, 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 + # As in the contract job: nothing in this job installs with pnpm, so + # there is no store to cache, and setup-node v5's own pnpm cache + # (on because package.json names a packageManager) fails the job in + # its post step when 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. v2.58.11 plans a pull request with apps/web - # waiting on the KV plan: it does not apply a dependsOn edge's - # `modeRules`. The lane pin does (advisory on a PR, enforced on main), - # 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 + # or newer: one older than v2.78.4 plans a pull request with apps/web + # waiting on the KV plan, because it does not apply a dependsOn edge's + # `modeRules` (advisory on a PR, enforced on main). 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 PRODUCT IT PRODUCES WORKS: its one landing under the checks - # its pull request waits on, the stage lane's own structure check, build - # (the live wiring render included), 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. Pinned at the product's lane version, - # because that is the orun the product's CI runs. + # Tier 2. THE PRODUCT IT PRODUCES WORKS: its one landing installed, its + # fixture rendered, type-checked, linted, tested and built, the stage lane's + # own structure check, build (the live wiring render included), 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. 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. site: 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 1426539..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 site converged. On main the convergence builds and tests the site -# 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 53b0f8b..a6b76c4 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -12,24 +12,27 @@ not separate workflows. The console card the platform renders is brokered secrets and the programme, and `testing/manifest.test.sh` holds it to what the build document does. -Target wall-clock: **about fourteen minutes** — an estimate summed from the -phases until a bootstrap measures it: ONE landing whose pull request waits on -Checks (a full Next.js build), then one convergence — the KV namespace -applied on stage and prod, then the app built with its id and deployed, -stage and prod side by side — then a short docs landing that restores the -promotion gate. Tenant SUBDOMAINS are not part of it: they need the root -domain's wildcard route, which is the owner's step afterwards (§4). +Target wall-clock: **about twelve minutes** — an estimate summed from the +phases (11 + 1) until a bootstrap measures it; no build of this baseline has +been timed. 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 — the KV namespace applied on +stage and prod, then the app built with its id and deployed, stage and prod +side by side — then a short docs landing that restores the promotion gate. +Tenant SUBDOMAINS are not part of it: they need the root domain's wildcard +route, which is the owner's step afterwards (§4). ## 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, `environments` on the secrets probe, a - probe deferred for a project not yet created, and `from: workspace`). The - product's own `ci.yml` pins its lanes separately (v2.78.4), and its plans - need that pin: the floor does not apply a `dependsOn` edge's `modeRules`. + CLI **≥ v2.88.0** — the floor for RUNNING the bootstrap (the phase overlay, + landings that commit per phase, `githubOwner` on the doctor probe, a probe + deferred for a project not yet created, `from: workspace`, the deploy + credentials minted in one `secrets` reconcile, the task set-up run in the + background (`background: true`), and landings checked in the box before + they merge (`checks: local`)). The product's own `ci.yml` pins its lanes + separately (v2.78.4). - A Cloudflare account (the free plan is enough for one Worker with static assets and a KV namespace per environment) and its **Account API token** with Workers Scripts Write and Workers KV Storage Write (the console's @@ -82,8 +85,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 product in one PR — intent, CI, tooling, identity, the KV root, the app and its tests; the brokered Cloudflare secrets | its PR's checks green and merged; the convergence green (KV applied, then the app built, deployed, smoke-tested); `WIRING_CLOUDFLARE_KV` on stage and prod; both workers.dev URLs answering | -| `02-docs` | `ai/context/deployment.md` from probed facts; prod's promotion gate and dev's push lanes restored | the final probe | +| `01-product` | the repository, created and linked; the WHOLE product in one PR — intent, CI, tooling, identity, the KV root, the app and its tests; the brokered Cloudflare secrets (the deploy token, the account id) | its commit validated and planned in the box (as the PR and as the merge), then merged; the convergence green (KV applied, then the app — which resolves `WIRING_CLOUDFLARE_KV` — built, deployed, smoke-tested); both workers.dev URLs answering | +| `02-docs` | `ai/context/deployment.md` from probed facts; prod's promotion gate and dev's push lanes restored | the render's own probes, recorded; the commit checked in the box and merged | ```bash orun new --blueprint repo-blueprint.yaml --out ~/sites/acme-tenants --run-hooks \ @@ -131,8 +134,9 @@ need landings of its own. It does not, because the product's plan holds it: environment's apply; on a pull request nothing deploys, so nothing waits. - A job resolves its secrets when it STARTS, so `WIRING_CLOUDFLARE_KV_` is there when the deploy begins. -- The landing's `await` then asks the platform that the wiring exists on - stage and prod (`orun.secrets/exists@v1`) — every later deploy reads it. +- The deploy resolves the document from the place every later run looks + (its `component.yaml` secret refs), so a green convergence already says it + is there: a missing one fails its lane. There is no separate check. `testing/phases.test.sh` fails if a component that reads a wiring document does not wait for its publisher this way; `testing/placement.test.sh` plans @@ -209,9 +213,9 @@ bash testing/e2e.test.sh # + network for pnpm: the product built in the The offline bootstrap (`testing/lib/bootstrap.sh`) places both phases in order and finishes each with the blueprint's OWN `run:` hooks — read out of `repo-blueprint.yaml`, not transcribed — so the retouch marker, the rebrand, -the re-tenant, the deferrals and their restore, the lockfile and the -deployment record all run exactly as a real bootstrap runs them. Only the -platform's typed actions (task, repo, link, reconcile, land, watch, secrets, +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, link, reconcile, land, watch, secrets, probe) are stood in for, a landing becoming a commit. What no offline test can do is the platform's half: the namespace applied for real (the KV root is held to `terraform validate`), the token minted, the deploy, the probes. @@ -243,12 +247,14 @@ at the tag and refuses the whole catalogue if it 404s. | KV lane or deploy lane: Authentication error (10000) | the connection's token lacks Workers Scripts or KV Storage write; re-issue it, re-connect, re-run `01-product` | | KV lane: title already exists (10014) | `adopt.tf` imports a namespace of the same title; restore it if removed. Two products with one `reponame` in one account share titles — pick another `reponame` | | web lane fails resolving `WIRING_CLOUDFLARE_KV_` | that environment's KV apply failed — read its lane; the web lane waits on it | -| `wiring` await stops: `WIRING_CLOUDFLARE_KV` missing on stage or prod | the convergence was green but the apply published nothing: the KV component lost its `secretOutputs`, or its lane was not in the plan. Re-run the phase; its retouch marker re-plans the KV root | +| web lane: `WIRING_CLOUDFLARE_KV` not found | that environment's KV apply published nothing: the KV component lost its `secretOutputs`, or its lane was not in the plan. Re-run the phase; its retouch marker re-plans the KV root | +| `land` stops: `the landing's own check failed — orun plan for …` | the product's tree does not plan — the line after it is orun's own error (an unknown component type, a composition that does not resolve). Nothing was pushed. Fix the tree (or the baseline) and re-run the phase | +| `land` waits on CI after all | the product's repository requires a status check on `main` (branch protection or a ruleset), so GitHub refused the early merge; the landing waits for the check as a `checks: ci` landing would, then merges | | 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 KV root and the app re-plan | | 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 | | web lane `verify-app-structure` fails on `wrangler.jsonc` | the config is not committed. It is the fixture render of `wrangler.template.jsonc`: `pnpm run wire:fixture` and commit it | | web lane `build-app`: `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) | -| 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` is pull-request 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 | diff --git a/README.md b/README.md index 64f7fec..434fe35 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,8 @@ purpose. ``` infra/terraform/cloudflare-kv ──apply──► orun secret WIRING_CLOUDFLARE_KV (stage, prod) - │ (the landing's await checks it exists) + │ (each deploy resolves it as it starts; + │ a missing one fails the lane) ▼ apps/web dependsOn cloudflare-kv (enforced on main) · secretEnv WIRING_CLOUDFLARE_KV_ build: tooling/wire/live.mjs → wrangler.jsonc with the environment's namespace id @@ -128,14 +129,13 @@ apps/web dependsOn cloudflare-kv (enforced on main) · secretEnv WIRING_CLOUDFL `wrangler.jsonc` is committed as the fixture render of `wrangler.template.jsonc`, because the deploy lane's `verify-app-structure` -step checks the config exists before it builds; Checks fails if the two -disagree. +step checks the config exists before it builds; `testing/e2e.test.sh` fails +if the two disagree. ## CI | Workflow | What it runs | Ships to a product | |---|---|---| -| `checks.yml` | install, wire fixtures (and 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; applies the KV namespace, then deploys stage → prod on merge. It plans nothing while `intent.yaml` names the placeholder workspace `ws_CHANGE_ME`, as this repository does | yes | +| `ci.yml` | the Orun pipeline, and the only workflow a product carries: `orun plan --changed`, then one job per lane. A pull request runs the verify lanes (the KV root planned for stage and prod, the app built and dry-deployed per environment; no tests or lint — `baseline.yml`'s e2e tier runs those before each tag), except the bootstrap's own landings (`orun/BASE-*`), where `plan` alone runs and nothing waits for it (the landing checked its commit in the box); a merge applies the KV namespace, then 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 wiring path, the blueprint read by the pinned orun, the leak gate, the offline bootstrap with the product's own plan, the product built in the job tree, dry-deployed and served — a tenant created and read back through the Worker | no | | `tag.yml` | cuts a `baseline-vN` tag (manual) | no | diff --git a/ai/context/deployment.md b/ai/context/deployment.md index d5f9d66..f59e8a6 100644 --- a/ai/context/deployment.md +++ b/ai/context/deployment.md @@ -2,6 +2,6 @@ > Not rendered yet. The bootstrap's `02-docs` phase probes every live URL and > regenerates this file from what answered — the workspace, the URLs and -> their status, and the secrets inventory by name. Until then, nothing here +> their status, and the secrets the site uses, by name. Until then, nothing here > claims the site is live. The operating contract is > [operations.md](operations.md). diff --git a/ai/context/operations.md b/ai/context/operations.md index 7f84733..4e47054 100644 --- a/ai/context/operations.md +++ b/ai/context/operations.md @@ -1,7 +1,7 @@ # platforms-starter-kit — operating contract (for humans and agents) This is the standing guide to how this site 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 @@ -24,15 +24,16 @@ component-native desired-state repo. deletes them. `proxy.ts` rewrites `./` to `/s/`. - **`tests/web`** — the store adapter over a fake namespace, the proxy's - routing, the host-dependent tenant links (vitest), verified on the `dev` - rung. + routing, the host-dependent tenant links (vitest). Run them with + `pnpm test` before you push: its `dev` lane installs and checks the + package, and does not run the suite. - **`tooling/*`** — shared TypeScript and ESLint configuration, and the wrangler renderer that turns `wrangler.template.jsonc` plus a wiring document into `wrangler.jsonc`. Environments: **`stage`** and **`prod`** are deployed; **`dev` is -verify-only by design** — lanes build and test, nothing deploys, and no KV -namespace exists for it (its build renders the committed fixture). +verify-only by design** — lanes build and dry-deploy, nothing deploys, and +no KV namespace exists for it (its build renders the committed fixture). ## Where a tenant lives @@ -92,8 +93,9 @@ Caveats that matter: - A change to `intent.yaml`'s `environments` (a new `BASE_DOMAIN`) maps to no component and redeploys nothing on its own. Land it with a change under `apps/web`. -- `wrangler.jsonc` is generated. Edit `wrangler.template.jsonc` and run - `pnpm run wire:fixture`; Checks fails when the two disagree. +- `wrangler.jsonc` is generated. Edit `wrangler.template.jsonc`, run + `pnpm run wire:fixture` and commit both; the deploy renders its own + config from the template, so a stale committed render misleads local work. ## Secrets model diff --git a/apps/web/component.yaml b/apps/web/component.yaml index f8fc711..0af6248 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 0900449..02a6a8b 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -26,7 +26,7 @@ metadata: namespace and deploys the app to stage and prod on merge. Tenants answer at /s/ on workers.dev from the first deploy, and as subdomains once the root domain's wildcard route points at the Worker. One - provider, one consent, one token. Live in about fifteen minutes, in one + provider, one consent, one token. Live in about twelve minutes, in one landing. tags: [multi-tenant, kv, cloudflare, nextjs, terraform] spec: @@ -113,15 +113,15 @@ spec: # build at the door, naming the fix, before anything is created. from: connection.cloudflare.workersSubdomain - # ── PREVIEW ONLY. repo-blueprint.yaml's `orun.integrations/reconcile@v1` - # hooks mint these, brokered, during 01-product. ───────────────────────── - # Transcribed from those hooks' own `keys:` and `template:` values, so - # testing/manifest.test.sh compares this list to the document that mints - # them. The console renders them read-only: no credential is ever typed, - # shown or stored. Keys that already exist are kept. The KV namespace ids - # are not here: they are not credentials, and the namespace's own apply - # publishes them. Nothing third-party is asked for: the app has no - # runtime secret. + # ── 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:` entries (each key and its + # template), in its order, so testing/manifest.test.sh compares this list + # to the document that mints them. The console renders them read-only: no + # credential is ever typed, shown or stored. Keys that already exist are + # kept. The KV namespace ids are not here: they are not credentials, and + # the namespace's own apply publishes them. Nothing third-party is asked + # for: the app has no runtime secret. secrets: - key: CLOUDFLARE_API_TOKEN provider: cloudflare @@ -150,9 +150,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. An estimate until a bootstrap - # measures it. - expectedMinutes: 14 + # Summed from the phases' expectedMinutes (11 + 1). An estimate until a + # bootstrap measures it: no build of this baseline has been timed. + expectedMinutes: 12 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 caaf1a3..60f85e5 100644 --- a/docs/phases/01-product.md +++ b/docs/phases/01-product.md @@ -14,23 +14,24 @@ waits. ## What runs +The run's task set-up — the epic, both milestones, both tasks — runs in the +background from the start (`background: true`), so every hook up to `task` +runs beside it; `task` is the first that waits for it. + | hook | what it does | |---|---| -| `task` (pre) | finds the phase's task and yields its key | | `retouch` | the redeploy marker on the components `.baseline/tasks/01-product.TaskContract.yaml` names: `cloudflare-kv`, `web`, `web-tests` | | `git-init`, `stage`, `rebrand` | the tree becomes a repository, then the product's | | `orun-workspace` | intent.yaml's `workspace:` becomes the product's (or `ws_SET_ME`, which fails loudly) | | `work-tree` | intent.yaml's `work:` block — this repository's epics and tasks — is removed | | `promotion`, `dev-lanes` | prod's promotion gate and dev's push-to-main activation deferred until `02-docs` | | `restage`, `rebrand-verify` | the sweep: no identity of this baseline left anywhere | -| `pnpm-lockfile` | confirms the baseline's complete lockfile against the placed tree | | `repo` | `orun.repo/ensure@v1` creates `/` (or finds it) | | `link` | the repository becomes the workspace's; `orun cloud check` is the gate | -| `secret-workers-deploy` | `orun.integrations/reconcile@v1` — `CLOUDFLARE_API_TOKEN` from the `workers-deploy` template: Workers Scripts and KV Storage write, so ONE token applies the namespace and deploys the Worker | -| `secret-account-id` | `CLOUDFLARE_ACCOUNT_ID`, the connection fact both bind | -| `land` | one PR bound to the task, merged once its checks (Checks, and `plan`) are green | -| `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_CLOUDFLARE_KV` exists on stage and prod | +| `secrets` | `orun.integrations/reconcile@v1`, both keys in one hook, created side by side: `CLOUDFLARE_API_TOKEN` from the `workers-deploy` template (Workers Scripts and KV Storage write, so ONE token applies the namespace and deploys the Worker); `CLOUDFLARE_ACCOUNT_ID`, the connection fact both bind | +| `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 | +| `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 | ## What the convergence does @@ -43,14 +44,17 @@ promotion gate deferred: | `cloudflare-kv · stage` / `· prod` | nothing | `terraform apply` of `stg--app-kv-stage` / `prod--app-kv-prod`, adopting a namespace of that title if one exists (`adopt.tf`), then lease-publishes `WIRING_CLOUDFLARE_KV` = `{app_kv_id, app_kv_title}` on that environment | | `stage · web` / `prod · web` | that environment's KV apply (`dependsOn: cloudflare-kv`, `mode: enforced` on main) | resolves `WIRING_CLOUDFLARE_KV_` as it starts, renders `wrangler.jsonc` with the real namespace id, builds with OpenNext and the environment's `BASE_DOMAIN`, deploys `-web-`, and smoke-tests it: `/` must address tenants as `/s/…` for the workers.dev host it was asked on (only the Worker rendering per request can), and `/admin` must answer (it lists the tenants from the namespace) | -Stage and prod run side by side. `web-tests` verifies on dev only, so on the -merge its gate is the pull request's Checks run, which the landing waited -for. +Stage and prod run side by side. `web-tests` is checked on dev only, on a +pull request. 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. ## Verified -The convergence run for the merge commit is green; `WIRING_CLOUDFLARE_KV` -exists on stage and prod; `https://-web-{stage,prod}..workers.dev` +The convergence run for the merge commit is green — the app's deploys +resolved `WIRING_CLOUDFLARE_KV` from stage and prod, where every later run +reads it; `https://-web-{stage,prod}..workers.dev` answer: the landing page, from which a tenant is created and served at `/s/`. Tenant subdomains wait for the owner's custom-domain step. @@ -60,6 +64,7 @@ answer: the landing page, from which a tenant is created and served at |---|---| | parks on the `providers` probe | GitHub (on the repository's owner) or Cloudflare is not connected to the workspace. Connect it (console → Integrations), then re-run the phase — the probe is a wait, not a failure | | stops at `link` | the repository is not linked to the workspace and the credential cannot link it. Allow-list it (console → Settings → Git repos) and re-run the phase | +| `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 | | KV lane: `a namespace with this account ID and title already exists` (10014) | `adopt.tf` imports a namespace of the same title; if it was removed, restore it. Two products with the same `reponame` in one account share a title — use a distinct `reponame` | | KV lane or deploy lane: Authentication error (10000) | the connection's token lacks Workers Scripts or KV Storage write. Re-issue it with the permission groups the console's Connect recipe lists, re-connect, re-run the phase | | web lane fails resolving `WIRING_CLOUDFLARE_KV_` | that environment's KV apply failed or never ran — read its lane; the web lane waits on it, so it shows as not run on a fresh failure | diff --git a/docs/phases/02-docs.md b/docs/phases/02-docs.md index 6a532d8..63a8995 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 `/admin` on both environments (whether each landing page was rendered for its host, tenants at `/s/`, and whether `/admin` read its tenant list from KV), lists the secrets by name and the workspace's integrations, and regenerates `ai/context/deployment.md` and the README's live-deployment section | -| `land` | one PR, waited for and merged. It touches no component, so it deploys nothing | -| `verify` (await) | the same probe `01-product` ended on | +| `render` | `hooks/render-deployment-docs.sh`: probes `/` and `/admin` on both environments (whether each landing page was rendered for its host, tenants at `/s/`, and whether `/admin` read its tenant list from KV) and regenerates `ai/context/deployment.md` — the identity, the probed URLs, the secrets the deployment uses by name — and the README's live-deployment section. It asks the platform nothing: what the workspace holds right now is on the console's Secrets and Integrations pages, which the record points to | +| `task` | finds the phase's task and yields its key | +| `land` | one PR, its commit checked in the box (`checks: local`) and merged. It touches no component, so it deploys nothing — and there is nothing after it to wait for: the render's probes are the phase's check | ## Re-running it diff --git a/docs/phases/README.md b/docs/phases/README.md index a112ec2..39ed63b 100644 --- a/docs/phases/README.md +++ b/docs/phases/README.md @@ -9,9 +9,13 @@ container the same operation as running them all. The product phase follows the contract every deploying phase does: -> **place its modules → brand them → land them as one pull request → watch -> the convergence that merge triggers (auto-resumed) → check what the -> convergence published → 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 site's repository is wherever `--out` points. @@ -20,7 +24,7 @@ site's repository is wherever `--out` points. | phase | lands | verified by | |---|---|---| -| [`01-product`](01-product.md) | **the GitHub repo created** and the whole product in ONE pull request: intent, CI, tooling, identity, the KV root, the app and its tests | the convergence green (KV applied, then the app built, deployed and smoke-tested), `WIRING_CLOUDFLARE_KV` on stage and prod, both URLs answering | +| [`01-product`](01-product.md) | **the GitHub repo created** and the whole product in ONE pull request: intent, CI, tooling, identity, the KV root, the app and its tests | the convergence green (KV applied, then the app built, deployed and smoke-tested), both URLs answering | | [`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, not three.** Before the one-landing shape a site like this @@ -35,12 +39,15 @@ published is there. On a pull request the edge is advisory: nothing deploys. the product's own plan honours it. Every landing is a pull request on a branch named for its task -(`orun/BASE--`). On those branches `ci.yml` runs `plan` only — the -intent, every component and every composition resolve — and skips the lanes, +(`orun/BASE--`), checked before it is pushed: `orun validate`, then +`orun plan` as the pull request and as the merge would plan it, in the box, +in under a second (`checks: local`). Then it merges; nothing waits for the +PR's CI. On those branches `ci.yml` runs `plan` only and skips the lanes, because the merge runs them on main a minute later, for real, and that -convergence is what the phase watches. `checks.yml` (install, the fixture -render, typecheck, lint, test, build) runs on every pull request regardless, -and the product's landing waits for it. +convergence is what the phase watches. The product carries no other +workflow: the baseline's own CI (Tier 2) installs, renders the fixture, +type-checks, lints, tests and builds this landing before a tag is cut, and +every later pull request in the product runs `ci.yml`'s verify lanes. There is no custom-domain phase, and so no tenant subdomains out of the bootstrap. A tenant is `.` (the environment's @@ -110,9 +117,10 @@ lands, its `post` hooks make them the site's: the two bootstrap deferrals (prod's promotion gate, dev's push lanes), restage, `rebrand --verify` — the identity rename over the whole tree, then a sweep that fails on any of this baseline's identity left behind. -3. `pnpm install --lockfile-only` — confirms the baseline's complete - lockfile against the placed tree, so `--frozen-lockfile` installs pass. -4. `repo`, `link`, the brokered Cloudflare credentials, `land`. +3. `repo`, `link`, the brokered Cloudflare credentials (the deploy token + and the account id, one `secrets` hook), `task`, `land`. The baseline's + lockfile is placed as it is and installed `--frozen-lockfile` by the + lanes; nothing re-resolves it. ## When a phase fails diff --git a/hooks/render-deployment-docs.sh b/hooks/render-deployment-docs.sh index 66c0ae7..a73feb7 100755 --- a/hooks/render-deployment-docs.sh +++ b/hooks/render-deployment-docs.sh @@ -12,15 +12,22 @@ # whether each Worker rendered its landing page # for the host it was asked on and read its # tenant list from KV), identity, the KV -# wiring, secrets inventory BY NAME, -# integrations +# wiring, and the secrets the deployment uses +# BY NAME # ai/context/operations.md — healed from the baseline's copy if absent # (the static operating contract; never rewritten) # README.md — the section between # is replaced (appended after the title if the # README predates the markers) # -# No secret VALUE is ever read or written here — inventories are names only. +# No secret VALUE is ever read or written here — secrets are named, not read. +# +# IT ASKS THE PLATFORM NOTHING. The record used to carry the workspace's slug, +# its secrets listed per rung and its integrations — five CLI calls, one after +# another, from the build box — and all of it is what the console shows live +# and this file could only show as it was the day it was written. The record +# keeps what the repository is the right place for: the identity the code +# names, what answered at the URLs, and where to look for the rest. set -euo pipefail out="${1:?usage: render-deployment-docs.sh }" @@ -38,10 +45,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="?" @@ -96,17 +99,6 @@ for pair in "stage|$stage_url" "prod|$prod_url"; do rows+="| app (${env}) | ${url} | $(badge "$(probe "$url")") |"$'\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 site predates it. @@ -123,15 +115,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\` | | KV namespaces (the tenant store) | \`stg-${repo}-app-kv-stage\`, \`prod-${repo}-app-kv-prod\` (\`infra/terraform/cloudflare-kv\`); their ids reach the Workers as \`WIRING_CLOUDFLARE_KV\` on each environment | @@ -147,24 +138,18 @@ The \`dev\` environment is verify-only by design — no deployed URL and no namespace. Tenant subdomains on the root domains above are not probed: they answer once the owner attaches the domain (README, "Tenant subdomains"). -## Secrets inventory (names only) - -Project rung: -${secrets_proj} +## Secrets (names only) -Environment \`stage\`: -${secrets_stage} - -Environment \`prod\`: -${secrets_prod} - -Provider secrets are BROKERED (minted per run from the workspace's Cloudflare -connection; no long-lived values at rest). \`WIRING_CLOUDFLARE_KV\` is written -by the KV root's apply and holds ids, not credentials. - -## Workspace integrations +| secret | where | what it is | +|---|---|---| +| \`CLOUDFLARE_API_TOKEN\` | the workspace | BROKERED from its Cloudflare connection (\`workers-deploy\`): applies the KV namespace and deploys the Worker | +| \`CLOUDFLARE_ACCOUNT_ID\` | the workspace | the connection's account id — a fact, not a credential | +| \`WIRING_CLOUDFLARE_KV\` | \`${repo}\` on stage and on prod | written by the KV root's apply: the tenant store's namespace id and title, not a credential | -${integrations} +Brokered secrets are minted per run, so no long-lived value is at rest. What +the workspace holds right now (every secret by name, and its integrations +and their health) is on the console's Secrets and Integrations pages for +\`${ws}\`. ## How this deployment changes @@ -179,7 +164,7 @@ python3 - <<'PY' import re begin, end = "", "" body = f"""{begin} -This site is **live**. Verified URLs, identity and the secrets inventory are +This site 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/infra/terraform/cloudflare-kv/component.yaml b/infra/terraform/cloudflare-kv/component.yaml index 3edbe7d..c947cdc 100644 --- a/infra/terraform/cloudflare-kv/component.yaml +++ b/infra/terraform/cloudflare-kv/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 461b3c9..4979123 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -184,8 +184,10 @@ modules: source: baseline from: pnpm-workspace.yaml to: pnpm-workspace.yaml - # The baseline's complete lockfile: the whole tree lands at once, so the - # `pnpm-lockfile` hook only confirms it. + # 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 @@ -305,16 +307,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 }}" @@ -330,6 +341,7 @@ hooks: owner: me - id: m01 uses: orun.task/ensure@v1 + background: true with: kind: milestone epic: "{{ .inputs.epicSlug }}" @@ -340,6 +352,7 @@ hooks: - the app built, deployed and answering on stage and prod - id: m02 uses: orun.task/ensure@v1 + background: true with: kind: milestone epic: "{{ .inputs.epicSlug }}" @@ -349,6 +362,7 @@ hooks: - prod waits on stage again - id: t01 uses: orun.task/ensure@v1 + background: true with: kind: task epic: "{{ .inputs.epicSlug }}" @@ -364,6 +378,7 @@ hooks: contract: .baseline/tasks/01-product.TaskContract.yaml - id: t02 uses: orun.task/ensure@v1 + background: true with: kind: task epic: "{{ .inputs.epicSlug }}" @@ -398,10 +413,14 @@ phases: - name: 01-product title: The product, built in one landing description: The whole tree — manifests, CI, tooling, the KV root, the multi-tenant 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, the KV apply, then the app's build, - # deploy and smoke on stage and prod side by side. - expectedMinutes: 12 + # An estimate, not a measurement — no bootstrap of this baseline has been + # timed on this shape: the landing checked here (no runner's Checks or + # `plan` waited for) and merged, then the merge's convergence — the KV + # apply, then the app's build, deploy and smoke, stage and prod side by + # side. A minute under the last estimate, for the task set-up in the + # background, the landing checked in the box and the watch reading every + # 5 s. + expectedMinutes: 11 narrate: start: "Creating the repository and landing the whole product in one pull request — intent, CI, tooling, the KV namespace and the multi-tenant app with its tests. Then one convergence applies the namespace and deploys the app on stage and prod. Usually about {{ .meta.expectedMinutes }} minutes." await: "One convergence is deploying the product: the KV namespace first, then the app built with its id, on stage and prod side by side. The Next.js build is the long pole; nothing is stuck." @@ -426,19 +445,6 @@ phases: waitSeconds: 600 pollSeconds: 20 hooks: - pre: - # The epic, the milestones and the tasks already exist (the run-level - # list above). This finds the task and yields its key, which the - # landing binds the pull request to. - - id: task - uses: orun.task/ensure@v1 - with: - kind: task - epic: "{{ .inputs.epicSlug }}" - milestone: "{{ .phase.name }}" - name: "Build the product in one landing" - prefix: BASE - contract: .baseline/tasks/01-product.TaskContract.yaml # The whole tree is placed when these run. rebrand.mjs enumerates it # with `git ls-files`, so the output has to be a git repository with a # populated index BEFORE it runs. `git add -A` only stages; the landing @@ -511,11 +517,6 @@ phases: run: ["git", "add", "-A"] - id: rebrand-verify run: ["node", "{{ .baseline.dir }}/tooling/rebrand/rebrand.mjs", "--verify", "--values", ".rebrand/values.json"] - # root-pnpm-lock places the baseline's complete lockfile and the whole - # tree is here, so this only confirms it; 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 @@ -544,32 +545,46 @@ 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. `workers-deploy` covers both halves of this product — - # Workers Scripts for the app's deploy and KV Storage for the - # namespace's apply — so one token serves the KV root and the deploy - # lane alike; the account id is a connection fact both bind. Keys that - # already exist are kept. After the link, before the landing whose - # convergence uses them. - - id: secret-workers-deploy + # The deploy credentials, brokered, in ONE hook (orun >= v2.87.0): + # `secrets` mints each key under its own scope template from the one + # connection the build is bound to, reading the connections and the + # existing secrets once and creating the missing keys side by side. + # `workers-deploy` covers both halves of this product — Workers + # Scripts for the app's deploy and KV Storage for the namespace's + # apply — so one token serves the KV root and the deploy lane alike; + # the account id is a connection fact both bind. Keys that already + # exist are kept. After the link, before the landing whose convergence + # uses them. + - id: secrets uses: orun.integrations/reconcile@v1 with: provider: cloudflare - keys: [CLOUDFLARE_API_TOKEN] - template: workers-deploy - - id: secret-account-id - uses: orun.integrations/reconcile@v1 + secrets: + - { key: CLOUDFLARE_API_TOKEN, template: workers-deploy } + - { key: CLOUDFLARE_ACCOUNT_ID, template: account-id } + # The task this landing closes, and its key. The run-level list above + # opens it in the background; this is the first hook that needs it, + # so it is the one that waits for that list (orun >= v2.88.0) — every + # hook before it ran while the task plane was still being set up. + - id: task + uses: orun.task/ensure@v1 with: - provider: cloudflare - keys: [CLOUDFLARE_ACCOUNT_ID] - template: account-id - # THE PRODUCT IS A PULL REQUEST THAT IS CHECKED, THEN MERGED. This - # landing waits for its PR's whole CI run (orun >= v2.58.6): Checks - # (install, the fixture render, 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 that convergence is what `await` watches. + 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. A tree that fails is never pushed. The PR's CI still runs + # (`plan` alone on a bootstrap branch, `orun/BASE-…`, ci.yml); nothing + # waits for it. The merge runs every lane on main a minute later, for + # real, and that convergence is what `await` watches. - id: land uses: orun.pr/land@v1 narrate: "The product is merged into main." @@ -578,6 +593,7 @@ phases: epic: "{{ .inputs.epicSlug }}" branchSlug: "{{ .phase.name }}" title: "feat: {{ .inputs.productname }}, the whole product from the platforms-starter-kit baseline" + checks: local await: - id: converge uses: orun.run/watch@v1 @@ -590,18 +606,18 @@ phases: repo: "{{ .inputs.githuborg }}/{{ .inputs.reponame }}" resumeBudget: 3 waitSeconds: 1800 - # The KV root's apply lease-publishes its wiring document to the - # project's ENVIRONMENT rungs (stage and prod), not to the workspace; - # every later deploy of the app reads it back. Asked of the platform - # directly, because a green convergence says the lanes passed, not - # that the document a FUTURE deploy needs is where it will look. - - id: wiring - uses: orun.secrets/exists@v1 - narrate: "The KV wiring the app's deploys read is published on stage and prod." - with: - keys: [WIRING_CLOUDFLARE_KV] - project: "{{ .inputs.reponame }}" - environments: [stage, prod] + # Read every 5 s, not the action's 40: the build goes on the + # moment the run is green instead of up to 40 s after it. + pollSeconds: 5 + # NO SEPARATE WIRING CHECK. The KV root's apply lease-publishes its + # wiring document to the project's stage and prod rungs, and its one + # reader resolves it in this convergence from the place every later + # run looks: the app's deploy job, on stage and on prod, resolves + # WIRING_CLOUDFLARE_KV_STAGE and _PROD (apps/web/component.yaml's + # secretEnv, waiting on the apply — enforced on main) before its first + # step, fail-closed. A missing document fails that lane, so a green run + # already says it is there. WIRING_CLOUDFLARE_KV was the await's only + # key, so the await goes with it. - id: verify uses: orun.http/probe@v1 narrate: "The app answered on stage and prod, on workers.dev." @@ -611,31 +627,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, not a measurement: the render's two probes, the task, and + # one 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 site 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 SITE GOES LIVE WITH ITS PROMOTION GATE. 01-product deferred # `prod.promotion.dependsOn: [stage]`; this, the last landing, puts it @@ -650,6 +658,17 @@ phases: run: ["node", "{{ .baseline.dir }}/tooling/bootstrap/dev-lanes.mjs", "--restore"] - id: render run: ["bash", "{{ .baseline.dir }}/hooks/render-deployment-docs.sh", ".", "{{ .inputs.orunWorkspace }}", "{{ .baseline.dir }}"] + - id: task + uses: orun.task/ensure@v1 + with: + kind: task + epic: "{{ .inputs.epicSlug }}" + milestone: "{{ .phase.name }}" + name: "Record the live deployment" + prefix: BASE + contract: .baseline/tasks/02-docs.TaskContract.yaml + # Checked here and merged, as 01-product's landing is + # (`checks: local`). - id: land uses: orun.pr/land@v1 narrate: "The deployment record is merged into main." @@ -658,11 +677,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..3a4fb8c 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: @@ -136,9 +176,10 @@ for wf in workflows: # ONE WORKFLOW ON A PUSH TO MAIN, in what a product carries. The bootstrap # watches each phase's convergence with `orun.run/watch@v1` and `sha:`, which # takes the newest workflow run for the merge commit — from any workflow. A -# second one on push (checks.yml did this) can be the run it finds: the first -# live bootstrap watched Checks go green while ci.yml's deploy lanes had -# failed. So every shipped workflow but ci.yml stays off pushes to main. +# second one on push (the Checks workflow this baseline once shipped did this) +# can be the run it finds: the first live bootstrap watched Checks go green +# while ci.yml's deploy lanes had failed. So every shipped workflow but ci.yml +# stays off pushes to main. import yaml as _yaml on_push = [] for wf in workflows: diff --git a/testing/e2e.test.sh b/testing/e2e.test.sh index 4398f9c..1afcc26 100755 --- a/testing/e2e.test.sh +++ b/testing/e2e.test.sh @@ -5,11 +5,11 @@ # This proves it WORKS, by doing to it what its own pipelines will: # # 1. at the 01-product landing (the commit its one pull request merges), -# run what `checks.yml` runs on that PR — install with the lockfile the -# phase confirmed, render the wrangler fixture and check the committed -# config IS that render, typecheck, lint, test, build. The landing WAITS -# on those checks, so a product they refuse is a bootstrap that never -# merges; +# install with the lockfile the product ships, render the wrangler +# fixture and check the committed config IS that render, typecheck, +# lint, test, build. The landing's own PR runs `plan` alone (an +# `orun/BASE-*` branch), so THIS is where a product those steps refuse +# is caught: before the tag, not after a build has merged it; # 2. the stage lane's own steps, rendered by `orun plan` in the product for # a pull request (the verify profile: the deploy profile has no dry run) # — `verify-app-structure` (which checks the wrangler config exists @@ -75,24 +75,29 @@ 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 — the ones the product's retired +# Checks workflow ran, run here at once on the whole tree. A product's pull +# requests verify through ci.yml's lanes (the app built — Next's build +# type-checks it — and dry-deployed per environment, the KV root planned), +# which neither lint nor run the tests, so before a tag THIS is where those +# are held. +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)" @@ -103,10 +108,10 @@ echo " 2 phases placed and landed" s01="$(git -C "$tree" rev-parse HEAD~1)" # ── 1. the product's one pull request ────────────────────────────────────── -echo "── 01-product's landing, under the checks its PR waits on" +echo "── 01-product's landing: install, the fixture render, typecheck, lint, test, build" git -C "$tree" worktree add -q "$scratch/at-01" "$s01" checks "$scratch/at-01" "$scratch/checks-01.log" -# The first Checks build is done; its tree is not needed again, and the disk is shared. +# The landing's build is done; its tree is not needed again, and the disk is shared. git -C "$tree" worktree remove --force "$scratch/at-01" # ── 2. the stage lane's steps, in the job's own tree ────────────────────── diff --git a/testing/leak.test.sh b/testing/leak.test.sh index 13cf185..ea9d6b3 100755 --- a/testing/leak.test.sh +++ b/testing/leak.test.sh @@ -88,7 +88,7 @@ for p in placed: # ── the site'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/app/site.ts", "tests/web/component.yaml", # the tenant store and the workers.dev fallback a fresh deploy # depends on (tenants at /s/ off the root domain) diff --git a/testing/lib/bootstrap.sh b/testing/lib/bootstrap.sh index 43bfd4e..44466cb 100644 --- a/testing/lib/bootstrap.sh +++ b/testing/lib/bootstrap.sh @@ -14,8 +14,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..a834d4d 100755 --- a/testing/manifest.test.sh +++ b/testing/manifest.test.sh @@ -83,13 +83,16 @@ def uses(phase, action): yield hook # THE SECRETS THE BOOTSTRAP MINTS. `orun.integrations/reconcile@v1` is what -# `create-secrets.sh` was written out longhand as: one connection, one scope -# template, the keys it ensures. Read per key so a hook minting two keys under -# one template is three facts rather than one. +# `create-secrets.sh` was written out longhand as: one connection, and per key +# the scope template it is minted under — `secrets: [{key, template}]`, or +# `keys` sharing one `template`. Read per key so a hook minting two keys is +# two facts rather than one. blueprint_secrets = {} for phase in bp_phases: for hook in uses(phase, "orun.integrations/reconcile@v1"): w = hook.get("with") or {} + for item in (w.get("secrets") or []): + blueprint_secrets[item.get("key")] = (w.get("provider"), item.get("template")) for key in (w.get("keys") or []): blueprint_secrets[key] = (w.get("provider"), w.get("template")) diff --git a/testing/phases.test.sh b/testing/phases.test.sh index 701589d..db661e4 100755 --- a/testing/phases.test.sh +++ b/testing/phases.test.sh @@ -10,9 +10,16 @@ # before the Worker that binds it — is carried by the plan instead, and this # file checks the edges that carry it: every component that reads a wiring # document waits, on a merge to main, for the infra component that publishes -# it, and the landing's await checks that document exists afterwards. A -# module that drifts into another phase, or an edge that goes missing, fails -# at landing time, live, with nothing in this repository having looked wrong. +# it. Each reader resolves its document in the convergence from the place +# every later run looks, so a green convergence says the document is there — +# no separate check. A module that drifts into another phase, or an edge that +# goes missing, fails at landing time, live, with nothing in this repository +# having looked wrong. +# +# 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. @@ -51,16 +58,19 @@ PARTITION = { HOOK_ONLY = {"02-docs"} # The phases that DEPLOY, and so must give a re-run something to land. DEPLOYS = {"01-product"} -# Each phase's post and await hooks, in order — the one-landing recipe. The -# `secret-*` reconciles are matched as a group (one per brokered key) and the -# `wiring` await only when infra publishes wiring; both are checked below. +# Each phase's pre, post and await hooks, in order — the one-landing recipe. +# The brokered keys are one `secrets` reconcile. 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. No phase awaits the +# wiring: the app's deploy resolves it in the convergence (checked below). +PRE = {"01-product": [], "02-docs": []} POST = { "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"], + "promotion", "dev-lanes", "restage", "rebrand-verify", + "repo", "link", "secrets", "task", "land"], + "02-docs": ["promotion", "dev-lanes", "render", "task", "land"], } -AWAIT = {"01-product": ["converge", "wiring", "verify"], "02-docs": ["verify"]} +AWAIT = {"01-product": ["converge", "verify"], "02-docs": []} by_name = {p["name"]: p for p in phases} names = [p["name"] for p in phases] @@ -140,15 +150,13 @@ for p in phases: f"commit it merged (orun.run/watch@v1 with sha: mergeSha)") # ── the hooks run in the one-landing order ──────────────────────────────── -def collapse(ids): - out = [] - for i in ids: - i = "secret-*" if i.startswith("secret-") else i - if not out or out[-1] != i or i != "secret-*": - out.append(i) - return out +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.items(): - got = collapse([h.get("id") for h in ((by_name.get(name, {}).get("hooks") or {}).get("post") or [])]) + got = [h.get("id") for h in ((by_name.get(name, {}).get("hooks") or {}).get("post") or [])] if got != want: bad(f"phase {name}'s post hooks are {got}; the one-landing order is {want}") for name, want in AWAIT.items(): @@ -206,18 +214,63 @@ for name, (rel, spec) in comps.items(): if (m.get("from") or "").rstrip("/") == comps[pub][0].rsplit("/", 1)[0]), None) if mod and pub_mod and pub_mod not in (mod.get("dependsOn") or []): bad(f"module {mod['name']} reads {key} and is not placed after {pub_mod} (module dependsOn)") -# …and the landing's await asks the platform that every one of them exists. +# …and every document published is one a component in the convergence +# resolves, on stage AND prod, from the place every later run looks (its +# secretEnv: `secret://///WIRING_X`). That read is what +# replaced the `wiring` await: a job resolves its secrets when it starts, +# fail-closed, so a green convergence says every one of them is there. A +# document nothing reads in the convergence would need the await back. +read_from = {} +for name, (rel, spec) in comps.items(): + for env_key, ref in (spec.get("secretEnv") or {}).items(): + m = re.match(r"^secret://[^/]+/[^/]+/(stage|prod)/(WIRING_[A-Z0-9_]+)$", str(ref)) + if m: + read_from.setdefault(m.group(2), set()).add(m.group(1)) +for key in sorted(publishes): + if read_from.get(key, set()) != {"stage", "prod"}: + bad(f"{key} is published and no component resolves it on both stage and prod " + f"(it is read on {sorted(read_from.get(key, set())) or 'none'}) — nothing in the " + f"convergence proves it is there; read it, or await it with orun.secrets/exists@v1") for p in phases: - if p["name"] not in DEPLOYS: - continue - exists = [h for h in ((p.get("hooks") or {}).get("await") or []) - if (h.get("uses") or "").startswith("orun.secrets/exists@")] - keys = {k for h in exists for k in ((h.get("with") or {}).get("keys") or [])} - envs = {e for h in exists for e in ((h.get("with") or {}).get("environments") or [])} - if set(publishes) - keys: - bad(f"phase {p['name']} does not await the wiring {sorted(set(publishes) - keys)} with orun.secrets/exists@v1") - if publishes and envs != {"stage", "prod"}: - bad(f"phase {p['name']} awaits the wiring on {sorted(envs)}, not stage and prod") + for h in hooks_of(p): + if (h.get("uses") or "").startswith("orun.secrets/exists@"): + keys = set((h.get("with") or {}).get("keys") or []) + proven = {k for k in keys if read_from.get(k, set()) >= {"stage", "prod"}} + if proven: + bad(f"phase {p['name']} awaits {sorted(proven)} with orun.secrets/exists@v1, which " + f"the convergence's own lanes already resolve on stage and prod — a second check") + +# ── 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 keeps a `pre` hook on the task plane: one there waits for the +# whole background list before the phase has done anything. +PLANE = ("orun.task/", "orun.pr/land@") +for p in phases: + for h in ((p.get("hooks") or {}).get("pre") or []): + if (h.get("uses") or "").startswith(PLANE): + bad(f"phase {p['name']} pre hook {h.get('id')} uses the task plane ({h['uses']}) — " + f"move it to `post`, just before the landing") +# Every landing checks its commit here and merges, instead of waiting 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") # ── every phase's task is one the run-level list opens, in the same order ─ def task_names(hooks): @@ -312,8 +365,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 diff --git a/testing/placement.test.sh b/testing/placement.test.sh index 033bb62..f0423d0 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 onto what the previous one landed, 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 +# deferrals and their restore, the deployment record), each # landing a commit; # 3. the product it ends with: branded with no residue — the app, the # Worker, the KV namespace titles, the root domains tenants hang off and @@ -33,9 +33,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)" @@ -46,9 +45,10 @@ 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: v2.58.11, the bootstrap floor, -# does not apply a dependsOn edge's `modeRules`, and would plan a pull request -# with the app waiting on the KV plan. +# product's CI runs (ci.yml's pin) or newer: an older orun (v2.58.11, the +# bootstrap's floor before v2.88.0) does not apply a dependsOn edge's +# `modeRules`, and would plan a pull request with the app waiting on the KV +# plan. 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..fae9dc1 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 — tenant addresses, the subdomain proxy and the tenant store over an in-memory KV namespace, and the site identity 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..c2cc704 100644 --- a/tests/web/docs/overview.md +++ b/tests/web/docs/overview.md @@ -1,5 +1,7 @@ # web-tests +The app's vitest suite — tenant addresses, the subdomain proxy and the tenant store over an in-memory KV namespace, and the site identity + 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