diff --git a/.baseline/tasks/01-product.TaskContract.yaml b/.baseline/tasks/01-product.TaskContract.yaml new file mode 100644 index 0000000..a40dd88 --- /dev/null +++ b/.baseline/tasks/01-product.TaskContract.yaml @@ -0,0 +1,24 @@ +# Task contract template for the 01-product landing. +# Unbound to a key on purpose: `orun.task/ensure@v1` seals and attaches it to +# the key the allocator issues. It lives under `.baseline/`, not `tasks/`, +# because `tasks/` is this repository's own work tree (`intent.yaml` `work:`), +# where an unkeyed contract is an error. gates: [] is a DECLARATION — merge +# alone finishes this task; the main convergence is the gate the bootstrap +# watches, not one the plane observes as a PR check. +# +# The whole site in one landing. `affects` names COMPONENTS, by +# metadata.name: the phase's retouch hook reads this list to decide which +# component.yaml files get the redeploy marker, so the deploy set and the task +# plane's statement of the work are one list. +apiVersion: orun.io/v1 +kind: TaskContract +spec: + goal: The site's repository is born and linked, the whole site lands in one pull request, and one convergence builds it with OpenNext and deploys it to stage and prod + affects: + - web + - web-tests + doneWhen: + - repo pushed, main pinned as default, workspace linked (orun cloud link) + - main convergence green (build, deploy and smoke on stage and prod) + - the home page answers on both workers.dev URLs + gates: [] diff --git a/.baseline/tasks/01-scaffold.TaskContract.yaml b/.baseline/tasks/01-scaffold.TaskContract.yaml deleted file mode 100644 index 79aa514..0000000 --- a/.baseline/tasks/01-scaffold.TaskContract.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# Task contract template for the 01-scaffold landing. -# Unbound to a key on purpose: `orun.task/ensure@v1` seals and attaches it to -# the key the allocator issues. It lives under `.baseline/`, not `tasks/`, -# because `tasks/` is this repository's own work tree (`intent.yaml` `work:`), -# where an unkeyed contract is an error. gates: [] is a DECLARATION — merge -# alone finishes this task; the main convergence is the gate the bootstrap -# watches, not one the plane observes as a PR check. -apiVersion: orun.io/v1 -kind: TaskContract -spec: - goal: The site's repository is born — intent, CI, tooling and identity — and linked to its workspace - affects: - - intent.yaml - - .github/workflows - - tooling - - .rebrand - doneWhen: - - repo pushed and main pinned as default - - workspace linked (orun cloud link) - gates: [] diff --git a/.baseline/tasks/02-site.TaskContract.yaml b/.baseline/tasks/02-site.TaskContract.yaml deleted file mode 100644 index 6088e64..0000000 --- a/.baseline/tasks/02-site.TaskContract.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# Task contract template for the 02-site landing. See 01-scaffold's header. -# -# `affects` names COMPONENTS, by metadata.name: the phase's retouch hook reads -# this list to decide which component.yaml files get the redeploy marker, so -# the deploy set and the task plane's statement of the work are one list. -apiVersion: orun.io/v1 -kind: TaskContract -spec: - goal: The site is built by OpenNext and live on stage and prod, its tests green - affects: - - web - - web-tests - doneWhen: - - main convergence green (build, tests, deploy and smoke on stage and prod) - - the home page answers on both workers.dev URLs - gates: [] diff --git a/.baseline/tasks/03-docs.TaskContract.yaml b/.baseline/tasks/03-docs.TaskContract.yaml index 28a7f55..c8f2ba1 100644 --- a/.baseline/tasks/03-docs.TaskContract.yaml +++ b/.baseline/tasks/03-docs.TaskContract.yaml @@ -1,4 +1,4 @@ -# Task contract template for the 03-docs landing. See 01-scaffold's header. +# Task contract template for the 03-docs landing. See 01-product's header. apiVersion: orun.io/v1 kind: TaskContract spec: diff --git a/.github/workflows/baseline.yml b/.github/workflows/baseline.yml index 9077e40..e08cd92 100644 --- a/.github/workflows/baseline.yml +++ b/.github/workflows/baseline.yml @@ -59,7 +59,7 @@ jobs: # registry, compiles every `when` and narration template, and writes # nothing. Then the leak gate (what a site would carry) and the placement # tier (the offline bootstrap: every phase placed and finished by the - # blueprint's own hooks, then the site's own `orun plan` for the 02-site + # blueprint's own hooks, then the site's own `orun plan` for the 01-product # merge). blueprint: runs-on: ubuntu-latest @@ -95,11 +95,11 @@ jobs: git config --global user.name "baseline ci" bash testing/placement.test.sh - # Tier 2. THE SITE IT PRODUCES WORKS: the scaffold's landing and the - # finished site under the checks their pull requests wait on, the stage - # lane's own build, output check and dry deploy, and the built Worker served - # and smoke-tested with the component's own smoke command. Pinned at the - # site's lane version, because that is the orun the site's CI runs. + # Tier 2. THE SITE IT PRODUCES WORKS: the finished site under the checks + # every later pull request of it runs, the stage lane's own build, output + # check and dry deploy, and the built Worker served and smoke-tested with + # the component's own smoke command. Pinned at the site's lane version, + # because that is the orun the site's CI runs. site: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index b44ace2..5e3f2c4 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -26,6 +26,17 @@ permissions: jobs: checks: + # A BOOTSTRAP LANDING IS CHECKED BY `plan` ALONE. The baseline bootstrap + # lands on branches named for its tasks (`orun/BASE-…`) and merges each + # one as soon as its pull request's CI is green; the convergence that the + # merge starts on main installs, builds, deploys and smoke-tests the site + # for real, and the bootstrap watches it to green. Running this job there + # too was the same build twice, and most of each landing's wait — the + # same reason ci.yml skips its lanes on those branches. Its typecheck, + # lint and unit tests are not lost: the baseline's own CI runs them over a + # bootstrapped tree of the very commit being built (its e2e tier), and + # every other pull request of the site runs this job. + if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'orun/BASE-')) }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index 0bd0c88..ffa2fe9 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -11,10 +11,13 @@ not separate workflows. The console card the platform renders is brokered secrets and the programme, and `testing/manifest.test.sh` holds it to what the build document does. -Target wall-clock: **about fifteen minutes** — an estimate summed from the -phases until a bootstrap measures it: three landings, one Next.js build (and -its Pagefind index) per environment, stage and prod deployed side by side -until `03-docs` restores the promotion gate. +Target wall-clock: **about six minutes** — an estimate summed from the +phases until a bootstrap measures it: two landings, each checked by `plan` +alone, one Next.js build (and its Pagefind index) per environment, stage and +prod deployed side by side until `03-docs` restores the promotion gate. +baseline-v1 measured 8m15s from the console's Build (2026-10-15) over three +landings, about 1m41s of it the build sandbox starting; `01-product` drops +one landing and the Checks waits, cirrus-baseline baseline-v22's shape. ## 0. What you need @@ -34,7 +37,7 @@ until `03-docs` restores the promotion gate. **admin-role API key** for headless runs (secret writes below admin are masked as `not_found`). - **The repository allow-listed in the workspace** (console → Settings → Git - repos), unless the credential can write links. `01-scaffold`'s `link` step + repos), unless the credential can write links. `01-product`'s `link` step stops and names the fix if it is not. ## 1. One command: `--resume` @@ -69,14 +72,13 @@ phase whose files are present but branded derives as `drifted`, and | phase | what it lands | verified by | |---|---|---| -| `01-scaffold` | the repository, created and linked; intent, CI, tooling, identity | its PR's checks green, merged | -| `02-site` | `apps/web` + `tests/web`; the brokered Cloudflare secrets | the convergence green (build, deploy, smoke) and both workers.dev URLs answering | +| `01-product` | the repository, created and linked; the brokered Cloudflare secrets; then the whole site in one PR — intent, CI, tooling, identity, `apps/web` + `tests/web` | its PR's `plan` green, merged; the convergence green (build, deploy, smoke) and both workers.dev URLs answering | | `03-docs` | `ai/context/deployment.md` from probed facts; prod's promotion gate and dev's push lanes restored | the final probe | ```bash orun new --blueprint repo-blueprint.yaml --out ~/sites/acme-docs --run-hooks \ - --phase 01-scaffold --values ~/acme-docs.values.yaml -# … then 02-site, then 03-docs + --phase 01-product --values ~/acme-docs.values.yaml +# … then 03-docs ``` Every later phase reads the identity back from `.rebrand/values.json` in the @@ -118,7 +120,7 @@ orun new --blueprint repo-blueprint.yaml \ | requirement | detail | |---|---| -| `GITHUB_TOKEN` | fine-grained PAT: **read** on this repository; on the SITE's repository **contents write**, **pull-requests write**, **actions read+write** (`orun.run/watch@v1` resumes runs with `gh run rerun`), **checks read**; **repository create** on the owner if `01-scaffold` creates it (or pre-create it — supported) | +| `GITHUB_TOKEN` | fine-grained PAT: **read** on this repository; on the SITE's repository **contents write**, **pull-requests write**, **actions read+write** (`orun.run/watch@v1` resumes runs with `gh run rerun`), **checks read**; **repository create** on the owner if `01-product` creates it (or pre-create it — supported) | | classic token caveat | a classic PAT or gh OAuth token also needs the `workflow` scope to push `.github/workflows/` | | pinning | the clone's `--branch ` pins everything: the blueprint, its modules and its hooks' scripts all come from that one commit | @@ -174,15 +176,15 @@ at the tag and refuses the whole catalogue if it 404s. | Symptom | Cause → fix | |---|---| -| `01-scaffold` parks: `waiting for github for ` | the workspace's GitHub connection is to another account. Connect the App installation on `` (console → Integrations → GitHub), then `--resume` | -| `01-scaffold` stops at `link` | the repository is not linked to the workspace and the credential cannot link it. Allow-list it (console → Settings → Git repos) and re-run the phase | -| `02-site` waits on the `providers` probe, then stops | Cloudflare is not connected. Connect it (console → Integrations), then re-run the phase — the probe is a wait, not a failure | +| `01-product` parks: `waiting for github for ` | the workspace's GitHub connection is to another account. Connect the App installation on `` (console → Integrations → GitHub), then `--resume` | +| `01-product` stops at `link` | the repository is not linked to the workspace and the credential cannot link it. Allow-list it (console → Settings → Git repos) and re-run the phase | +| `01-product` waits on the `providers` probe, then stops | Cloudflare is not connected. Connect it (console → Integrations), then re-run the phase — the probe is a wait, not a failure | | Secret WRITE fails `not_found` while listings work | the API key's role is below admin; re-mint it with the admin role | -| Deploy lane: Authentication error (10000) | the connection's token lacks Workers Scripts Write; re-issue it, re-connect, re-run `02-site` | -| Convergence failed AFTER the PR merged; re-running lands nothing | expected on its own — the files are on main. Re-run the phase (`--phase 02-site`, `--redo 02-site`, or the console's Retry): its `retouch` hook gives the landing a diff and the site redeploys | -| The site's `intent.yaml` says `workspace: ws_SET_ME` | `orunWorkspace` was empty and the build ran outside a workspace; set it and re-run `01-scaffold` | +| Deploy lane: Authentication error (10000) | the connection's token lacks Workers Scripts Write; re-issue it, re-connect, re-run `01-product` | +| Convergence failed AFTER the PR merged; re-running lands nothing | expected on its own — the files are on main. Re-run the phase (`--phase 01-product`, `--redo 01-product`, or the console's Retry): its `retouch` hook gives the landing a diff and the site redeploys | +| The site's `intent.yaml` says `workspace: ws_SET_ME` | `orunWorkspace` was empty and the build ran outside a workspace; set it and re-run `01-product` | | A bootstrap stopped before `03-docs`; prod no longer waits on stage | the gate is deferred, not dropped: run `03-docs`, or `node tooling/bootstrap/promotion.mjs --restore --file /intent.yaml` | | `✕ input "productdomain" is required` | all four required inputs must be set on every invocation, single-phase ones included | | `unknown flag: --phase` or a parse error in the blueprint | the CLI is below the v2.58.11 floor | -| `02-site` lanes fail in `build-app`: `Symlink apps/web/node_modules/next is invalid, it points out of the filesystem root` | the site's intent pins stack-tectonic ≥ 0.20.0, whose lane-scoped install links each job's node_modules out of its tree, which Next 16's Turbopack refuses. Pin 0.19.0 (this baseline does; `intent.yaml` says why) | -| `02-site`'s convergence reported green, then `verify` got 404 from both URLs | a second workflow ran on the push to main and the watch took its run (a `checks.yml` that also runs on push). This baseline runs `checks.yml` on pull requests only, and its coverage gate holds the rule; read the CI run on main for the real result | +| `01-product` lanes fail in `build-app`: `Symlink apps/web/node_modules/next is invalid, it points out of the filesystem root` | the site's intent pins stack-tectonic ≥ 0.20.0, whose lane-scoped install links each job's node_modules out of its tree, which Next 16's Turbopack refuses. Pin 0.19.0 (this baseline does; `intent.yaml` says why) | +| `01-product`'s convergence reported green, then `verify` got 404 from both URLs | a second workflow ran on the push to main and the watch took its run (a `checks.yml` that also runs on push). This baseline runs `checks.yml` on pull requests only, and its coverage gate holds the rule; read the CI run on main for the real result | diff --git a/README.md b/README.md index 146e549..fb55731 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,9 @@ orun new --blueprint repo-blueprint.yaml --out ~/sites/acme-docs --run-hooks --r ``` Or, once the platform's registry lists it, from the Orun console (Baselines → -`nextra-docs` → Build). Three phases — `01-scaffold` (the repository, its CI -and identity), `02-site` (the site deployed to stage and prod, -smoke-tested), `03-docs` (the live deployment recorded) — each landing one +`nextra-docs` → Build). Two phases — `01-product` (the repository created, +then the whole site in one pull request, deployed to stage and prod and +smoke-tested) and `03-docs` (the live deployment recorded) — each landing one pull request in the new repository. **[BOOTSTRAP.md](BOOTSTRAP.md)** is the operator guide; [docs/phases/](docs/phases/README.md) has a page per phase. diff --git a/blueprint.yaml b/blueprint.yaml index 82e91b8..cb4dd4a 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -23,7 +23,7 @@ metadata: dark mode and full-text search through a Pagefind index, on Nextra 4 and Next.js, built by OpenNext into one Cloudflare Worker with Static Assets, and CI that deploys it to stage and prod on merge. One provider, one - consent, one token. Live in about fifteen minutes. + consent, one token, one landing. Live in about six minutes. tags: [docs, nextra, mdx, cloudflare, nextjs] spec: source: @@ -91,7 +91,7 @@ spec: example: acme # ── PREVIEW ONLY. repo-blueprint.yaml's `orun.integrations/reconcile@v1` - # hooks mint these, brokered, during 02-site. ───────────────────────────── + # hooks mint these, brokered, during 01-product. ────────────────────────── # Transcribed from those hooks' own `keys:` and `template:` values, so # testing/manifest.test.sh compares this list to the document that mints # them. The console renders them read-only: no credential is ever typed, @@ -115,8 +115,7 @@ spec: epicSlug: nextra-docs-baselining # = repo-blueprint.yaml's `epicSlug` default epicName: "Nextra docs baselining — {productname}" milestones: - - name: 01-scaffold - - name: 02-site + - name: 01-product - name: 03-docs bootstrap: @@ -125,7 +124,7 @@ spec: blueprint: repo-blueprint.yaml # Summed from the phases' expectedMinutes. An estimate until a bootstrap # measures it. - expectedMinutes: 15 + expectedMinutes: 6 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 new file mode 100644 index 0000000..3cdd8c7 --- /dev/null +++ b/docs/phases/01-product.md @@ -0,0 +1,74 @@ +# 01-product — the site, built in one landing + +**Places** the whole tree: the root manifests (`intent.yaml`, `package.json`, +the pnpm workspace and lockfile, `turbo.json`, the kiox pin), +`.github/workflows` (`ci.yml` and `checks.yml` — the baseline's own +`baseline.yml` and `tag.yml` are ignored), the shared TypeScript/ESLint +config and the wrangler renderer, the site's README and its two context +pages, the identity file `.rebrand/values.json`, `.gitkeep` files for the +four discovery roots, `apps/web` (the Nextra site — its content, its theme, +its OpenNext build with the Pagefind index, and its deploy contract) and +`tests/web` (vitest). + +**Requires** both connections live — GitHub (the App installation on +`githuborg`) and Cloudflare — probed, waited for up to ten minutes each, so a +consent can be clicked while it waits. The platform sees a pull request only +through the installation on the account that owns the repository, so the +probe runs before anything is created. + +## What runs + +| hook | what it does | +|---|---| +| `task` (pre) | finds the phase's task (opened by the run-level list) and yields its key | +| `retouch` | the redeploy marker on `apps/web/component.yaml` and `tests/web/component.yaml` (`.baseline/tasks/01-product.TaskContract.yaml`'s `affects`) | +| `git-init`, `git-stage` | the rebrand enumerates with `git ls-files`, so the tree is a staged repo first | +| `rebrand` | renames the baseline's identity to the site's over the whole tree (`tooling/rebrand/rebrand.mjs`) | +| `orun-workspace` | writes the site's workspace into `intent.yaml` (`ws_SET_ME` if there is none — loud, not silent) | +| `work-tree` | removes the baseline's own `work:` block from `intent.yaml` — `specs/` and `tasks/` do not ship | +| `promotion` | defers prod's wait on stage until `03-docs` (both environments deploy side by side) | +| `dev-lanes` | keeps dev's verify lanes off main's convergences until `03-docs` | +| `git-restage`, `rebrand-verify` | refuses the landing if any baseline identity is left | +| `pnpm-lockfile` | confirms the baseline's complete lockfile against the placed tree (a no-op) | +| `repo` | `orun.repo/ensure@v1` — creates `githuborg/reponame` (private unless `repoPrivate=false`) | +| `link` | `orun cloud link` (best effort) then `orun cloud check` — an unlinked repo stops here | +| `secret-workers-deploy` | `orun.integrations/reconcile@v1` — ensures `CLOUDFLARE_API_TOKEN`, brokered from the Cloudflare connection with the `workers-deploy` scope | +| `secret-account-id` | ensures `CLOUDFLARE_ACCOUNT_ID`, the connection fact | +| `land` | one PR, checked by `plan` alone (a bootstrap branch skips the lanes and Checks) and merged on green | +| `converge` (await) | `orun.run/watch@v1` on the merge commit's run; resumes it up to three times | +| `verify` (await) | `orun.http/probe@v1` on both workers.dev URLs | + +## What the convergence does + +`orun plan --changed` plans `web` on stage and prod (deploy) and — dev's push +activation being deferred — nothing on dev. Each deploy lane installs the +workspace INSIDE its own staged tree (stack-tectonic 0.19.0), builds +(`next build` with Turbopack, Pagefind over `.next/server/app`, the OpenNext +bundle), checks the build output, deploys `-web-` with +`wrangler deploy`, and smoke-tests it: the home page must render the docs +theme's navbar and `/_pagefind/pagefind-entry.json` must be the search +index. Stage and prod deploy side by side (this phase deferred the promotion +gate). + +## Verified + +The repository exists and is linked to the workspace, the convergence run for +the merge commit is green, and +`https://-web-{stage,prod}..workers.dev` answer. + +## Troubleshooting + +| symptom | cause → fix | +|---|---| +| parks on `waiting for github for ` | the workspace's GitHub connection is to another account. Connect the App installation on `` (console → Integrations → GitHub), then `--resume` | +| parks on the `providers` probe for cloudflare | Cloudflare is not connected to the workspace. Connect it (console → Integrations → Cloudflare, paste the Account API token) | +| `link` fails: `… is not linked to workspace` | the credential cannot write links and the platform has not linked the repo. Allow-list it (console → Settings → Git repos) and re-run the phase | +| `rebrand-verify` lists leftovers | a file carries an identity form no rule renames. Add a rule to `tooling/rebrand/rebrand.mjs` (and a case to `testing/rebrand.test.sh`) | +| `intent.yaml` says `workspace: ws_SET_ME` | `orunWorkspace` was empty and the build ran outside a workspace. Set it and re-run | +| deploy lane: `secret resolution failed … CLOUDFLARE_API_TOKEN` | the reconcile did not run or minted against a revoked connection. Re-connect and re-run the phase; the reconcile re-mints only what is missing | +| deploy lane: Authentication error (10000) | the connection's token lacks Workers Scripts Write. Re-issue it with the permission groups the console's Connect recipe lists | +| smoke fails right after the FIRST deploy | workers.dev route propagation; the composition retries the first deploy and the smoke with backoff (stack-tectonic ≥ 0.19.0). A convergence resume clears what is left | +| `build-app` fails: `Symlink apps/web/node_modules/next is invalid, it points out of the filesystem root` | the site's `intent.yaml` pins stack-tectonic ≥ 0.20.0 (lane-scoped install). Pin 0.19.0 — `intent.yaml`'s comment says why | +| smoke fails on `/_pagefind/pagefind-entry.json` | the search index was not in the assets: the `build` script in `apps/web/package.json` must run Pagefind over `.next/server/app` AFTER `next build` and BEFORE `opennextjs-cloudflare build`, which copies `public/` into the assets | +| the watch says green, the probe says 404 | another workflow ran on the push and the watch took its run. Only `ci.yml` may run on a push to main | +| re-run lands nothing | the hooks did not run (`--run-hooks`), or the contract names no component — `node tooling/bootstrap/retouch.mjs --check --affects .baseline/tasks/01-product.TaskContract.yaml` in the site's tree says which | diff --git a/docs/phases/01-scaffold.md b/docs/phases/01-scaffold.md deleted file mode 100644 index bbef72a..0000000 --- a/docs/phases/01-scaffold.md +++ /dev/null @@ -1,44 +0,0 @@ -# 01-scaffold — the repo is born - -**Places** the root manifests (`intent.yaml`, `package.json`, the pnpm -workspace and lockfile, `turbo.json`, the kiox pin), `.github/workflows` -(`ci.yml` and `checks.yml` — the baseline's own `baseline.yml` and `tag.yml` -are ignored), the shared TypeScript/ESLint config and the wrangler renderer, -the site's README and its two context pages, the identity file -`.rebrand/values.json`, and `.gitkeep` files for the four discovery roots. - -**Requires** the GitHub App installation on `githuborg` — probed, waited for -up to ten minutes. The platform sees a pull request only through the -installation on the account that owns the repository. - -## What runs - -| hook | what it does | -|---|---| -| `task` (pre) | finds the phase's task (opened by the run-level list) and yields its key | -| `git-init`, `git-stage` | the rebrand enumerates with `git ls-files`, so the tree is a staged repo first | -| `rebrand` | renames the baseline's identity to the site's (`tooling/rebrand/rebrand.mjs`) | -| `orun-workspace` | writes the site's workspace into `intent.yaml` (`ws_SET_ME` if there is none — loud, not silent) | -| `work-tree` | removes the baseline's own `work:` block from `intent.yaml` — `specs/` and `tasks/` do not ship | -| `promotion` | defers prod's wait on stage until `03-docs` (both environments deploy side by side) | -| `dev-lanes` | keeps dev's verify lanes off main's convergences until `03-docs` | -| `rebrand-verify` | refuses the landing if any baseline identity is left | -| `pnpm-lockfile` | prunes the lockfile to the projects placed | -| `repo` | `orun.repo/ensure@v1` — creates `githuborg/reponame` (private unless `repoPrivate=false`) | -| `link` | `orun cloud link` (best effort) then `orun cloud check` — an unlinked repo stops here | -| `land` | one PR, waited for (Checks + `plan`) and merged | - -## Verified - -The repository exists, is linked to the workspace, and its first PR merged -green. Nothing deploys in this phase — there are no components yet — so there -is no convergence to watch. - -## Troubleshooting - -| symptom | cause → fix | -|---|---| -| parks on `waiting for github for ` | the workspace's GitHub connection is to another account. Connect the App installation on `` (console → Integrations → GitHub), then `--resume` | -| `link` fails: `… is not linked to workspace` | the credential cannot write links and the platform has not linked the repo. Allow-list it (console → Settings → Git repos) and re-run the phase | -| `rebrand-verify` lists leftovers | a file carries an identity form no rule renames. Add a rule to `tooling/rebrand/rebrand.mjs` (and a case to `testing/rebrand.test.sh`) | -| `intent.yaml` says `workspace: ws_SET_ME` | `orunWorkspace` was empty and the build ran outside a workspace. Set it and re-run | diff --git a/docs/phases/02-site.md b/docs/phases/02-site.md deleted file mode 100644 index 329c929..0000000 --- a/docs/phases/02-site.md +++ /dev/null @@ -1,53 +0,0 @@ -# 02-site — the site, live - -**Places** `apps/web` (the Nextra site — its content, its theme, its -OpenNext build with the Pagefind index, and its deploy contract) and -`tests/web` (vitest). - -**Requires** `01-scaffold` placed, and both connections live — GitHub (the -owner's App installation) and Cloudflare — probed, waited for up to ten -minutes, so the Cloudflare consent can be clicked while it waits. - -## What runs - -| hook | what it does | -|---|---| -| `task` (pre) | finds the phase's task and yields its key | -| `secret-workers-deploy` (pre) | `orun.integrations/reconcile@v1` — ensures `CLOUDFLARE_API_TOKEN`, brokered from the Cloudflare connection with the `workers-deploy` scope | -| `secret-account-id` (pre) | ensures `CLOUDFLARE_ACCOUNT_ID`, the connection fact | -| `retouch` | the redeploy marker on `apps/web/component.yaml` and `tests/web/component.yaml` (`.baseline/tasks/02-site.TaskContract.yaml`'s `affects`) | -| `stage`, `rebrand`, `restage`, `rebrand-verify` | brands what this phase placed | -| `pnpm-lockfile-seed`, `pnpm-lockfile` | the lockfile from the baseline's complete one, pruned | -| `land` | one PR, merged without waiting on its checks (`wait: false`) — the convergence is the gate | -| `converge` (await) | `orun.run/watch@v1` on the merge commit's run; resumes it up to three times | -| `verify` (await) | `orun.http/probe@v1` on both workers.dev URLs | - -## What the convergence does - -`orun plan --changed` plans `web` on stage and prod (deploy) and — dev's push -activation being deferred — nothing on dev. Each deploy lane installs the -workspace INSIDE its own staged tree (stack-tectonic 0.19.0), builds -(`next build` with Turbopack, Pagefind over `.next/server/app`, the OpenNext -bundle), checks the build output, deploys `-web-` with -`wrangler deploy`, and smoke-tests it: the home page must render the docs -theme's navbar and `/_pagefind/pagefind-entry.json` must be the search -index. Stage and prod deploy side by side (`01-scaffold` deferred the -promotion gate). - -## Verified - -The convergence run for the merge commit is green, and -`https://-web-{stage,prod}..workers.dev` answer. - -## Troubleshooting - -| symptom | cause → fix | -|---|---| -| parks on the `providers` probe | Cloudflare is not connected to the workspace. Connect it (console → Integrations → Cloudflare, paste the Account API token) | -| deploy lane: `secret resolution failed … CLOUDFLARE_API_TOKEN` | the reconcile did not run or minted against a revoked connection. Re-connect and re-run the phase; the reconcile re-mints only what is missing | -| deploy lane: Authentication error (10000) | the connection's token lacks Workers Scripts Write. Re-issue it with the permission groups the console's Connect recipe lists | -| smoke fails right after the FIRST deploy | workers.dev route propagation; the composition retries the first deploy and the smoke with backoff (stack-tectonic ≥ 0.19.0). A convergence resume clears what is left | -| `build-app` fails: `Symlink apps/web/node_modules/next is invalid, it points out of the filesystem root` | the site's `intent.yaml` pins stack-tectonic ≥ 0.20.0 (lane-scoped install). Pin 0.19.0 — `intent.yaml`'s comment says why | -| smoke fails on `/_pagefind/pagefind-entry.json` | the search index was not in the assets: the `build` script in `apps/web/package.json` must run Pagefind over `.next/server/app` AFTER `next build` and BEFORE `opennextjs-cloudflare build`, which copies `public/` into the assets | -| the watch says green, the probe says 404 | another workflow ran on the push and the watch took its run. Only `ci.yml` may run on a push to main | -| re-run lands nothing | the hooks did not run (`--run-hooks`), or the contract names no component — `node tooling/bootstrap/retouch.mjs --check --affects .baseline/tasks/02-site.TaskContract.yaml` in the site's tree says which | diff --git a/docs/phases/03-docs.md b/docs/phases/03-docs.md index daa0ed5..cc0d105 100644 --- a/docs/phases/03-docs.md +++ b/docs/phases/03-docs.md @@ -1,10 +1,10 @@ # 03-docs — the deployment, recorded -**Places** nothing. Its work is hooks: it records what `02-site` built, from +**Places** nothing. Its work is hooks: it records what `01-product` built, from probed facts rather than from what the blueprint intended, and it puts back -the two things `01-scaffold` deferred for the bootstrap's sake. +the two things `01-product` deferred for the bootstrap's sake. -**Requires** `02-site` placed. (A hook-only phase derives as `unknown`, so no +**Requires** `01-product` placed. (A hook-only phase derives as `unknown`, so no phase may require this one.) ## What runs @@ -15,8 +15,8 @@ phase may require this one.) | `promotion` | restores `environments.prod.promotion` — from now on prod deploys only after stage | | `dev-lanes` | restores dev's activation on pushes to main | | `render` | `hooks/render-deployment-docs.sh`: probes `/` and the search index (`/_pagefind/pagefind-entry.json`) on both environments, lists the secrets by name and the workspace's integrations, and regenerates `ai/context/deployment.md` and the README's live-deployment section | -| `land` | one PR, waited for and merged. It touches no component, so it deploys nothing | -| `verify` (await) | the same probe `02-site` ended on | +| `land` | one PR, checked by `plan` alone and merged on green. It touches no component, so it deploys nothing | +| `verify` (await) | the same probe `01-product` ended on | ## Re-running it diff --git a/docs/phases/README.md b/docs/phases/README.md index e602f9d..724b6c0 100644 --- a/docs/phases/README.md +++ b/docs/phases/README.md @@ -1,7 +1,8 @@ -# The phases — one blueprint, three selections +# The phases — one blueprint, two selections -`repo-blueprint.yaml` declares three phases that take a site from **nothing** -to **live on stage and prod, documented**. Run them one at a time with +`repo-blueprint.yaml` declares two phases that take a site from **nothing** +to **live on stage and prod, documented**: one landing builds the whole site, +one records it. Run them one at a time with `--phase `, or the whole sequence unattended with `--resume`. There is no umbrella workflow and no per-phase document: a phase is a selection on one artifact, which is what makes running one alone, months later, from a fresh @@ -27,12 +28,15 @@ Every landing is a pull request on a branch named for its task intent, every component and every composition resolve — and skips the lanes, because the merge runs them on main a minute later, for real, and that convergence is what the phase watches. `checks.yml` (install, typecheck, lint, -test, build) runs on every pull request regardless. +test, build) skips its job on those branches for the same reason — the +convergence builds, deploys and smoke-tests the site, and the baseline's own +CI ran these checks over a bootstrapped tree at the tag being built — and runs +on every other pull request. +So each landing waits for `plan` alone, a few seconds, and merges. | phase | lands | verified by | |---|---|---| -| [`01-scaffold`](01-scaffold.md) | **the GitHub repo created** and born: intent, CI, tooling, identity | repo pushed, workspace-linked, its PR's checks green | -| [`02-site`](02-site.md) | `apps/web` + `tests/web`, deployed to stage and prod side by side | convergence green (build, deploy, smoke) + both URLs answer | +| [`01-product`](01-product.md) | **the GitHub repo created**, then the WHOLE site in one PR: intent, CI, tooling, identity, `apps/web` + `tests/web` — one convergence deploys it to stage and prod side by side | repo workspace-linked, convergence green (build, deploy, smoke) + both URLs answer | | [`03-docs`](03-docs.md) | the live-deployment record; the promotion gate and dev lanes put back | committed manifest matches probed reality | There is no custom-domain phase. Attaching a domain to a Worker needs zone @@ -43,7 +47,7 @@ the site renders is relative. ## Inputs -`01-scaffold` takes the site's identity once and writes it into the repo +`01-product` takes the site's identity once and writes it into the repo (`.rebrand/values.json`); every later phase reads it back from the placed tree. But the blueprint's **required** inputs — `reponame`, `productname`, `productdomain`, `githuborg` — are validated before any phase runs, so they @@ -63,7 +67,7 @@ must be supplied on every invocation, single-phase ones included. A ```bash orun new --blueprint repo-blueprint.yaml \ - --out $HOME/sites/acme-docs --run-hooks --phase 02-site \ + --out $HOME/sites/acme-docs --run-hooks --phase 01-product \ --values ~/acme-docs.values.yaml ``` @@ -73,20 +77,20 @@ which is exactly what makes a dry instantiation of this baseline possible in CI with no workspace and no provider (`testing/placement.test.sh`, `testing/e2e.test.sh`). -## What every phase does after it places +## What 01-product does after it places -Placement writes the baseline's files as they are here. Before a phase lands, -its `post` hooks make them the site's: +Placement writes the baseline's files as they are here. Before the phase +lands, its `post` hooks make them the site's: -1. `retouch` (deploying phases) — one `# orun: redeploy ` line +1. `retouch` — one `# orun: redeploy ` line at the end of each component.yaml its task contract names, so a re-run after a failed convergence still has a diff to land and redeploys exactly those components. 2. `rebrand` → `rebrand --verify` — the identity rename over the whole tree, then a sweep that fails on any of this baseline's identity left behind. -3. `pnpm install --lockfile-only` from the baseline's complete lockfile — - pruned to the projects placed so far, so `--frozen-lockfile` installs - pass. +3. `pnpm install --lockfile-only` over the baseline's complete lockfile — + the whole tree is placed, so it only confirms it and `--frozen-lockfile` + installs pass. ## When a phase fails @@ -94,6 +98,6 @@ its `post` hooks make them the site's: link): nothing was merged. Fix what the message names and re-run the phase. - **After it lands** (the convergence went red): the files are on main. `orun.run/watch@v1` has already resumed the run up to three times. Re-run - the phase (`--phase 02-site`, `--redo 02-site` under `--resume`, or the + the phase (`--phase 01-product`, `--redo 01-product` under `--resume`, or the console's Retry): its `retouch` hook gives the landing a diff and the component redeploys. diff --git a/intent.yaml b/intent.yaml index b5c6f33..5123564 100644 --- a/intent.yaml +++ b/intent.yaml @@ -75,7 +75,7 @@ discovery: # # THIS BLOCK IS THE BASELINE'S OWN. A site built from this baseline has no # `specs/` and no `tasks/` (its bootstrap work lives on the platform), so -# 01-scaffold removes the block, and this comment with it, from the +# 01-product removes the block, and this comment with it, from the # product's copy (tooling/bootstrap/work-tree.mjs). work: epics: specs/epics diff --git a/repo-blueprint.yaml b/repo-blueprint.yaml index d31ddf9..20f20bf 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -7,7 +7,7 @@ metadata: documentation repository (MDX pages, a sidebar and navbar ordered by `_meta`, full-text search through Pagefind, Nextra 4 on Next.js on Cloudflare Workers + Static Assets) and take it from nothing to live on - stage and prod in three phases. Run one at a + stage and prod in one landing, then record it. Run one at a time with `--phase ` or the whole sequence with `--resume`; see docs/phases/README.md for the contract every phase follows, and BOOTSTRAP.md for the operator checklist no script can perform. @@ -44,7 +44,7 @@ inputs: required: true description: >- GitHub owner the site's repository is created under — and the owner in - the source link the site's nav carries. 01-scaffold waits for the App + the source link the site's nav carries. 01-product waits for the App installation on THIS owner before it creates anything: the platform learns of a pull request only through the installation on the account that owns the repository. @@ -68,7 +68,7 @@ inputs: from: workspace description: >- Orun Cloud workspace (ws_…) for the site's remote state. Unset, it is - the workspace the build runs in; with none anywhere, 01-scaffold writes + the workspace the build runs in; with none anywhere, 01-product writes a placeholder that fails loudly rather than silently claiming another tenant's workspace. epicSlug: @@ -230,7 +230,7 @@ modules: # ── the empty discovery roots, declared ────────────────────────────────── # orun's repo-scale gate — and later `orun plan` in the site's own CI — # discovers apps/, infra/, packages/ and tests/, and a missing root is a - # hard failure. They are empty until 02-site fills two of them. A file the + # hard failure. The site fills two of them in the same landing. A file the # tree needs in order to be valid is what a module is for. - name: discovery-roots mode: template @@ -304,27 +304,19 @@ hooks: description: >- Everything the Nextra docs baseline builds for {{ .inputs.productname }} in {{ .inputs.githuborg }}/{{ .inputs.reponame }}: - the repository and its CI, the site live on stage and prod, and the - record of what went live. One milestone per phase, in the order the - phases run; one task per landing, each bound to the pull request - that lands it. + the repository, its CI and the site live on stage and prod in one + landing, then the record of what went live. One milestone per phase, + in the order the phases run; one task per landing, each bound to the + pull request that lands it. owner: me - id: m01 uses: orun.task/ensure@v1 with: kind: milestone epic: "{{ .inputs.epicSlug }}" - name: 01-scaffold + name: 01-product exitCriteria: - repository created under {{ .inputs.githuborg }} and linked to the workspace - - the scaffold merged, main pinned as the default branch - - id: m02 - uses: orun.task/ensure@v1 - with: - kind: milestone - epic: "{{ .inputs.epicSlug }}" - name: 02-site - exitCriteria: - the site built and deployed on stage and prod, its smoke green - the home page answers on both workers.dev URLs - id: m03 @@ -341,27 +333,16 @@ hooks: with: kind: task epic: "{{ .inputs.epicSlug }}" - milestone: 01-scaffold - name: "Scaffold the site's repository" - brief: >- - Create {{ .inputs.githuborg }}/{{ .inputs.reponame }} and land its - foundations as the first pull request: the intent, CI, tooling and - the identity every later phase reads back, branded as - {{ .inputs.productname }}. - prefix: BASE - contract: .baseline/tasks/01-scaffold.TaskContract.yaml - - id: t02 - uses: orun.task/ensure@v1 - with: - kind: task - epic: "{{ .inputs.epicSlug }}" - milestone: 02-site - name: "Deploy the site" + milestone: 01-product + name: "Build the site in one landing" brief: >- - Land the site and its tests, and see the convergence build it with - OpenNext and deploy it to stage and prod, smoke-tested over HTTP. + Create {{ .inputs.githuborg }}/{{ .inputs.reponame }} and land the + whole site as one pull request — intent, CI, tooling, the identity, + the site and its tests, branded as {{ .inputs.productname }} — then + see the convergence build it with OpenNext and deploy it to stage and + prod, smoke-tested over HTTP. prefix: BASE - contract: .baseline/tasks/02-site.TaskContract.yaml + contract: .baseline/tasks/01-product.TaskContract.yaml - id: t03 uses: orun.task/ensure@v1 with: @@ -387,30 +368,46 @@ hooks: # the task plane's milestones carry. A dependency may never point forward # across a phase boundary; orun refuses the blueprint if one does. # +# ONE LANDING BUILDS THE SITE (cirrus-baseline baseline-v22's shape). A landing +# has a fixed cost however small it is — place, open a PR, wait for its +# checks, merge, wait for the convergence to start — and the bootstrap used to +# pay it three times: the scaffold, the site, the record. Nothing in the +# scaffold/site split was order the plan could not carry itself: the site's +# build reads the tooling from the same tree, and the convergence on main is +# what deploys it either way. So 01-product places the whole tree, brands it +# and lands it as one pull request, and its convergence deploys the site to +# stage and prod. 03-docs stays a landing of its own because it records what +# went live and puts back the two bootstrap deferrals. The numbering keeps its +# gap so the names stay the identities the task plane and `--phase` use. +# # One phase places NO modules: `03-docs` is hooks only. It is a phase because # it is a separately landable unit with its own task and its own PR. phases: - - name: 01-scaffold - title: The repo is born - description: Root manifests, tooling, CI, the identity file, and the empty discovery roots. - expectedMinutes: 3 + - name: 01-product + title: The site, built in one landing + description: The whole tree — manifests, tooling, CI, the identity and the Nextra site — branded, landed as one pull request, built by OpenNext with its Pagefind index and deployed to stage and prod by one convergence. + expectedMinutes: 5 narrate: - start: "Creating the repository and writing its foundations — intent, CI, tooling, and the identity every later phase reads back. About {{ .meta.expectedMinutes }} minutes." - await: "Waiting for the first push to settle on main." - done: "{{ .inputs.reponame }} exists on GitHub with {{ .meta.files }} files on main, branded as {{ .inputs.productname }}. That took {{ .meta.elapsed }}." - failed: "The repository did not get off the ground. The log above says where it stopped." - modules: [ai-deployment, ai-operations, discovery-roots, github-workflows, rebrand-values, root-gitignore, root-intent, root-kiox, root-kiox-lock, root-package-json, root-pnpm-lock, root-pnpm-workspace, root-readme, root-turbo, tooling-eslint, tooling-tsconfig, tooling-wire, vscode] + start: "Creating the repository and landing the whole site in one pull request — intent, CI, tooling, the pages, the sidebar and the search index. Then one convergence builds it with OpenNext and deploys it to stage and prod side by side. Usually about {{ .meta.expectedMinutes }} minutes." + await: "The site is building and deploying on both environments. The Next.js build is the long pole; nothing is stuck." + done: "{{ .inputs.reponame }} is live on stage and prod — {{ .meta.files }} files on main, branded as {{ .inputs.productname }}. That took {{ .meta.elapsed }}." + failed: "The site did not come up. The failing lane above names the step — the build, the deploy or the smoke — and a provider error is in its log." + modules: [ai-deployment, ai-operations, discovery-roots, github-workflows, rebrand-values, root-gitignore, root-intent, root-kiox, root-kiox-lock, root-package-json, root-pnpm-lock, root-pnpm-workspace, root-readme, root-turbo, tooling-eslint, tooling-tsconfig, tooling-wire, vscode, web, web-tests] # THE PLATFORM MUST BE ABLE TO SEE THE REPOSITORY BEFORE IT EXISTS. Every # phase lands a pull request that files under its task, and the platform # learns of a PR only through the GitHub App installation on the account # that OWNS the repository. So the owner's connection is asked for here, # before a repository is created, and waited for like any other consent. + # And the Cloudflare connection, which the deploy credentials below are + # minted from — asked for here too, since this phase is the one that + # deploys. `requires.probe` asks reality what a lock file cannot: are both + # connections live right now? requires: probe: - - id: github + - id: providers uses: orun.doctor/check@v1 with: - providers: [github] + providers: [github, cloudflare] githubOwner: "{{ .inputs.githuborg }}" waitSeconds: 600 pollSeconds: 20 @@ -425,14 +422,24 @@ phases: kind: task epic: "{{ .inputs.epicSlug }}" milestone: "{{ .phase.name }}" - name: "Scaffold the site's repository" + name: "Build the site in one landing" prefix: BASE - contract: .baseline/tasks/01-scaffold.TaskContract.yaml - # The identity chain. rebrand.mjs enumerates the tree with - # `git ls-files`, so the output has to be a git repository with a - # populated index BEFORE it runs. `git add -A` only stages; the landing - # commits. + contract: .baseline/tasks/01-product.TaskContract.yaml post: + # A RE-RUN PHASE MUST HAVE SOMETHING TO LAND. A convergence can fail + # AFTER its PR merged, and the merge has already put every file this + # phase places on main; orun derives phase state from the tree, so a + # forced re-run lands an EMPTY diff while the site's CI plans + # `--changed`. So the phase rewrites ONE trailing marker line in each + # component.yaml its contract names — `# orun: redeploy + # ` — and the landing has a diff. The marker is a deploy + # trigger, not state: nothing reads it back. + - id: retouch + run: ["node", "{{ .baseline.dir }}/tooling/bootstrap/retouch.mjs", "--phase", "{{ .phase.name }}", "--affects", "{{ .baseline.dir }}/.baseline/tasks/01-product.TaskContract.yaml"] + # The identity chain. rebrand.mjs enumerates the tree with + # `git ls-files`, so the output has to be a git repository with a + # populated index BEFORE it runs. `git add -A` only stages; the landing + # commits. The whole tree is here, so the one rebrand brands all of it. - id: git-init run: ["git", "init", "-q"] - id: git-stage @@ -474,7 +481,7 @@ phases: run: ["node", "{{ .baseline.dir }}/tooling/bootstrap/work-tree.mjs", "--strip"] # STAGE AND PROD DEPLOY SIDE BY SIDE UNTIL THE BOOTSTRAP IS DONE. The # promotion gate makes prod wait out stage's deploy; during a - # bootstrap both are empty and every phase is watched to green, so it + # bootstrap both are empty and the landing is watched to green, so it # protects nothing and doubles the convergence. Deferred here, # restored by 03-docs. tooling/bootstrap/promotion.mjs. - id: promotion @@ -490,8 +497,10 @@ phases: run: ["git", "add", "-A"] - id: rebrand-verify run: ["node", "{{ .baseline.dir }}/tooling/rebrand/rebrand.mjs", "--verify", "--values", ".rebrand/values.json"] - # The lockfile, pruned to the projects placed so far; the lanes and - # Checks install with --frozen-lockfile. + # root-pnpm-lock places the baseline's complete lockfile and the whole + # tree is here, so this only confirms it — a no-op in well under a + # second, where the old per-phase prune of the Next.js tree was a + # resolve. The lanes and Checks install with --frozen-lockfile. - id: pnpm-lockfile run: ["pnpm", "install", "--lockfile-only"] # The repo has to exist before there is anywhere to land. @@ -522,56 +531,11 @@ phases: - link - "{{ .inputs.orunWorkspace }}" - "{{ .inputs.githuborg }}/{{ .inputs.reponame }}" - # EVERY PHASE IS A PULL REQUEST THAT IS CHECKED, THEN MERGED. This one - # waits for its PR's whole CI run (orun >= v2.58.6): Checks over the - # scaffold, and `plan` — on a bootstrap branch (`orun/BASE-…`) the - # lanes are skipped (ci.yml), because the merge runs them on main. - - id: land - uses: orun.pr/land@v1 - narrate: "The first commit is merged into main." - with: - task: "{{ .phase.hooks.task.outputs.key }}" - epic: "{{ .inputs.epicSlug }}" - branchSlug: "{{ .phase.name }}" - title: "feat(scaffold): the site's repository, its CI and its identity" - - - name: 02-site - title: The site, live - description: Nextra on Next.js, on Workers and Static Assets, built by OpenNext with its Pagefind index and deployed to stage and prod. - expectedMinutes: 8 - narrate: - start: "Now the site itself — the pages, the sidebar and the search index — built by OpenNext and deployed to stage and prod side by side. This is the first phase that touches Cloudflare. Usually about {{ .meta.expectedMinutes }} minutes." - await: "The site is building and deploying on both environments. The Next.js build is the long pole; nothing is stuck." - done: "{{ .meta.files }} files are on main and the site answers on stage and prod. {{ .meta.elapsed }}." - failed: "The site did not come up. The failing lane above names the step — the build, the deploy or the smoke — and a provider error is in its log." - modules: [web, web-tests] - # The first phase that DEPLOYS. `requires.probe` asks reality what a lock - # file cannot: are both connections live right now? - requires: - phases: [01-scaffold] - probe: - - id: providers - uses: orun.doctor/check@v1 - with: - providers: [github, cloudflare] - githubOwner: "{{ .inputs.githuborg }}" - waitSeconds: 600 - pollSeconds: 20 - hooks: - pre: - - id: task - uses: orun.task/ensure@v1 - with: - kind: task - epic: "{{ .inputs.epicSlug }}" - milestone: "{{ .phase.name }}" - name: "Deploy the site" - prefix: BASE - contract: .baseline/tasks/02-site.TaskContract.yaml - # Brokered, one hook per template: `integrations/reconcile` mints from - # ONE connection with ONE scope template. The deploy lane binds both - # keys (the workers-assets composition's `secretBindings`). Keys that - # already exist are kept. + # The deploy credentials, brokered, one hook per template: + # `integrations/reconcile` mints from ONE connection with ONE scope + # template. The deploy lane binds both keys (the workers-assets + # composition's `secretBindings`). Keys that already exist are kept. + # After the link, before the landing whose convergence uses them. - id: secret-workers-deploy uses: orun.integrations/reconcile@v1 with: @@ -584,54 +548,28 @@ phases: provider: cloudflare keys: [CLOUDFLARE_ACCOUNT_ID] template: account-id - post: - # A RE-RUN PHASE MUST HAVE SOMETHING TO LAND. A convergence can fail - # AFTER its PR merged, and the merge has already put every file this - # phase places on main; orun derives phase state from the tree, so a - # forced re-run lands an EMPTY diff while the site's CI plans - # `--changed`. So the phase rewrites ONE trailing marker line in each - # component.yaml its contract names — `# orun: redeploy - # ` — and the landing has a diff. The marker is a deploy - # trigger, not state: nothing reads it back. - - id: retouch - run: ["node", "{{ .baseline.dir }}/tooling/bootstrap/retouch.mjs", "--phase", "{{ .phase.name }}", "--affects", "{{ .baseline.dir }}/.baseline/tasks/02-site.TaskContract.yaml"] - # EVERY PHASE BRANDS WHAT IT PLACED, before it lands: orun writes a - # phase's files between its pre and post hooks, so they arrive - # carrying the baseline's identity after 01-scaffold's rebrand ran. - - id: stage - run: ["git", "add", "-A"] - - id: rebrand - run: ["node", "{{ .baseline.dir }}/tooling/rebrand/rebrand.mjs", "--values", ".rebrand/values.json", "--allow-dirty"] - - id: restage - run: ["git", "add", "-A"] - - id: rebrand-verify - run: ["node", "{{ .baseline.dir }}/tooling/rebrand/rebrand.mjs", "--verify", "--values", ".rebrand/values.json"] - # START FROM THE BASELINE'S COMPLETE LOCKFILE, then let pnpm prune it - # to the projects placed so far: re-resolving only what a phase added - # costs a cold resolve of the Next.js tree, and the complete lockfile - # makes it a prune in seconds. The lockfile carries no identity. - - id: pnpm-lockfile-seed - run: ["cp", "{{ .baseline.dir }}/pnpm-lock.yaml", "pnpm-lock.yaml"] - - id: pnpm-lockfile - run: ["pnpm", "install", "--lockfile-only"] + # THE SITE IS A PULL REQUEST THAT IS CHECKED, THEN MERGED. This + # landing waits for its PR's own CI (orun >= v2.58.6) and merges only + # on green — and on a bootstrap branch (`orun/BASE-…`) that CI is + # `plan` alone: ci.yml skips the lanes and checks.yml skips its job, + # because the merge runs the site's build, deploy and smoke on + # main moments later, for real, and the convergence after the merge + # is what `await` watches to green. - id: land uses: orun.pr/land@v1 - narrate: "The site PR is merged into main." + narrate: "The site is merged into main." with: - # The PR's lane check is `plan`; the convergence this landing - # triggers on main is the real gate, and `await` watches it. - wait: false task: "{{ .phase.hooks.task.outputs.key }}" epic: "{{ .inputs.epicSlug }}" branchSlug: "{{ .phase.name }}" - title: "feat(site): the site on Workers and Static Assets, on stage and prod" + title: "feat: {{ .inputs.productname }}, the whole site from the Nextra docs baseline" await: - id: converge uses: orun.run/watch@v1 narrate: "The site built, deployed and passed its smoke, and the convergence run came back green." with: # The run for the commit THIS landing merged — the branch's newest - # run, read the moment the merge returns, is the previous phase's. + # run, read the moment the merge returns, may be another push's. sha: "{{ .phase.hooks.land.outputs.mergeSha }}" repo: "{{ .inputs.githuborg }}/{{ .inputs.reponame }}" resumeBudget: 3 @@ -644,13 +582,13 @@ phases: - "https://{{ .inputs.reponame }}-web-stage.{{ .inputs.subdomain }}.workers.dev" - "https://{{ .inputs.reponame }}-web-prod.{{ .inputs.subdomain }}.workers.dev" - # Places nothing. It records what the other phases built, from PROBED facts + # Places nothing. It records what 01-product built, from PROBED facts # rather than from what the blueprint intended — which is why it runs last - # and why its verify is the probe 02-site ends on. + # and why its verify is the probe 01-product ends on. - name: 03-docs title: The deployment, recorded description: The live-deployment manifest, rendered from probed reality, and the promotion gate put back. - expectedMinutes: 4 + expectedMinutes: 1 narrate: start: "Now recording what was actually built — probing every URL and writing the deployment manifest into the repository." await: "Probing the live endpoints one last time." @@ -658,7 +596,7 @@ phases: failed: "The deployment record did not land. The site is still live; only the write-up is missing." modules: [] requires: - phases: [02-site] + phases: [01-product] hooks: pre: - id: task @@ -671,7 +609,7 @@ phases: prefix: BASE contract: .baseline/tasks/03-docs.TaskContract.yaml post: - # THE SITE GOES LIVE WITH ITS PROMOTION GATE. 01-scaffold deferred + # THE SITE GOES LIVE WITH ITS PROMOTION GATE. 01-product deferred # `prod.promotion.dependsOn: [stage]`; this, the last landing, puts it # back, and from here on a change reaches prod only after stage. # Restoring touches only intent.yaml's `environments` section, which @@ -679,11 +617,13 @@ phases: # redeploys nothing. - id: promotion run: ["node", "{{ .baseline.dir }}/tooling/bootstrap/promotion.mjs", "--restore"] - # And dev verifies every merge to main again (01-scaffold deferred it). + # 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"] - id: render run: ["bash", "{{ .baseline.dir }}/hooks/render-deployment-docs.sh", ".", "{{ .inputs.orunWorkspace }}", "{{ .baseline.dir }}"] + # Checked by `plan` alone, like 01-product's: a bootstrap branch skips + # the lanes and checks.yml's job, and nothing here builds. - id: land uses: orun.pr/land@v1 narrate: "The deployment record is merged into main." diff --git a/specs/epics/README.md b/specs/epics/README.md index 7b27042..fbe6efc 100644 --- a/specs/epics/README.md +++ b/specs/epics/README.md @@ -7,6 +7,6 @@ folder is the adoption; the merge creates the epic in the workspace. | Epic | Cluster | Status | What it is | |------|---------|--------|------------| -| [`nextra-docs/`](./nextra-docs/) | **ND** | 🟡 ND3 in progress | Vercel's Nextra Docs Starter Kit, equivalent in content and function, running on Cloudflare Workers + Static Assets via OpenNext — and an Orun baseline that instantiates it (ND3) | +| [`nextra-docs/`](./nextra-docs/) | **ND** | 🟡 ND4 in progress | Vercel's Nextra Docs Starter Kit, equivalent in content and function, running on Cloudflare Workers + Static Assets via OpenNext — and an Orun baseline that instantiates it (ND3) | As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`. diff --git a/specs/epics/nextra-docs/IMPLEMENTATION-STATUS.md b/specs/epics/nextra-docs/IMPLEMENTATION-STATUS.md index 9c0652d..bf5ad5b 100644 --- a/specs/epics/nextra-docs/IMPLEMENTATION-STATUS.md +++ b/specs/epics/nextra-docs/IMPLEMENTATION-STATUS.md @@ -8,7 +8,8 @@ the code departed from `design.md` or from the upstream template. | ND0 — the spec | ✅ Shipped | [#1](https://github.com/sourceplane/nextra-docs/pull/1) | | ND1 — the docs on Workers | ✅ Shipped | [#2](https://github.com/sourceplane/nextra-docs/pull/2) | | ND2 — ready to instantiate | ✅ Shipped | [#3](https://github.com/sourceplane/nextra-docs/pull/3) | -| ND3 — a baseline | 🟡 In progress | this PR (ND-4), to be tagged `baseline-v1` | +| ND3 — a baseline | ✅ Shipped | [#4](https://github.com/sourceplane/nextra-docs/pull/4) (ND-4), tagged `baseline-v1`; a console bootstrap of it went live on 2026-10-15 (below) | +| ND4 — one landing | 🟡 In progress | this PR (ND-5), to be tagged `baseline-v2` | ## Departures from the upstream template @@ -99,6 +100,30 @@ the template (MIT). | discovery roots | `infra/`, `packages/` absent | `infra/.gitkeep`, `packages/.gitkeep` | `intent.yaml` discovers them; a bootstrap places the same files | | `tasks/ND-1..3` | no `metadata` | `metadata.name` and `title` | `orun work check` (≥ v2.79) wants them, as the portfolio's did | +## One landing (ND4) + +cirrus-baseline's baseline-v22 builds its whole product in one landing +(`01-product`) and checks each bootstrap pull request with `plan` alone, and +portfolio-starter-kit followed (its PK-6). This baseline now does the same +(ND-5): + +| Before (baseline-v1) | Now | Why | +|---|---|---| +| three phases: `01-scaffold`, `02-site`, `03-docs` | two: `01-product` (every module), `03-docs` (hooks only; its name kept, the gap kept, as Cirrus kept `08-docs`) | a landing has a fixed cost (place, PR, checks, merge, convergence start); nothing in the scaffold/site split was order the plan could not carry | +| `01-scaffold` waited on Checks (install, typecheck, lint, test, build) and `plan`; `02-site` merged without waiting (`wait: false`); `03-docs` waited on both | every landing waits on its PR's CI, which on `orun/BASE-…` is `plan` alone: `ci.yml` skips the lanes and `checks.yml` now skips its job | the convergence on main installs, builds (Turbopack, Pagefind, OpenNext), deploys and smoke-tests the site for real, and this baseline's own CI runs the Checks over a bootstrapped tree at the tag being built (e2e); Checks on the PR was the same build twice, and most of each landing's wait | +| the brokered secrets minted in `02-site`'s `pre` | minted in `01-product`'s `post`, after `repo` and `link`, before `land` | the repository exists and is linked before a secret is written for its project — Cirrus's order | +| `02-site` seeded the lockfile from the baseline's, then pruned | `pnpm install --lockfile-only` only confirms the placed lockfile | the whole tree is placed at once, so the complete lockfile is already the right one | +| `.baseline/tasks/01-scaffold`, `02-site` | `.baseline/tasks/01-product` (`affects: [web, web-tests]` — the retouch set) | one landing, one task | +| the offline bootstrap committed one landing per phase from an empty repository | the repository's empty first commit, then one per phase | on the platform the first pull request opens against an empty "Initial commit" by `orun`; it is the base the one landing's push is planned against (`testing/placement.test.sh` §4, `testing/e2e.test.sh` §2) | +| e2e ran the Checks at the scaffold's landing and at the finished site | at the finished site only | there is no scaffold landing, and no landing waits on Checks | + +Measured on `baseline-v1` from the console's Build, 2026-10-15 +(`nextra-live`, `bst_PW76WBTK`): 8m15s end to end — about 1m41s of build +sandbox start, `01-scaffold` 1m6s, `02-site` 3m20s, `03-docs` 2m8s (its +landing waited 77s on Checks) — and the site went live on stage and prod. +The estimate here is 6 minutes (5 + 1), to be replaced by the first +bootstrap from `baseline-v2`. + ## Verified (ND3) - `orun new --status` reads the blueprint at v2.58.11 (the bootstrap floor) diff --git a/specs/epics/nextra-docs/README.md b/specs/epics/nextra-docs/README.md index a0320ad..9fe6cb1 100644 --- a/specs/epics/nextra-docs/README.md +++ b/specs/epics/nextra-docs/README.md @@ -8,8 +8,8 @@ The upstream content stays the content. What changes is the framework underneath | Field | Value | |-------|-------| -| Status | 🟡 ND0–ND2 shipped (#1, #2, #3); ND3 — a baseline — in progress (ND-4) | -| Cluster | **ND** (ND0–ND3) | +| Status | 🟡 ND0–ND3 shipped (#1–#4); ND4 — one landing — in progress (ND-5) | +| Cluster | **ND** (ND0–ND4) | | Owner(s) | `apps/web` (the site) · `tests/web` (the content-layout and site-identity tests) | | Builds on | `cirrus-baseline` conventions (intent, components, `checks.yml` gate, gated `ci.yml`) — no bounded context of the fleet is needed | | Upstream | [shuding/nextra-docs-template](https://github.com/shuding/nextra-docs-template) (Vercel's "Nextra Docs Starter Kit") | @@ -33,3 +33,4 @@ The upstream content stays the content. What changes is the framework underneath | ND1 — the docs on Workers | `apps/web` on Nextra 4 built by OpenNext, `tests/web`, green checks | `wrangler dev` serves every page and the search index from the worker; Checks green | | ND2 — ready to instantiate | README, as-built status | a reader can run, test, preview and deploy it | | ND3 — a baseline | card, build document, rename, bootstrap tooling, tests | a new docs site goes from nothing to live in three phases; Baseline CI green | +| ND4 — one landing | the site in one landing, each bootstrap landing checked by `plan` alone (cirrus-baseline baseline-v22's shape) | a site bootstrapped from the next tag is live faster than baseline-v1's 8m15s | diff --git a/specs/epics/nextra-docs/design.md b/specs/epics/nextra-docs/design.md index 45d3023..f60da1a 100644 --- a/specs/epics/nextra-docs/design.md +++ b/specs/epics/nextra-docs/design.md @@ -122,14 +122,14 @@ that makes the copy somebody else's. | Cirrus | Here | Why the difference | |---|---|---| -| six phases (scaffold, foundation + data plane, workers, edge + console, domain, docs) | three: `01-scaffold`, `02-site`, `03-docs` | one component deploys; no data plane, no fleet, no bindings | +| `01-product` (the whole product in one landing), `07-domain`, `08-docs` (baseline-v22) | two: `01-product` (the whole site in one landing), `03-docs` (ND-5; three — `01-scaffold`, `02-site`, `03-docs` — before it) | one component deploys; no data plane, no fleet, no bindings, no domain phase | | `CLOUDFLARE_API_TOKEN`, `CLOUDFLARE_D1_TOKEN`, `CLOUDFLARE_ACCOUNT_ID` | `CLOUDFLARE_API_TOKEN` (`workers-deploy`), `CLOUDFLARE_ACCOUNT_ID` | no D1 | | `07-domain` (parked component) | no domain phase, and no `SITE_URL` | `workers-deploy` has no DNS or zone scope; and unlike the portfolio, a Nextra site bakes no absolute link (no sitemap, feed or Open Graph image), so nothing needs the origin | | task contracts in `tasks/` | `.baseline/tasks/` | `tasks/` is this repository's own work tree (`intent.yaml` `work:`), where an unkeyed contract is an error | | ships its own README | ships `.baseline/product/README.md` as the site's README | this README is about the baseline; a site's owner needs the site's | | — | `work-tree.mjs` strips `work:` from the site's intent | a site has no `specs/` or `tasks/` | | stack-tectonic 0.20.0 (lane-scoped install) | 0.19.0 (the job installs in its own tree) | Next 16's Turbopack cannot build through the lane's symlinked `node_modules` (risks ND-K) | -| one push workflow (`ci.yml`) | `checks.yml` on pull requests only | `orun.run/watch@v1` takes the newest run for a commit from any workflow (risks ND-L) | +| one push workflow (`ci.yml`), no `checks.yml` | `checks.yml` on pull requests only, its job skipped on bootstrap branches (`orun/BASE-…`) | `orun.run/watch@v1` takes the newest run for a commit from any workflow (risks ND-L); a bootstrap landing is checked by `plan` alone, as Cirrus's is (ND-5) | | rebrand rules for a SaaS (console prefix, SDK class, CLI bin, API host) | rules for a site: the source link (owner + repo), the `SITE_NAME` seam, the domain, the subdomain, Worker names, secret refs, the repo slug; the upstream template's repository protected | the identity this tree actually carries (risks ND-M) | **Identity in the app** is two literals in `apps/web/app/site.ts`: `SITE_NAME` diff --git a/specs/epics/nextra-docs/epic.yaml b/specs/epics/nextra-docs/epic.yaml index f19a7f5..fa06eed 100644 --- a/specs/epics/nextra-docs/epic.yaml +++ b/specs/epics/nextra-docs/epic.yaml @@ -32,3 +32,9 @@ spec: - "a site built from it carries the site only, renamed throughout to its own name, repository and Worker, through one seam (apps/web/app/site.ts)" - "Baseline CI is green: contract tests, the blueprint read by the pinned orun, the leak gate, the offline bootstrap and the end-to-end tier — the site built on Turbopack in a staged job tree, its own Pagefind index shipped, served and smoke-tested" tasks: [ND-4] + - name: "ND4 — one landing" + exitCriteria: + - "repo-blueprint.yaml builds the site in one landing (`01-product`) and records it in a second (`03-docs`); the card's programme names the same two" + - "a bootstrap landing is checked by `plan` alone: ci.yml skips the lanes and checks.yml its job on `orun/BASE-…` branches" + - "Baseline CI is green, and a site bootstrapped from the next tag is live faster than baseline-v1's measured 8m15s" + tasks: [ND-5] diff --git a/tasks/ND-5.TaskContract.yaml b/tasks/ND-5.TaskContract.yaml new file mode 100644 index 0000000..f11fbb8 --- /dev/null +++ b/tasks/ND-5.TaskContract.yaml @@ -0,0 +1,27 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: ND-5 + title: "One landing builds the site" +spec: + goal: A docs site bootstraps in two landings instead of three — 01-product places, brands and lands the whole site and its convergence builds it (Turbopack, Pagefind, OpenNext) and deploys it to stage and prod, 03-docs records it — and each bootstrap landing is checked by `plan` alone, cirrus-baseline baseline-v22's shape + affects: + - repo-blueprint.yaml + - blueprint.yaml + - .baseline/** + - .github/workflows/** + - docs/phases/** + - tooling/bootstrap/** + - testing/** + - intent.yaml + - README.md + - BOOTSTRAP.md + - specs/** + - tasks/** + doneWhen: + - repo-blueprint.yaml declares two phases, 01-product (every module, the repo, the link, the brokered secrets, one landing, the convergence watch and the probe) and 03-docs, and the card's programme names the same two + - checks.yml skips its job on a bootstrap branch (orun/BASE-…), so each landing waits on plan alone + - Baseline CI is green — contract tests, the blueprint read by the pinned orun, the leak gate, the offline bootstrap (the repository's empty first commit, then one commit per phase) and the end-to-end tier + - a site bootstrapped from the tag cut after this is live on stage and prod faster than baseline-v1's 8m15s + gates: + - checks diff --git a/testing/e2e.test.sh b/testing/e2e.test.sh index 2cc46d1..acb79c3 100644 --- a/testing/e2e.test.sh +++ b/testing/e2e.test.sh @@ -4,13 +4,14 @@ # placement.test.sh proves the tree a bootstrap ends with is the right tree. # This proves it WORKS, by doing to it what its own pipelines will: # -# 1. at the 01-scaffold landing (the commit its first PR merges), run what -# `checks.yml` runs on that PR — install with the lockfile the phase -# pruned, render fixtures, typecheck, lint, test, build. That landing -# WAITS on its checks, so a scaffold they refuse is a bootstrap that never -# gets past phase one; -# 2. at the finished site, the same Checks sequence; -# 3. the stage lane's own steps, rendered by `orun plan` in the site: on a +# 1. at the finished site, what `checks.yml` runs on a pull request — +# install with the committed lockfile, render fixtures, typecheck, lint, +# test, build. The bootstrap's own landings do not wait on it (on a +# `orun/BASE-…` branch the job is skipped and `plan` is the check; the +# convergence on main builds, deploys and smoke-tests the site), so this +# tier is where they run over a bootstrapped tree, and the gate +# every LATER pull request of the site meets; +# 2. the stage lane's own steps, rendered by `orun plan` in the site: on a # pull request (the verify profile) `build-app` — the component's # buildCommand (`next build` with Turbopack, Pagefind over # `.next/server/app`, the OpenNext bundle), the same step the deploy @@ -25,7 +26,7 @@ # out of the filesystem root"). The staged build must also have run on # Turbopack and written its OWN search index — the source tree's is # removed before staging, as a CI checkout has none; -# 4. serve the built Worker with `wrangler dev` and run the component's OWN +# 3. serve the built Worker with `wrangler dev` and run the component's OWN # `smokeCommand` against it, verbatim — the check the real deploy ends # with — and then read every route the site promises: the logo, the # titles and the footer carry the site's name, the GitHub and "Edit this @@ -38,7 +39,8 @@ # bootstrap against a workspace (BOOTSTRAP.md); everything short of it is here. # # Needs: orun, node, pnpm, python3 (+PyYAML), git, curl, and the network for -# `pnpm install` (or a warm store). A few minutes: two installs and builds. +# `pnpm install` (or a warm store). A few minutes: two installs and builds +# (the Checks over the site, and the stage lane's own in its staged tree). set -euo pipefail here="$(cd "$(dirname "$0")" && pwd)" root="$(cd "$here/.." && pwd)" @@ -91,22 +93,19 @@ echo "── the offline bootstrap (testing/lib/bootstrap.sh)" tree="$scratch/$repo" bootstrap_offline "$root" "$tree" "$values" "$scratch/logs" > "$scratch/bootstrap.log" 2>&1 || { echo "FAIL: the offline bootstrap stopped" >&2; tail -40 "$scratch/bootstrap.log" >&2; exit 1; } -echo " 3 phases placed and landed" +echo " 2 phases placed and landed" -# ── 1. the scaffold's own pull request ───────────────────────────────────── -echo "── 01-scaffold's landing, under the checks its PR waits on" -git -C "$tree" worktree add -q "$scratch/at-01" "$(git -C "$tree" rev-parse HEAD~2)" -checks "$scratch/at-01" "$scratch/checks-01.log" - -# ── 2. the finished site ─────────────────────────────────────────────────── -echo "── the finished site, under the same checks" +# ── 1. the finished site ─────────────────────────────────────────────────── +echo "── the finished site, under the checks a pull request of it runs" checks "$tree" "$scratch/checks-site.log" -# ── 3. the deploy lane's steps, for stage ────────────────────────────────── +# ── 2. the deploy lane's steps, for stage ────────────────────────────────── echo "── the stage lane: build-app, verify-build-output, deploy-dry-run" -s01="$(git -C "$tree" rev-parse HEAD~2)"; s02="$(git -C "$tree" rev-parse HEAD~1)" +# The 01-product landing over the repository's empty first commit: every file +# of the site changed, as on its pull request. +s00="$(git -C "$tree" rev-parse HEAD~2)"; s01="$(git -C "$tree" rev-parse HEAD~1)" (cd "$tree" && orun plan --intent intent.yaml --trigger github-pull-request --changed \ - --base "$s01" --head "$s02" --env stage --output "$scratch/plan.json") > "$scratch/plan.log" 2>&1 \ + --base "$s00" --head "$s01" --env stage --output "$scratch/plan.json") > "$scratch/plan.log" 2>&1 \ || { echo "FAIL: orun plan" >&2; tail -15 "$scratch/plan.log" >&2; exit 1; } python3 - "$scratch/plan.json" "$scratch/steps" <<'PY' import json, pathlib, sys @@ -127,7 +126,7 @@ PY # The job's private tree, staged as orun stages it. The source checkout # carries no build output (a CI checkout has none, so the plain-tree build's is # removed rather than copied in), and its dependencies are what the pinned -# composition says: a lane-scoped install ran once in the source tree (step 2 +# composition says: a lane-scoped install ran once in the source tree (step 1 # ran the same command) and is linked in, or the job installs its own. rm -rf "$tree/apps/web/.open-next" "$tree/apps/web/.wrangler" "$tree/apps/web/public/_pagefind" work="$tree/.orun/runs/e2e/web.stage.verify-deploy/work" @@ -174,7 +173,7 @@ if count != len(pages): print(f" the staged build ran on Turbopack and indexed all {count} pages for search") PY -# ── 4. serve it, and smoke it as the deploy does ─────────────────────────── +# ── 3. serve it, and smoke it as the deploy does ─────────────────────────── echo "── wrangler dev over the built Worker" port=$(python3 -c "import socket;s=socket.socket();s.bind(('127.0.0.1',0));print(s.getsockname()[1]);s.close()") (cd "$work/apps/web" && exec setsid pnpm exec wrangler dev --config wrangler.jsonc --ip 127.0.0.1 --port "$port" \ diff --git a/testing/lib/bootstrap.sh b/testing/lib/bootstrap.sh index 43bfd4e..0cb819e 100644 --- a/testing/lib/bootstrap.sh +++ b/testing/lib/bootstrap.sh @@ -10,12 +10,16 @@ # - the typed actions (`uses:` — task, repo, reconcile, land, watch, probe) # are skipped; a landing becomes a commit on `main`, which is what the # next phase's placement sees on the real thing too; +# - the repository's first commit is an empty one, as on the real thing: +# the platform's landing opens the first pull request against an empty +# "Initial commit" by `orun`, and that commit is the base the first +# landing's push is planned against; # - `link` (a `run:` hook that calls `orun cloud`) is skipped — it needs a # workspace; # - `{{ .inputs.* }}` render from the fixture. # Everything else — the rebrand, the re-tenant, the work-tree strip, the -# deferrals and their restore, the retouch marker, the lockfile seed and -# prune, the deployment-docs render — runs exactly as declared. +# deferrals and their restore, the retouch marker, the lockfile check, the +# deployment-docs render — runs exactly as declared. # # Needs: orun, node, pnpm, python3 (+PyYAML), git. @@ -32,6 +36,13 @@ PY ) mkdir -p "$tree"/{apps,infra,packages,tests} "$logs" for d in apps infra packages tests; do touch "$tree/$d/.gitkeep"; done + ( + cd "$tree" + git init -q -b main + git config user.email bootstrap@example.invalid + git config user.name "offline bootstrap" + git commit -q --allow-empty -m "Initial commit" + ) || { echo "FAIL: the repository's first commit" >&2; return 1; } for phase in $(python3 -c "import yaml,sys;print(' '.join(p['name'] for p in yaml.safe_load(open(sys.argv[1]))['phases']))" "$root/repo-blueprint.yaml"); do echo "── $phase: place" diff --git a/testing/phases.test.sh b/testing/phases.test.sh index b43bcb5..11091ce 100644 --- a/testing/phases.test.sh +++ b/testing/phases.test.sh @@ -4,11 +4,13 @@ # what the engine can resolve. # # The partition below is the bootstrap's order, written down a second time on -# purpose: the order is load-bearing (the site cannot land before the tooling -# it builds with, and the deployment record cannot be written before the site -# is live), and a module that drifts into another phase fails at landing time, -# live, with nothing in this repository having looked wrong. Moving one is a -# deliberate change, argued in the diff that edits both places. +# purpose: the order is load-bearing (the deployment record cannot be written +# before the site is live), and a module that drifts into another phase fails +# at landing time, live, with nothing in this repository having looked wrong. +# Moving one is a deliberate change, argued in the diff that edits both places. +# +# ONE LANDING BUILDS THE SITE (PK-6, cirrus-baseline baseline-v22's shape): +# 01-product places every module, and 03-docs only records. # # Adapted from sourceplane/cirrus-baseline's testing/phases.test.sh: the # narration rules and the hook-only rule are Cirrus's, unchanged. @@ -37,17 +39,16 @@ if not phases: sys.exit("repo-blueprint.yaml declares no phases — this check has gone blind") PARTITION = { - "01-scaffold": ["ai-deployment", "ai-operations", "discovery-roots", "github-workflows", - "rebrand-values", "root-gitignore", "root-intent", "root-kiox", - "root-kiox-lock", "root-package-json", "root-pnpm-lock", - "root-pnpm-workspace", "root-readme", "root-turbo", "tooling-eslint", - "tooling-tsconfig", "tooling-wire", "vscode"], - "02-site": ["web", "web-tests"], + "01-product": ["ai-deployment", "ai-operations", "discovery-roots", "github-workflows", + "rebrand-values", "root-gitignore", "root-intent", "root-kiox", + "root-kiox-lock", "root-package-json", "root-pnpm-lock", + "root-pnpm-workspace", "root-readme", "root-turbo", "tooling-eslint", + "tooling-tsconfig", "tooling-wire", "vscode", "web", "web-tests"], "03-docs": [], } HOOK_ONLY = {"03-docs"} # The phases that DEPLOY, and so must give a re-run something to land. -DEPLOYS = {"02-site"} +DEPLOYS = {"01-product"} by_name = {p["name"]: p for p in phases} names = [p["name"] for p in phases] diff --git a/testing/placement.test.sh b/testing/placement.test.sh index 9faa880..a8f289e 100644 --- a/testing/placement.test.sh +++ b/testing/placement.test.sh @@ -16,17 +16,18 @@ # commit; # 3. the product it ends with: branded with no residue, carrying nothing of # the factory, re-tenanted, its gates restored, its record rendered; -# 4. what the product's own CI would do with the 02-site merge: `orun plan` -# for a push to main over exactly that commit — the site deployed to stage -# and prod side by side, nothing on dev, the Worker name, the smoke and -# the secret refs the product's own; +# 4. what the product's own CI would do with the 01-product merge: `orun +# plan` for a push to main over exactly that commit, onto the +# repository's empty first commit — the site deployed to stage and prod +# side by side, nothing on dev, the Worker name, the smoke and the secret +# refs the product's own; # 5. a `--resume` over the finished site places nothing and un-brands nothing. # # testing/e2e.test.sh goes on from here: it installs, builds and serves the # product and runs its smoke against it. # # Needs: orun, node, pnpm, python3 (+PyYAML), git. No credential. The pnpm -# lockfile prune and the deployment-record probes reach the network if they +# lockfile check and the deployment-record probes reach the network if they # can, and pass without it. set -euo pipefail here="$(cd "$(dirname "$0")" && pwd)" @@ -78,7 +79,7 @@ bootstrap_offline "$root" "$tree" "$values" "$scratch/logs" > "$scratch/bootstra echo "FAIL: the offline bootstrap stopped" >&2; tail -40 "$scratch/bootstrap.log" >&2; exit 1; } grep -E '^── ' "$scratch/bootstrap.log" | sed 's/^/ /' commits="$(git -C "$tree" rev-list --count HEAD)" -[ "$commits" = 3 ] || fail "the bootstrap landed $commits commits, not one per phase (3)" +[ "$commits" = 3 ] || fail "the repository has $commits commits, not its first one and one per phase (1 + 2)" # ── 3. the product it ends with ──────────────────────────────────────────── echo "── the site it produced" @@ -151,8 +152,8 @@ for page in (intent.get("repo") or {}).get("docs", {}).get("pages", []): bad(f"intent repo.docs names {page['path']}, which the site does not have") # The landings, as the phases made them. -if not re.search(r"^# orun: redeploy 02-site \S+$", (tree / "apps/web/component.yaml").read_text(), re.M): - bad("apps/web/component.yaml carries no 02-site redeploy marker") +if not re.search(r"^# orun: redeploy 01-product \S+$", (tree / "apps/web/component.yaml").read_text(), re.M): + bad("apps/web/component.yaml carries no 01-product redeploy marker") dep = (tree / "ai/context/deployment.md").read_text() if "GENERATED by the `03-docs` phase" not in dep or f"https://{repo}-web-prod.{sub}.workers.dev" not in dep: bad("ai/context/deployment.md was not rendered for the site") @@ -174,15 +175,17 @@ if problems: print(f" {len(tracked)} tracked files; branded, re-tenanted, gates restored, record rendered") PY -# ── 4. the product's own CI, over the 02-site merge ──────────────────────── -echo "── orun plan in the site, for the push that merged 02-site" -s01="$(git -C "$tree" rev-parse HEAD~2)"; s02="$(git -C "$tree" rev-parse HEAD~1)" -git -C "$tree" checkout -q "$s02" +# ── 4. the product's own CI, over the 01-product merge ───────────────────── +# The one landing's push: from the repository's empty first commit to the +# whole site, as main sees it the moment the pull request merges. +echo "── orun plan in the site, for the push that merged 01-product" +s00="$(git -C "$tree" rev-parse HEAD~2)"; s01="$(git -C "$tree" rev-parse HEAD~1)" +git -C "$tree" checkout -q "$s01" (cd "$tree" && orun validate --intent intent.yaml) > "$scratch/validate.log" 2>&1 \ - || { fail "orun validate refused the site's intent at 02-site"; tail -10 "$scratch/validate.log" >&2; } + || { fail "orun validate refused the site's intent at 01-product"; tail -10 "$scratch/validate.log" >&2; } (cd "$tree" && orun plan --intent intent.yaml --trigger github-push-main --changed \ - --base "$s01" --head "$s02" --output "$scratch/plan.json") > "$scratch/plan.log" 2>&1 \ - || { fail "orun plan failed in the site at 02-site"; tail -15 "$scratch/plan.log" >&2; } + --base "$s00" --head "$s01" --output "$scratch/plan.json") > "$scratch/plan.log" 2>&1 \ + || { fail "orun plan failed in the site at 01-product"; tail -15 "$scratch/plan.log" >&2; } git -C "$tree" checkout -q main python3 - "$scratch/plan.json" "$values" <<'PY' || fails=$((fails + 1)) import json, sys @@ -192,7 +195,7 @@ problems = [] def bad(m): problems.append(m) jobs = {(j["component"], j["environment"]): j for j in plan["jobs"]} if set(jobs) != {("web", "stage"), ("web", "prod")}: - bad(f"the 02-site merge plans {sorted(jobs)}; it must deploy web to stage and prod and nothing else") + bad(f"the 01-product merge plans {sorted(jobs)}; it must deploy web to stage and prod and nothing else") for (comp, env), j in jobs.items(): if not j["profile"].endswith(".deploy"): bad(f"{comp}@{env} plans profile {j['profile']}, not a deploy") diff --git a/testing/retouch.test.sh b/testing/retouch.test.sh index 78dd179..e524cd9 100755 --- a/testing/retouch.test.sh +++ b/testing/retouch.test.sh @@ -193,7 +193,7 @@ while IFS= read -r line; do bad "a retouch hook does not resolve: $argv"; sed 's/^/ /' "$tmp/hook.log" >&2 fi done < <(grep -E '^\s*run: \[.*retouch\.mjs' "$root/repo-blueprint.yaml") -[ "$hooks" -ge 1 ] || bad "only $hooks retouch hook(s) in repo-blueprint.yaml — 02-site lands the deployable site and needs one" +[ "$hooks" -ge 1 ] || bad "only $hooks retouch hook(s) in repo-blueprint.yaml — 01-product lands the deployable site and needs one" [ "$fail" -eq 0 ] || exit 1 echo "retouch.test.sh: ok" diff --git a/tooling/bootstrap/dev-lanes.mjs b/tooling/bootstrap/dev-lanes.mjs index b0f9543..8ce3fbb 100755 --- a/tooling/bootstrap/dev-lanes.mjs +++ b/tooling/bootstrap/dev-lanes.mjs @@ -15,10 +15,10 @@ // where this tool comes from: dev took eight of eighteen lanes and stage and // prod got five each.) // -// So 01-scaffold defers the trigger and 03-docs, the last landing, puts it +// So 01-product defers the trigger and 03-docs, the last landing, puts it // back, exactly as tooling/bootstrap/promotion.mjs does for prod's gate: // -// node tooling/bootstrap/dev-lanes.mjs --defer # 01-scaffold, before the first landing +// node tooling/bootstrap/dev-lanes.mjs --defer # 01-product, before its landing // node tooling/bootstrap/dev-lanes.mjs --restore # 03-docs, the last landing // node tooling/bootstrap/dev-lanes.mjs --check # prints deferred | active // diff --git a/tooling/bootstrap/promotion.mjs b/tooling/bootstrap/promotion.mjs index 7aef64d..ed6edf8 100644 --- a/tooling/bootstrap/promotion.mjs +++ b/tooling/bootstrap/promotion.mjs @@ -10,9 +10,9 @@ // is watched to green before the next one starts) and it doubles the length // of every convergence: each worker's prod deploy waits out its stage deploy. // -// So 01-scaffold defers the gate and 03-docs, the last landing, puts it back: +// So 01-product defers the gate and 03-docs, the last landing, puts it back: // -// node tooling/bootstrap/promotion.mjs --defer # 01-scaffold, before the first landing +// node tooling/bootstrap/promotion.mjs --defer # 01-product, before its landing // node tooling/bootstrap/promotion.mjs --restore # 03-docs, the last landing // node tooling/bootstrap/promotion.mjs --check # prints deferred | enforced // diff --git a/tooling/bootstrap/retouch.mjs b/tooling/bootstrap/retouch.mjs index 65718ec..26c31b2 100644 --- a/tooling/bootstrap/retouch.mjs +++ b/tooling/bootstrap/retouch.mjs @@ -29,8 +29,8 @@ // phase state is DERIVED from the tree, never stored in it — holds. Delete the // line and nothing is lost but the next redeploy's reason to happen. // -// node retouch.mjs --phase 02-site --affects .baseline/tasks/02-site.TaskContract.yaml -// node retouch.mjs --phase 02-site --components web,web-tests +// node retouch.mjs --phase 01-product --affects .baseline/tasks/01-product.TaskContract.yaml +// node retouch.mjs --phase 01-product --components web,web-tests // // Options: // --phase the phase the marker names (required) diff --git a/tooling/bootstrap/work-tree.mjs b/tooling/bootstrap/work-tree.mjs index cf9eabd..ac16e62 100644 --- a/tooling/bootstrap/work-tree.mjs +++ b/tooling/bootstrap/work-tree.mjs @@ -15,9 +15,9 @@ // block would point the product's every plan at two directories that do not // exist. // -// So 01-scaffold removes it from the product's copy, before the first landing: +// So 01-product removes it from the product's copy, before its landing: // -// node tooling/bootstrap/work-tree.mjs --strip # 01-scaffold +// node tooling/bootstrap/work-tree.mjs --strip # 01-product // node tooling/bootstrap/work-tree.mjs --check # prints declared | absent // // The block removed is the top-level `work:` key with everything indented