Skip to content

SS4: supabase-starter 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

SS4 (task SS-5): the repository is an Orun baseline on the Cloudflare + Supabase (Lumen) conventions, built the way cirrus-baseline v22 builds a product, in one landing. The machinery is the saas-starter port's (sourceplane/saas-starter#6), with no Hyperdrive and no db-migrate.

What was added

The baseline

  • blueprint.yaml is the console card.
    • requires: [github, cloudflare, supabase].
    • A preview of the four brokered keys: CLOUDFLARE_API_TOKEN (workers-deploy), CLOUDFLARE_ACCOUNT_ID (account-id), SUPABASE_ACCESS_TOKEN (management-access) and SUPABASE_ORG_ID (org-id).
    • The programme 01-product, 02-docs.
    • The two Supabase projects the free plan allows (stage and prod) are stated as an owner prerequisite, here and in BOOTSTRAP.
  • repo-blueprint.yaml:
    • 01-product places every module, then runs: retouch → git-init/stage → rebrand → orun-workspace → work-tree strip → promotion and dev-lanes deferred → restage → rebrand-verify → pnpm lockfile → orun.repo/ensure → link → four orun.integrations/reconcile → orun.pr/land.
      • It awaits orun.run/watch on the merge sha.
      • Then orun.secrets/exists for WIRING_SUPABASE, SUPABASE_PROJECT_REF, SUPABASE_DB_PASSWORD and SUPABASE_DB_URL on stage and prod.
      • Then orun.http/probe on / and /api/health for both environments.
    • 02-docs runs hooks only: it restores promotion and dev's lanes, renders the deployment record, lands, and probes.
  • .baseline/ holds the identity, the task contracts and the product's README.
  • The rename engine has a SITE_NAME seam, and the upstream example's links are protected.
  • Also added: tooling/bootstrap/*, hooks/render-deployment-docs.sh, ai/context/, BOOTSTRAP.md and docs/phases/.
  • testing/ holds the full suite, .github/workflows/baseline.yml runs it, and tag.yml cuts tags.
  • Workflow changes:
    • checks.yml now runs on pull requests only.
    • ci.yml has the linked gate, and its lanes run on v2.78.4.
    • stack-tectonic is pinned to 0.19.0.

The product

  • Supabase root:
    • It keeps Lumen's three outputs and publishes WIRING_SUPABASE (the project URL and publishable key).
    • It no longer publishes SUPABASE_URL, SUPABASE_ANON_KEY or the service-role key.
    • It sets the project's Auth Site URL and redirect allow-list to the Worker with supabase_settings.
    • Email confirmation is off until the project has its own SMTP (authEmailConfirmation). This is because a fresh project emails only its organization's members.
    • It waits for ACTIVE_HEALTHY before reading the keys and writing the settings.
    • The provider lock file is committed.
  • web:
    • It depends on supabase: enforced on main, advisory on PRs.
    • It reads WIRING_SUPABASE_<ENV> as optional refs. While stage and prod deploy side by side, prod's document may not exist yet when stage's deploy starts. live.mjs still refuses a deploy whose own environment's document is missing.
    • It re-renders the committed wrangler.jsonc in stage and prod.
    • next.config.ts makes next build inline the URL and key from that same config.
  • /api/health checks that Supabase Auth answers the inlined key, and reports whether sign-up is open and whether it asks for confirmation. The proxy matcher exempts it. The smoke check, the probes and the deployment record all read it.
  • Sign-up goes to /protected when it gets a session. The auth forms now explain email_address_not_authorized, the email rate limit and an unreachable service, instead of failing with a 500.
  • The tutorial's notes table gets row-level security in the same statement that creates it, with policies keyed on auth.uid().
  • Added packages/.gitkeep: SS3's tree failed orun validate without that discovery root.

How it was verified

  • The repo's own checks: pnpm install --frozen-lockfile, wire:fixture (no diff), typecheck, lint, test (25 tests in 7 files) and build all pass.
  • Contract tests: testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer,leak}.test.sh all pass.
  • placement.test.sh passes at orun v2.58.11 and at 2.79.0.
    • It runs the offline bootstrap of both phases.
    • The product's own push-to-main plan shows supabase → web enforced. A pull request shows the edge advisory (checked at 2.79.0; at 2.58.11 it is reported as not checkable).
    • The plan resolves exactly the four minted keys plus WIRING_SUPABASE.
    • The Auth Site URL TF_VARs are the product's.
    • A --resume is a no-op.
  • e2e.test.sh passes at the lane pin, v2.78.4:
    • The 01-product landing passes the checks its PR waits on.
    • Terraform fmt, init -backend=false and validate pass on the product's root.
    • The stage web lane's steps run in the staged job tree: install, verify-app-structure, build-app with the stage wiring inlined into the browser bundle, verify-build-output and deploy-dry-run.
    • Under wrangler dev: the component's own smoke check, every route, /api/health, and /auth/confirm refusing a bad link.
    • A sign-up is signed in at once. The protected page renders from the session cookies, and a forged session is refused. Sign-in works.
    • With confirmation on, the emailed link signs the user in through /auth/confirm. An address the project cannot email is refused with email_address_not_authorized.
    • The tutorial's SQL, run as the SQL editor runs it: RLS is on from the first statement, and each user reads only their own notes through the Data API. anon reads none, and no one can write as someone else.
  • orun new --status passes at v2.58.11, v2.78.4 and 2.79.0. orun validate and orun work check are clean.

Verified only offline:

  • Supabase in the tests is a stand-in (testing/lib/fake-supabase-api.py): the Auth endpoints, the Data API's select * and the Management API query, over a local Postgres with Supabase's roles.
  • No browser is driven. The client forms' supabase-js calls are made from Node with the product's own @supabase/ssr, using the same cookies.
  • The Terraform root is validated, never applied.

Not verified:

  • Whether the brokered Supabase OAuth token can reach the API-keys and Auth-config endpoints (SS-I).
  • Whether new projects still return a legacy anon key.
  • A live deploy or a live bootstrap.
  • Real email delivery.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AuyckrXahuAVgdmxamUUtk


Generated by Claude Code

The repository is an Orun baseline on the Cloudflare + Supabase (Lumen)
conventions, built the way cirrus-baseline v22 builds a product: ONE
landing. 01-product places every module, brands it, links the repository,
reconciles four brokered keys (workers-deploy, account-id,
management-access, org-id) and lands it as one pull request, then awaits
the convergence, WIRING_SUPABASE and Lumen's three database credentials on
stage and prod, and / + /api/health; 02-docs restores the promotion gate
and dev's lanes and renders the deployment record. No Hyperdrive and no
db-migrate: the chain is supabase -> web, enforced on main, advisory on
pull requests.

The baseline:
- blueprint.yaml (card: requires github, cloudflare, supabase; the two
  Supabase projects the free plan allows stated as a prerequisite) and
  repo-blueprint.yaml (two phases, one landing)
- .baseline/ (identity, task contracts, the product's README), the rename
  engine with the SITE_NAME seam, the bootstrap helpers, the
  deployment-record hook, ai/context/, BOOTSTRAP.md, docs/phases/
- testing/: manifest, phases, coverage, rebrand, retouch, bootstrap-defer,
  leak, placement (offline bootstrap of both phases, the product's own
  push-to-main plan, --resume) and e2e (the 01-product landing under its
  checks, the stage web lane's steps in the job tree orun stages, wrangler
  dev against a local Supabase stand-in: Auth, the Data API's select and
  the SQL editor's query endpoint over a Postgres with Supabase's roles)
- baseline.yml, tag.yml; checks.yml on pull requests only; ci.yml's linked
  gate and lanes on v2.78.4; stack-tectonic 0.19.0

The product:
- the supabase root keeps Lumen's three outputs and publishes
  WIRING_SUPABASE (URL + publishable key); the service-role key is no
  longer read out; it sets the project's Auth Site URL and redirect
  allow-list to the Worker and turns email confirmation off until the
  project has SMTP (authEmailConfirmation), after waiting for
  ACTIVE_HEALTHY; provider lock file committed
- web depends on supabase (enforced on main), reads its wiring as optional
  refs, re-renders the committed wrangler.jsonc in stage/prod, and next
  build inlines the URL and key from that config (next.config.ts)
- /api/health (Supabase Auth reachable with the inlined key, sign-up and
  confirmation state), exempt from the session proxy; the smoke reads it
- sign-up goes to /protected when it gets a session; the auth forms
  explain email_address_not_authorized, the email rate limit and an
  unreachable service
- the tutorial's notes table: RLS on in the same statement, policies keyed
  on auth.uid()
- packages/.gitkeep (orun refused the intent without the discovery root)

Not verified: a Terraform apply (the brokered OAuth token's reach to the
API-keys and Auth-config endpoints), a live deploy and bootstrap, real
email delivery.

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:50
@ruehowl
ruehowl merged commit 619bb5d 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