Skip to content

Sandbox — isolation and promotion model ​

What platform-sandbox isolates today ​

LayerIsolated?Notes
Billing D1 (site_billing, accounts, Stripe mode in D1)YesSandbox signups live only in lovely-home-platform-billing-sandbox.
Provision queues / hub-jobsYes*-sandbox queues and Worker. The sandbox deploy script also puts the deployed commit's workers/hub-jobs/index.js on lovely-home-hub-jobs-sandbox, so the whole sandbox stack runs one commit.
Site cards in the dashboardFiltered on sandbox deploydeploy-sandbox-lovely-home.sh sets LOVELY_STACK=sandbox / PLATFORM_MANIFEST_SANDBOX=1 so build-platform-manifest.mjs keeps allowlisted hubs (demo, sandbox, test, practice + PLATFORM_MANIFEST_SANDBOX_SITES). Prod manifest unchanged.
Health / Access probesShared URLsManifest points at real hostnames (*.lovely-hub.com, demo, etc.), so sandbox reads prod/test hub endpoints for monitoring.
Git / registry PRsShared repoSuccessful sandbox signup → provision still dispatches the same GitHub workflows. A real site_id can still create real Cloudflare resources.

So: billing and signup state are sandbox-only; hub cards are filtered after a sandbox deploy (not prod’s full manifest).

Safe sandbox habits ​

  • Use disposable site ids for signup/provision tests (never prod household slugs).
  • Redeploy sandbox after merging manifest/provision fixes so Pages picks up queue bindings + filtered manifest.
  • Provision still hits real GitHub workflows — test slugs only.

See sandbox-provision-chain.md and scripts/verify-sandbox-provision-chain.sh.


Promotion model (code): feature → sandbox → production ​

Goal: exercise real marketing + platform + signup on sandbox, then ship the same commit to production.

Branches (suggested) ​

BranchRole
mainProduction truth — merges here deploy prod marketing/platform (manual scripts / existing workflows).
sandbox (long-lived)Optional push target for Deploy sandbox on push or local deploy-sandbox-lovely-home.sh. Marketing custom domain uses Production branch main; optional preview alias sandbox via SANDBOX_MARKETING_PAGES_PREVIEW_BRANCH.
feature/*Short-lived work; open PR to sandbox or main.

You do not need a permanent sandbox branch if you prefer deploy sandbox from feature branches via deploy-sandbox-lovely-home.sh (Wrangler) before merge.

Typical flow ​

text
feature/xyz  ──PR──►  sandbox (optional)  ──deploy sandbox──►  QA on marketing-sandbox + platform-sandbox
       │
       └──PR──►  main  ──deploy prod──►  lovely-home.co.uk + platform.lovely-home.co.uk
  1. Develop on feature/….
  2. Verify on sandbox (no prod impact):
    • bash scripts/deploy-sandbox-lovely-home.sh from that branch (unset CLOUDFLARE_API_TOKEN for OAuth), or
    • merge to sandbox and auto-deploy if configured.
  3. Sign-off — signup, billing, My Homes, provision with test site ids only.
  4. Promote — squash-merge PR to main.
  5. Production — deploy-lovely-home-website.sh + deploy-platform-admin.sh (Terraform only when infra vars changed).

What “promotion” is not (today) ​

  • No automatic promotion of D1 data — sandbox billing rows never copy to prod.
  • No separate sandbox git fork — one repo; isolation is hostnames + D1 + queues, not a second manifest unless filtered at build.
  • Terraform — sandbox uses platform-sandbox.tfstate; prod uses platform.tfstate. Promote code via git; promote infra by applying the right var-file + state key on main when module vars change.

CI alignment (optional future) ​

CheckBranch
npm run lint / npm run testEvery PR
Deploy sandbox PagesPush to sandbox, manual Deploy sandbox Lovely Home, or local deploy-sandbox-lovely-home.sh
Deploy prod Pagesmain only, manual or release workflow
Platform admin Terraformmain + apply-platform-admin; sandbox Terraform local with sandbox-hub.tfvars