Skip to content

CM4: commerce 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

CM4 (task CM-5): the repository becomes an Orun baseline in cirrus-baseline v22's one-landing shape, ported from kv-redis-starter's conversion (sourceplane/kv-redis-starter#5). Its infra is an R2 bucket (the storefront's Next.js data cache), and its third party, Shopify, is no longer a precondition of going live.

What was added

The baseline layer (copied from kv-redis-starter where the porting note calls it generic, adapted elsewhere)

  • blueprint.yaml (the card) and repo-blueprint.yaml (the build): two phases.
    • 01-product places every module, then runs retouch → git-init → stage → rebrand → orun-workspace → work-tree strip → promotion/dev-lanes defer → restage → rebrand-verify → pnpm lockfile → orun.repo/ensure@v1 → link → three orun.integrations/reconcile@v1 hooks → orun.pr/land@v1. Its await runs orun.run/watch@v1 on the merge sha, then orun.secrets/exists@v1 for WIRING_CLOUDFLARE_R2 on stage and prod, then orun.http/probe@v1 on both URLs.
    • 02-docs is hook-only: it restores both deferrals, renders the deployment record, lands, and probes.
  • .baseline/ (identity, task contracts, the product README), tooling/rebrand (only its header and defaults changed), tooling/bootstrap, tooling/wire (now with --fixture-envs), hooks/render-deployment-docs.sh, ai/context/, docs/phases/, BOOTSTRAP.md.
  • testing/ (the full suite) and .github/workflows/{baseline,tag}.yml. ci.yml now has the linked gate, and checks.yml runs on PRs only.

Infra before app. apps/web declares dependsOn: cloudflare-r2 with mode: enforced and a modeRules entry that makes it advisory on github-pull-request. The product's own push-to-main plan (placement tier) comes out as:

job profile level waits on token
cloudflare-r2.{stage,prod}.terraform terraform.apply 0 — CLOUDFLARE_R2_TOKEN
web.{stage,prod}.verify-deploy cloudflare-workers-assets-turbo.deploy 1 its own env's R2 apply CLOUDFLARE_API_TOKEN

The R2 key. workers-deploy carries no R2. The R2 root now binds its provider CLOUDFLARE_API_TOKEN to CLOUDFLARE_R2_TOKEN, which a separate r2-data reconcile hook mints. The card's spec.secrets mirrors all three keys (workers-deploy, r2-data, account-id), and manifest.test.sh checks them against the hooks.

No third-party key on a fresh build. Rule 8 applies: Shopify is a third party.

  • Every export of lib/shopify is now a switch. With SHOPIFY_STORE_DOMAIN set it calls upstream's cached Storefront API reader, unchanged. Unset, it answers from lib/demo: six products with variants (one sold out), collections including the two hidden-homepage-*, menus, pages, and SVG images in public/demo. The cart is a cookie, priced from the catalogue on every read.
  • The switch sits outside "use cache", so no cached demo answer survives connecting a store.
  • New routes: /cart (rendered on the server) and /checkout. Without a store, /checkout answers 200 with "Connect a payment provider to enable checkout"; with one, it forwards to Shopify's hosted checkout.
  • A banner on every page says the store is a demo.
  • The product README, under "Connecting Shopify", documents the three Worker secrets, the menus and collections the storefront expects, and the revalidation webhooks.

Latent faults fixed

  • wrangler.jsonc is now committed as the fixture render. verify-app-structure checks for it before the build, and Checks diffs it.
  • The dev lane renders from the fixture.
  • Added packages/.gitkeep.
  • Next 16 passes Promise params to the two image routes; they now await them.
  • The sitemap no longer returns a 500 without a store.
  • tasks/CM-1..4 gained metadata, so orun work check passes.

Other changes

  • No SITE_URL: metadata, robots and the sitemap are built on the request's origin.
  • The store's name and source link live in apps/web/app/site.ts.
  • The smoke check is now / plus a robots.txt that must name the origin it was asked on. It does not depend on the name or the store backend.
  • The slug commerce is an English word. No shipped file spells it, or Commerce, outside an identity form, and the leak gate enforces this. Upstream is credited by description instead.

How it was verified

  • pnpm install --frozen-lockfile, wire:fixture + git diff --exit-code, typecheck, lint, test (6 files, 33 tests), build: green on Node 22.
  • testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer,wire}.test.sh: green.
  • testing/leak.test.sh: green at v2.58.11 and v2.79.0. 140 files derived, 133 shipped sources scanned.
  • testing/placement.test.sh: green at v2.78.4 and v2.79.0. At v2.58.11 the test refuses to run, by design. It covers the offline bootstrap of both phases, the product's own push-to-main plan above, the PR plan (nothing waits), the 02-docs merge (0 jobs), and --resume (a no-op).
  • testing/e2e.test.sh: green at v2.78.4 and v2.79.0.
    • Checks pass on the 01-product landing.
    • The stage lane runs in the staged tree: verify-app-structure, build-app, verify-build-output, deploy-dry-run. The bucket name comes from the stage wiring document.
    • Under wrangler dev, with no Shopify key, the component's smoke passes.
    • A shopper flow: home → /product/cloud-tee?color=Black&size=S → Add To Cart twice through the build's own addItem server action → /cart shows 2 → Proceed to Checkout → /checkout shows the payment-provider notice.
    • Search, a collection, a page, robots, the sitemap, OG images, static assets and 404s all answer.
  • orun new --status at v2.58.11, v2.78.4 and 2.79.0: 01-product places 140 files and 02-docs is hook-only. orun validate and orun work check are clean.
  • terraform validate passes on infra/terraform/cloudflare-r2. adopt.tf needs the Cloudflare API at plan time, so offline verification stops at validate.

Not verified (offline only):

  • A live bootstrap: tokens minted, the bucket applied, the Worker deployed with its R2 and Durable Object bindings, the probes.
  • Whether the workers-deploy token is enough to upload a Worker that binds an R2 bucket. This is risk CM-M; if a live deploy refuses it, the fix is to give the deploy the r2-data key as well.
  • Any real Shopify store.

🤖 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 storefront from nothing to live
on stage and prod in TWO phases, cirrus-baseline v22's one-landing shape,
ported from kv-redis-starter's conversion:

- 01-product places every module (root files, CI, tooling, the R2 root,
  the storefront, its tests), retouches, brands, re-tenants, strips the
  work tree, defers prod's promotion gate and dev's push lanes, confirms
  the lockfile, ensures and links the repository, reconciles three
  brokered keys - CLOUDFLARE_API_TOKEN (workers-deploy), CLOUDFLARE_R2_TOKEN
  (r2-data) and CLOUDFLARE_ACCOUNT_ID (account-id) - and lands it as one
  pull request; it then watches the merge's convergence, checks
  WIRING_CLOUDFLARE_R2 exists on stage and prod, and probes both URLs.
- 02-docs is hook-only: restores the two deferrals, renders the
  deployment record from probed facts, lands it.

INFRA BEFORE APP. apps/web depends on cloudflare-r2 with mode: enforced
(advisory on github-pull-request), so the product's own push-to-main plan
applies the bucket at lane level 0 and deploys each Worker at level 1,
waiting on its own environment's apply alone.

THE R2 KEY. workers-deploy grants Workers Scripts and KV and no R2, so the
R2 root now binds its provider token to CLOUDFLARE_R2_TOKEN, minted from
r2-data by its own reconcile hook; the card's spec.secrets mirrors it.

NO THIRD-PARTY KEY ON A FRESH BUILD. Shopify is not a provider the platform
brokers, so every function lib/shopify exports is now a switch: with
SHOPIFY_STORE_DOMAIN set, upstream's cached Storefront API reader; unset,
lib/demo - a bundled catalogue (six products with variants, collections,
menus, pages, SVG images) and a cookie cart priced from it. The switch is
outside "use cache", so no demo answer outlives a connected store. A /cart
page renders the cart on the server; /checkout answers 200 with "Connect a
payment provider to enable checkout" (or forwards to Shopify's checkout);
a banner says the store is a demo. The product's README documents
connecting Shopify (three Worker secrets, the webhooks).

The port's latent faults, fixed: wrangler.jsonc committed as the fixture
render (verify-app-structure checks it before the build); dev renders the
fixture; packages/.gitkeep; Next 16's Promise params in the two image
routes; the sitemap's 500 without a store. No SITE_URL: metadata, robots
and the sitemap are built on the request's origin. The store's name and
source link are apps/web/app/site.ts. The slug is an English word, so no
shipped file spells it (or "Commerce") outside an identity form, and the
leak gate holds that.

Verified: the contract tests, the leak gate (v2.58.11, v2.79.0), placement
with the product's own plan (v2.78.4, v2.79.0), the e2e (v2.78.4, v2.79.0:
the stage lane in the staged tree, wrangler dev, the smoke, browse to a
product, add it to the cart through the build's server action, check out
to the payment-provider notice), orun new --status at three versions,
orun validate, orun work check, terraform validate, and the repository's
own Checks. Not verified: a live bootstrap, or a real Shopify store.

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 9f69ea4 into main Oct 15, 2026
6 checks passed
ruehowl added a commit that referenced this pull request Oct 21, 2026
…text pack (#6)

* CM5: the cirrus standard — no kiox, generated component docs, the context pack

- Remove kiox.yaml/kiox.lock and their two blueprint modules: nothing ran
  the kiox pin (v2.15.0); every workflow pins orun through orun-action.
- Generate docs/{overview,architecture,runbook}.md for every component
  from what it declares (tooling/catalog/gen-component-docs.py), and fail
  Baseline CI when they drift (--check).
- Add ai/context/{current,decisions,open-risks}.md (this repository's own;
  nothing places them).
- Close out CM4 (shipped in #5, tagged baseline-v1) and record CM5 (CM-6).
- Make the docs say what CM4 built: risk CM-B and design §2/§7 no longer
  list wrangler vars or call CM-B open; the status file no longer cites a
  .dev.vars.example that CM4 folded into .env.example; the epic README's
  gate says offline is terraform validate only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D8AmgTwmnp4M8mgmnS9aha

* Regenerate component docs: prettier-padded tables, accurate wording

The generator now lays tables out the way prettier does (an app whose lint
is `prettier --check` accepts the pages as written), lists the WIRING_*
failure only for Workers that take wiring, and no longer claims a package
holds no credentials.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D8AmgTwmnp4M8mgmnS9aha

* Component docs: list optional and per-environment secrets

The generator now reads `optionalSecretEnv` (listed as "(optional)") and
secrets declared per environment under `subscribe.environments[]`, so a
page no longer leaves out a secret its component declares. Its tables are
laid out as prettier lays them out, the WIRING_* failure is listed only
for Workers that take wiring, and a package is no longer said to hold no
credentials. Every starter now carries the identical generator.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D8AmgTwmnp4M8mgmnS9aha

---------

Co-authored-by: Claude <noreply@anthropic.com>
ruehowl added a commit that referenced this pull request Oct 21, 2026
* CM5: the cirrus standard — no kiox, generated component docs, the context pack

- Remove kiox.yaml/kiox.lock and their two blueprint modules: nothing ran
  the kiox pin (v2.15.0); every workflow pins orun through orun-action.
- Generate docs/{overview,architecture,runbook}.md for every component
  from what it declares (tooling/catalog/gen-component-docs.py), and fail
  Baseline CI when they drift (--check).
- Add ai/context/{current,decisions,open-risks}.md (this repository's own;
  nothing places them).
- Close out CM4 (shipped in #5, tagged baseline-v1) and record CM5 (CM-6).
- Make the docs say what CM4 built: risk CM-B and design §2/§7 no longer
  list wrangler vars or call CM-B open; the status file no longer cites a
  .dev.vars.example that CM4 folded into .env.example; the epic README's
  gate says offline is terraform validate only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D8AmgTwmnp4M8mgmnS9aha

* Regenerate component docs: prettier-padded tables, accurate wording

The generator now lays tables out the way prettier does (an app whose lint
is `prettier --check` accepts the pages as written), lists the WIRING_*
failure only for Workers that take wiring, and no longer claims a package
holds no credentials.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D8AmgTwmnp4M8mgmnS9aha

* Component docs: list optional and per-environment secrets

The generator now reads `optionalSecretEnv` (listed as "(optional)") and
secrets declared per environment under `subscribe.environments[]`, so a
page no longer leaves out a secret its component declares. Its tables are
laid out as prettier lays them out, the WIRING_* failure is listed only
for Workers that take wiring, and a package is no longer said to hold no
credentials. Every starter now carries the identical generator.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D8AmgTwmnp4M8mgmnS9aha

* CM5: read the workers.dev subdomain from the Cloudflare connection

- blueprint.yaml: the subdomain input is `from:
  connection.cloudflare.workersSubdomain`, as cirrus-baseline since
  baseline-v23 (#30); the console renders no field for it
- testing/manifest.test.sh: cirrus's rule verbatim, accepting the source
  only when spec.requires.integrations lists its provider (mutation-checked)
- repo-blueprint.yaml, BOOTSTRAP.md, docs/phases/README.md: only a hand-run
  build passes --set subdomain
- records: CM-7 under CM5, status, plan, epic index, ai/context

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D8AmgTwmnp4M8mgmnS9aha

---------

Co-authored-by: Claude <noreply@anthropic.com>
ruehowl added a commit that referenced this pull request Oct 22, 2026
* CM5: the cirrus standard — no kiox, generated component docs, the context pack

- Remove kiox.yaml/kiox.lock and their two blueprint modules: nothing ran
  the kiox pin (v2.15.0); every workflow pins orun through orun-action.
- Generate docs/{overview,architecture,runbook}.md for every component
  from what it declares (tooling/catalog/gen-component-docs.py), and fail
  Baseline CI when they drift (--check).
- Add ai/context/{current,decisions,open-risks}.md (this repository's own;
  nothing places them).
- Close out CM4 (shipped in #5, tagged baseline-v1) and record CM5 (CM-6).
- Make the docs say what CM4 built: risk CM-B and design §2/§7 no longer
  list wrangler vars or call CM-B open; the status file no longer cites a
  .dev.vars.example that CM4 folded into .env.example; the epic README's
  gate says offline is terraform validate only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D8AmgTwmnp4M8mgmnS9aha

* Regenerate component docs: prettier-padded tables, accurate wording

The generator now lays tables out the way prettier does (an app whose lint
is `prettier --check` accepts the pages as written), lists the WIRING_*
failure only for Workers that take wiring, and no longer claims a package
holds no credentials.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D8AmgTwmnp4M8mgmnS9aha

* Component docs: list optional and per-environment secrets

The generator now reads `optionalSecretEnv` (listed as "(optional)") and
secrets declared per environment under `subscribe.environments[]`, so a
page no longer leaves out a secret its component declares. Its tables are
laid out as prettier lays them out, the WIRING_* failure is listed only
for Workers that take wiring, and a package is no longer said to hold no
credentials. Every starter now carries the identical generator.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D8AmgTwmnp4M8mgmnS9aha

* CM5: read the workers.dev subdomain from the Cloudflare connection

- blueprint.yaml: the subdomain input is `from:
  connection.cloudflare.workersSubdomain`, as cirrus-baseline since
  baseline-v23 (#30); the console renders no field for it
- testing/manifest.test.sh: cirrus's rule verbatim, accepting the source
  only when spec.requires.integrations lists its provider (mutation-checked)
- repo-blueprint.yaml, BOOTSTRAP.md, docs/phases/README.md: only a hand-run
  build passes --set subdomain
- records: CM-7 under CM5, status, plan, epic index, ai/context

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D8AmgTwmnp4M8mgmnS9aha

* CM6: the console asks for no domain — the domain is set later

The store goes live on workers.dev from its first deploy and builds its
absolute links from the request it answers, so nothing in the build needs a
domain and the console no longer asks for one. The logic that uses a domain
stays where it is, waiting for one.

- blueprint.yaml: no productdomain input
- repo-blueprint.yaml: productdomain is optional, default empty
- rebrand.mjs: productdomain no longer required; empty brands the reserved
  placeholder <reponame>.example.com (RFC 2606) where the domain goes
  (BASE_DOMAIN in intent.yaml, every environment), so setting it later is
  replacing one string
- the product README and ai/context/operations.md say how to set it
- testing/fixtures/acme.json carries no domain; rebrand.test.sh pins the
  placeholder (absent, empty, and the fixture's acme-commerce.example.com,
  which ends in the baseline's domain); baseline.yml's blueprint read sets
  no domain
- records: CM6 / CM-8, tagged baseline-v3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D8AmgTwmnp4M8mgmnS9aha

---------

Co-authored-by: Claude <noreply@anthropic.com>
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