Skip to content

CS3: cms-sanity becomes an Orun baseline - #4

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

CS3 (task CS-4): the Sanity-backed Next.js blog on Cloudflare Workers + Static Assets becomes an Orun baseline that takes a new blog from nothing to live on stage and prod in ONE landing (cirrus-baseline v22's shape), with what a small-site baseline contains taken from portfolio-starter-kit baseline-v2 and the no-infra two-phase shape from hono-api (sourceplane/hono-api#4). It deploys before its owner has a Sanity project.

What was added

The card and the build

  • blueprint.yaml: inputs (reponame, productname, productdomain, githuborg, subdomain), the brokered-secrets preview (CLOUDFLARE_API_TOKEN / workers-deploy, CLOUDFLARE_ACCOUNT_ID / account-id), the programme (01-product, 02-docs), requires.integrations: [github, cloudflare], expectedMinutes: 14. Nothing is asked for Sanity.
  • repo-blueprint.yaml: two phases.
    • 01-product places every module. Post hooks: retouch, git-init, git-stage, rebrand, orun-workspace, work-tree --strip, promotion --defer, dev-lanes --defer, git-restage, rebrand-verify, pnpm lockfile, orun.repo/ensure@v1, link, one orun.integrations/reconcile@v1 per key, orun.pr/land@v1.
    • Its await is orun.run/watch@v1 on the merge sha, then orun.http/probe@v1 on both workers.dev URLs. There is no orun.secrets/exists@v1 await because there is no infra.
    • 02-docs is hook-only: it restores promotion and dev-lanes, renders the deployment record, lands it, and probes.

Sanity, which the platform does not broker (rule 8)

  • A build with no project id is the unconnected blog, never a 500:
    • sanity/lib/api.ts and sanity/lib/token.ts no longer throw.
    • sanityFetch answers the four queries from three bundled sample posts (sanity/lib/sample.ts, typed by TypeGen's results) without calling Sanity.
    • The layout shows a "Sample content … Connect your Sanity project" notice.
    • /studio renders a connect page instead of a Studio pointed at no project.
    • /api/draft-mode/enable answers 401 with the reason.
  • The project id and dataset are now optionalSecretEnv refs, not secretEnv. Unstored keys are skipped at resolve; both orun 2.58.11 and 2.78.4 plan them optional: true.
  • The read token is an optional Worker secret.
  • The product README ("Connecting Sanity") and ai/context/operations.md cover:
    • orun secrets set SANITY_PROJECT_ID|SANITY_DATASET --env stage|prod;
    • redeploying (the # orun: redeploy line);
    • adding the Workers to CORS;
    • wrangler secret put SANITY_API_READ_TOKEN.
  • The upstream public demo dataset (r0z1eifg/blog-vercel) does still answer. The template doesn't read it by default, though, so bundled samples were chosen instead.

Identity and the rest

  • The SITE_NAME seam (apps/web/app/site.ts, the template's Blog.).
  • The rebrand engine protects the upstream vercel/next.js/tree/canary/examples/cms-sanity links, which share the slug.
  • The smoke checks the home page's layout plus draft mode's 401, which is server code only the Worker answers.
  • .baseline/ (identity, the two task contracts, the blog's README), tooling/bootstrap, hooks/render-deployment-docs.sh, ai/context, docs/phases, BOOTSTRAP.md, baseline.yml, tag.yml.
  • tooling/wire copied from kv-redis-starter. infra/.gitkeep and packages/.gitkeep added.
  • ci.yml: the linked gate (it plans nothing only while ws_CHANGE_ME) at orun v2.78.4.
  • checks.yml: pull requests and workflow_dispatch only, with git diff --exit-code after wire:fixture.
  • stack-tectonic pinned at 0.19.0.
  • .dev.vars.example now ships: the old **/.dev.vars.* ignore glob swallowed it.
  • testing/: manifest, phases, coverage, rebrand, retouch, bootstrap-defer, leak, placement, e2e.
  • The specs gain the CS3 milestone, the CS-4 contract, the design §6, risks CS-J…M and the as-built status.

How it was verified

Everything was run locally on the committed head (8b7f3d9) with no Sanity values in the environment. The tree was clean before and after.

  • The repository's own checks:
    • pnpm install --frozen-lockfile, wire:fixture and git diff --exit-code;
    • typecheck;
    • lint: 0 errors, and the one upstream warning;
    • test: 18 tests in 5 files, including the new unconnected.test.ts and site.test.ts;
    • build on Turbopack, after which git diff is clean.
  • Contract tests: manifest, phases, coverage, rebrand, retouch and bootstrap-defer all pass. The rebrand fixtures include a name with & and an apostrophe, and check that the upstream examples/cms-sanity link survives.
  • leak.test.sh, at orun v2.58.11 and 2.79.0:
    • 93 files are derived, and every one is read;
    • no factory path ships or is named;
    • .dev.vars.example ships.
  • placement.test.sh, at v2.78.4 and 2.79.0:
    • the offline bootstrap of both phases runs on orun's Initial commit;
    • the product is branded, re-tenanted, has its gates restored and its record rendered;
    • the product's own push-to-main plan (ci.yml's --from-ci github --event-file … --changed) deploys web to stage and prod side by side. There is no infra, so nothing is ordered before it.
    • verify-app-structure runs before build-app, and the Worker, smoke and Cloudflare refs are the product's;
    • both Sanity refs are optional: true;
    • a --resume is a no-op.
  • e2e.test.sh, at v2.78.4:
    • Both landings pass the Checks sequence.
    • Every run step of the stage lane's PR plan passes in a job tree staged the way orun stages it: install, verify-app-structure, build-app, verify-build-output and deploy-dry-run. The tree has its own install and no build output. The dry run is 7.9 MB, 1.6 MB gzipped.
    • wrangler dev serves the staged Worker.
    • The component's smoke passes verbatim, and inside the planned deploy smoke step with only its workers.dev URL swapped for the local one. It refuses a path that is not the blog.
    • These routes are the blog's own, carrying "Sam's Notes & Links", with no Sanity project behind them:
      • /;
      • the three sample posts;
      • two 404s;
      • /studio and /studio/structure, which show the connect page;
      • the favicon and a _next/static chunk;
      • /api/draft-mode/enable, which answers 401 with the reason.
  • orun itself:
    • orun new --status passes at v2.58.11, v2.78.4 and 2.79.0;
    • orun validate passes at all three;
    • orun work check is clean.
  • Not verified, offline only:
    • a live bootstrap against a workspace: repository creation, the brokered token, a real deploy and the probes;
    • a connected blog reading a real Sanity dataset through the Worker, including the Presentation preview (risks CS-H and CS-M).

🤖 Generated with Claude Code

https://claude.ai/code/session_01AuyckrXahuAVgdmxamUUtk


Generated by Claude Code

The Sanity-backed Next.js blog on Cloudflare Workers + Static Assets becomes
a baseline that takes a new blog from nothing to live on stage and prod in
ONE landing, built the way cirrus-baseline builds its product since
baseline-v22, with what a small-site baseline contains taken from
portfolio-starter-kit's baseline-v2 and the no-infra two-phase shape from
hono-api (HA3) — and deployable before its owner has a Sanity project.

- blueprint.yaml (the card) and repo-blueprint.yaml (the build): two
  phases. 01-product places every module, brands it, re-tenants it, strips
  the work tree, defers promotion and dev's push lanes, creates and links
  the repository, reconciles CLOUDFLARE_API_TOKEN (workers-deploy) and
  CLOUDFLARE_ACCOUNT_ID (account-id), lands one PR, and awaits the
  convergence and a probe of both workers.dev URLs. No wiring await: there
  is no infra. 02-docs is hook-only: it restores both deferrals, renders the
  deployment record and lands it. requires.integrations: [github,
  cloudflare]; nothing is asked or minted for Sanity.
- Sanity is not a provider the platform brokers, so a build with no project
  id is the UNCONNECTED blog instead of a 500: sanity/lib/api.ts and
  token.ts no longer throw; sanityFetch answers the four queries from three
  bundled sample posts (sanity/lib/sample.ts, typed by TypeGen's results)
  without calling Sanity; the layout shows a "connect your Sanity project"
  notice; /studio renders a connect page; draft mode answers 401 with the
  reason. The project id and dataset are optionalSecretEnv refs (skipped
  while unstored), the read token an optional Worker secret; the product's
  README ("Connecting Sanity") and ai/context/operations.md say how an owner
  sets all three, redeploys, and allows the CORS origins.
- The SITE_NAME seam (apps/web/app/site.ts, the template's "Blog."); the
  rebrand engine protects the upstream template's examples/cms-sanity links,
  which share the slug. The smoke reads the home page's layout and the
  draft-mode route's 401 (server code only the Worker answers).
- .baseline/ (identity, the two task contracts, the blog's README), the
  bootstrap helpers, the deployment-record hook (which records whether each
  environment shows samples or the project's content), ai/context,
  docs/phases, BOOTSTRAP.md, baseline.yml and tag.yml; tooling/wire from
  kv-redis-starter; infra/ and packages/ discovery roots.
- ci.yml plans nothing only while intent.yaml names ws_CHANGE_ME (no ORUN_CI
  variable) at orun v2.78.4; checks.yml runs on pull requests only and
  checks the committed wrangler config is the fixture render;
  stack-tectonic 0.19.0; .dev.vars.example ships (the ignore glob no longer
  swallows it).
- testing/: manifest, phases (the two-phase partition and cirrus's
  01-product hook chain), coverage, rebrand (the upstream link survives,
  an "&" and "'" name), retouch, bootstrap-defer, leak (every shipped file
  read for factory paths), placement (the offline bootstrap on orun's
  Initial commit, the product's own push-to-main plan through ci.yml's
  --from-ci github --event-file path with the Sanity refs optional, a
  --resume no-op) and e2e (both landings under Checks, every run step of
  the stage lane's PR plan in a staged job tree with no Sanity credentials,
  wrangler dev, the component's smoke verbatim and in the planned smoke
  step, every route including draft mode's 401).

Orun-Task: CS-4

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:02
@ruehowl
ruehowl merged commit 6d17ca5 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