diff --git a/.baseline/product/README.md b/.baseline/product/README.md index 5ddd11e..a00017c 100644 --- a/.baseline/product/README.md +++ b/.baseline/product/README.md @@ -10,7 +10,7 @@ Merges to `main` deploy it to `stage` and `prod`. Not recorded yet. The bootstrap's last phase probes every live URL and -writes the addresses, the workspace and the secrets inventory into +writes the addresses, the workspace and the secrets the product uses into [ai/context/deployment.md](ai/context/deployment.md); how the product deploys and how to operate it is in [ai/context/operations.md](ai/context/operations.md). diff --git a/.baseline/product/deployment.md b/.baseline/product/deployment.md index 21623b0..23e4d88 100644 --- a/.baseline/product/deployment.md +++ b/.baseline/product/deployment.md @@ -2,6 +2,6 @@ > Not rendered yet. The bootstrap's `08-docs` phase probes every live URL and > regenerates this file from what answered — the workspace, the URLs and -> their status, and the secrets inventory by name. Until then, nothing here +> their status, and the secrets the product uses, by name. Until then, nothing here > claims the product is live. The operating contract is > [operations.md](operations.md). diff --git a/.github/workflows/baseline.yml b/.github/workflows/baseline.yml index d1a046a..669144a 100644 --- a/.github/workflows/baseline.yml +++ b/.github/workflows/baseline.yml @@ -99,13 +99,16 @@ jobs: with: # The bootstrap floor (BOOTSTRAP.md), not the product lane pin: the # blueprint's `orun.run/watch@v1` `sha:` exists from v2.58.5, and an - # older CLI refuses the whole document at parse; v2.58.6 is where a - # landing's check wait covers the whole PR run; v2.58.7 knows - # orun.doctor/check@v1's `githubOwner`; v2.58.8 reads - # orun.secrets/exists@v1's `environments`; v2.58.10 defers a probe + # older CLI refuses the whole document at parse; v2.58.7 knows + # orun.doctor/check@v1's `githubOwner`; v2.58.10 defers a probe # about a project the bootstrap has not created yet; v2.58.11 fills - # an input declared `from: workspace`. - version: v2.58.11 + # an input declared `from: workspace`; v2.87.0 mints the deploy + # credentials in one `secrets` reconcile (an older CLI refuses + # `has no parameter "secrets"`); and v2.88.0 runs the task set-up in + # the background (`background: true`) and checks a landing in the + # box before it merges (`checks: local`). The placement tier below + # runs this same CLI. + version: v2.88.0 - name: repo-blueprint.yaml, read by the pinned CLI run: | set -euo pipefail @@ -129,9 +132,15 @@ jobs: # the step nothing here had ever taken, and where orun BE-O12's two # defects lived. It needs node for rebrand alongside orun, and about ten # seconds. Still offline: placement writes files, and since BE-O12 a run - # with hooks off does not probe. + # with hooks off does not probe. And pnpm, at the product's own pin + # (package.json `packageManager`): with no lockfile hook, the branded + # tree is checked against the lockfile it ships, frozen, as every lane + # installs it. - uses: actions/setup-node@v6 with: node-version: "20" + - uses: pnpm/action-setup@v4 + with: + version: 10.12.1 - name: Tier 1 — the tree is placed, branded, and made to answer run: bash testing/placement.test.sh diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index ee9a7e4..fed7068 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -12,19 +12,22 @@ layer is now a typed action inside the binary, which is why the version floor matters and why a phase can be run alone, months later, from a fresh container. -Target wall-clock: **about half an hour** (it was under an hour; see -[docs/phases/TIMINGS.md](docs/phases/TIMINGS.md) for what a run measured). Five landings instead of eight, each -pull request checked by `plan` alone because its merge runs the lanes on -main anyway, the worker fleet deployed in two parallel waves instead of in -binding order, and stage and prod deployed side by side until `08-docs` -restores the promotion gate — [docs/phases/README.md](docs/phases/README.md) +Target wall-clock: **about thirteen minutes** — an estimate summed from the +phases (12 + 1) until a one-landing build measures it; the last measurement +was five landings ([docs/phases/TIMINGS.md](docs/phases/TIMINGS.md)). 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 that deploys the data plane, the +migrations, the fleet with its bindings, the edge and the console in +dependency order, stage and prod side by side, then a short docs landing +that restores the promotion gate — [docs/phases/README.md](docs/phases/README.md) has the account. The Cloudflare-only data plane creates in seconds, which is where this baseline is cheaper than a Postgres-backed one. ## 0. What you need - GitHub org access (repo creation) and a machine with `git`, `gh`, `node` - (≥20), `pnpm`, `python3`, and the `orun` CLI **≥ v2.58.11**. That is the + (≥20), `pnpm`, `python3`, and the `orun` CLI **≥ v2.88.0**. That is the floor for RUNNING the bootstrap; the product's own `ci.yml` lane pin is a separate, lower floor (≥ v2.56.2). v2.56.0 carried the phase overlay (before it there is no `--phase` and `hooks.{pre,post,await}` does not parse); @@ -32,18 +35,19 @@ where this baseline is cheaper than a Postgres-backed one. resolves a milestone name and a rendered bool; v2.58.5 is the first that can bootstrap at all — it writes each phase's files on that phase's turn, its landing commits, seeds an empty repository and deletes the branch it - merged, and a convergence watches the commit it landed (`sha:`); and v2.58.6 - is the first whose landing waits for a PR's whole CI run — every phase here - is a pull request that must go green before it merges; and v2.58.7 checks - that the workspace's GitHub connection is to the account that owns the - repository (`githubOwner`), without which no PR is ever seen by the platform; - and v2.58.8 looks for the wiring secrets on the project's environments, - where the infrastructure publishes them (`secrets/exists` `environments`); - v2.58.10 treats a project the bootstrap has not created yet as "not yet" - rather than a failed preflight, without which every fresh build stops before - its first phase; and v2.58.11 fills `orunWorkspace` from the workspace the - build runs in (`from: workspace`), which is the only way a console build has - of saying it. + merged, and a convergence watches the commit it landed (`sha:`); and v2.58.7 + checks that the workspace's GitHub connection is to the account that owns + the repository (`githubOwner`), without which no PR is ever seen by the + platform; v2.58.10 treats a project the bootstrap has not created yet as + "not yet" rather than a failed preflight, without which every fresh build + stops before its first phase; v2.58.11 fills `orunWorkspace` from the + workspace the build runs in (`from: workspace`), which is the only way a + console build has of saying it; v2.87.0 mints the three deploy credentials + in one `secrets` reconcile, side by side; and v2.88.0 runs the task set-up + in the background (`background: true`), so the placement, the rebrand, the + repository and the secrets run beside it, and checks each landing in the + box before it merges (`checks: local`: `orun validate`, then `orun plan` as + the pull request and as the merge), so no landing waits for a runner. - A Cloudflare account (Workers paid plan for the fleet) and its **Account API token** (the console's Connect recipe lists the exact permission groups). It is the ONLY provider credential this baseline needs — and it @@ -158,8 +162,9 @@ minutes, so the consent can be clicked while it waits: token's permission groups omit D1 Write, the `d1-edit` mint is refused (`parent_grant_insufficient`) and `01-product` stops with that message — re-issue the token with D1 Write, re-connect, and re-run the - phase. Its three secret hooks are a *reconcile*: keys that exist are kept, - keys that are missing are re-minted against the ACTIVE connection. + phase. Its one `secrets` hook is a *reconcile* of all three keys: keys that + exist are kept, keys that are missing are re-minted against the ACTIVE + connection, side by side. ## 2. Headless / container mode (Daytona, CI, any sandbox) @@ -199,7 +204,7 @@ every phase's state and is the flag for that. | requirement | detail | |---|---| -| image deps | `git`, `gh`, `node` (≥20), `pnpm`, `python3`, `curl`, `orun` ≥ v2.58.11 to run the bootstrap. The product's `ci.yml` lane pin (≥ v2.56.2) is its own floor | +| image deps | `git`, `gh`, `node` (≥20), `pnpm`, `python3`, `curl`, `orun` ≥ v2.88.0 to run the bootstrap. The product's `ci.yml` lane pin (≥ v2.56.2) is its own floor | | `ORUN_TOKEN` | orun access token; the typed actions authenticate with it (no login flow) | | `GITHUB_TOKEN` | fine-grained PAT: **read** on `sourceplane/cirrus` (the clone); on the PRODUCT repo: **contents write** (pushes), **pull-requests write** (landings), **actions read+write** (`orun.run/watch@v1` watches runs and auto-resumes via `gh run rerun`), **checks read**; **repo create** on the org if `01-product` creates the repo (or pre-create it — supported) | | pinning | the clone's `--branch ` pins EVERYTHING: the blueprint, its modules, and the hooks' scripts all come from that one commit. Use a tag for reproducible bootstraps; `main` for latest | @@ -267,11 +272,13 @@ that logic. Then move the registry row in orun-cloud's | Terraform: resource already exists (10014 etc.) with empty platform state | `adopt.tf` handles this by importing at plan time — present in the d1 and kv roots. Roots without adoption must be state-migrated or the resource deleted. | | Convergence run fails, lanes look transient | `orun.run/watch@v1` already resumes it ×3 (`gh run rerun --failed` = true resume: exec-id + `--retry`). Re-running the phase re-enters the watch on the same run. | | Convergence failed AFTER the phase's PR merged; re-running the phase lands nothing and redeploys nothing | Expected on its own: the merge put every file in place, phase state is derived from the tree, and `plan --changed` deploys only what changed. Re-run the phase (`--phase `, `--redo ` under `--resume`, or the console's Retry): its `retouch` hook writes `# orun: redeploy ` as the last line of each affected `component.yaml`, so the landing has a diff and the phase's components redeploy. If the landing is still empty, the hook did not run (`--run-hooks`) or the contract names no component — `node tooling/bootstrap/retouch.mjs --check …` in the product tree says which. | -| Worker verify lane: missing `WIRING_*` secret | Its terraform upstream hasn't applied (check that lane first) — inside one convergence run the DAG guarantees order (every reader declares an enforced `dependsOn` on the infra component); across manual partial runs it does not. | +| Worker verify lane: missing `WIRING_*` secret | Its terraform upstream hasn't applied (check that lane first) — inside one convergence run the DAG guarantees order (every reader declares an enforced `dependsOn` on the infra component); across manual partial runs it does not. There is no separate wiring check after the convergence: a document the apply did not publish shows here, in its readers' lanes. | | D1 lane or db-migrate: `Authentication error (10000)` | The lane resolved `CLOUDFLARE_API_TOKEN` (workers-deploy), which cannot touch D1. Both D1 components must bind `CLOUDFLARE_D1_TOKEN`. | | 01-product parks: `waiting for github for (connected: )` | The workspace's GitHub connection is to a different account than the one the product repository will live under, so the platform would never see its pull requests. Connect the GitHub App installation on `` to the workspace (console → Integrations → GitHub), then `--resume`. | | CLI login dies with 429 `rate_limited` | Fixed ≥ v2.48.1 (redeem honors Retry-After). Upgrade the CLI. | -| `unknown flag: --phase`, `cannot unmarshal !!map into []scaffold.Hook`, or `orun.run/watch@v1 has no parameter "sha"` | The CLI is below the v2.58.11 floor. This blueprint is not readable by an older one. | +| `unknown flag: --phase`, `cannot unmarshal !!map into []scaffold.Hook`, `orun.run/watch@v1 has no parameter "sha"`, `has no parameter "secrets"`, `has no parameter "checks"`, or another parse error in the blueprint | The CLI is below the v2.88.0 floor. This blueprint is not readable by an older one. | +| `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. | | A fresh build fails in a worker deploy with `10143` (service binding target not found) | The worker does not wait on `policy-worker`, whose pre-deploy places every binding target (`tooling/deploy/fleet-stubs.mjs`): its `dependsOn: policy-worker` must be `mode: enforced`. `testing/fleet-stubs.test.sh` checks every binding holder. | | The product's `intent.yaml` says `workspace: ws_SET_ME`, or its secret refs name the repository (`secret:///…`) | `orunWorkspace` was empty: set it, or run the build in the workspace (ORUN_WORKSPACE) with a CLI ≥ v2.58.11, which fills it from there. | | `✕ input "productname" is required` | Required inputs are validated before anything else, so this names the key nobody typed. All three requireds — `reponame`, `productname`, `githuborg` — must be set on every invocation, including single-phase ones. The domain is not one of them (since baseline-v25): a product is born with the placeholder `.example.com`. | diff --git a/ai/context/operations.md b/ai/context/operations.md index 1f58df9..5f989ff 100644 --- a/ai/context/operations.md +++ b/ai/context/operations.md @@ -1,7 +1,7 @@ # cirrus-baseline — operating contract (for humans and agents) This is the standing guide to how this product is deployed and operated. -Instance facts (live URLs, workspace, secrets inventory) live in +Instance facts (live URLs, workspace, the secrets it uses) live in [deployment.md](deployment.md), regenerated by the baseline's `08-docs` phase; this file is the contract that stays true between deployments. It is @@ -77,7 +77,7 @@ Caveats that matter: ## Secrets model -- **Brokered provider secrets** (project rung): `CLOUDFLARE_API_TOKEN` +- **Brokered provider secrets** (workspace scope): `CLOUDFLARE_API_TOKEN` (workers + KV), `CLOUDFLARE_D1_TOKEN` (D1 — the deploy token deliberately cannot reach it), and `CLOUDFLARE_ACCOUNT_ID` — pointers minted per-run from the workspace's Cloudflare connection. No long-lived diff --git a/apps/admin-worker/component.yaml b/apps/admin-worker/component.yaml index 51d770a..86e2592 100644 --- a/apps/admin-worker/component.yaml +++ b/apps/admin-worker/component.yaml @@ -7,6 +7,15 @@ spec: type: cloudflare-worker-turbo 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-runtime path: apps/admin-worker dependsOn: diff --git a/apps/api-edge/component.yaml b/apps/api-edge/component.yaml index 1fc2590..7b963e5 100644 --- a/apps/api-edge/component.yaml +++ b/apps/api-edge/component.yaml @@ -7,6 +7,15 @@ spec: type: cloudflare-worker-turbo 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-runtime path: apps/api-edge dependsOn: diff --git a/apps/api-edge/docs/overview.md b/apps/api-edge/docs/overview.md index d6df758..4dc18d9 100644 --- a/apps/api-edge/docs/overview.md +++ b/apps/api-edge/docs/overview.md @@ -18,7 +18,8 @@ Part of the cirrus-baseline runtime: a Cloudflare Worker deployed per environmen - **membership-worker** — Cloudflare Worker for the Membership org runtime - **metering-worker** — Cloudflare Worker for the Metering API surface (usage recording, quota checks) - **notifications-worker** — Cloudflare Worker for the Notifications bounded context +- **policy-worker** — Cloudflare Worker for policy authorization decisions ## Depended on by -- **web-console-next** — Next.js 15 + opennextjs/cloudflare delivery of the cirrus-baseline web console (per-environment, Workers + Static Assets) +- (none) diff --git a/apps/billing-worker/component.yaml b/apps/billing-worker/component.yaml index 3bcb7bd..2c00e11 100644 --- a/apps/billing-worker/component.yaml +++ b/apps/billing-worker/component.yaml @@ -7,6 +7,15 @@ spec: type: cloudflare-worker-turbo 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-runtime path: apps/billing-worker dependsOn: diff --git a/apps/billing-worker/docs/overview.md b/apps/billing-worker/docs/overview.md index 7aee80b..d079112 100644 --- a/apps/billing-worker/docs/overview.md +++ b/apps/billing-worker/docs/overview.md @@ -7,6 +7,7 @@ Part of the cirrus-baseline runtime: a Cloudflare Worker deployed per environmen ## Depends on - **policy-worker** — Cloudflare Worker for policy authorization decisions +- **cloudflare-d1** — Provisions the Cloudflare D1 platform database for stage and prod ## Depended on by diff --git a/apps/config-worker/component.yaml b/apps/config-worker/component.yaml index 02bfc8c..60df33e 100644 --- a/apps/config-worker/component.yaml +++ b/apps/config-worker/component.yaml @@ -7,6 +7,15 @@ spec: type: cloudflare-worker-turbo 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-runtime path: apps/config-worker dependsOn: diff --git a/apps/config-worker/docs/overview.md b/apps/config-worker/docs/overview.md index ad320a2..4aa8311 100644 --- a/apps/config-worker/docs/overview.md +++ b/apps/config-worker/docs/overview.md @@ -8,6 +8,7 @@ Part of the cirrus-baseline runtime: a Cloudflare Worker deployed per environmen - **membership-worker** — Cloudflare Worker for the Membership org runtime - **policy-worker** — Cloudflare Worker for policy authorization decisions +- **cloudflare-d1** — Provisions the Cloudflare D1 platform database for stage and prod ## Depended on by diff --git a/apps/events-worker/component.yaml b/apps/events-worker/component.yaml index a793d5c..d7cfe1e 100644 --- a/apps/events-worker/component.yaml +++ b/apps/events-worker/component.yaml @@ -7,6 +7,15 @@ spec: type: cloudflare-worker-turbo 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-runtime path: apps/events-worker dependsOn: diff --git a/apps/events-worker/docs/overview.md b/apps/events-worker/docs/overview.md index 811971e..eeed1dd 100644 --- a/apps/events-worker/docs/overview.md +++ b/apps/events-worker/docs/overview.md @@ -8,6 +8,7 @@ Part of the cirrus-baseline runtime: a Cloudflare Worker deployed per environmen - **membership-worker** — Cloudflare Worker for the Membership org runtime - **policy-worker** — Cloudflare Worker for policy authorization decisions +- **cloudflare-d1** — Provisions the Cloudflare D1 platform database for stage and prod ## Depended on by diff --git a/apps/identity-worker/component.yaml b/apps/identity-worker/component.yaml index 5f7bfbf..c12d34f 100644 --- a/apps/identity-worker/component.yaml +++ b/apps/identity-worker/component.yaml @@ -7,6 +7,15 @@ spec: type: cloudflare-worker-turbo 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-runtime path: apps/identity-worker dependsOn: diff --git a/apps/integrations-worker/component.yaml b/apps/integrations-worker/component.yaml index 02fffae..9a57031 100644 --- a/apps/integrations-worker/component.yaml +++ b/apps/integrations-worker/component.yaml @@ -7,6 +7,15 @@ spec: type: cloudflare-worker-turbo 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-runtime path: apps/integrations-worker dependsOn: diff --git a/apps/integrations-worker/docs/overview.md b/apps/integrations-worker/docs/overview.md index 67183f7..8d2f490 100644 --- a/apps/integrations-worker/docs/overview.md +++ b/apps/integrations-worker/docs/overview.md @@ -10,6 +10,7 @@ Part of the cirrus-baseline runtime: a Cloudflare Worker deployed per environmen - **policy-worker** — Cloudflare Worker for policy authorization decisions - **billing-worker** — Cloudflare Worker for the Billing API surface (private, service-binding only) - **projects-worker** — Cloudflare Worker for the Projects runtime +- **cloudflare-d1** — Provisions the Cloudflare D1 platform database for stage and prod ## Depended on by diff --git a/apps/membership-worker/component.yaml b/apps/membership-worker/component.yaml index 58ebf8e..e383bee 100644 --- a/apps/membership-worker/component.yaml +++ b/apps/membership-worker/component.yaml @@ -7,6 +7,15 @@ spec: type: cloudflare-worker-turbo 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-runtime path: apps/membership-worker dependsOn: diff --git a/apps/membership-worker/docs/overview.md b/apps/membership-worker/docs/overview.md index 34c3dc9..705c13f 100644 --- a/apps/membership-worker/docs/overview.md +++ b/apps/membership-worker/docs/overview.md @@ -8,6 +8,7 @@ Part of the cirrus-baseline runtime: a Cloudflare Worker deployed per environmen - **policy-worker** — Cloudflare Worker for policy authorization decisions - **billing-worker** — Cloudflare Worker for the Billing API surface (private, service-binding only) +- **cloudflare-d1** — Provisions the Cloudflare D1 platform database for stage and prod ## Depended on by diff --git a/apps/metering-worker/component.yaml b/apps/metering-worker/component.yaml index 4df4930..3d08881 100644 --- a/apps/metering-worker/component.yaml +++ b/apps/metering-worker/component.yaml @@ -7,6 +7,15 @@ spec: type: cloudflare-worker-turbo 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-runtime path: apps/metering-worker dependsOn: diff --git a/apps/metering-worker/docs/overview.md b/apps/metering-worker/docs/overview.md index 5bbb7d8..e6084a4 100644 --- a/apps/metering-worker/docs/overview.md +++ b/apps/metering-worker/docs/overview.md @@ -8,6 +8,7 @@ Part of the cirrus-baseline runtime: a Cloudflare Worker deployed per environmen - **membership-worker** — Cloudflare Worker for the Membership org runtime - **policy-worker** — Cloudflare Worker for policy authorization decisions +- **cloudflare-d1** — Provisions the Cloudflare D1 platform database for stage and prod ## Depended on by diff --git a/apps/notifications-worker/component.yaml b/apps/notifications-worker/component.yaml index 3a804a4..825dd31 100644 --- a/apps/notifications-worker/component.yaml +++ b/apps/notifications-worker/component.yaml @@ -7,6 +7,15 @@ spec: type: cloudflare-worker-turbo 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-runtime path: apps/notifications-worker dependsOn: diff --git a/apps/notifications-worker/docs/overview.md b/apps/notifications-worker/docs/overview.md index 77bf6a6..100e22a 100644 --- a/apps/notifications-worker/docs/overview.md +++ b/apps/notifications-worker/docs/overview.md @@ -8,6 +8,8 @@ Part of the cirrus-baseline runtime: a Cloudflare Worker deployed per environmen - **events-worker** — Cloudflare Worker for the Events and Audit runtime - **db-migrate** — Applies database migrations to the stage and prod Cloudflare D1 databases +- **policy-worker** — Cloudflare Worker for policy authorization decisions +- **cloudflare-d1** — Provisions the Cloudflare D1 platform database for stage and prod ## Depended on by diff --git a/apps/policy-worker/component.yaml b/apps/policy-worker/component.yaml index 2a4a279..68cb4d4 100644 --- a/apps/policy-worker/component.yaml +++ b/apps/policy-worker/component.yaml @@ -7,6 +7,15 @@ spec: type: cloudflare-worker-turbo 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-runtime path: apps/policy-worker subscribe: diff --git a/apps/policy-worker/docs/overview.md b/apps/policy-worker/docs/overview.md index f571d01..881d74c 100644 --- a/apps/policy-worker/docs/overview.md +++ b/apps/policy-worker/docs/overview.md @@ -10,6 +10,7 @@ Part of the cirrus-baseline runtime: a Cloudflare Worker deployed per environmen ## Depended on by +- **api-edge** — Cloudflare Worker for the API edge Runtime - **billing-worker** — Cloudflare Worker for the Billing API surface (private, service-binding only) - **config-worker** — Cloudflare Worker for the Config read-only API surface - **events-worker** — Cloudflare Worker for the Events and Audit runtime @@ -17,5 +18,6 @@ Part of the cirrus-baseline runtime: a Cloudflare Worker deployed per environmen - **integrations-worker** — Cloudflare Worker for the integrations bounded context — provider connections (GitHub App first), inbound delivery inbox, repo links, and the installation-token broker - **membership-worker** — Cloudflare Worker for the Membership org runtime - **metering-worker** — Cloudflare Worker for the Metering API surface (usage recording, quota checks) +- **notifications-worker** — Cloudflare Worker for the Notifications bounded context - **projects-worker** — Cloudflare Worker for the Projects runtime - **webhooks-worker** — Cloudflare Worker for webhook endpoint, subscription, and delivery-attempt management diff --git a/apps/projects-worker/component.yaml b/apps/projects-worker/component.yaml index 43c5653..2512b78 100644 --- a/apps/projects-worker/component.yaml +++ b/apps/projects-worker/component.yaml @@ -7,6 +7,15 @@ spec: type: cloudflare-worker-turbo 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-runtime path: apps/projects-worker dependsOn: diff --git a/apps/projects-worker/docs/overview.md b/apps/projects-worker/docs/overview.md index 4dc404e..908d763 100644 --- a/apps/projects-worker/docs/overview.md +++ b/apps/projects-worker/docs/overview.md @@ -9,6 +9,7 @@ Part of the cirrus-baseline runtime: a Cloudflare Worker deployed per environmen - **membership-worker** — Cloudflare Worker for the Membership org runtime - **policy-worker** — Cloudflare Worker for policy authorization decisions - **billing-worker** — Cloudflare Worker for the Billing API surface (private, service-binding only) +- **cloudflare-d1** — Provisions the Cloudflare D1 platform database for stage and prod ## Depended on by diff --git a/apps/web-console-next/component.yaml b/apps/web-console-next/component.yaml index bcac8cf..b4e69f5 100644 --- a/apps/web-console-next/component.yaml +++ b/apps/web-console-next/component.yaml @@ -7,6 +7,15 @@ spec: type: cloudflare-workers-assets-turbo 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-ui path: apps/web-console-next # Its own lane per environment (execution.lanes in intent.yaml): the Next.js diff --git a/apps/web-console-next/docs/overview.md b/apps/web-console-next/docs/overview.md index 2eb7f36..932e695 100644 --- a/apps/web-console-next/docs/overview.md +++ b/apps/web-console-next/docs/overview.md @@ -6,7 +6,7 @@ Part of the cirrus-baseline runtime: a Cloudflare Worker serving static assets p ## Depends on -- **api-edge** — Cloudflare Worker for the API edge Runtime +- (none) ## Depended on by diff --git a/apps/webhooks-worker/component.yaml b/apps/webhooks-worker/component.yaml index 92f2cbe..d969211 100644 --- a/apps/webhooks-worker/component.yaml +++ b/apps/webhooks-worker/component.yaml @@ -7,6 +7,15 @@ spec: type: cloudflare-worker-turbo 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-runtime path: apps/webhooks-worker dependsOn: diff --git a/apps/webhooks-worker/docs/overview.md b/apps/webhooks-worker/docs/overview.md index 42c7b00..d3082e3 100644 --- a/apps/webhooks-worker/docs/overview.md +++ b/apps/webhooks-worker/docs/overview.md @@ -8,6 +8,7 @@ Part of the cirrus-baseline runtime: a Cloudflare Worker deployed per environmen - **membership-worker** — Cloudflare Worker for the Membership org runtime - **policy-worker** — Cloudflare Worker for policy authorization decisions +- **cloudflare-d1** — Provisions the Cloudflare D1 platform database for stage and prod ## Depended on by diff --git a/blueprint.yaml b/blueprint.yaml index 5c94892..5b4d73e 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -27,7 +27,7 @@ metadata: Multi-tenant SaaS on Cloudflare alone: 12 bounded-context Workers behind one edge API, a Next.js console, D1 + KV data plane, migrations, and CI that converges on merge. One provider, one consent, one token. Live on - stage and prod in about fifteen minutes. + stage and prod in about thirteen minutes. tags: [saas, cloudflare, d1, nextjs] spec: source: @@ -128,12 +128,14 @@ spec: # naming the fix, before anything is created. from: connection.cloudflare.workersSubdomain - # ── PREVIEW ONLY. `repo-blueprint.yaml`'s `integrations/reconcile` 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 rather than to a copy of itself — it used to compare against a shell - # script's `create` calls, and BE4 deleted the script, not the check. + # ── PREVIEW ONLY. `repo-blueprint.yaml`'s `secrets` hook + # (`orun.integrations/reconcile@v1`) mints these, brokered, during + # 01-product, in this order. ───────────────────────────────────────────── + # Transcribed from that hook's own `secrets:` list (each key with its + # `template`), so `testing/manifest.test.sh` compares this list to the + # document that mints them rather than to a copy of itself — it used to + # compare against a shell script's `create` calls, and BE4 deleted the + # script, not the check. # The console renders them read-only: they are minted from the # workspace's connections at build time, so no credential is ever typed, # shown or stored in the console. Keys that already exist are kept. @@ -180,10 +182,14 @@ spec: # the registry row names THIS file, the console card; it is not the build. blueprint: repo-blueprint.yaml # Was 60, then 30; baseline-v21 measured 14m51s over five landings. - # Fifteen is the one-landing build's budget until a run measures it: the - # sum of the phases' own `expectedMinutes` (01-product 13, 08-docs 2), - # which testing/manifest.test.sh holds equal to this figure. - expectedMinutes: 15 + # Thirteen is the one-landing build's budget until a run measures it: the + # sum of the phases' own `expectedMinutes` (01-product 12, 08-docs 1), + # which testing/manifest.test.sh holds equal to this figure. An estimate: + # the 15 it was, less what the orun v2.88.0 shape (the task set-up in the + # background, landings checked in the box, a 5 s convergence watch, no + # wiring await, no final probe) took out of turso-starter's measured + # build — not yet timed on cirrus. + expectedMinutes: 13 tokenChannel: ORUN_TOKEN_FILE # how a runner hands over its refreshed token verify: urls: diff --git a/docs/phases/01-product.md b/docs/phases/01-product.md index 644b1ba..3fbbe20 100644 --- a/docs/phases/01-product.md +++ b/docs/phases/01-product.md @@ -111,6 +111,10 @@ credential is minted from. ## Steps +The run's task set-up — the epic, both milestones, both tasks — runs in the +background from the start (`background: true`), so every step up to `task` +runs beside it; `task` is the first that waits for it. + 1. **place** — the engine writes every module into `--out`. 2. **retouch** — one trailing `# orun: redeploy 01-product ` line in each component the task contract `affects`, so a RE-RUN has a diff to land @@ -119,9 +123,9 @@ credential is minted from. intent `workspace:` rewrite → `promotion.mjs --defer` and `dev-lanes.mjs --defer` (prod deploys beside stage, and dev's verify lanes stay off main, until 08-docs puts both back) → `git add` → - `rebrand.mjs --verify` → `pnpm install --lockfile-only` (a no-op: the - baseline's complete lockfile is already placed) → the console artifact - pin. + `rebrand.mjs --verify` → the console artifact pin. (No lockfile step: the + baseline's complete lockfile is placed as it is, and every lane installs + it with `--frozen-lockfile`.) 4. **repo** — `orun.repo/ensure@v1`: an existing `origin` is pushed to; a repo pre-created empty on GitHub is detected and wired; otherwise it is created under `githuborg`. @@ -129,21 +133,29 @@ credential is minted from. best effort; `orun cloud check` is the gate). Every convergence lane authenticates over GitHub OIDC through that link. 6. **the deploy credentials** — `CLOUDFLARE_API_TOKEN` (workers-deploy), - `CLOUDFLARE_D1_TOKEN` (d1-edit) and `CLOUDFLARE_ACCOUNT_ID`, each minted by - `orun.integrations/reconcile@v1` from its own scope template; keys that - exist are kept. -7. **land** — `orun.pr/land@v1`, one PR bound to the phase's task. Its check - is `plan` alone on a bootstrap branch; the convergence after the merge is - the real gate. -8. **await** — the convergence for the merged commit (`orun.run/watch@v1`, - up to three resumes), the wiring secrets on stage and prod, and a probe of - the four URLs. + `CLOUDFLARE_D1_TOKEN` (d1-edit) and `CLOUDFLARE_ACCOUNT_ID`, in ONE + `orun.integrations/reconcile@v1` hook (`secrets`), each key minted from + its own scope template, side by side; keys that exist are kept. +7. **task** — `orun.task/ensure@v1` finds the phase's task and yields its + key, waiting, if it must, for the background set-up. +8. **land** — `orun.pr/land@v1`, one PR bound to the phase's 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) and merged without + waiting for the PR's CI; the convergence after the merge is the real + gate. +9. **await** — the convergence for the merged commit (`orun.run/watch@v1`, + read every 5 s, up to three resumes), then a probe of the four URLs. No + separate wiring check: every reader of `WIRING_CLOUDFLARE_D1` and + `WIRING_CLOUDFLARE_KV` resolves it in that convergence as its job starts, + from where every later run looks, and a missing document fails its lane. ## Verify / done means -- `WIRING_CLOUDFLARE_D1` and `WIRING_CLOUDFLARE_KV` exist on stage and prod. - The convergence for the merge commit is green: migrations applied, every - worker deployed once with its bindings, the edge and the console up. + worker deployed once with its bindings, the edge and the console up — and + with them `WIRING_CLOUDFLARE_D1` and `WIRING_CLOUDFLARE_KV` resolved from + stage and prod by db-migrate, the D1-bound workers and api-edge, where + every later run reads them. - `api-edge` `/health` answers 200 and the console root answers, on stage and prod. @@ -153,7 +165,8 @@ credential is minted from. |---|---| | a worker's deploy: 10143 (binding target not found) | `policy-worker`'s pre-deploy did not run first: the worker lacks the enforced `dependsOn: policy-worker` (`testing/fleet-stubs.test.sh` checks every binding holder), or the binding names a Worker outside `apps/` | | `fleet-stubs: checking : HTTP 403` | the workers-deploy token cannot read scripts — re-run the phase after reconnecting Cloudflare; the tool refuses to create a placeholder it cannot prove is missing | -| a lane fails resolving `WIRING_*` | the terraform lane for that environment failed — read its log; the workers wait on it, so they show as not run | +| a lane fails resolving `WIRING_*` | the terraform lane for that environment failed, or published nothing (the component lost its `secretOutputs`) — read its log; the workers wait on it, so they show as not run | +| `land`: `the landing's own check failed — orun plan for …` | the placed tree does not plan; the next line is orun's error. Nothing was pushed. Fix it and re-run the phase | | d1 apply: database name already exists with empty platform state | `adopt.tf` looks the database up by name at plan time and imports it — if you removed that file, restore it | | kv apply: title already exists (10014) | the same adoption, by namespace title | | d1 apply or db-migrate: `Authentication error (10000)` | the token in play is workers-deploy, which deliberately cannot touch D1 — both components bind `CLOUDFLARE_D1_TOKEN` | diff --git a/docs/phases/08-docs.md b/docs/phases/08-docs.md index 562d501..e905cbd 100644 --- a/docs/phases/08-docs.md +++ b/docs/phases/08-docs.md @@ -10,11 +10,11 @@ operate it" from the repository alone. | file | content | |---|---| -| `ai/context/deployment.md` | REGENERATED manifest: live URLs with probe results, workspace/project identity, secrets inventory **by name only**, integration statuses, baseline provenance, CI lane pin | +| `ai/context/deployment.md` | REGENERATED manifest: live URLs with probe results, workspace/project identity, the secrets the product uses **by name only** with where each lives, CI lane pin. It asks the platform nothing: what the workspace holds right now (every secret, the integrations and their health) is on the console's Secrets and Integrations pages, which the record points to | | `ai/context/operations.md` | the standing operating contract (architecture, tenancy resolution, deploy pipeline, secrets model, verification, troubleshooting). Healed from the baseline template when the product predates it; never rewritten after that | | `README.md` | the section between `` / `` markers is replaced (markers are appended for READMEs that predate them) | -No secret VALUE is ever read or written — inventories are names/statuses. +No secret VALUE is ever read or written — secrets are named, not read. ## Steps @@ -39,14 +39,16 @@ No secret VALUE is ever read or written — inventories are names/statuses. whole fix for a bootstrap that stopped early. 4. **docs** — a `post` hook runs `hooks/render-deployment-docs.sh` from the baseline checkout: it probes the four public URLs (plus the custom domain - when `productdomain` is set), lists secrets/integrations by name, and - renders the files above. The script itself refuses to finish if a - `TBD_08DOCS` placeholder survives. -4. **land** — `orun.pr/land@v1`. A docs-only landing plans ZERO deploy - lanes, so this phase has no convergence to watch — it is the one phase - whose `await` is a probe alone. -5. **verify** — an `orun.http/probe@v1` `await` hook re-probes the URLs the - manifest claims, trusting nothing the render step said about them. + when `productdomain` is set), names the secrets the product's manifests + use and where each lives, and renders the files above. The script itself + refuses to finish if a `TBD_08DOCS` placeholder survives. +5. **task** — `orun.task/ensure@v1` finds the phase's task and yields its + key. +6. **land** — `orun.pr/land@v1`, its commit checked in the box + (`checks: local`) and merged. A docs-only landing plans ZERO deploy + lanes, so this phase has no convergence to watch — and nothing after it + to wait for: the render's probes, recorded in the manifest, are the + phase's check. `08-docs` requires `01-product`. Re-run it once an owner has wired the custom domain to pick up the domain URLs. @@ -97,13 +99,14 @@ Preview with zero side effects: drop `--run-hooks` — the phase places files and stops, with no repo, no landing, no convergence watch and no probe. Add `--status` to derive every phase's state and write nothing at all. Re-running a completed phase is always safe (idempotent): the placement is a -no-op, the landing finds nothing, and the `await` hooks re-assert. +no-op, and the render probes again and rewrites the record (with its new +timestamp), which the landing lands; it redeploys nothing. ## Troubleshooting -- **verify fails on a URL** — the manifest is honest: something the docs - would claim live is not. Re-run phase 05/06's verify to localize. -- **secrets/integrations listed as "unavailable to this credential"** — - the runner's token cannot list that rung; the manifest still renders - (URLs and identity are the load-bearing parts). Re-run with a - fuller-scoped credential to enrich it. +- **a URL is recorded as `unreachable` or `answering 5xx`** — the manifest + is honest: something the docs would claim live is not. Re-run + `01-product`, whose `verify` probe names the address, to localize. +- **what does the workspace hold right now?** — not in the record, by + design: the console's Secrets and Integrations pages show it live. The + record names the secrets the product uses and where each one lives. diff --git a/docs/phases/README.md b/docs/phases/README.md index 055d184..2c9513f 100644 --- a/docs/phases/README.md +++ b/docs/phases/README.md @@ -10,10 +10,14 @@ them all. Each phase follows the same contract: -> **place its modules → land them as a PR (checked by `plan`, then merged — -> the convergence is the gate) → watch the deployment convergence +> **place its modules → check them in the box and land them as a PR (the +> convergence is the gate) → watch the deployment convergence > (auto-resumed) → verify it is actually deployed.** +The run's task set-up — the epic, a milestone per phase, a task per landing +— runs in the background from the start; the first hook that needs it, the +phase's `task`, waits for it. + Run from the baseline checkout (the blueprint's source is `path: .`); the product repo is wherever `--out` points. @@ -24,11 +28,11 @@ before anything else can build or deploy. Each phase's `requires.phases` states this in the document, and the engine refuses a phase whose predecessor is not placed, naming it. -Every phase lands as a pull request that is checked, then merged: each landing waits for its PR's own CI to finish green — and on a bootstrap branch (`orun/BASE-…`) that CI is `plan` alone (the intent, every component and composition resolve; the changed set is computed). The lanes are skipped on those pull requests because the merge runs every one of them on main a minute later, for real, and that convergence is what each phase watches to green before the next starts. Any other pull request in the product runs its lanes as before. +Every phase lands as a pull request that is checked, then merged — checked in the box before it is pushed (`checks: local`): `orun validate`, then `orun plan` as the pull request and as the merge would plan it (the intent, every component and composition resolve; the changed set is computed). Then it merges; nothing waits for the PR's CI, which on a bootstrap branch (`orun/BASE-…`) runs `plan` alone. The lanes are skipped on those pull requests because the merge runs every one of them on main a minute later, for real, and that convergence is what each phase watches to green before the next starts. Any other pull request in the product runs its lanes as before. | phase | lands | verified by | |---|---|---| -| [`01-product`](01-product.md) | **GitHub repo created**, then the WHOLE product in one PR: intent, CI, tooling, identity, 13 packages, D1 + KV, db-migrate, the 12-worker fleet with its bindings, api-edge, the web console and the custom-domain component (parked until a zone is wired) — one convergence deploys it in dependency order | `WIRING_*` published, convergence green, `/health` and console live on stage+prod | +| [`01-product`](01-product.md) | **GitHub repo created**, then the WHOLE product in one PR: intent, CI, tooling, identity, 13 packages, D1 + KV, db-migrate, the 12-worker fleet with its bindings, api-edge, the web console and the custom-domain component (parked until a zone is wired) — one convergence deploys it in dependency order | convergence green (its migrations and deploys resolved `WIRING_*` on stage and prod), `/health` and console live on stage+prod | | [`08-docs`](08-docs.md) | live-deployment docs (manifest + operating contract) | committed manifest matches probed reality | ## Inputs @@ -94,9 +98,9 @@ modes are the same files. `--resume` places every phase not already derived as done, in dependency order, honouring each barrier. Expected wall-clock on a clean run: **about -15 minutes** — `01-product` 13, `08-docs` 2, the figure the console card -shows (a budget until a one-landing run measures it; baseline-v21 measured -14m51s over five landings, and it was 50–65 before that): +13 minutes** — `01-product` 12, `08-docs` 1, the figure the console card +shows (an estimate until a one-landing run measures it; baseline-v21 +measured 14m51s over five landings, and it was 50–65 before that): - **One landing builds the product.** `01-product` places the whole tree and lands it as one PR; the convergence that follows deploys everything in @@ -105,8 +109,14 @@ shows (a budget until a one-landing run measures it; baseline-v21 measured it later in an ordinary PR (see [01-product](01-product.md#the-custom-domain--parked)). The numbering keeps its gaps so the names stay the identities the task plane and `--phase` use. -- **A landing's PR is checked by `plan` alone.** The lanes run - once, on main. +- **A landing is checked in the box.** `orun validate` and `orun plan` run + on the commit before it is pushed (`checks: local`), and it merges without + waiting for a runner; the lanes run once, on main. +- **The task set-up runs in the background** (`background: true`): the + provider check, the placement, the rebrand, the repository and the secrets + run beside it, and each phase finds its task just before its landing. +- **The convergence watch reads every 5 s**, so the build goes on the moment + the run is green. - **Every worker deploys once, with its bindings.** The data plane comes first because every component reading its wiring declares an ENFORCED `dependsOn` on it, and the service-binding cycles are broken by @@ -138,9 +148,13 @@ Why it can run unattended: and inside its convergence nothing that reads the wiring starts before the apply that publishes it. A consent nobody has clicked is a *wait*, not a failure. -- **Verification is the phase's own last act.** `await` hooks re-probe the - live endpoints and re-list the published secrets, trusting no earlier - step's word. +- **Verification is the phase's own last act.** `01-product`'s `await` + watches the convergence and then probes the live endpoints, trusting no + earlier step's word. The wiring the infrastructure publishes needs no + separate check: every migration and deploy that reads it resolves it as + its job starts, from where every later run looks, and a missing document + fails that lane. `08-docs` awaits nothing — its render probes as it + writes, and its landing redeploys nothing. ## Pacing, idempotence, resume @@ -189,16 +203,15 @@ a closed registry inside the orun binary, not a script this repo ships: |---|---| | `orun.task/ensure@v1` | the phase's own task in the workspace's task plane: find-or-create by identity under `epicSlug`, contract attached from `tasks/.TaskContract.yaml`. Never blocks a landing | | `orun.repo/ensure@v1` | create the product repo under `githuborg` if it does not exist (pre-created is supported) | -| `orun.pr/land@v1` | commit → branch → PR → wait for checks → merge → back on main, through the provenance pen so the landing binds to the phase's task | -| `orun.run/watch@v1` | wait for the main convergence run; auto-resume through transient failures (`resumeBudget: 3`) | +| `orun.pr/land@v1` | commit → check it in the box (`checks: local`: validate, plan as the PR and as the merge) → branch → PR → merge → back on main, through the provenance pen so the landing binds to the phase's task | +| `orun.run/watch@v1` | wait for the main convergence run, read every 5 s; auto-resume through transient failures (`resumeBudget: 3`) | | `orun.doctor/check@v1` | the provider-consent wait — a precondition, not a preamble | -| `orun.secrets/exists@v1` | assert the keys a later phase reads are published | -| `orun.integrations/reconcile@v1` | bring the brokered provider secrets to their declared state: keys that exist are KEPT, keys that are missing are minted against the ACTIVE connection. It never holds a value — a brokered secret is a pointer at a connection and a scope template | +| `orun.integrations/reconcile@v1` | bring the brokered provider secrets to their declared state, all three in one hook (`secrets: [{key, template}]`): keys that exist are KEPT, keys that are missing are minted against the ACTIVE connection, side by side. It never holds a value — a brokered secret is a pointer at a connection and a scope template | | `orun.http/probe@v1` | probe the live `/health` and console URLs | The hooks that still `run:` a command are the ones that are this baseline's own business rather than a verb any bootstrap needs: git init / -stage / restage and `pnpm install --lockfile-only` in `01-product`, +stage / restage in `01-product`, `tooling/rebrand/rebrand.mjs` (the identity rename, then `--verify`), `tooling/bootstrap/promotion.mjs` (defer and restore the prod promotion gate), `tooling/bootstrap/dev-lanes.mjs` (defer and @@ -215,10 +228,13 @@ the blueprint's run-level `hooks.preInstantiate` list (orun ≥ v2.60) opens the `epicSlug` epic with its description, one milestone per phase in phase order with the phase's verify assertions as exit criteria, and one task per landing with a brief — so a reader can open the epic while `01-product` is -still creating the repository. Every phase's `pre` hook is then an -`orun.task/ensure@v1` on its own task: the same identity (title within the -epic), so it finds rather than creates, and yields the key its landing binds -the pull request to. A task title is an imperative sentence about the outcome +still creating the repository. The list runs in the background +(`background: true`, orun ≥ v2.88.0), so nothing waits for it until a hook +that works on the plane. Every phase's `task` hook — in `post`, just before +its landing, so that everything before it runs beside the set-up — is then +an `orun.task/ensure@v1` on its own task: the same identity (title within +the epic), so it finds rather than creates, and yields the key its landing +binds the pull request to. A task title is an imperative sentence about the outcome ("Deploy the worker fleet"); the pull request that lands it carries a conventional-commit title of its own (`feat(workers): …`). The milestone keeps the phase's name, which is the identity the engine's events, the plane's diff --git a/hooks/render-deployment-docs.sh b/hooks/render-deployment-docs.sh index 92faee8..2fd0b2d 100755 --- a/hooks/render-deployment-docs.sh +++ b/hooks/render-deployment-docs.sh @@ -9,15 +9,24 @@ # # What it writes (in ): # ai/context/deployment.md — REGENERATED: the deployment manifest (URLs -# with live probe results, identity, secrets -# inventory BY NAME, integrations, provenance) +# with live probe results, identity, and the +# secrets the product uses BY NAME, with where +# each one lives) # ai/context/operations.md — healed from the baseline template if absent # (static operator/agent guide; never rewritten) # README.md — the section between # markers is replaced (markers appended if the # README predates them) # -# 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, the secrets the product's manifests name +# and where each lives, and where to look for the rest. set -euo pipefail out="${1:?usage: render-deployment-docs.sh }" @@ -32,11 +41,6 @@ repo="$(python3 -c "import json;print(json.load(open('$vals'))['reponame'])")" sub="$(python3 -c "import json;print(json.load(open('$vals'))['subdomain'])")" domain="$(python3 -c "import json;print(json.load(open('$vals')).get('productdomain',''))")" -# Workspace slug via the direct backend read (works for user sessions AND -# workspace-scoped ORUN_TOKENs); tolerate failure — slug then shows as "?". -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="?" @@ -66,20 +70,32 @@ if [ -n "$domain" ]; then | console (custom domain) | https://app.${domain} | $( [ "$p_dc" = 000 ] && echo 'pending (zone not wired yet, or DNS propagating)' || badge "$p_dc" ) |" fi -# Inventories — NAMES/status only, never values. Tolerant: a token that -# cannot list simply yields an "unavailable" note instead of failing docs. -secrets_proj="$( { orun secrets list --org "$ws" --project 2>/dev/null || true; } | awk 'NR>1 && NF {print " - "$1}' )" -secrets_stage="$( { orun secrets list --org "$ws" --env stage 2>/dev/null || true; } | awk 'NR>1 && NF {print " - "$1}' )" -secrets_prod="$( { orun secrets list --org "$ws" --env prod 2>/dev/null || true; } | awk 'NR>1 && NF {print " - "$1}' )" -[ -n "$secrets_proj" ] || secrets_proj=" - (listing unavailable to this credential)" -[ -n "$secrets_stage" ] || secrets_stage=" - (listing unavailable to this credential)" -[ -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)')" )" +# The Workers' RUNTIME secrets, by name, from the product's own manifests +# (each Worker's `optionalSecretEnv`): wire-now-seed-later, so a Worker +# deploys without them and pushes each one once an owner has seeded it. Read +# from the tree rather than listed here, because adding one is an ordinary +# change in the product, and this file is re-rendered long after it. +runtime_rows="$(python3 -c ' +import pathlib, re, sys +repo = sys.argv[1] +keys = {} +for f in sorted(pathlib.Path("apps").glob("*/component.yaml")): + block = False + for line in f.read_text().splitlines(): + if re.match(r"^ optionalSecretEnv:\s*$", line): + block = True + continue + if not block or not line.strip() or line.lstrip().startswith("#"): + continue + m = re.match(r"^ ([A-Z0-9_]+):", line) + if not m: + block = False + continue + keys.setdefault(m.group(1), set()).add(f.parent.name) +for k in sorted(keys): + who = ", ".join(sorted(keys[k])) + print(f"| `{k}` | `{repo}` per environment, once an owner seeds it | a runtime secret of {who}, optional until then |") +' "$repo")" now="$(date -u +%Y-%m-%dT%H:%M:%SZ)" @@ -106,15 +122,15 @@ cat > ai/context/deployment.md < GENERATED by the docs flow on ${now}; re-run it to refresh (idempotent; > command in [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 | | | |---|---| | product / project slug | \`${repo}\` | -| Orun workspace | \`${ws}\` (slug \`${slug}\`) | +| Orun workspace | \`${ws}\` | | declared in | \`intent.yaml\` → \`execution.state.workspace\` / \`.project\` | | CI lane CLI pin | orun \`${lanepin}\` (\`.github/workflows/ci.yml\`) | @@ -138,25 +154,21 @@ deployed URLs. migrations applied) and serve the URLs above. - \`dev\` is verify-only: plan/verify lanes run, nothing is deployed. -## Secrets inventory (names only) - -Project rung: -${secrets_proj} - -Environment \`stage\`: -${secrets_stage} +## Secrets (names only) -Environment \`prod\`: -${secrets_prod} - -Provider secrets are BROKERED (minted per-run from the workspace's -integration connections; no long-lived values at rest). \`WIRING_*\` env-rung -entries are job-output secrets published by the infrastructure terraform — -deploy lanes resolve them for worker bindings. - -## Workspace integrations - -${integrations} +| secret | where | what it is | +|---|---|---| +| \`CLOUDFLARE_API_TOKEN\` | the workspace | BROKERED from its Cloudflare connection (\`workers-deploy\`): deploys the Workers and applies the KV namespace | +| \`CLOUDFLARE_D1_TOKEN\` | the workspace | BROKERED (\`d1-edit\`): applies the D1 database and runs its migrations — the deploy token cannot touch D1 | +| \`CLOUDFLARE_ACCOUNT_ID\` | the workspace | the connection's account id — a fact, not a credential | +| \`WIRING_CLOUDFLARE_D1\` | \`${repo}\` on stage and on prod | written by the D1 root's apply: the database's id and name, read by the migrations and by every Worker that binds it — not a credential | +| \`WIRING_CLOUDFLARE_KV\` | \`${repo}\` on stage and on prod | written by the KV root's apply: the edge's idempotency namespace, read by api-edge — not a credential | +${runtime_rows} + +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 @@ -173,8 +185,8 @@ import re, sys repo = sys.argv[1] begin, end = "", "" body = f"""{begin} -This product is **live**. Verified URLs, identity, and the secrets -inventory are recorded in +This product is **live**. Verified URLs, identity, and the secrets it +uses are recorded in [ai/context/deployment.md](ai/context/deployment.md) (regenerated by the docs flow — command in the operating contract); how it deploys and how to operate it: [ai/context/operations.md](ai/context/operations.md). diff --git a/infra/db-migrate/component.yaml b/infra/db-migrate/component.yaml index 11a142f..21dfb66 100644 --- a/infra/db-migrate/component.yaml +++ b/infra/db-migrate/component.yaml @@ -13,6 +13,15 @@ spec: type: db-migrate lifecycle: production owner: platform + # Its pages, attached to it in the workspace's catalog: what the Docs + # library shows for it, and what the catalog's docs and runbook checks read. + # Generated from what this manifest declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: infra dependsOn: diff --git a/infra/db-migrate/docs/overview.md b/infra/db-migrate/docs/overview.md index d93f0d1..719c8f9 100644 --- a/infra/db-migrate/docs/overview.md +++ b/infra/db-migrate/docs/overview.md @@ -6,7 +6,7 @@ Applies this repo's ordered migrations to the environment's Cloudflare D1 databa ## Depends on -- **db** — +- **db** — D1 executor, repositories and the ordered migrations the Workers and db-migrate use - **cloudflare-d1** — Provisions the Cloudflare D1 platform database for stage and prod ## Depended on by diff --git a/infra/terraform/cloudflare-d1/component.yaml b/infra/terraform/cloudflare-d1/component.yaml index 096943f..5223a97 100644 --- a/infra/terraform/cloudflare-d1/component.yaml +++ b/infra/terraform/cloudflare-d1/component.yaml @@ -12,6 +12,15 @@ 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 declares + # (tooling/catalog/gen-component-docs.mjs). + 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/infra/terraform/cloudflare-d1/docs/overview.md b/infra/terraform/cloudflare-d1/docs/overview.md index 2d6df83..7e56756 100644 --- a/infra/terraform/cloudflare-d1/docs/overview.md +++ b/infra/terraform/cloudflare-d1/docs/overview.md @@ -12,5 +12,14 @@ Terraform-managed infrastructure for cirrus-baseline, per environment (`stage`, - **admin-worker** — Internal Cloudflare Worker for audited support/administration diagnostics - **api-edge** — Cloudflare Worker for the API edge Runtime +- **billing-worker** — Cloudflare Worker for the Billing API surface (private, service-binding only) +- **config-worker** — Cloudflare Worker for the Config read-only API surface - **db-migrate** — Applies database migrations to the stage and prod Cloudflare D1 databases +- **events-worker** — Cloudflare Worker for the Events and Audit runtime - **identity-worker** — Cloudflare Worker for the Identity auth runtime +- **integrations-worker** — Cloudflare Worker for the integrations bounded context — provider connections (GitHub App first), inbound delivery inbox, repo links, and the installation-token broker +- **membership-worker** — Cloudflare Worker for the Membership org runtime +- **metering-worker** — Cloudflare Worker for the Metering API surface (usage recording, quota checks) +- **notifications-worker** — Cloudflare Worker for the Notifications bounded context +- **projects-worker** — Cloudflare Worker for the Projects runtime +- **webhooks-worker** — Cloudflare Worker for webhook endpoint, subscription, and delivery-attempt management diff --git a/infra/terraform/cloudflare-domain/component.yaml b/infra/terraform/cloudflare-domain/component.yaml index be0186f..1dcb16c 100644 --- a/infra/terraform/cloudflare-domain/component.yaml +++ b/infra/terraform/cloudflare-domain/component.yaml @@ -12,6 +12,15 @@ 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 declares + # (tooling/catalog/gen-component-docs.mjs). + 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/infra/terraform/cloudflare-domain/docs/overview.md b/infra/terraform/cloudflare-domain/docs/overview.md index 4479efc..83efc65 100644 --- a/infra/terraform/cloudflare-domain/docs/overview.md +++ b/infra/terraform/cloudflare-domain/docs/overview.md @@ -2,11 +2,11 @@ Manages the Cloudflare zone and attaches custom domains to environment-specific Worker services (web-console-next) -Terraform-managed infrastructure for cirrus, per environment (`stage`, `prod`; `dev` is verify-only and provisions nothing). +Terraform-managed infrastructure for cirrus-baseline, per environment (`stage`, `prod`; `dev` is verify-only and provisions nothing). ## Depends on -- **web-console-next** — Next.js 15 + opennextjs/cloudflare delivery of the Cirrus web console (per-environment, Workers + Static Assets) +- **web-console-next** — Next.js 15 + opennextjs/cloudflare delivery of the cirrus-baseline web console (per-environment, Workers + Static Assets) ## Depended on by diff --git a/infra/terraform/cloudflare-kv/component.yaml b/infra/terraform/cloudflare-kv/component.yaml index fe7919a..cede48a 100644 --- a/infra/terraform/cloudflare-kv/component.yaml +++ b/infra/terraform/cloudflare-kv/component.yaml @@ -12,6 +12,15 @@ 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: infra parameters: diff --git a/packages/cli/component.yaml b/packages/cli/component.yaml index 548f439..b88a712 100644 --- a/packages/cli/component.yaml +++ b/packages/cli/component.yaml @@ -7,6 +7,15 @@ 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-cli subscribe: environments: diff --git a/packages/contracts/component.yaml b/packages/contracts/component.yaml index ef39e51..63092fc 100644 --- a/packages/contracts/component.yaml +++ b/packages/contracts/component.yaml @@ -2,10 +2,20 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: contracts + description: API, tenancy, event and error types shared by every Worker, the SDK and the console 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-contracts subscribe: environments: diff --git a/packages/contracts/docs/overview.md b/packages/contracts/docs/overview.md index 4fd112f..f79b2c0 100644 --- a/packages/contracts/docs/overview.md +++ b/packages/contracts/docs/overview.md @@ -1,6 +1,6 @@ # contracts - +API, tenancy, event and error types shared by every Worker, the SDK and the console A workspace package built by the turbo pipeline. It deploys nothing on its own — its lane type-checks, lints, tests, and builds it for the components that depend on it. diff --git a/packages/db/component.yaml b/packages/db/component.yaml index 307a944..087f6f1 100644 --- a/packages/db/component.yaml +++ b/packages/db/component.yaml @@ -2,10 +2,20 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: db + description: D1 executor, repositories and the ordered migrations the Workers and db-migrate use 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-data subscribe: environments: diff --git a/packages/db/docs/overview.md b/packages/db/docs/overview.md index 0828787..db6af77 100644 --- a/packages/db/docs/overview.md +++ b/packages/db/docs/overview.md @@ -1,6 +1,6 @@ # db - +D1 executor, repositories and the ordered migrations the Workers and db-migrate use A workspace package built by the turbo pipeline. It deploys nothing on its own — its lane type-checks, lints, tests, and builds it for the components that depend on it. diff --git a/packages/notifications-client/component.yaml b/packages/notifications-client/component.yaml index 097cf59..1bef2a6 100644 --- a/packages/notifications-client/component.yaml +++ b/packages/notifications-client/component.yaml @@ -2,10 +2,20 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: notifications-client + description: Best-effort client a Worker uses to enqueue a notification with notifications-worker over its service binding 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-shared subscribe: environments: diff --git a/packages/notifications-client/docs/overview.md b/packages/notifications-client/docs/overview.md index d62c750..abbfcd1 100644 --- a/packages/notifications-client/docs/overview.md +++ b/packages/notifications-client/docs/overview.md @@ -1,6 +1,6 @@ # notifications-client - +Best-effort client a Worker uses to enqueue a notification with notifications-worker over its service binding A workspace package built by the turbo pipeline. It deploys nothing on its own — its lane type-checks, lints, tests, and builds it for the components that depend on it. diff --git a/packages/policy-engine/component.yaml b/packages/policy-engine/component.yaml index 90e36ef..60cc308 100644 --- a/packages/policy-engine/component.yaml +++ b/packages/policy-engine/component.yaml @@ -2,10 +2,20 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: policy-engine + description: The role-to-permission rules and authorization decisions policy-worker serves 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-shared subscribe: environments: diff --git a/packages/policy-engine/docs/overview.md b/packages/policy-engine/docs/overview.md index 67a1e56..1149210 100644 --- a/packages/policy-engine/docs/overview.md +++ b/packages/policy-engine/docs/overview.md @@ -1,6 +1,6 @@ # policy-engine - +The role-to-permission rules and authorization decisions policy-worker serves A workspace package built by the turbo pipeline. It deploys nothing on its own — its lane type-checks, lints, tests, and builds it for the components that depend on it. diff --git a/packages/sdk/component.yaml b/packages/sdk/component.yaml index 706d573..7f64ebe 100644 --- a/packages/sdk/component.yaml +++ b/packages/sdk/component.yaml @@ -7,6 +7,15 @@ 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-sdk subscribe: environments: diff --git a/packages/shared/component.yaml b/packages/shared/component.yaml index cd243a8..47c4a3d 100644 --- a/packages/shared/component.yaml +++ b/packages/shared/component.yaml @@ -2,10 +2,20 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: shared + description: Generic id and error helpers with no domain knowledge 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-shared subscribe: environments: diff --git a/packages/shared/docs/overview.md b/packages/shared/docs/overview.md index e7678cf..e24d34c 100644 --- a/packages/shared/docs/overview.md +++ b/packages/shared/docs/overview.md @@ -1,6 +1,6 @@ # shared - +Generic id and error helpers with no domain knowledge A workspace package built by the turbo pipeline. It deploys nothing on its own — its lane type-checks, lints, tests, and builds it for the components that depend on it. diff --git a/packages/testing/component.yaml b/packages/testing/component.yaml index 3d8e395..ff95f0e 100644 --- a/packages/testing/component.yaml +++ b/packages/testing/component.yaml @@ -2,10 +2,20 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: testing + description: Test fixtures shared by the suites (tenant contexts, health responses, deterministic ids) 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-shared subscribe: environments: diff --git a/packages/testing/docs/overview.md b/packages/testing/docs/overview.md index 3cbd7ab..e0f10f2 100644 --- a/packages/testing/docs/overview.md +++ b/packages/testing/docs/overview.md @@ -1,6 +1,6 @@ # testing - +Test fixtures shared by the suites (tenant contexts, health responses, deterministic ids) A workspace package built by the turbo pipeline. It deploys nothing on its own — its lane type-checks, lints, tests, and builds it for the components that depend on it. diff --git a/packages/webhook-verifier/component.yaml b/packages/webhook-verifier/component.yaml index fe80d63..c362092 100644 --- a/packages/webhook-verifier/component.yaml +++ b/packages/webhook-verifier/component.yaml @@ -2,10 +2,20 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: webhook-verifier + description: Zero-dependency HMAC-SHA256 verifier for the signatures on outbound webhook deliveries 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-shared subscribe: environments: diff --git a/packages/webhook-verifier/docs/overview.md b/packages/webhook-verifier/docs/overview.md index d4b1e35..8b670fc 100644 --- a/packages/webhook-verifier/docs/overview.md +++ b/packages/webhook-verifier/docs/overview.md @@ -1,6 +1,6 @@ # webhook-verifier - +Zero-dependency HMAC-SHA256 verifier for the signatures on outbound webhook deliveries A workspace package built by the turbo pipeline. It deploys nothing on its own — its lane type-checks, lints, tests, and builds it for the components that depend on it. diff --git a/repo-blueprint.yaml b/repo-blueprint.yaml index 97e4ec7..c8e9fcf 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -600,6 +600,11 @@ 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 (rebrand.mjs leaves it alone), so + # there is nothing to re-resolve — every lane installs it with + # --frozen-lockfile, and testing/placement.test.sh checks the BRANDED tree + # against it the same way before a tag. - name: root-pnpm-lock mode: copy source: baseline @@ -697,10 +702,20 @@ modules: # that names a milestone the epic does not yet have would create it out of # order at the end. # -# Each phase's own `pre` hook still runs `orun.task/ensure@v1` on its task. -# That is the same identity, so it finds rather than creates, and it is how -# the phase gets the task's KEY for its landing — `{{ .phase.name }}` renders -# empty here, and the outputs of a run-level hook are not a phase's to read. +# 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 console-artifact pin, the +# repository, the link, 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. That is the same identity, so it finds rather than +# creates, and it is how the phase gets the task's KEY for its landing — +# `{{ .phase.name }}` renders empty here, and the outputs of a run-level hook +# are not a phase's to read. It sits in `post` rather than `pre` so that +# everything before it overlaps with this list. # # Names, not phase ids. A task title is what a person reads in the work # surface, so it is an imperative sentence about the outcome; the pull @@ -712,6 +727,7 @@ hooks: preInstantiate: - id: epic uses: orun.task/ensure@v1 + background: true narrate: 'Epic {{ .hooks.epic.outputs.key }} is open.' with: kind: epic @@ -731,6 +747,7 @@ hooks: # assertions — the same lines the task contracts' `doneWhen` carry. - id: m01 uses: orun.task/ensure@v1 + background: true with: kind: milestone epic: "{{ .inputs.epicSlug }}" @@ -743,6 +760,7 @@ hooks: - api-edge /health answers 200 and the console root answers on stage and prod - id: m08 uses: orun.task/ensure@v1 + background: true with: kind: milestone epic: "{{ .inputs.epicSlug }}" @@ -754,6 +772,7 @@ hooks: # `task` hook names, verbatim — that is the identity they are found by. - id: t01 uses: orun.task/ensure@v1 + background: true with: kind: task epic: "{{ .inputs.epicSlug }}" @@ -769,6 +788,7 @@ hooks: contract: tasks/01-product.TaskContract.yaml - id: t08 uses: orun.task/ensure@v1 + background: true with: kind: task epic: "{{ .inputs.epicSlug }}" @@ -838,9 +858,18 @@ phases: - name: 01-product title: The product, built in one landing description: The whole tree — manifests, tooling, packages, data plane, fleet, edge and console — branded, landed as one pull request, and deployed by one convergence. - # The phases budget 13 + 2 = 15 minutes, the card's + # The phases budget 12 + 1 = 13 minutes, the card's # `bootstrap.expectedMinutes`; testing/manifest.test.sh holds them equal. - expectedMinutes: 13 + # An ESTIMATE, not a measurement: the 13 it was, less about the minute + # the orun v2.88.0 shape took out of turso-starter's measured build — the + # task set-up in the background (~23 s there), the landing checked in the + # box instead of by a runner's `plan` (~24 s), the convergence read every + # 5 s instead of 40 (~20 s) — and the wiring await it no longer makes. + # The rest is the merge's convergence: D1 and KV, the migrations, the + # fleet with its bindings, the edge and the console, stage and prod side + # by side. Replace it when a one-landing cirrus build is timed + # (docs/phases/TIMINGS.md). + expectedMinutes: 12 # WHAT THE BUILD PANEL SHOWS, line for line (orun-cloud saas-build-panel). # The panel prints each hook's `narrate:` verbatim as progress, and it # shows the timing itself — so every line here is short, and true @@ -882,23 +911,10 @@ phases: waitSeconds: 600 pollSeconds: 20 hooks: - pre: - # The epic, every milestone and every task already exist — the - # run-level `hooks.preInstantiate` list above opened them before this - # phase began. Each phase's own `task` hook is the same find-or-create - # by title within the epic, so it FINDS the task and yields its key, - # which the landing below binds the pull request to. (Under an orun - # older than v2.60, which has no run-level pre list, this hook is what - # creates the task — same identity, same result, one phase late.) - - 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: tasks/01-product.TaskContract.yaml + # NO `pre` HOOK. The phase's task is found in `post`, just before the + # landing (below), so that everything before it runs beside the + # run-level task set-up, which is in the background. + # # The identity chain, moved here from `hooks.postInstantiate`. The end # of 01-product is the moment the whole tree is placed: every later # phase applies into a tree that is already a git repo and already @@ -975,12 +991,8 @@ phases: run: ["git", "add", "-A"] - id: rebrand-verify run: ["node", "{{ .baseline.dir }}/tooling/rebrand/rebrand.mjs", "--verify", "--values", ".rebrand/values.json"] - # root-pnpm-lock places the baseline's complete lockfile and the whole - # tree is here, so this only confirms it (a no-op, ~0.3 s, ~160 MB — - # the per-phase re-resolve that was OOM-killed on the platform box is - # gone with the phases). - - id: pnpm-lockfile - run: ["pnpm", "install", "--lockfile-only"] + # No lockfile hook: root-pnpm-lock places the baseline's complete + # lockfile as it is (see that module). # The console deploys from the prebuilt artifact for its sources # (saas-console-artifact CA4); the pin names it. - id: console-artifact @@ -1029,47 +1041,50 @@ 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, and these three keys are three different scopes on - # purpose — the deploy token deliberately cannot touch D1. Keys that - # already exist are kept. After the link, before the landing whose - # convergence uses them. + # The deploy credentials, brokered, in ONE hook (orun >= v2.87.0): + # `secrets` mints each key under its own scope template from the one + # Cloudflare connection, reading the connections and the existing + # secrets once and creating the missing keys side by side. The three + # are three different scopes on purpose — the deploy token + # deliberately cannot touch D1. Keys that already exist are kept. + # After the link, before the landing whose convergence uses them. # - # Their lines are static: an id with a `-` cannot be named in a - # template, and each says the one thing that is true whether the key - # was minted now or kept from before. - - id: secret-workers-deploy - uses: orun.integrations/reconcile@v1 - narrate: "CLOUDFLARE_API_TOKEN is in place, minted from your Cloudflare connection." - with: - provider: cloudflare - keys: [CLOUDFLARE_API_TOKEN] - template: workers-deploy - - id: secret-d1-edit + # The line is static: it says the one thing that is true whether the + # keys were minted now or kept from before. + - id: secrets uses: orun.integrations/reconcile@v1 - narrate: "CLOUDFLARE_D1_TOKEN is in place, minted from your Cloudflare connection." + narrate: "CLOUDFLARE_API_TOKEN, CLOUDFLARE_D1_TOKEN and CLOUDFLARE_ACCOUNT_ID are in place, from your Cloudflare connection." with: provider: cloudflare - keys: [CLOUDFLARE_D1_TOKEN] - template: d1-edit - - id: secret-account-id - uses: orun.integrations/reconcile@v1 - narrate: "CLOUDFLARE_ACCOUNT_ID is in place, read from your Cloudflare connection." + secrets: + - { key: CLOUDFLARE_API_TOKEN, template: workers-deploy } + - { key: CLOUDFLARE_D1_TOKEN, template: d1-edit } + - { 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. The same + # find-or-create by title within the epic, so it FINDS the task. + - 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 own CI — - # the workflow run to its last job (orun >= v2.58.6) — and merges only - # on green. But on a bootstrap branch (`orun/BASE-…`) that run is the - # BASIC check only: `plan` resolves the intent, every component and - # every composition, and the lanes are skipped - # (.github/workflows/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 bootstrap watches to green. - # The PR pass was the same work twice and a third of the wall-clock. + kind: task + epic: "{{ .inputs.epicSlug }}" + milestone: "{{ .phase.name }}" + name: "Build the product in one landing" + prefix: BASE + contract: 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, without waiting for a runner. A tree that + # fails is never pushed. The PR's CI still runs (`plan` alone on a + # bootstrap branch, `orun/BASE-…`, .github/workflows/ci.yml); nothing + # waits for it. The merge runs every lane on main a minute later, for + # real, and the convergence after it is what this bootstrap watches to + # green. # # The line names the pull request, and says so when a re-run had # nothing new to land. `label` names its pull request in the build @@ -1083,6 +1098,7 @@ phases: epic: "{{ .inputs.epicSlug }}" branchSlug: "{{ .phase.name }}" title: "feat: {{ .inputs.productname }}, the whole product from the cirrus baseline" + checks: local await: - id: converge uses: orun.run/watch@v1 @@ -1095,15 +1111,22 @@ phases: repo: "{{ .inputs.githuborg }}/{{ .inputs.reponame }}" resumeBudget: 3 waitSeconds: 3600 - # Each apply lease-publishes its outputs to the project's ENVIRONMENT - # rungs (stage and prod), not to the workspace. - - id: wiring - uses: orun.secrets/exists@v1 - narrate: "WIRING_CLOUDFLARE_D1 and WIRING_CLOUDFLARE_KV are published on stage and prod." - with: - keys: [WIRING_CLOUDFLARE_D1, 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, for either key. Each apply lease-publishes + # its document to the project's ENVIRONMENT rungs (stage and prod), and + # readers in THIS convergence resolve it as their job starts, from the + # place every later run looks (their component.yaml `secretEnv` refs, + # each waiting for its publisher on main, `mode: enforced`): + # WIRING_CLOUDFLARE_D1 — db-migrate on stage and on prod before it + # migrates, and every deploy of api-edge and of the eleven fleet + # workers that bind D1 (all but policy-worker; stage and prod refs); + # WIRING_CLOUDFLARE_KV — api-edge's deploys (stage and prod refs). + # `secretEnv` resolution is fail-closed — a missing document fails + # that lane — so a green run already says both are there. + # testing/phases.test.sh holds it: a published document no reader + # resolves on stage and prod must be awaited again. - id: verify uses: orun.http/probe@v1 narrate: "The edge and the console answer on stage and prod." @@ -1117,9 +1140,11 @@ phases: - name: 08-docs title: The deployment, recorded description: The live deployment written into ai/context/deployment.md from what its URLs answered, with prod's wait on stage and dev's verify lanes put back, landed as one pull request. - expectedMinutes: 2 + # An estimate: the render's probes, the landing checked in the box and + # merged, and nothing after it to wait for. + expectedMinutes: 1 narrate: - # No `await` line, for the reason 01-product gives. + # No `await` line: this phase awaits nothing. start: "Recording the live deployment in one pull request." done: "ai/context/deployment.md records the live deployment, and prod waits on stage again." failed: "The deployment record did not land; nothing deployed was changed." @@ -1127,16 +1152,6 @@ phases: requires: phases: [01-product] hooks: - pre: - - id: task - uses: orun.task/ensure@v1 - with: - kind: task - epic: "{{ .inputs.epicSlug }}" - milestone: "{{ .phase.name }}" - name: "Record the live deployment" - prefix: BASE - contract: tasks/08-docs.TaskContract.yaml post: # THE PRODUCT GOES LIVE WITH ITS PROMOTION GATE. 01-product deferred # `prod.promotion.dependsOn: [stage]` so every bootstrap convergence @@ -1150,9 +1165,23 @@ phases: # And dev verifies every merge to main again (01-product deferred it). - id: dev-lanes run: ["node", "{{ .baseline.dir }}/tooling/bootstrap/dev-lanes.mjs", "--restore"] + # The record asks the platform nothing: it probes the four addresses + # as it writes them, and names the secrets the product uses and where + # they live (hooks/render-deployment-docs.sh). - id: render narrate: "The deployment record is written from the probed addresses." run: ["bash", "{{ .baseline.dir }}/hooks/render-deployment-docs.sh", ".", "{{ .inputs.orunWorkspace }}", "{{ .baseline.dir }}"] + # The task, found just before the landing, as 01-product's is. + - id: task + uses: orun.task/ensure@v1 + with: + kind: task + epic: "{{ .inputs.epicSlug }}" + milestone: "{{ .phase.name }}" + name: "Record the live deployment" + prefix: BASE + contract: tasks/08-docs.TaskContract.yaml + # Checked here and merged, as 01-product's landing is. - id: land uses: orun.pr/land@v1 label: Docs @@ -1162,17 +1191,8 @@ phases: epic: "{{ .inputs.epicSlug }}" branchSlug: "{{ .phase.name }}" title: "docs(deployment): record the live deployment state" - await: - # A re-check of the addresses 01-product already probed and pinned, so - # `quiet`: it files no facts of its own (orun >= BV3; an older orun - # ignores the key). Its authored line still speaks. - - id: verify - uses: orun.http/probe@v1 - quiet: true - narrate: "The edge and the console still answer on stage and prod." - with: - urls: - - "https://{{ .inputs.reponame }}-api-edge-stage.{{ .inputs.subdomain }}.workers.dev/health" - - "https://{{ .inputs.reponame }}-web-console-next-stage.{{ .inputs.subdomain }}.workers.dev" - - "https://{{ .inputs.reponame }}-api-edge-prod.{{ .inputs.subdomain }}.workers.dev/health" - - "https://{{ .inputs.reponame }}-web-console-next-prod.{{ .inputs.subdomain }}.workers.dev" + checks: local + # NO `await`. The render probes every address as it writes the record, + # and this landing redeploys nothing (it touches intent.yaml's + # `environments` and the docs, which map to no component), so a probe + # after it would re-ask what the render has just recorded. diff --git a/testing/coverage.test.sh b/testing/coverage.test.sh index ea17b7e..ece05d6 100755 --- a/testing/coverage.test.sh +++ b/testing/coverage.test.sh @@ -101,6 +101,52 @@ 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 — +# tooling/catalog/gen-component-docs.mjs) and must ATTACH them in +# `spec.docs`: a `docs/` folder no manifest declares is never attached, so a +# product's Docs library shows nothing for the component and the catalog +# fails it on docs and on runbook (found on turso-starter, whose components +# shipped the same generated pages undeclared, as these did). A component also +# needs a description: it is the catalog's one-line answer to "what is this", +# and the packages and test suites had none. +# +# And a domain may not share a component's name. The catalog keys entities by +# name, so a domain called `web` took the `web` component's place on +# turso-starter, and the product's one deployable was missing from its own +# catalog. A domain is read where a manifest can declare one: `spec.domain` +# and `labels.domain`. +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 dom in (spec.get("domain"), (meta.get("labels") or {}).get("domain"), + (spec.get("labels") or {}).get("domain")): + if dom: + domains.setdefault(dom, 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 — " + f"generate it: node tooling/catalog/gen-component-docs.mjs") +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: @@ -149,6 +195,8 @@ if problems: shipped = len(components) - len(BASELINE_ONLY) print(f" {shipped} of {len(components)} components placed, " f"{len(BASELINE_ONLY)} baseline-only by declaration") +print(f" each attaches its three pages and says what it is; " + f"{len(domains)} domain(s), none named like a component") PY echo "coverage.test.sh: ok" diff --git a/testing/manifest.test.sh b/testing/manifest.test.sh index bc57d38..21f3689 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 bd80f9c..33dd01c 100755 --- a/testing/phases.test.sh +++ b/testing/phases.test.sh @@ -17,6 +17,15 @@ # and a module that drifts one phase earlier fails at deploy time, live, with # nothing in this repo having looked wrong. # +# THE HOOKS, TOO (ported from sourceplane/turso-starter's copy of this file). +# Each phase's hooks run in the one-landing order; the shape that keeps a +# bootstrap fast holds (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 in the box (`checks: local`), and the convergence +# watch reads every few seconds. And the wiring the infrastructure publishes +# is proved by the components that resolve it in the convergence — which is +# why 01-product no longer awaits it separately. +# # bash + python3 + PyYAML. No network, no fakes, no credential. set -euo pipefail here="$(cd "$(dirname "$0")" && pwd)" @@ -184,6 +193,175 @@ for p in phases: bad(f"phase {p['name']} hook {h.get('id')} names contract {rel}, " f"which does not exist") +run_hooks = list((bp.get("hooks") or {}).get("preInstantiate") or []) + +# ── the hooks run in the one-landing order ──────────────────────────────── +# Each phase's pre, post and await hooks, in order. The brokered keys are one +# `secrets` reconcile (testing/manifest.test.sh holds them to the card). 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. 08-docs awaits nothing: its render probes as it writes, and its +# landing redeploys nothing. +PRE = {"01-product": [], "08-docs": []} +POST = { + "01-product": ["retouch", "git-init", "git-stage", "rebrand", "orun-workspace", + "promotion", "dev-lanes", "git-restage", "rebrand-verify", + "console-artifact", "restage-console-artifact", + "repo", "link", "secrets", "task", "land"], + "08-docs": ["promotion", "dev-lanes", "render", "task", "land"], +} +AWAIT = {"01-product": ["converge", "verify"], "08-docs": []} +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 = [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(): + got = [h.get("id") for h in ((by_name.get(name, {}).get("hooks") or {}).get("await") or [])] + if got != want: + bad(f"phase {name}'s await hooks are {got}; want {want}") +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("task") != "{{ .phase.hooks.task.outputs.key }}": + bad(f"phase {p['name']} lands without binding the PR to its task key") + +# ── 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, console pin, 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. +TASK_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(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 the tree this box just wrote. +for p in phases: + for h in hooks_of(p): + if (h.get("uses") or "").startswith("orun.pr/land@") and (h.get("with") or {}).get("checks") != "local": + bad(f"phase {p['name']} lands with checks {(h.get('with') or {}).get('checks', 'ci')!r}, " + f"not 'local' — it waits for a runner to plan a tree that is here") +# The convergence watch reads every few seconds, not the action's default 40. +for p in phases: + for h in ((p.get("hooks") or {}).get("await") or []): + if (h.get("uses") or "").startswith("orun.run/watch@"): + every = (h.get("with") or {}).get("pollSeconds") + if not isinstance(every, int) or every > 10: + bad(f"phase {p['name']} watches its convergence every {every or 40} s; at most 10 — " + f"the build goes on that much after the run is green") + +# ── THE WIRING IS PROVED BY ITS READERS ─────────────────────────────────── +# +# Each infra apply lease-publishes a wiring document (`secretOutputs: +# "WIRING_X=wiring"`) to the project's stage and prod rungs. 01-product used +# to ask the platform afterwards whether they were there +# (`orun.secrets/exists@v1`). It no longer does, because components in the +# same convergence resolve them as their jobs start, from the `secretEnv` +# refs in their component.yaml — the place every later run reads them — and +# that resolution is fail-closed: a missing document fails the lane, so a +# green convergence has already said it is there. +# +# That holds only while every published document has such a reader on stage +# AND on prod: a `secretEnv` ref (an `optionalSecretEnv` one skips a missing +# key), in a component that runs in both environments on a merge to main and +# waits there for its publisher (`mode: enforced` on github-push-main — or it +# would start before the apply). A pull request deploys nothing, so on one +# nothing waits (advisory). A document nothing reads that way must be awaited +# again (orun.secrets/exists@v1, stage and prod), and is then exempt here. +intent = yaml.safe_load((root / "intent.yaml").read_text()) or {} +env_mode = {n: (e or {}).get("dependencyMode") for n, e in (intent.get("environments") or {}).items()} +comps = {} +for f in root.rglob("component.yaml"): + if "node_modules" in f.parts or ".git" in f.parts: + continue + d = yaml.safe_load(f.read_text()) or {} + comps[(d.get("metadata") or {}).get("name")] = (f.relative_to(root).as_posix(), d.get("spec") or {}) + +def subscribed(spec): + return {s.get("name"): s for s in ((spec.get("subscribe") or {}).get("environments") or [])} + +def edge_mode(spec, env, target, trigger): + """A dependsOn edge's mode in one environment under one trigger, by orun's + precedence: the edge's modeRules, its mode, then the lane's — the + subscription's dependencyRules, its dependencyMode, the environment's + dependencyMode, enforced.""" + edge = next((d for d in spec.get("dependsOn") or [] if d.get("component") == target), None) + if edge is None: + return None + for r in edge.get("modeRules") or []: + if (r.get("when") or {}).get("triggerRef") == trigger: + return r.get("mode") + if edge.get("mode"): + return edge["mode"] + sub = subscribed(spec).get(env) or {} + for r in sub.get("dependencyRules") or []: + if (r.get("when") or {}).get("triggerRef") == trigger: + return r.get("mode") + return sub.get("dependencyMode") or env_mode.get(env) or "enforced" + +REF = re.compile(r"^secret://[^/]+/[^/]+/([^/]+)/([A-Za-z0-9_]+)$") +def resolves(spec, key): + """The environments whose `key` document this component's jobs resolve, fail-closed.""" + envs = set() + for ref in (spec.get("secretEnv") or {}).values(): + m = REF.match(str(ref).strip()) + if m and m.group(2) == key: + envs |= set(subscribed(spec)) if m.group(1) == "{{ .environment }}" else {m.group(1)} + return envs + +publishes = {} +for name, (rel, spec) in comps.items(): + outs = str((spec.get("parameters") or {}).get("secretOutputs") or "") + for pair in filter(None, (x.strip() for x in outs.split(","))): + key = pair.split("=", 1)[0] + if key.startswith("WIRING_"): + publishes[key] = name +if not publishes: + bad("no infra component lease-publishes a WIRING_* document — this check has gone blind") +awaited = {k for p in phases for h in ((p.get("hooks") or {}).get("await") or []) + if (h.get("uses") or "").startswith("orun.secrets/exists@") + and set((h.get("with") or {}).get("environments") or []) >= {"stage", "prod"} + for k in ((h.get("with") or {}).get("keys") or [])} +module_of = {(m.get("from") or "").rstrip("/"): m for m in bp.get("modules") or []} +readers = {} +for key, pub in sorted(publishes.items()): + seen = set() + for name, (rel, spec) in sorted(comps.items()): + envs = resolves(spec, key) + if not envs or name == pub: + continue + readers.setdefault(key, []).append(name) + for env in sorted({"stage", "prod"} & set(subscribed(spec))): + if edge_mode(spec, env, pub, "github-push-main") != "enforced": + bad(f"{rel} reads {key} and does not wait for {pub} on {env} on a merge to main — " + f"declare dependsOn {pub} with mode: enforced") + if edge_mode(spec, env, pub, "github-pull-request") != "advisory": + bad(f"{rel} waits for {pub} on {env} on a pull request, which deploys nothing — " + f"make the edge advisory on github-pull-request") + if {"stage", "prod"} <= set(subscribed(spec)): + seen |= envs + mod = module_of.get(rel.rsplit("/", 1)[0]) + pub_mod = module_of.get(comps[pub][0].rsplit("/", 1)[0]) + if mod and pub_mod and pub_mod["name"] not in (mod.get("dependsOn") or []): + bad(f"module {mod['name']} reads {key} and is not placed after {pub_mod['name']} (module dependsOn)") + missing = {"stage", "prod"} - seen + if missing and key not in awaited: + bad(f"{key} ({pub}) is resolved on {sorted(missing)} by nothing in the convergence — a " + f"green run no longer says it was published there; await it with " + f"orun.secrets/exists@v1 on stage and prod") + # ── every phase has a documentation page, and every page a phase ────────── # This replaces BE1's "every flows/phases folder has a phase declared here". # The folders are gone (BE4), and the thing that can now drift out from under @@ -288,6 +466,12 @@ 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")) + # A phase that awaits nothing never says its await line — except while + # `requires.probe` waits for a provider, which is a waiting event too. + if n.get("await") and not awaits and not (p.get("requires") or {}).get("probe"): + bad(f"phase {p['name']} declares narrate.await and waits on nothing — " + f"nobody would ever read it") for slot in ("start", "await", "done", "failed"): line = n.get(slot) # `await` IS OPTIONAL, and this baseline authors none (orun-cloud @@ -341,6 +525,10 @@ 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} modules, " f"{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") +for key in sorted(publishes): + print(f" {key} ({publishes[key]}): resolved in the convergence by {len(readers.get(key, []))} " + f"reader(s), each waiting for it on main{' — and awaited' if key in awaited else ''}") print(f" {narrated} authored narration lines, every reference resolving") PY diff --git a/testing/placement.test.sh b/testing/placement.test.sh index 9e1a0e4..d0af59f 100755 --- a/testing/placement.test.sh +++ b/testing/placement.test.sh @@ -25,9 +25,11 @@ # domain — and that the domain it was born without is the placeholder; # 6. THE PHASED SEQUENCE THROUGH A REBRAND: place 01, brand, then place the # phases that follow. This is the step no test in this repository has ever -# taken, and it is where BE-O12's two defects lived. +# taken, and it is where BE-O12's two defects lived; +# 7. the lockfile it ships installs frozen in the branded tree — there is +# no lockfile hook, and every lane installs it with --frozen-lockfile. # -# Needs: orun (the pinned version) + node + python3 + git. No network, no +# Needs: orun (the pinned version) + node + pnpm + python3 + git. No network, no # credential. Nothing here contacts a provider: placement writes files, and # since BE-O12 a run with hooks off does not probe. set -euo pipefail @@ -36,6 +38,7 @@ root="$(cd "$here/.." && pwd)" command -v orun >/dev/null || { echo "placement.test.sh needs orun on PATH" >&2; exit 1; } command -v node >/dev/null || { echo "placement.test.sh needs node for rebrand" >&2; exit 1; } +command -v pnpm >/dev/null || { echo "placement.test.sh needs pnpm for the frozen-lockfile check" >&2; exit 1; } scratch="$(mktemp -d)" trap 'rm -rf "$scratch"' EXIT @@ -75,10 +78,11 @@ fi # ── the gates that ride inside the placement ─────────────────────────────── # `orun new` prints this line only after running validate + plan --dry-run in # the produced tree. Its absence means the tier lost a check without failing. -# Two spellings: the pinned v2.58.11 prints `repo gate: validate + plan -# --dry-run passed`; later releases print a summary whose `✓ Verified intent -# valid · N components × M envs → J jobs` row is written only when that same -# gate passed (cmd/orun/new_summary.go), so a pin bump does not turn this red. +# Two spellings: v2.58.11 (the pinned floor until v2.88.0) prints `repo +# gate: validate + plan --dry-run passed`; later releases, the v2.88.0 floor +# among them, print a summary whose `✓ Verified intent valid · N components × +# M envs → J jobs` row is written only when that same gate passed +# (cmd/orun/new_summary.go), so a pin bump does not turn this red. grep -qE "repo gate: validate \+ plan --dry-run passed|Verified +intent valid" "$scratch/place.log" \ || fail "the placement did not report the repo-scale gate — \`orun validate\` and \`orun plan --dry-run\` are Tier 1 checks that ride inside \`orun new\`, @@ -112,6 +116,24 @@ if ! (cd "$tree" && node "$root/tooling/rebrand/rebrand.mjs" \ fi echo " branded; no baseline-identity residue" +# ── the lockfile it ships installs frozen ────────────────────────────────── +# There is no lockfile hook any more: root-pnpm-lock places the baseline's +# complete lockfile as it is, and every lane of the product's CI installs it +# with --frozen-lockfile. So the BRANDED tree must still be exactly what that +# lockfile locks — a rebrand that renamed a workspace package or a +# dependency would fail every lane of the first convergence, and this +# repository has no later tier that installs the product. Checked without +# installing or fetching anything (--lockfile-only --offline); a refusal +# names the importer whose specifiers no longer match. +echo "── the shipped lockfile, frozen, against the branded tree" +if ! (cd "$tree" && pnpm install --frozen-lockfile --lockfile-only --ignore-scripts --offline) \ + > "$scratch/lockfile.log" 2>&1; then + echo "FAIL: the branded product does not install frozen from the lockfile it ships" >&2 + tail -20 "$scratch/lockfile.log" >&2 + exit 1 +fi +echo " pnpm-lock.yaml installs frozen — nothing to re-resolve" + # ── the leak rules, over the files rather than the derivation ────────────── echo "── what the product actually carries" python3 - "$tree" "$root" <<'PY' diff --git a/tests/admin-worker/component.yaml b/tests/admin-worker/component.yaml index 95ab171..5ea6923 100644 --- a/tests/admin-worker/component.yaml +++ b/tests/admin-worker/component.yaml @@ -2,10 +2,20 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: admin-worker-tests + description: admin-worker's tests (support lookup, support actions, entitlement decisions), run on dev 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-tests subscribe: environments: diff --git a/tests/admin-worker/docs/overview.md b/tests/admin-worker/docs/overview.md index 086a1f3..bd09617 100644 --- a/tests/admin-worker/docs/overview.md +++ b/tests/admin-worker/docs/overview.md @@ -1,6 +1,6 @@ # admin-worker-tests - +admin-worker's tests (support lookup, support actions, entitlement decisions), run on dev A workspace package built by the turbo pipeline. It deploys nothing on its own — its lane type-checks, lints, tests, and builds it for the components that depend on it. diff --git a/tests/api-edge/component.yaml b/tests/api-edge/component.yaml index 8967756..07084bc 100644 --- a/tests/api-edge/component.yaml +++ b/tests/api-edge/component.yaml @@ -2,10 +2,20 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: api-edge-tests + description: api-edge's tests (the routing facades, actor resolution, CORS, rate limits, idempotency, API keys), run on dev 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-tests subscribe: environments: diff --git a/tests/api-edge/docs/overview.md b/tests/api-edge/docs/overview.md index 69a18b0..4492deb 100644 --- a/tests/api-edge/docs/overview.md +++ b/tests/api-edge/docs/overview.md @@ -1,6 +1,6 @@ # api-edge-tests - +api-edge's tests (the routing facades, actor resolution, CORS, rate limits, idempotency, API keys), run on dev A workspace package built by the turbo pipeline. It deploys nothing on its own — its lane type-checks, lints, tests, and builds it for the components that depend on it. diff --git a/tests/billing-worker/component.yaml b/tests/billing-worker/component.yaml index 4dcf7a3..d195658 100644 --- a/tests/billing-worker/component.yaml +++ b/tests/billing-worker/component.yaml @@ -2,10 +2,20 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: billing-worker-tests + description: billing-worker's tests (plans, billing scope, the Polar provider, webhook intake), run on dev 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-tests path: tests/billing-worker subscribe: diff --git a/tests/billing-worker/docs/overview.md b/tests/billing-worker/docs/overview.md index 0b7e66a..77004cd 100644 --- a/tests/billing-worker/docs/overview.md +++ b/tests/billing-worker/docs/overview.md @@ -1,6 +1,6 @@ # billing-worker-tests - +billing-worker's tests (plans, billing scope, the Polar provider, webhook intake), run on dev A workspace package built by the turbo pipeline. It deploys nothing on its own — its lane type-checks, lints, tests, and builds it for the components that depend on it. diff --git a/tests/config-worker/component.yaml b/tests/config-worker/component.yaml index 7a37a48..07caf47 100644 --- a/tests/config-worker/component.yaml +++ b/tests/config-worker/component.yaml @@ -2,10 +2,20 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: config-worker-tests + description: config-worker's tests (config and secret mutations, encrypted secret storage, deployment config), run on dev 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-tests path: tests/config-worker subscribe: diff --git a/tests/config-worker/docs/overview.md b/tests/config-worker/docs/overview.md index 1b9eebf..a6e055d 100644 --- a/tests/config-worker/docs/overview.md +++ b/tests/config-worker/docs/overview.md @@ -1,6 +1,6 @@ # config-worker-tests - +config-worker's tests (config and secret mutations, encrypted secret storage, deployment config), run on dev A workspace package built by the turbo pipeline. It deploys nothing on its own — its lane type-checks, lints, tests, and builds it for the components that depend on it. diff --git a/tests/contracts/component.yaml b/tests/contracts/component.yaml index e8c81ea..d3364ba 100644 --- a/tests/contracts/component.yaml +++ b/tests/contracts/component.yaml @@ -2,10 +2,20 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: contracts-tests + description: The shared contracts' tests (events, policy, idempotency, billing, webhooks, projects, timing), run on dev 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-tests subscribe: environments: diff --git a/tests/contracts/docs/overview.md b/tests/contracts/docs/overview.md index 8e5f861..17ab9cf 100644 --- a/tests/contracts/docs/overview.md +++ b/tests/contracts/docs/overview.md @@ -1,6 +1,6 @@ # contracts-tests - +The shared contracts' tests (events, policy, idempotency, billing, webhooks, projects, timing), run on dev A workspace package built by the turbo pipeline. It deploys nothing on its own — its lane type-checks, lints, tests, and builds it for the components that depend on it. diff --git a/tests/db/component.yaml b/tests/db/component.yaml index bd516a3..7541346 100644 --- a/tests/db/component.yaml +++ b/tests/db/component.yaml @@ -2,10 +2,20 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: db-tests + description: The db package's tests (the D1 executor and SQL, the repositories, every migration and its runner), run on dev 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-tests subscribe: environments: diff --git a/tests/db/docs/overview.md b/tests/db/docs/overview.md index dfd5364..414625a 100644 --- a/tests/db/docs/overview.md +++ b/tests/db/docs/overview.md @@ -1,6 +1,6 @@ # db-tests - +The db package's tests (the D1 executor and SQL, the repositories, every migration and its runner), run on dev A workspace package built by the turbo pipeline. It deploys nothing on its own — its lane type-checks, lints, tests, and builds it for the components that depend on it. diff --git a/tests/identity-worker/component.yaml b/tests/identity-worker/component.yaml index 5d582ed..3627a89 100644 --- a/tests/identity-worker/component.yaml +++ b/tests/identity-worker/component.yaml @@ -2,10 +2,20 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: identity-worker-tests + description: identity-worker's tests (sign-in, OAuth, API keys, security events, profiles), run on dev 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-tests subscribe: environments: diff --git a/tests/identity-worker/docs/overview.md b/tests/identity-worker/docs/overview.md index 4cd1eda..c7e5eb4 100644 --- a/tests/identity-worker/docs/overview.md +++ b/tests/identity-worker/docs/overview.md @@ -1,6 +1,6 @@ # identity-worker-tests - +identity-worker's tests (sign-in, OAuth, API keys, security events, profiles), run on dev A workspace package built by the turbo pipeline. It deploys nothing on its own — its lane type-checks, lints, tests, and builds it for the components that depend on it. diff --git a/tests/integrations-worker/component.yaml b/tests/integrations-worker/component.yaml index 75b9945..acf14cb 100644 --- a/tests/integrations-worker/component.yaml +++ b/tests/integrations-worker/component.yaml @@ -2,10 +2,20 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: integrations-worker-tests + description: integrations-worker's tests (the connect flow, the GitHub provider, the inbound pipeline, repo links, the token broker), run on dev 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-tests subscribe: environments: diff --git a/tests/integrations-worker/docs/overview.md b/tests/integrations-worker/docs/overview.md index a43e41c..847ece0 100644 --- a/tests/integrations-worker/docs/overview.md +++ b/tests/integrations-worker/docs/overview.md @@ -1,6 +1,6 @@ # integrations-worker-tests - +integrations-worker's tests (the connect flow, the GitHub provider, the inbound pipeline, repo links, the token broker), run on dev A workspace package built by the turbo pipeline. It deploys nothing on its own — its lane type-checks, lints, tests, and builds it for the components that depend on it. diff --git a/tests/membership-worker/component.yaml b/tests/membership-worker/component.yaml index 97adcd7..e1f0ade 100644 --- a/tests/membership-worker/component.yaml +++ b/tests/membership-worker/component.yaml @@ -2,10 +2,20 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: membership-worker-tests + description: membership-worker's tests (organizations, invitations, authorization context, service principals), run on dev 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-tests subscribe: environments: diff --git a/tests/membership-worker/docs/overview.md b/tests/membership-worker/docs/overview.md index eaba1cd..78c91ce 100644 --- a/tests/membership-worker/docs/overview.md +++ b/tests/membership-worker/docs/overview.md @@ -1,6 +1,6 @@ # membership-worker-tests - +membership-worker's tests (organizations, invitations, authorization context, service principals), run on dev A workspace package built by the turbo pipeline. It deploys nothing on its own — its lane type-checks, lints, tests, and builds it for the components that depend on it. diff --git a/tests/metering-worker/component.yaml b/tests/metering-worker/component.yaml index 11cfb99..3cdc33f 100644 --- a/tests/metering-worker/component.yaml +++ b/tests/metering-worker/component.yaml @@ -2,10 +2,20 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: metering-worker-tests + description: metering-worker's tests (usage recording and rollups), run on dev 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-tests path: tests/metering-worker subscribe: diff --git a/tests/metering-worker/docs/overview.md b/tests/metering-worker/docs/overview.md index 79fcce1..555272f 100644 --- a/tests/metering-worker/docs/overview.md +++ b/tests/metering-worker/docs/overview.md @@ -1,6 +1,6 @@ # metering-worker-tests - +metering-worker's tests (usage recording and rollups), run on dev A workspace package built by the turbo pipeline. It deploys nothing on its own — its lane type-checks, lints, tests, and builds it for the components that depend on it. diff --git a/tests/notifications-client/component.yaml b/tests/notifications-client/component.yaml index ecf1579..ff5420b 100644 --- a/tests/notifications-client/component.yaml +++ b/tests/notifications-client/component.yaml @@ -2,10 +2,20 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: notifications-client-tests + description: notifications-client's tests (the best-effort enqueue), run on dev 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-tests subscribe: environments: diff --git a/tests/notifications-client/docs/overview.md b/tests/notifications-client/docs/overview.md index 04aed35..dcdbb84 100644 --- a/tests/notifications-client/docs/overview.md +++ b/tests/notifications-client/docs/overview.md @@ -1,6 +1,6 @@ # notifications-client-tests - +notifications-client's tests (the best-effort enqueue), run on dev A workspace package built by the turbo pipeline. It deploys nothing on its own — its lane type-checks, lints, tests, and builds it for the components that depend on it. diff --git a/tests/notifications-worker/component.yaml b/tests/notifications-worker/component.yaml index 46c4f01..de93f63 100644 --- a/tests/notifications-worker/component.yaml +++ b/tests/notifications-worker/component.yaml @@ -2,10 +2,20 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: notifications-worker-tests + description: notifications-worker's tests (the router, the service, the Cloudflare email provider), run on dev 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-tests subscribe: environments: diff --git a/tests/notifications-worker/docs/overview.md b/tests/notifications-worker/docs/overview.md index a41683e..b6a3aac 100644 --- a/tests/notifications-worker/docs/overview.md +++ b/tests/notifications-worker/docs/overview.md @@ -1,6 +1,6 @@ # notifications-worker-tests - +notifications-worker's tests (the router, the service, the Cloudflare email provider), run on dev A workspace package built by the turbo pipeline. It deploys nothing on its own — its lane type-checks, lints, tests, and builds it for the components that depend on it. diff --git a/tests/policy-engine/component.yaml b/tests/policy-engine/component.yaml index 38e747a..5ba766a 100644 --- a/tests/policy-engine/component.yaml +++ b/tests/policy-engine/component.yaml @@ -2,10 +2,20 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: policy-engine-tests + description: policy-engine's tests (role permissions and API-key policy), run on dev 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-tests subscribe: environments: diff --git a/tests/policy-engine/docs/overview.md b/tests/policy-engine/docs/overview.md index a90e433..f42b8ed 100644 --- a/tests/policy-engine/docs/overview.md +++ b/tests/policy-engine/docs/overview.md @@ -1,6 +1,6 @@ # policy-engine-tests - +policy-engine's tests (role permissions and API-key policy), run on dev A workspace package built by the turbo pipeline. It deploys nothing on its own — its lane type-checks, lints, tests, and builds it for the components that depend on it. diff --git a/tests/policy-worker/component.yaml b/tests/policy-worker/component.yaml index f515f56..095bdf6 100644 --- a/tests/policy-worker/component.yaml +++ b/tests/policy-worker/component.yaml @@ -2,10 +2,20 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: policy-worker-tests + description: policy-worker's tests (its authorization API), run on dev 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-tests subscribe: environments: diff --git a/tests/policy-worker/docs/overview.md b/tests/policy-worker/docs/overview.md index c18fc02..2e47dfd 100644 --- a/tests/policy-worker/docs/overview.md +++ b/tests/policy-worker/docs/overview.md @@ -1,6 +1,6 @@ # policy-worker-tests - +policy-worker's tests (its authorization API), run on dev A workspace package built by the turbo pipeline. It deploys nothing on its own — its lane type-checks, lints, tests, and builds it for the components that depend on it. diff --git a/tests/projects-worker/component.yaml b/tests/projects-worker/component.yaml index 444f106..fe29898 100644 --- a/tests/projects-worker/component.yaml +++ b/tests/projects-worker/component.yaml @@ -2,10 +2,20 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: projects-worker-tests + description: projects-worker's tests, run on dev 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-tests path: tests/projects-worker subscribe: diff --git a/tests/projects-worker/docs/overview.md b/tests/projects-worker/docs/overview.md index dbc336c..4e6a77d 100644 --- a/tests/projects-worker/docs/overview.md +++ b/tests/projects-worker/docs/overview.md @@ -1,6 +1,6 @@ # projects-worker-tests - +projects-worker's tests, run on dev A workspace package built by the turbo pipeline. It deploys nothing on its own — its lane type-checks, lints, tests, and builds it for the components that depend on it. diff --git a/tests/web-console-next/component.yaml b/tests/web-console-next/component.yaml index 325e055..8c9359f 100644 --- a/tests/web-console-next/component.yaml +++ b/tests/web-console-next/component.yaml @@ -2,10 +2,20 @@ apiVersion: sourceplane.io/v1 kind: Component metadata: name: web-console-next-tests + description: The console's tests (navigation, organizations, audit and settings views, app config, UI components), run on dev 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 declares + # (tooling/catalog/gen-component-docs.mjs). + docs: + overview: docs/overview.md + pages: + - { path: docs/architecture.md, role: architecture, title: Architecture } + - { path: docs/runbook.md, role: runbook, title: Runbook } domain: starter-tests subscribe: environments: diff --git a/tests/web-console-next/docs/overview.md b/tests/web-console-next/docs/overview.md index 59c9e08..add2b55 100644 --- a/tests/web-console-next/docs/overview.md +++ b/tests/web-console-next/docs/overview.md @@ -1,6 +1,6 @@ # web-console-next-tests - +The console's tests (navigation, organizations, audit and settings views, app config, UI components), run on dev A workspace package built by the turbo pipeline. It deploys nothing on its own — its lane type-checks, lints, tests, and builds it for the components that depend on it. diff --git a/tooling/catalog/gen-component-docs.mjs b/tooling/catalog/gen-component-docs.mjs index e2d4701..ee05f73 100644 --- a/tooling/catalog/gen-component-docs.mjs +++ b/tooling/catalog/gen-component-docs.mjs @@ -2,8 +2,11 @@ // Generates each component's catalog docs (overview / architecture / runbook) // from its component.yaml and the dependency graph those files already form. // -// Why generated: the workspace Docs library renders a `docs/` folder next to -// every component.yaml, and there are ~40 of them. Hand-written, they drift the +// Why generated: every component.yaml attaches its `docs/` folder in +// `spec.docs` (overview, architecture, runbook), which is what the workspace +// 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) — and there are ~40 of them. Hand-written, they drift the // first time a dependency or a wiring secret changes — and a docs page that // lies about which secret a Worker needs is worse than no page. Everything here // is derived from declarations that CI already validates, so the docs cannot @@ -97,7 +100,11 @@ function discover() { // ── Page bodies ───────────────────────────────────────────────── -const PRODUCT = "cirrus"; +// The tree's own name as rebrand.mjs knows it (`.baseline/identity.json`'s +// `slug`). A product's copy of these pages is rebranded, and only that string +// is renamed into the product's: any other word for this baseline (it was +// "cirrus", which the identity no longer is) ships into every product as is. +const PRODUCT = JSON.parse(fs.readFileSync(path.join(ROOT, ".baseline", "identity.json"), "utf8")).slug; function overview(component, byName, dependents) { const kind = {