Skip to content

PS4: platforms-starter-kit becomes an Orun baseline - #5

Merged
ruehowl merged 1 commit into
mainfrom
claude/blissful-ptolemy-c5ajf8
Oct 15, 2026
Merged

ruehowl merged 1 commit into
mainfrom
claude/blissful-ptolemy-c5ajf8

Conversation

@ruehowl

@ruehowl ruehowl commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

PS4 (task PS-5). The repository is now an Orun baseline. blueprint.yaml is the console card and repo-blueprint.yaml is the build. Together they take a new multi-tenant product from nothing to live on stage and prod in one landing. This is cirrus-baseline v22's two-phase shape, ported from kv-redis-starter's baseline-v1. The generic parts are copied verbatim, as the porting note says.

What was added

  • Two phases. 01-product places every module (21) and brands it. It re-tenants the workspace, strips the work tree, and defers prod's promotion gate and dev's push lanes. It then reconciles CLOUDFLARE_API_TOKEN (workers-deploy) and CLOUDFLARE_ACCOUNT_ID (account-id) and lands everything as one PR. Its await watches the convergence on the merge sha, checks WIRING_CLOUDFLARE_KV exists on stage and prod (orun.secrets/exists@v1), and probes both workers.dev URLs. 02-docs places nothing: it restores the two deferrals, renders the deployment record and lands it. Epic slug platforms-baselining, task prefix BASE, contracts in .baseline/tasks/.
  • The KV namespace is applied before the app. apps/web declares dependsOn: cloudflare-kv with mode: enforced, plus a modeRules entry that makes it advisory on github-pull-request. The product's own push-to-main plan:
    level 0  cloudflare-kv.prod.terraform
    level 0  cloudflare-kv.stage.terraform
    level 1  web.prod.verify-deploy   ← waits on cloudflare-kv.prod.terraform
    level 1  web.stage.verify-deploy  ← waits on cloudflare-kv.stage.terraform
    
  • workers.dev works end to end with no custom domain. A request that is not on the root domain gets tenants as a path on its own host, /s/<tenant> (apps/web/lib/addresses.ts). The landing form offers that path, creating a tenant redirects to it, and /admin and the tenant page link to it. On the root domain, links stay upstream's subdomains, and the proxy is unchanged.
  • BASE_DOMAIN. It is still the build input: the product domain on prod and dev, stage.<domain> on stage. The zone, the wildcard DNS record and the Worker route are the owner's follow-up. The product README covers it under "Tenant subdomains".
  • /admin. It keeps upstream's no-auth TODO. There is no third-party provider for rule 8 to degrade. The docs say to put Cloudflare Access in front of it.
  • Two fixes for problems that were already there. No Orun lane had ever run, so neither had shown up:
    • apps/web/wrangler.jsonc is now committed as the fixture render. verify-app-structure checks that it exists before the build, and Checks diffs it.
    • dev now renders its config from the fixture (live.mjs --fixture … --fixture-envs dev).
  • Smaller changes:
    • Pins: stack-tectonic 0.19.0, orun lane pin v2.78.4.
    • Workflows: checks.yml runs on pull requests only, and ci.yml skips while the workspace is ws_CHANGE_ME.
    • Tree: packages/.gitkeep, and the app/site.ts name seam.
    • The web smoke now checks two things. / must name <host>/s/, which only the Worker rendering per request can do. /admin must answer, which needs the KV read.
    • Task contracts PS-1 to PS-4 now carry their keys.
  • Also added: .baseline/, tooling/{rebrand,bootstrap}, hooks/render-deployment-docs.sh, ai/context/, docs/phases/, BOOTSTRAP.md, testing/, baseline.yml and tag.yml. The specs are updated with design §8b and §9 and risks PS-I to PS-L.

How it was verified

  • Repo checks: pnpm install --frozen-lockfile, wire:fixture (the committed config matches the render), typecheck, lint (upstream's two any warnings), test (28 tests), build (ƒ /, ○ /_not-found, ƒ /admin, ƒ /s/[subdomain]).
  • Contract tests: testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer,wire}.test.sh are green.
  • leak (v2.79.0 and v2.58.11): 84 files derived, and none of the 78 shipped sources names a factory path.
  • placement (v2.78.4 and v2.79.0; v2.58.11 is refused by design):
    • Both phases bootstrap offline, and the branded product (Sam's Tenants & Co / acme-inc/acme-platforms, root tenants.acme.dev) has no residue.
    • The product's own push-to-main plan puts the KV apply before the web deploy, as shown above. On a pull request nothing waits.
    • The 02-docs merge plans 0 jobs, and --resume changes nothing.
  • e2e (v2.78.4 and v2.79.0):
    • The landing commit passes the Checks steps.
    • The stage lane's verify-app-structure, build-app, verify-build-output and deploy-dry-run pass in the job tree staged the way orun stages it. KV is bound to the stage document's id, and the build includes stage.tenants.acme.dev.
    • Under wrangler dev, the component's own smoke passes.
    • A tenant is created through the landing form exactly as a browser without JavaScript submits it (303 → /s/acme-e2e). It is read back through the Worker on its page, on /admin, and by the action refusing a duplicate. It is also served as acme-e2e.stage.tenants.acme.dev via a Host header.
    • /admin redirects away on tenant hosts, unknown tenants and paths return 404, assets are served, and the tenant is gone after deletion.
  • orun: orun new --status succeeds at v2.58.11, v2.78.4 and 2.79.0 (01-product 84 files, 02-docs hook-only). orun validate and orun work check are clean.
  • Terraform: terraform validate passes on infra/terraform/cloudflare-kv. That is the offline limit: a plan needs the account.
  • Not verified: a live bootstrap against a workspace (real apply, minted token, deploy, probes) and tenant subdomains on a real zone. These are risk PS-K.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AuyckrXahuAVgdmxamUUtk


Generated by Claude Code

The repository is now a baseline: blueprint.yaml (the console card) and
repo-blueprint.yaml (the build) take a new multi-tenant product from
nothing to live on stage and prod in TWO phases, cirrus-baseline v22's
one-landing shape, ported from kv-redis-starter's baseline-v1:

- 01-product places every module (root files, CI, tooling, the KV root,
  the app, its tests), retouches, brands, re-tenants, strips the work
  tree, defers prod's promotion gate and dev's push lanes, lands it as one
  pull request after reconciling CLOUDFLARE_API_TOKEN (workers-deploy:
  Workers Scripts and KV Storage) and CLOUDFLARE_ACCOUNT_ID, then watches
  the convergence, checks WIRING_CLOUDFLARE_KV exists on stage and prod,
  and probes both workers.dev URLs.
- 02-docs is hook-only: restores the two deferrals, renders the
  deployment record, lands it.

Infra before app: apps/web depends on cloudflare-kv with mode: enforced
on github-push-main and advisory on pull requests. The product's own
push-to-main plan puts cloudflare-kv.{stage,prod}.terraform at lane level
0 and web.{stage,prod}.verify-deploy at level 1, each waiting on its own
environment's apply.

workers.dev, end to end, with no custom domain: tenant subdomains need a
zone and a wildcard route a fresh build does not have, so off the root
domain a tenant is a path on the request's host, /s/<tenant>
(apps/web/lib/addresses.ts). The landing form offers it, creating a
tenant redirects to it, /admin and the tenant page link to it; on the
root domain the links are upstream's subdomains. The root domain stays
BASE_DOMAIN (productdomain on prod, stage.<productdomain> on stage); the
zone, wildcard DNS record and Worker route are the owner's follow-up,
documented in the product README. /admin keeps upstream's no-auth TODO
(no third-party provider to degrade); the README says to gate it with
Cloudflare Access.

Fixed on the way, latent since PS1 because no Orun lane had run:
- wrangler.jsonc is committed as the fixture render; the composition's
  verify-app-structure checks it exists BEFORE the build.
- dev, which no root applies to, renders the fixture
  (live.mjs --fixture --fixture-envs dev).
Also: packages/ (a required discovery root), stack-tectonic 0.19.0, the
orun lane pin v2.78.4, checks.yml on pull requests only, the ci.yml
ws_CHANGE_ME gate, the site.ts identity seam, a smoke that proves the
Worker renders per request and reads KV, keyed task contracts.

Tests (testing/, baseline.yml): manifest, phases, coverage, rebrand,
retouch, bootstrap-defer, wire, leak, placement (both phases offline, the
product's own plans) and e2e (the stage lane's steps incl.
verify-app-structure in the staged job tree, wrangler dev, the
component's smoke, a tenant created through the landing form and read
back through the Worker by path, on /admin and as a subdomain).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AuyckrXahuAVgdmxamUUtk
@ruehowl
ruehowl marked this pull request as ready for review October 15, 2026 20:06
@ruehowl
ruehowl merged commit cb1ee6b into main Oct 15, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants